Struct Frame

struct Frame<T> { ... }

A frame of any kind related to an HTTP stream (body).

Implementations

impl<T> Frame<T>

fn data(buf: T) -> Self

Create a DATA frame with the provided Buf.

fn trailers(map: HeaderMap) -> Self

Create a trailers frame.

fn map_data<F, D>(self: Self, f: F) -> Frame<D>
where
    F: FnOnce(T) -> D

Maps this frame's data to a different type.

fn is_data(self: &Self) -> bool

Returns whether this is a DATA frame.

fn into_data(self: Self) -> Result<T, Self>

Consumes self into the buf of the DATA frame.

Returns an Err containing the original Frame when frame is not a DATA frame. Frame::is_data can also be used to determine if the frame is a DATA frame.

fn data_ref(self: &Self) -> Option<&T>

If this is a DATA frame, returns a reference to it.

Returns None if not a DATA frame.

fn data_mut(self: &mut Self) -> Option<&mut T>

If this is a DATA frame, returns a mutable reference to it.

Returns None if not a DATA frame.

fn is_trailers(self: &Self) -> bool

Returns whether this is a trailers frame.

fn into_trailers(self: Self) -> Result<HeaderMap, Self>

Consumes self into the buf of the trailers frame.

Returns an Err containing the original Frame when frame is not a trailers frame. Frame::is_trailers can also be used to determine if the frame is a trailers frame.

fn trailers_ref(self: &Self) -> Option<&HeaderMap>

If this is a trailers frame, returns a reference to it.

Returns None if not a trailers frame.

fn trailers_mut(self: &mut Self) -> Option<&mut HeaderMap>

If this is a trailers frame, returns a mutable reference to it.

Returns None if not a trailers frame.

impl<T> Any for Frame<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Frame<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Frame<T>

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

impl<T> Freeze for Frame<T>

impl<T> From for Frame<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Frame<T>

impl<T> Send for Frame<T>

impl<T> Sync for Frame<T>

impl<T> Unpin for Frame<T>

impl<T> UnsafeUnpin for Frame<T>

impl<T> UnwindSafe for Frame<T>

impl<T, U> Into for Frame<T>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Frame<T>

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

impl<T, U> TryInto for Frame<T>

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

impl<T: $crate::fmt::Debug> Debug for Frame<T>

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