Struct webmachine_rust::WebmachineDispatcher
[−]
[src]
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
Methods
impl WebmachineDispatcher
[src]
fn new(
routes: BTreeMap<String, Arc<WebmachineResource>>
) -> WebmachineDispatcher
routes: BTreeMap<String, Arc<WebmachineResource>>
) -> WebmachineDispatcher
Create a new Webmachine dispatcher given a map of routes to webmachine resources
fn dispatch(&self, req: Request, res: Response) -> Result<(), Error>
Main hyper 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
fn dispatch_to_resource(&self, context: &mut WebmachineContext)
Dispatches to the matching webmachine resource. If there is no matching resource, returns 404 Not Found response