[][src]Struct stream_body::StreamBody

pub struct StreamBody { /* fields omitted */ }

An HttpBody implementation which handles data streaming in an efficient way.

It is similar to Body.

Methods

impl StreamBody[src]

pub fn empty() -> StreamBody[src]

Creates an empty body.

pub fn channel() -> (PipeWriter, StreamBody)[src]

Creates a body stream with an associated writer half.

Useful when wanting to stream chunks from another thread.

pub fn channel_with_capacity(capacity: usize) -> (PipeWriter, StreamBody)[src]

Creates a body stream with an associated writer half having a specific size of internal buffer.

Useful when wanting to stream chunks from another thread.

pub fn from_reader<R: AsyncRead + Unpin + Send + 'static>(r: R) -> StreamBody[src]

A helper method to convert an AsyncRead to a StreamBody. If there is any error thrown during the reading/writing, it will be logged via log::error!.

Trait Implementations

impl Body for StreamBody[src]

type Data = StreamData

Values yielded by the Body.

type Error = Error

The error type this Body might generate.

impl From<&'static [u8]> for StreamBody[src]

impl From<&'static str> for StreamBody[src]

impl From<Bytes> for StreamBody[src]

impl From<Cow<'static, [u8]>> for StreamBody[src]

impl From<Cow<'static, str>> for StreamBody[src]

impl From<String> for StreamBody[src]

impl From<Vec<u8>> for StreamBody[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.