pub struct Path<T> { /* private fields */ }Expand description
Resource path match information
Wraps a path source and stores the values of dynamic segments matched by
a Router.
Implementations§
Source§impl<T> Path<T>where
T: ResourcePath,
impl<T> Path<T>where
T: ResourcePath,
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the path state and return the inner path instance
Sourcepub fn path(&self) -> &str
pub fn path(&self) -> &str
Path that is not matched yet, e.g. the rest of the path after a prefix resource matched.
Unlike get_ref().path(), which is the full path,
it excludes the skipped part of the path.
Sourcepub fn skip(&mut self, n: u32)
pub fn skip(&mut self, n: u32)
Skip first n bytes in path, matching starts after them
The skipped length is limited to the path length.
Sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Get matched segment by name without type conversion
If no segment is named tail, the tail key returns the unprocessed
part of the path, see path().
Sourcepub fn iter(&self) -> PathIter<'_, T> ⓘ
pub fn iter(&self) -> PathIter<'_, T> ⓘ
Iterator over matched segments as (name, value) pairs, in pattern
order
Sourcepub fn load<'de, U>(&'de self) -> Result<U, Error>where
U: Deserialize<'de>,
pub fn load<'de, U>(&'de self) -> Result<U, Error>where
U: Deserialize<'de>,
Try to deserialize matched segments to a specified type U
See PathDeserializer.
Trait Implementations§
Source§impl<'a, T> IntoIterator for &'a Path<T>where
T: ResourcePath,
impl<'a, T> IntoIterator for &'a Path<T>where
T: ResourcePath,
Auto Trait Implementations§
impl<T> Freeze for Path<T>where
T: Freeze,
impl<T> RefUnwindSafe for Path<T>where
T: RefUnwindSafe,
impl<T> Send for Path<T>where
T: Send,
impl<T> Sync for Path<T>where
T: Sync,
impl<T> Unpin for Path<T>where
T: Unpin,
impl<T> UnsafeUnpin for Path<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Path<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more