Skip to main content

MessageBody

Trait MessageBody 

Source
pub trait MessageBody: 'static {
    // Required methods
    fn size(&self) -> BodySize;
    fn poll_next_chunk(
        &mut self,
        cx: &mut Context<'_>,
    ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>;
}
Expand description

Interface for types that can be streamed to a peer.

Required Methods§

Source

fn size(&self) -> BodySize

Returns the body size hint.

Source

fn poll_next_chunk( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Polls the next body chunk.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MessageBody for &'static [u8]

Source§

fn size(&self) -> BodySize

Source§

fn poll_next_chunk( &mut self, _: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Source§

impl MessageBody for &'static str

Source§

fn size(&self) -> BodySize

Source§

fn poll_next_chunk( &mut self, _: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Source§

impl MessageBody for ()

Source§

fn size(&self) -> BodySize

Source§

fn poll_next_chunk( &mut self, _: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Source§

impl MessageBody for String

Source§

fn size(&self) -> BodySize

Source§

fn poll_next_chunk( &mut self, _: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Source§

impl MessageBody for Vec<u8>

Source§

fn size(&self) -> BodySize

Source§

fn poll_next_chunk( &mut self, _: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Source§

impl<T> MessageBody for Box<T>
where T: MessageBody,

Source§

fn size(&self) -> BodySize

Source§

fn poll_next_chunk( &mut self, cx: &mut Context<'_>, ) -> Poll<Option<Result<Bytes, Rc<dyn Error>>>>

Implementors§

Source§

impl MessageBody for Body

Source§

impl MessageBody for BytePages

Source§

impl MessageBody for Bytes

Source§

impl MessageBody for BytesMut

Source§

impl<B: MessageBody> MessageBody for Encoder<B>

Source§

impl<B> MessageBody for ResponseBody<B>
where B: MessageBody,

Source§

impl<S, E> MessageBody for BodyStream<S, E>
where S: Stream<Item = Result<Bytes, E>> + Unpin + 'static, E: Error + 'static,

Source§

impl<S> MessageBody for BoxedBodyStream<S>
where S: Stream<Item = Result<Bytes, Rc<dyn Error>>> + Unpin + 'static,

Source§

impl<S> MessageBody for SizedStream<S>
where S: Stream<Item = Result<Bytes, Rc<dyn Error>>> + Unpin + 'static,