Skip to main content

ChunksAlg

Trait ChunksAlg 

Source
pub trait ChunksAlg {
    type Chunk;
    type Error;

    // Required method
    fn next_chunk(
        &mut self,
    ) -> impl Future<Output = Option<Result<Self::Chunk, Self::Error>>> + Send;
}
Expand description

States a body produced over time: the chunks it carries, and what taking the next one means.

A domain answering with a body it cannot hold all at once states this rather than naming a stream type. What a chunk is, what a failure part-way through means, and how bytes actually move are then the interpretation’s to choose, which is the whole reason a program states a surface rather than a framework’s callbacks.

Required Associated Types§

Source

type Chunk

What one chunk carries.

Source

type Error

What a body failing part-way through means.

Required Methods§

Source

fn next_chunk( &mut self, ) -> impl Future<Output = Option<Result<Self::Chunk, Self::Error>>> + Send

Takes the next chunk, or nothing where the body has ended.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§