Struct Router
struct Router<T> { ... }
A zero-copy URL router.
See the crate documentation for details.
Implementations
impl<T> Router<T>
fn new() -> SelfConstruct a new router.
fn insert<impl Into<String>: Into<String>>(self: &mut Self, route: impl Into<String>, value: T) -> Result<(), InsertError>Insert a route into the router.
Examples
# use Router; #fn at<'path>(self: &Self, path: &'path str) -> Result<Match<'_, 'path, &T>, MatchError>Tries to find a value in the router matching the given path.
Examples
# use Router; #fn at_mut<'path>(self: &mut Self, path: &'path str) -> Result<Match<'_, 'path, &mut T>, MatchError>Tries to find a value in the router matching the given path, returning a mutable reference.
Examples
# use Router; #fn remove<impl Into<String>: Into<String>>(self: &mut Self, path: impl Into<String>) -> Option<T>Remove a given route from the router.
Returns the value stored under the route if it was found. If the route was not found or invalid,
Noneis returned.Examples
# use Router; let mut router = new; router.insert; assert_eq!; assert_eq!; router.insert; assert_eq!; assert_eq!; router.insert; // the route does not match assert_eq!; assert_eq!; router.insert; // invalid route assert_eq!; assert_eq!;
impl<T> Any for Router<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Router<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Router<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Router<T>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> Default for Router<T>
fn default() -> Self
impl<T> Freeze for Router<T>
impl<T> From for Router<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> RefUnwindSafe for Router<T>
impl<T> Send for Router<T>
impl<T> Sync for Router<T>
impl<T> ToOwned for Router<T>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> Unpin for Router<T>
impl<T> UnsafeUnpin for Router<T>
impl<T> UnwindSafe for Router<T>
impl<T, U> Into for Router<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Router<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Router<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T: $crate::clone::Clone> Clone for Router<T>
fn clone(self: &Self) -> Router<T>
impl<T: $crate::fmt::Debug> Debug for Router<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result