Struct tsukuyomi::output::Output[][src]

pub struct Output { /* fields omitted */ }

The type representing outputs returned from handlers.

The values of this type are constructed indirectly by Responder, or by converting from the value of Response<T>.

Methods

impl Output
[src]

Methods from Deref<Target = Response<ResponseBody>>

Returns the StatusCode.

Examples

let response: Response<()> = Response::default();
assert_eq!(response.status(), StatusCode::OK);

Returns a mutable reference to the associated StatusCode.

Examples

let mut response: Response<()> = Response::default();
*response.status_mut() = StatusCode::CREATED;
assert_eq!(response.status(), StatusCode::CREATED);

Returns a reference to the associated version.

Examples

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

Returns a mutable reference to the associated version.

Examples

let mut response: Response<()> = Response::default();
*response.version_mut() = Version::HTTP_2;
assert_eq!(response.version(), Version::HTTP_2);

Returns a reference to the associated header field map.

Examples

let response: Response<()> = Response::default();
assert!(response.headers().is_empty());

Returns a mutable reference to the associated header field map.

Examples

let mut response: Response<()> = Response::default();
response.headers_mut().insert(HOST, HeaderValue::from_static("world"));
assert!(!response.headers().is_empty());

Returns a reference to the associated extensions.

Examples

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

Returns a mutable reference to the associated extensions.

Examples

let mut response: Response<()> = Response::default();
response.extensions_mut().insert("hello");
assert_eq!(response.extensions().get(), Some(&"hello"));

Important traits for &'a mut R

Returns a reference to the associated HTTP body.

Examples

let response: Response<String> = Response::default();
assert!(response.body().is_empty());

Important traits for &'a mut R

Returns a mutable reference to the associated HTTP body.

Examples

let mut response: Response<String> = Response::default();
response.body_mut().push_str("hello world");
assert!(!response.body().is_empty());

Trait Implementations

impl Deref for Output
[src]

The resulting type after dereferencing.

Dereferences the value.

impl DerefMut for Output
[src]

Mutably dereferences the value.

impl Debug for Output
[src]

Formats the value using the given formatter. Read more

impl<T> From<Response<T>> for Output where
    T: Into<ResponseBody>, 
[src]

Performs the conversion.

impl Responder for Output
[src]

Converts self to an HTTP response.

Auto Trait Implementations

impl Send for Output

impl !Sync for Output