Struct rustful::context::Context
[−]
[src]
pub struct Context<'a, 'b: 'a, 'l, 'g> { pub headers: Headers, pub http_version: HttpVersion, pub address: SocketAddr, pub method: Method, pub uri_path: UriPath, pub hyperlinks: Vec<Link<'l>>, pub variables: Parameters, pub query: Parameters, pub fragment: Option<MaybeUtf8Owned>, pub global: &'g Global, pub body: BodyReader<'a, 'b>, }
A container for handler input, like request data and utilities.
Fields
headers: Headers
Headers from the HTTP request.
http_version: HttpVersion
The HTTP version used in the request.
address: SocketAddr
The client address
method: Method
The HTTP method.
uri_path: UriPath
The requested path.
hyperlinks: Vec<Link<'l>>
Hyperlinks from the current endpoint.
variables: Parameters
Route variables.
query: Parameters
Query variables from the path.
fragment: Option<MaybeUtf8Owned>
The fragment part of the URL (after #), if provided.
global: &'g Global
Globally accessible data.
body: BodyReader<'a, 'b>
A reader for the request body.
Methods
impl<'a, 'b, 'l, 'g> Context<'a, 'b, 'l, 'g>
[src]
impl<'a, 'b, 'l, 'g> Context<'a, 'b, 'l, 'g>
pub fn mock<P: Into<String>>(
method: Method,
path: P,
headers: Headers,
global: &'g Global
) -> Context<'static, 'static, 'l, 'g>
[src]
pub fn mock<P: Into<String>>(
method: Method,
path: P,
headers: Headers,
global: &'g Global
) -> Context<'static, 'static, 'l, 'g>
Create a context with minimal setup, for testing purposes.
pub fn replace_hyperlinks<'n>(
self,
hyperlinks: Vec<Link<'n>>
) -> (Context<'a, 'b, 'n, 'g>, Vec<Link<'l>>)
[src]
pub fn replace_hyperlinks<'n>(
self,
hyperlinks: Vec<Link<'n>>
) -> (Context<'a, 'b, 'n, 'g>, Vec<Link<'l>>)
Replace the hyperlinks. This consumes the context and returns a new one with a different lifetime, together with the old hyperlinks.