IntoRequestBytes

Trait IntoRequestBytes 

Source
pub trait IntoRequestBytes {
    // Required method
    fn into_request_bytes(
        self,
    ) -> impl Future<Output = Result<Bytes, BoxError>> + Send + Sync;
}
Expand description

A trait for converting various body types into a Bytes object.

This requires reading the entire body into memory.

Required Methods§

Source

fn into_request_bytes( self, ) -> impl Future<Output = Result<Bytes, BoxError>> + Send + Sync

Convert this object into a Bytes object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IntoRequestBytes for ()

Convert the unit type () into an empty Bytes object.

Source§

async fn into_request_bytes(self) -> Result<Bytes, BoxError>

Convert the unit type () into an empty Bytes object.

This is infalliable.

Source§

impl IntoRequestBytes for Vec<u8>

Convert a Vec<u8> into a Bytes object.

Source§

async fn into_request_bytes(self) -> Result<Bytes, BoxError>

Convert a Vec<u8> into a Bytes object.

This is infalliable.

Source§

impl IntoRequestBytes for Bytes

Identity transformation: return the Bytes object as-is.

Source§

async fn into_request_bytes(self) -> Result<Bytes, BoxError>

Identity transformation: return the Bytes object as-is.

This is infalliable.

Implementors§