Enum rocket::response::Body [−][src]
The body of a response: can be sized or streamed/chunked.
Variants
Sized(T, u64)
A fixed-size body.
Chunked(T, u64)
A streamed/chunked body, akin to Transfer-Encoding: chunked
.
Methods
impl<T> Body<T>
[src]
impl<T> Body<T>
pub fn as_mut(&mut self) -> Body<&mut T>
[src]
pub fn as_mut(&mut self) -> Body<&mut T>
Returns a new Body
with a mutable borrow to self
's inner type.
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Body<U>
[src]
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Body<U>
Consumes self
. Passes the inner type as a parameter to f
and
constructs a new body with the size of self
and the return value of
the call to f
.
pub fn into_inner(self) -> T
[src]
pub fn into_inner(self) -> T
Consumes self
and returns the inner body.
pub fn is_sized(&self) -> bool
[src]
pub fn is_sized(&self) -> bool
Returns true
if self
is a Body::Sized
.
pub fn is_chunked(&self) -> bool
[src]
pub fn is_chunked(&self) -> bool
Returns true
if self
is a Body::Chunked
.
impl<T: Read> Body<T>
[src]
impl<T: Read> Body<T>
pub fn into_bytes(self) -> Option<Vec<u8>>
[src]
pub fn into_bytes(self) -> Option<Vec<u8>>
Attepts to read self
into a Vec
and returns it. If reading fails,
returns None
.
pub fn into_string(self) -> Option<String>
[src]
pub fn into_string(self) -> Option<String>
Attepts to read self
into a String
and returns it. If reading or
conversion fails, returns None
.
Trait Implementations
impl<T: PartialEq> PartialEq for Body<T>
[src]
impl<T: PartialEq> PartialEq for Body<T>
fn eq(&self, other: &Body<T>) -> bool
[src]
fn eq(&self, other: &Body<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Body<T>) -> bool
[src]
fn ne(&self, other: &Body<T>) -> bool
This method tests for !=
.
impl<T: Clone> Clone for Body<T>
[src]
impl<T: Clone> Clone for Body<T>
fn clone(&self) -> Body<T>
[src]
fn clone(&self) -> Body<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Hash> Hash for Body<T>
[src]
impl<T: Hash> Hash for Body<T>
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> Debug for Body<T>
[src]
impl<T> Debug for Body<T>