Struct webmachine_rust::WebmachineDispatcher
source · pub struct WebmachineDispatcher<'a> {
pub routes: BTreeMap<&'a str, WebmachineResource<'a>>,
}
Expand description
The main hyper dispatcher
Fields§
§routes: BTreeMap<&'a str, WebmachineResource<'a>>
Map of routes to webmachine resources
Implementations§
source§impl<'a> WebmachineDispatcher<'a>
impl<'a> WebmachineDispatcher<'a>
sourcepub async fn dispatch(self, req: Request<Body>) -> Result<Response<Body>>
pub async fn dispatch(self, req: Request<Body>) -> Result<Response<Body>>
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
sourcepub fn dispatch_to_resource(&self, context: &mut WebmachineContext)
pub 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
Trait Implementations§
source§impl<'a> Clone for WebmachineDispatcher<'a>
impl<'a> Clone for WebmachineDispatcher<'a>
source§fn clone(&self) -> WebmachineDispatcher<'a>
fn clone(&self) -> WebmachineDispatcher<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Service<Request<Body>> for WebmachineDispatcher<'static>
impl Service<Request<Body>> for WebmachineDispatcher<'static>
§type Future = Pin<Box<dyn Future<Output = Result<<WebmachineDispatcher<'static> as Service<Request<Body>>>::Response, <WebmachineDispatcher<'static> as Service<Request<Body>>>::Error>> + Send, Global>>
type Future = Pin<Box<dyn Future<Output = Result<<WebmachineDispatcher<'static> as Service<Request<Body>>>::Response, <WebmachineDispatcher<'static> as Service<Request<Body>>>::Error>> + Send, Global>>
The future response value.
Auto Trait Implementations§
impl<'a> RefUnwindSafe for WebmachineDispatcher<'a>
impl<'a> Send for WebmachineDispatcher<'a>
impl<'a> Sync for WebmachineDispatcher<'a>
impl<'a> Unpin for WebmachineDispatcher<'a>
impl<'a> UnwindSafe for WebmachineDispatcher<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more