Struct anterofit::net::body::RawBody [−][src]
pub struct RawBody<R>(_);
A wrapper around a type that is intended to be read directly as the request body, instead of being serialized.
Methods
impl<R: Read> RawBody<R>
[src]
impl<R: Read> RawBody<R>
pub fn new<C: Into<Option<Mime>>>(readable: R, content_type: C) -> Self
[src]
pub fn new<C: Into<Option<Mime>>>(readable: R, content_type: C) -> Self
Wrap a Read
type and a content-type
impl<T: AsRef<[u8]>> RawBody<Cursor<T>>
[src]
impl<T: AsRef<[u8]>> RawBody<Cursor<T>>
pub fn bytes(bytes: T) -> Self
[src]
pub fn bytes(bytes: T) -> Self
Wrap anything Cursor
can work with (such as String
or Vec<u8>
) as a raw request body.
Assumes application/octet-stream
as the content-type.
pub fn text(text: T) -> Self where
T: Borrow<str>,
[src]
pub fn text(text: T) -> Self where
T: Borrow<str>,
Wrap anything Send + 'static
that can deref to str
(String
, &'static str
, Box<str>
, etc)
as a plain text body.
Assumes text/plain; charset=utf8
as the content-type.
impl RawBody<Cursor<String>>
[src]
impl RawBody<Cursor<String>>
pub fn display<T: ToString>(text: &T) -> Self
[src]
pub fn display<T: ToString>(text: &T) -> Self
Convert the ToString
value to a String
and wrap it.
Assumes text/plain; charset=utf8
as the content-type.
impl RawBody<Cursor<Vec<u8>>>
[src]
impl RawBody<Cursor<Vec<u8>>>
pub fn serialize_now<S, T>(ser: &S, val: &T) -> Result<Self> where
S: Serializer,
T: Serialize,
[src]
pub fn serialize_now<S, T>(ser: &S, val: &T) -> Result<Self> where
S: Serializer,
T: Serialize,
Use the serializer in adapter
to serialize val
as a raw body immediately.
Trait Implementations
impl<R: Debug> Debug for RawBody<R>
[src]
impl<R: Debug> Debug for RawBody<R>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<R: Read + Send + 'static> EagerBody for RawBody<R>
[src]
impl<R: Read + Send + 'static> EagerBody for RawBody<R>
type Readable = R
The readable request body.
fn into_readable<S>(self, _ser: &S) -> ReadableResult<Self::Readable> where
S: Serializer,
[src]
fn into_readable<S>(self, _ser: &S) -> ReadableResult<Self::Readable> where
S: Serializer,
Serialize self
with the given adapter into a request body.
impl<R> From<Readable<R>> for RawBody<R>
[src]
impl<R> From<Readable<R>> for RawBody<R>