Struct susanoo::Context
[−]
[src]
pub struct Context { pub method: Method, pub uri: Uri, pub params: OwnedCaptures, pub headers: Headers, pub ext: SendMap, // some fields omitted }
A context during handling.
It contains an HTTP request, HTTP response to return, and a typemap in order to share variables between middlewares.
Fields
method: Method
uri: Uri
params: OwnedCaptures
Captured parameters from router
headers: Headers
ext: SendMap
Extension map to share values between handlers/middlewares
Methods
impl Context
[src]
fn from_components(req: Request, params: OwnedCaptures, handle: Remote) -> Self
fn path(&self) -> &str
Returns the path of request URL.
fn header<T: Header>(&self) -> Option<&T>
fn respond<R: Responder>(self, responder: R) -> Outcome<Response>
fn take_body<T: FromBody>(&mut self) -> Outcome<T>
fn spawn<F, R>(self, f: F) where
F: Send + 'static + FnOnce(&Handle) -> R,
R: IntoFuture<Item = (), Error = ()>,
R::Future: 'static,
F: Send + 'static + FnOnce(&Handle) -> R,
R: IntoFuture<Item = (), Error = ()>,
R::Future: 'static,
Spawn a new future into the event loop.