Struct shio::Context
[−]
[src]
pub struct Context { /* fields omitted */ }
Context
represents the context of the current HTTP request.
A Context
consists of:
- The current HTTP Request
.
- A Handle
referencing the event loop in which this request is being
handled.
Methods
impl Context
[src]
fn handle(&self) -> &Handle
Return a reference to a handle to the event loop this Context
is associated with.
fn body(self) -> Body
Take the request body.
fn put<K: Key>(&mut self, value: K::Value)
Puts a value into the request context.
fn get<K: Key>(&self) -> &K::Value
Gets a value from the request context.
Panics
If there is no value in the request context of the given type.
fn try_get<K: Key>(&self) -> Option<&K::Value>
Gets a value from the request context.
Methods from Deref<Target = Request>
fn version(&self) -> &HttpVersion
Returns a reference to the request HTTP version.
fn headers(&self) -> &Headers
Returns a reference to the request headers.
fn method(&self) -> &Method
Returns a reference to the request HTTP method.
fn uri(&self) -> &Uri
Returns a reference to the request URI.
fn path(&self) -> &str
Returns a reference to the request path.
fn body(self) -> Body
Take the request body.