[][src]Struct webmachine_rust::WebmachineDispatcher

pub struct WebmachineDispatcher<'a> {
    pub routes: BTreeMap<&'a str, WebmachineResource<'a>>,
}

The main hyper dispatcher

Fields

routes: BTreeMap<&'a str, WebmachineResource<'a>>

Map of routes to webmachine resources

Implementations

impl<'a> WebmachineDispatcher<'a>[src]

pub async fn dispatch(self, req: Request<Body>) -> Result<Response<Body>>[src]

Main dispatch function for the Webmachine. This will look for a matching resource based on the request path. If one is not found, a 404 Not Found response is returned

pub fn dispatch_to_resource(&self, context: &mut WebmachineContext)[src]

Dispatches to the matching webmachine resource. If there is no matching resource, returns 404 Not Found response

Trait Implementations

impl<'a> Clone for WebmachineDispatcher<'a>[src]

impl Service<Request<Body>> for WebmachineDispatcher<'static>[src]

type Response = Response<Body>

Responses given by the service.

type Error = Error

Errors produced by the service.

type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>

The future response value.

Auto Trait Implementations

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> Instrument for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.