[−][src]Enum now_lambda::Body
Representation of http request and response bodies as supported by Zeit Now v2.
These come in three flavors
Empty
( no body )Text
( text data )Binary
( binary data )
Body types can be Deref
and AsRef
'd into [u8]
types much like the hyper
crate
Examples
Body types are inferred with From
implementations.
Text
Types like String
, str
whose type reflects
text produce Body::Text
variants
assert!(match now_lambda::Body::from("text") { now_lambda::Body::Text(_) => true, _ => false })
Binary
Types like Vec<u8>
and &[u8]
whose types reflect raw bytes produce Body::Binary
variants
assert!(match now_lambda::Body::from("text".as_bytes()) { now_lambda::Body::Binary(_) => true, _ => false })
Binary
responses bodies will automatically get base64 encoded.
Empty
The unit type ( ()
) whose type represents an empty value produces Body::Empty
variants
assert!(match now_lambda::Body::from(()) { now_lambda::Body::Empty => true, _ => false })
Variants
Empty
An empty body
Text(String)
A body containing string data
Binary(Vec<u8>)
A body containing binary data
Trait Implementations
impl AsRef<[u8]> for Body
[src]
impl PartialEq<Body> for Body
[src]
impl Default for Body
[src]
impl From<()> for Body
[src]
impl From<Body> for ()
[src]
impl<'a> From<&'a str> for Body
[src]
impl From<String> for Body
[src]
impl From<Body> for String
[src]
impl From<Cow<'static, str>> for Body
[src]
impl From<Body> for Cow<'static, str>
[src]
impl From<Cow<'static, [u8]>> for Body
[src]
impl From<Body> for Cow<'static, [u8]>
[src]
impl From<Vec<u8>> for Body
[src]
impl From<Body> for Vec<u8>
[src]
impl<'a> From<&'a [u8]> for Body
[src]
impl Debug for Body
[src]
impl Deref for Body
[src]
impl<'a> Serialize for Body
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,