Struct ferrum::response::Response
[−]
[src]
pub struct Response { pub status: StatusCode, pub headers: Headers, pub body: Option<Body>, pub extensions: TypeMap<TypeMapInner>, }
The response representation given to Middleware
Fields
status: StatusCode
The response status-code.
headers: Headers
The headers of the response.
body: Option<Body>
The body of the response.
extensions: TypeMap<TypeMapInner>
A TypeMap to be used as an extensible storage for data associated with this Response.
Methods
impl Response
[src]
fn new() -> Response
[src]
Construct a blank Response
fn new_redirect<R: Into<Raw>>(location: R) -> Response
[src]
Construct a redirect Response
fn with_status(self, status: StatusCode) -> Self
[src]
Set the status and move the Response.
Useful for the "builder-style" pattern.
fn with_header<H: Header>(self, header: H) -> Self
[src]
Set a header and move the Response.
Useful for the "builder-style" pattern.
fn with_headers(self, headers: Headers) -> Self
[src]
Set the headers and move the Response.
Useful for the "builder-style" pattern.
fn with_body<T: Into<Body>>(self, body: T) -> Self
[src]
Set the body and move the Response.
Useful for the "builder-style" pattern.
fn with_content<C: Into<Content>>(self, content: C, mime: Mime) -> Self
[src]
Set the content and move the Response.
Useful for the "builder-style" pattern.
fn set_content<C: Into<Content>>(&mut self, content: C, mime: Mime)
[src]
Set the content.
fn with_mime(self, mime: Mime) -> Self
[src]
Set the content-type mime and move the Response.
Useful for the "builder-style" pattern.
fn set_mime(&mut self, mime: Mime)
[src]
Set the content-type mime.
Trait Implementations
impl From<HyperResponse> for Response
[src]
fn from(from_response: HyperResponse) -> Response
[src]
Performs the conversion.
impl Debug for Response
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter.
impl Display for Response
[src]
fn fmt(&self, formatter: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Extensible<TypeMapInner> for Response
[src]
fn extensions(&self) -> &TypeMap<TypeMapInner>
[src]
Get a reference to the type's extension storage.
fn extensions_mut(&mut self) -> &mut TypeMap<TypeMapInner>
[src]
Get a mutable reference to the type's extension storage.
impl Plugin for Response
[src]
fn get<'a, P>(
&'a mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Clone,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
[src]
&'a mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Clone,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
Return a copy of the plugin's produced value. Read more
fn get_ref<'a, P>(
&'a mut self
) -> Result<&'a <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
[src]
&'a mut self
) -> Result<&'a <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
Return a reference to the plugin's produced value. Read more
fn get_mut<'a, P>(
&'a mut self
) -> Result<&'a mut <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
[src]
&'a mut self
) -> Result<&'a mut <P as Key>::Value, <P as Plugin<Self>>::Error> where
A: 'a,
P: Plugin<Self>,
Self: Extensible<A>,
<P as Key>::Value: Any,
<P as Key>::Value: Implements<A>,
Return a mutable reference to the plugin's produced value. Read more
fn compute<P>(
&mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
P: Plugin<Self>,
[src]
&mut self
) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error> where
P: Plugin<Self>,
Create and evaluate a once-off instance of a plugin.