Struct susanoo::Context
[−]
[src]
pub struct Context { /* 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.
Methods
impl Context
[src]
fn new(req: Request, shared: Storage) -> Self
Create a new instance of Context
from components.
fn version(&self) -> HttpVersion
Return the HTTP version
fn method(&self) -> &Method
Return the reference of request method
fn path(&self) -> &str
Return the path of request URL
fn query(&self) -> Option<&str>
Return the query string of request URL
fn header<T: Header>(&self) -> Option<&T>
Get a reference of header field of T
.
fn headers(&self) -> &Headers
Return a reference of the request headers
fn headers_mut(&mut self) -> &mut Headers
Return a mutable reference of the request headers
fn states(&self) -> &Storage
Return a reference of the temporary storage, available during request handling.
fn states_mut(&mut self) -> &mut Storage
Return a mutable reference of the temporary storage, available during request handling.
Return a reference of the global, shared storage.
fn take_body<T: FromBody>(&mut self) -> Outcome<T>
fn respond<R: Responder>(self, responder: R) -> Outcome<Response>
Create returned future of Response
from given Responder
.