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]
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]
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.
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]
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]
fn serialize_now<A, T>(adapter: &A, val: &T) -> Result<Self> where A: AbsAdapter, 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: Read + Send + 'static> EagerBody for RawBody<R>
[src]
type Readable = R
The readable request body.
fn into_readable<A>(self, _adapter: &A) -> ReadableResult<Self::Readable> where A: AbsAdapter
Serialize self
with the given adapter into a request body.