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

Message body size hind

Source

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

Implementations on Foreign Types§

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 &'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 ()

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 MessageBody for Bytes

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 BytesMut

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> MessageBody for Box<T>

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<B: MessageBody> MessageBody for ResponseBody<B>

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,

Source§

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