pub struct Body { /* private fields */ }Expand description
A response body as it arrives, read once.
An implementation builds one with Body::from_stream, passing along the length the
transport knows so a body declared past the caller’s cap is refused before a byte of it
is read. The SDK reads it with Body::chunk or Body::collect.
Implementations§
Source§impl Body
impl Body
Sourcepub fn from_stream(
stream: impl Stream<Item = Result<Bytes, Error>> + Send + 'static,
content_length: Option<u64>,
) -> Body
pub fn from_stream( stream: impl Stream<Item = Result<Bytes, Error>> + Send + 'static, content_length: Option<u64>, ) -> Body
A body over the transport’s stream of chunks, with the length it declared, if any.
Sourcepub fn content_length(&self) -> Option<u64>
pub fn content_length(&self) -> Option<u64>
What the transport declared the body’s length to be, when it declared one.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Body
impl !Sync for Body
impl !UnwindSafe for Body
impl Freeze for Body
impl Send for Body
impl Unpin for Body
impl UnsafeUnpin for Body
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more