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§
Required Methods§
Provided Methods§
Sourcefn size_hint(
&self,
) -> impl Future<Output = Result<SizeHint, Self::Error>> + Send
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.