Enum axol_http::body::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>> + Send + Sync, Global>>> 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>> + Send + Sync, Global>>> 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 !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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.