Struct submillisecond::reader::UriReader
source · 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
impl UriReader
sourcepub fn peek(&self, len: usize) -> &str
pub fn peek(&self, len: usize) -> &str
Returns the next len
characters from the uri, without modifying the
cursor position.
sourcepub fn is_dangling_slash(&self) -> bool
pub fn is_dangling_slash(&self) -> bool
Returns a bool indicating whether the reader has reached the end, disregarding any trailing slash.
sourcepub fn is_dangling_terminal_slash(&self) -> bool
pub fn is_dangling_terminal_slash(&self) -> bool
Returns a bool indicating whether the reader has reached the end, disregarding any trailing slash.
sourcepub fn read_matching(&mut self, s: &str) -> bool
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.
sourcepub fn ensure_next_slash(&mut self) -> bool
pub fn ensure_next_slash(&mut self) -> bool
Reads a single /
character, modifying the cursor and returning whether
there was a match.
sourcepub fn is_empty(&self, allow_trailing_slash: bool) -> bool
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.
sourcepub fn read_param(&mut self) -> Option<&str>
pub fn read_param(&mut self) -> Option<&str>
Read a param until the next /
or end of uri.
sourcepub fn read_to_end(&self) -> &str
pub fn read_to_end(&self) -> &str
Returns the remainder of the uri from the current cursor position.