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