[][src]Struct turbofish::router::Router

pub struct Router<K: Eq + Hash, V> {
    pub map: HashMap<K, Node<V>>,
}

Router is container which can be used to dispatch requests to different handler functions via configurable routes

Fields

map: HashMap<K, Node<V>>

Implementations

impl<K: Eq + Hash, V> Router<K, V>[src]

pub fn with_capacity(capacity: usize) -> Self[src]

pub fn add(&mut self, key: K, value: V, path: &str)[src]

Add registers a new request handle with the given key and value in the route map

pub fn lookup(
    &mut self,
    key: &K,
    path: &str
) -> Result<RouteLookup<'_, V>, bool>
[src]

Allows the manual lookup of a path in the route map. Returns the value and the path parameter values if the path is found. If no match can be found, a TSR (trailing slash redirect) recommendation is made if a match exists with an extra (without the) trailing slash for the given path.

Trait Implementations

impl<K: Eq + Hash, V> Default for Router<K, V>[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for Router<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for Router<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for Router<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for Router<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for Router<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.