Struct Response

Source
pub struct Response {
    pub status: Option<Status>,
    pub headers: Headers,
    pub extensions: TypeMap,
    pub body: Option<Box<dyn WriteBody>>,
}
Expand description

The response representation given to Middleware

Fields§

§status: Option<Status>

The response status-code.

§headers: Headers

The headers of the response.

§extensions: TypeMap

A TypeMap to be used as an extensible storage for data associated with this Response.

§body: Option<Box<dyn WriteBody>>

The body of the response.

Implementations§

Source§

impl Response

Source

pub fn new() -> Response

Construct a blank Response

Source

pub fn with<M: Modifier<Response>>(m: M) -> Response

Construct a Response with the specified modifier pre-applied.

Trait Implementations§

Source§

impl Debug for Response

Source§

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

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

impl Display for Response

Source§

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

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

impl Extensible for Response

Source§

fn extensions(&self) -> &TypeMap

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

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

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

impl<'a> Modifier<Response> for &'a [u8]

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl<'a> Modifier<Response> for &'a Path

Source§

fn modify(self, res: &mut Response)

Set the body to the contents of the File at this path.

§Panics

Panics if there is no file at the passed-in Path.

Source§

impl<'a> Modifier<Response> for &'a str

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl<R: Read + Send + 'static> Modifier<Response> for BodyReader<R>

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for Box<dyn WriteBody>

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for File

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl<H> Modifier<Response> for Header<H>
where H: Header + HeaderFormat,

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for Mime

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for PathBuf

Source§

fn modify(self, res: &mut Response)

Set the body to the contents of the File at this path.

§Panics

Panics if there is no file at the passed-in Path.

Source§

impl Modifier<Response> for Redirect

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for RedirectRaw

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for Status

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for String

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Modifier<Response> for Vec<u8>

Source§

fn modify(self, res: &mut Response)

Modify F with self.
Source§

impl Pluggable for Response

Source§

fn get<P>(&mut self) -> Result<<P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>, <P as Key>::Value: Clone + Any, Self: Extensible,

Return a copy of the plugin’s produced value. Read more
Source§

fn get_ref<P>( &mut self, ) -> Result<&<P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>, <P as Key>::Value: Any, Self: Extensible,

Return a reference to the plugin’s produced value. Read more
Source§

fn get_mut<P>( &mut self, ) -> Result<&mut <P as Key>::Value, <P as Plugin<Self>>::Error>
where P: Plugin<Self>, <P as Key>::Value: Any, Self: Extensible,

Return a mutable reference to the plugin’s produced value. Read more
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.
Source§

impl Set for Response

Source§

fn set<M>(self, modifier: M) -> Self
where M: Modifier<Self>, Self: Sized,

Modify self using the provided modifier.
Source§

fn set_mut<M>(&mut self, modifier: M) -> &mut Self
where M: Modifier<Self>,

Modify self through a mutable reference with the provided modifier.

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§

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> Typeable for T
where T: Any,

Source§

fn get_type(&self) -> TypeId

Get the TypeId of this object.
Source§

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

Source§

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