StreamingSource

Trait StreamingSource 

Source
pub trait StreamingSource {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn next(
        &mut self,
    ) -> impl Future<Output = Option<Result<Bytes, Self::Error>>> + Send;

    // Provided method
    fn size_hint(
        &self,
    ) -> impl Future<Output = Result<SizeHint, Self::Error>> + Send { ... }
}
Expand description

Provides bytes from single-pass sources.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type.

Required Methods§

Source

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

Gets the next set of data.

Provided Methods§

Source

fn size_hint( &self, ) -> impl Future<Output = Result<SizeHint, Self::Error>> + Send

An estimate of the payload size.

Returns the expected size as a [min, max) range. The maximum may be unknown. If the minimum is unknown use 0.

If the maximum size is known and sufficiently small, the client library may be able to use a more efficient protocol for the upload.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§