Struct tsukuyomi::Context[][src]

pub struct Context { /* fields omitted */ }

Contextural values used by handlers during processing an incoming HTTP request.

The values of this type are created at calling AppService::call, and used until the future created at its time is completed.

Methods

impl Context
[src]

Returns 'true' if the reference to a Context is set to the scoped TLS.

If this function returns 'false', the function Context::with will panic.

Executes a closure by using a reference to a Context from the scoped TLS and returns its result.

Panics

This function will panic if any reference to Context is set to the scoped TLS. Do not call this function outside the manage of the framework.

Returns a reference to the value of Request contained in this context.

Parses a header field in the request to a value of H.

Runs a closure using the reference to a Route matched to the incoming request.

Returns a proxy object for accessing parameters extracted by the router.

Returns a proxy object for managing the value of Cookie entries.

This function will perform parsing when called at first, and returns an Err if the value of header field is invalid.

Methods from Deref<Target = Request<RequestBody>>

Returns a reference to the associated HTTP method.

Examples

let request: Request<()> = Request::default();
assert_eq!(*request.method(), Method::GET);

Returns a reference to the associated URI.

Examples

let request: Request<()> = Request::default();
assert_eq!(*request.uri(), *"/");

Returns the associated version.

Examples

let request: Request<()> = Request::default();
assert_eq!(request.version(), Version::HTTP_11);

Returns a reference to the associated header field map.

Examples

let request: Request<()> = Request::default();
assert!(request.headers().is_empty());

Returns a reference to the associated extensions.

Examples

let request: Request<()> = Request::default();
assert!(request.extensions().get::<i32>().is_none());

Important traits for &'a mut R

Returns a reference to the associated HTTP body.

Examples

let request: Request<String> = Request::default();
assert!(request.body().is_empty());

Trait Implementations

impl Debug for Context
[src]

Formats the value using the given formatter. Read more

impl Deref for Context
[src]

The resulting type after dereferencing.

Dereferences the value.

impl ContextSessionExt for Context
[src]

Auto Trait Implementations

impl Send for Context

impl !Sync for Context