Skip to main content

ChunkSource

Trait ChunkSource 

Source
pub trait ChunkSource: Send {
    // Required method
    fn next_chunk(
        &mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + '_>>;
}
Expand description

A body arriving in pieces.

One method, because that is all a cursor-driven stream needs: Ok(None) is the end of the body, however it ended. Which way it ended is not this trait’s business — the protocol answers that with the presence or absence of a terminal exit event, which is exactly why the transport is framed.

Required Methods§

Source

fn next_chunk( &mut self, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + '_>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§