Trait BodySource
pub trait BodySource:
AsyncRead
+ Send
+ 'static {
// Required method
fn trailers(self: Pin<&mut Self>) -> Option<Headers>;
}Expand description
Streaming body source that can optionally produce trailers.
Implement this on types that compute trailer headers dynamically as the body
is read — for example, a hashing wrapper that produces a Digest trailer
after all bytes have been streamed. For plain AsyncRead sources with no
trailers, Body::new_streaming is simpler.
Required Methods§
fn trailers(self: Pin<&mut Self>) -> Option<Headers>
fn trailers(self: Pin<&mut Self>) -> Option<Headers>
Returns the trailers for this body, called after the body has been fully read.
Implementations may clear internal state on this call; the result is
only meaningful after AsyncRead::poll_read has returned Ok(0).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".