pub struct UriReader {
    pub uri: String,
    pub cursor: usize,
}
Expand description

A uri string and cursor reader.

Fields§

§uri: String

Request uri.

§cursor: usize

Request uri cursor.

Implementations§

source§

impl UriReader

source

pub fn new(uri: String) -> UriReader

Creates a new UriReader with the cursor set to 0.

source

pub fn peek(&self, len: usize) -> &str

Returns the next len characters from the uri, without modifying the cursor position.

source

pub fn is_dangling_slash(&self) -> bool

Returns a bool indicating whether the reader has reached the end, disregarding any trailing slash.

source

pub fn is_dangling_terminal_slash(&self) -> bool

Returns a bool indicating whether the reader has reached the end, disregarding any trailing slash.

source

pub fn read(&mut self, len: usize)

Move the cursor forward based on len.

source

pub fn read_matching(&mut self, s: &str) -> bool

Attempt to read s from the current cursor position, modifying the cursor if a match was found.

true is returned if s matched the uri and the cursor was updated.

source

pub fn ensure_next_slash(&mut self) -> bool

Reads a single / character, modifying the cursor and returning whether there was a match.

source

pub fn reset(&mut self)

Reset the cursor to the start of the uri.

source

pub fn is_empty(&self, allow_trailing_slash: bool) -> bool

Check if the cursor has reached the end of the uri, optionally allowing for a trailing slash.

source

pub fn read_param(&mut self) -> Option<&str>

Read a param until the next / or end of uri.

source

pub fn ends_with(&self, suffix: &str) -> bool

Check if the uri ends with suffix.

source

pub fn read_to_end(&self) -> &str

Returns the remainder of the uri from the current cursor position.

Trait Implementations§

source§

impl Clone for UriReader

source§

fn clone(&self) -> UriReader

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UriReader

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for UriReader

source§

fn default() -> UriReader

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V