[−][src]Enum rocket::response::Body
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>
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,