pub struct Body(_);
The trillium representation of a http body. This can contain
&'static [u8] content,
Vec<u8> content, or a boxed
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
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.
Transform this Body into a dyn
AsyncRead. This will wrap
static content in a [
Cursor]. Note that this is different
from reading directly from the Body, which includes chunked
Consume this body and return the full content. If the body was
[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.
This returns an error variant if either of the following conditions are met:
- there is an io error when reading from the underlying transport such as a disconnect
- the 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.
determine if the this body represents no data
determine if the this body represents static content
determine if the this body represents streaming content
AsyncReadExt::read()], except it reads into a slice of buffers. Read more
buf. Read more
limitbytes from it. Read more
AsyncRead] into a [
Stream] of bytes. Read more
dyn AsyncRead + Send + 'a. Read more
Returns the argument unchanged.