[][src]Struct reroute::Router

pub struct Router { /* fields omitted */ }

The Router struct contains the information for your app to route requests properly based on their HTTP method and matching route. It allows the use of a custom 404 handler if desired but provides a default as well.

Under the hood a Router uses a RegexSet to match URI's that come in to the instance of the hyper server. Because of this, it has the potential to match multiple patterns that you provide. It will call the first handler that it matches against so the order in which you add routes matters.

Methods

impl Router[src]

pub fn handle(&self, req: Request<Body>) -> Response<Body>[src]

This function should be called inside of a hyper service. It will find the correct handler for the given route and handle errors appropriately.

Auto Trait Implementations

impl !RefUnwindSafe for Router

impl Send for Router

impl Sync for Router

impl Unpin for Router

impl !UnwindSafe for Router

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, 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.