Body

Enum Body 

Source
pub enum Body {
    Bytes(Vec<u8>),
    Stream {
        size_hint: Option<usize>,
        stream: BodyStream,
    },
}

Variants§

§

Bytes(Vec<u8>)

§

Stream

Fields

§size_hint: Option<usize>
§stream: BodyStream

Implementations§

Source§

impl Body

Source

pub fn new() -> Self

Source

pub fn empty() -> Self

Source

pub fn bytes_and_trailers(bytes: Vec<u8>, trailers: HeaderMap) -> Self

Source

pub fn trailers(trailers: HeaderMap) -> Self

Source

pub async fn collect(self) -> Result<Vec<u8>, Error>

Source

pub fn into_stream( self, ) -> Pin<Box<dyn Stream<Item = Result<BodyComponent, Error>> + Send + Sync + 'static>>

Trait Implementations§

Source§

impl Debug for Body

Source§

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

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

impl Default for Body

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<Body> for BodyWrapper

Source§

fn from(body: Body) -> Self

Converts to this type from the input type.
Source§

impl From<Pin<Box<dyn Stream<Item = Result<BodyComponent, Error>> + Sync + Send>>> for Body

Source§

fn from(stream: BodyStream) -> Self

Converts to this type from the input type.
Source§

impl From<Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Sync + Send>>> for Body

Source§

fn from( value: Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send + Sync + 'static>>, ) -> Self

Converts to this type from the input type.
Source§

impl Into<Body> for &str

Source§

fn into(self) -> Body

Converts this type into the (usually inferred) input type.
Source§

impl Into<Body> for ()

Source§

fn into(self) -> Body

Converts this type into the (usually inferred) input type.
Source§

impl Into<Body> for BodyWrapper

Source§

fn into(self) -> Body

Converts this type into the (usually inferred) input type.
Source§

impl Into<Body> for String

Source§

fn into(self) -> Body

Converts this type into the (usually inferred) input type.
Source§

impl Into<Body> for Vec<u8>

Source§

fn into(self) -> Body

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

§

impl Freeze for Body

§

impl !RefUnwindSafe for Body

§

impl Send for Body

§

impl Sync for Body

§

impl Unpin for Body

§

impl !UnwindSafe for Body

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> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> 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.