[][src]Struct webmachine_rust::WebmachineDispatcher

pub struct WebmachineDispatcher {
    pub routes: Mutex<BTreeMap<String, Arc<WebmachineResource>>>,
}

The main hyper dispatcher

Fields

routes: Mutex<BTreeMap<String, Arc<WebmachineResource>>>

Map of routes to webmachine resources

Implementations

impl WebmachineDispatcher[src]

pub fn new(
    routes: BTreeMap<String, Arc<WebmachineResource>>
) -> WebmachineDispatcher
[src]

Create a new Webmachine dispatcher given a map of routes to webmachine resources

pub fn dispatch(&self, req: Request<Vec<u8>>) -> Result<Response<Vec<u8>>>[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

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