ferrum::response

Struct Response

Source
pub struct Response {
    pub status: StatusCode,
    pub headers: Headers,
    pub body: Option<Body>,
    pub extensions: TypeMap<TypeMapInner>,
}
Expand description

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.

Implementations§

Source§

impl Response

Source

pub fn new() -> Response

Construct a blank Response

Source

pub fn new_redirect<R: Into<Raw>>(location: R) -> Response

Construct a redirect Response

Source

pub fn with_status(self, status: StatusCode) -> Self

Set the status and move the Response.

Useful for the “builder-style” pattern.

Source

pub fn with_header<H: Header>(self, header: H) -> Self

Set a header and move the Response.

Useful for the “builder-style” pattern.

Source

pub fn with_headers(self, headers: Headers) -> Self

Set the headers and move the Response.

Useful for the “builder-style” pattern.

Source

pub fn with_body<T: Into<Body>>(self, body: T) -> Self

Set the body and move the Response.

Useful for the “builder-style” pattern.

Source

pub fn with_content<C: Into<Content>>(self, content: C, mime: Mime) -> Self

Set the content and move the Response.

Useful for the “builder-style” pattern.

Source

pub fn set_content<C: Into<Content>>(&mut self, content: C, mime: Mime)

Set the content.

Source

pub fn with_mime(self, mime: Mime) -> Self

Set the content-type mime and move the Response.

Useful for the “builder-style” pattern.

Source

pub fn set_mime(&mut self, mime: Mime)

Set the content-type mime.

Trait Implementations§

Source§

impl Debug for Response

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Response

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Extensible<dyn UnsafeAny + Send + Sync> for Response

Source§

fn extensions(&self) -> &TypeMap<TypeMapInner>

Get a reference to the type’s extension storage.
Source§

fn extensions_mut(&mut self) -> &mut TypeMap<TypeMapInner>

Get a mutable reference to the type’s extension storage.
Source§

impl From<Response> for Response

Source§

fn from(from_response: HyperResponse) -> Response

Converts to this type from the input type.
Source§

impl From<Response> for HyperResponse

Source§

fn from(from_response: Response) -> HyperResponse

Converts to this type from the input type.
Source§

impl Pluggable for Response

Source§

fn compute<P>( &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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DebugAny for T
where T: Any + Debug,

Source§

impl<T> UnsafeAny for T
where T: Any,