pub trait BodyStream {
// Required methods
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> BodyReadFuture<'a>;
fn trailers(&mut self) -> BodyTrailersFuture<'_>;
fn length(&self) -> Option<u64>;
}Expand description
A body on its way to or from a server: bytes read a piece at a time, the length when the
sender said it, and trailers once the body has ended. Read as FileStream is.
Required Methods§
Sourcefn read<'a>(&'a mut self, buf: &'a mut [u8]) -> BodyReadFuture<'a>
fn read<'a>(&'a mut self, buf: &'a mut [u8]) -> BodyReadFuture<'a>
Reads the next bytes into buf, answering how many it read, 0 once the body has ended.
Sourcefn trailers(&mut self) -> BodyTrailersFuture<'_>
fn trailers(&mut self) -> BodyTrailersFuture<'_>
The fields that came after the body, once it has ended; None where the response has
none, and always None on a client whose protocol layer does not expose them.
Called only after read has answered 0; asking again answers the same
fields, so an implementation over a future that may be awaited once keeps its answer. On
a request body this answers the fields to send.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".