Struct trillium::Body [−][src]
pub struct Body(_);
Expand description
The trillium representation of a http body. This can contain
either &'static [u8]
content, Vec<u8>
content, or a boxed
AsyncRead
type.
Implementations
Construct a new body from a streaming (AsyncRead) source. If
you have the body content in memory already, prefer
Body::new_static
or one of the From conversions.
Construct a fixed-length Body from a Vec<u8>
or &'static [u8]
.
Retrieve a borrow of the static content in this body. If this body is a streaming body or an empty body, this will return None.
Consume this body and return the full body. If the body was
constructed with [Body::new_streaming
], this will read the
entire streaming body into memory, awaiting the streaming
source’s completion. This function will return an error if a
streaming body has already been read to completion.
Retrieve the number of bytes that have been read from this body
returns the content length of this body, if known and available.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Body
impl !UnwindSafe for Body
Blanket Implementations
Reads some bytes from the byte stream. Read more
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
Reads the exact number of bytes required to fill buf
. Read more
Creates an adapter which will read at most limit
bytes from it. Read more
Creates an adapter which will chain this stream with another. Read more
Mutably borrows from an owned value. Read more