OutgoingResponse

Struct OutgoingResponse 

Source
pub struct OutgoingResponse<B = Body> { /* private fields */ }
Available on crate feature server only.
Expand description

Server response that can be sent to an HTTP client.

Implementations§

Source§

impl OutgoingResponse<()>

Source

pub const fn builder() -> OutgoingResponseBuilder

Get a builder for the outgoing response.

Source§

impl<B> OutgoingResponse<B>

Source

pub fn deconstruct(self) -> (ResponseHeader, B, Option<UpgradeRequest>)

Deconstruct the response back into its response header and body.

Source

pub fn into_builder(self) -> (OutgoingResponseBuilder, B)

Deconstruct the response back into a response builder and the body.

Source

pub fn take_upgrade_request(&mut self) -> Option<UpgradeRequest>

Take the connection upgrade request (if any).

Methods from Deref<Target = Response<B>>§

Source

pub fn header(&self) -> &ResponseHeader

Get the response header.

Source

pub fn status(&self) -> &Status

Get the response status.

Source

pub fn status_code(&self) -> u16

Get the status code.

Source

pub fn status_message(&self) -> &StatusMessage

Get the status message.

Source

pub fn get_all_header_fields(&self) -> Iter<'_>

Get all header fields.

Source

pub fn get_header_fields<'a, N>(&'a self, name: &'a N) -> FieldIter<'a>
where N: AsRef<[u8]> + ?Sized,

Get header fields corresponding to a given name.

Source

pub fn get_header_field<'a, N>(&'a self, name: &'a N) -> Option<&'a HeaderField>
where N: AsRef<[u8]> + ?Sized,

Get the last header field of a given name.

Source

pub fn get_header_field_value<'a, N>( &'a self, name: &'a N, ) -> Option<&'a HeaderFieldValue>
where N: AsRef<[u8]> + ?Sized,

Get value of the last header field with a given name.

Trait Implementations§

Source§

impl<B> AsRef<Response<B>> for OutgoingResponse<B>

Source§

fn as_ref(&self) -> &Response<B>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<B> Borrow<Response<B>> for OutgoingResponse<B>

Source§

fn borrow(&self) -> &Response<B>

Immutably borrows from an owned value. Read more
Source§

impl<B> Deref for OutgoingResponse<B>

Source§

type Target = Response<B>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<B> Freeze for OutgoingResponse<B>

§

impl<B = Body> !RefUnwindSafe for OutgoingResponse<B>

§

impl<B> Send for OutgoingResponse<B>
where B: Send,

§

impl<B> Sync for OutgoingResponse<B>
where B: Sync,

§

impl<B> Unpin for OutgoingResponse<B>

§

impl<B = Body> !UnwindSafe for OutgoingResponse<B>

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V