Struct Body

struct Body { ... }

An asynchronous request body.

Implementations

impl Body

fn as_bytes(self: &Self) -> Option<&[u8]>

Returns a reference to the internal data of the Body.

None is returned, if the underlying data is a stream.

fn wrap<B>(inner: B) -> Body
where
    B: HttpBody + Send + Sync + 'static,
    <B as >::Data: Into<Bytes>,
    <B as >::Error: Into<Box<dyn Error + Send + Sync>>

Wrap a HttpBody in a box inside Body.

Example

# use reqwest::Body;
# use futures_util;
# fn main() {
let content = "hello,world!".to_string();

let body = Body::wrap(content);
# }

impl Body for Body

fn poll_frame(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Frame<<Self as >::Data>, <Self as >::Error>>>
fn size_hint(self: &Self) -> SizeHint
fn is_end_stream(self: &Self) -> bool

impl Debug for Body

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Default for Body

fn default() -> Body

impl Freeze for Body

impl From for Body

fn from(s: String) -> Body

impl From for Body

fn from(bytes: Bytes) -> Body

impl From for Body

fn from(s: &'static [u8]) -> Body

impl From for Body

fn from(vec: Vec<u8>) -> Body

impl From for Body

fn from(r: Response) -> Body

impl From for Body

fn from(s: &'static str) -> Body

impl RefUnwindSafe for Body

impl Send for Body

impl Sync for Body

impl Unpin for Body

impl UnsafeUnpin for Body

impl UnwindSafe for Body

impl<T> Any for Body

fn type_id(self: &Self) -> TypeId

impl<T> BodyExt for Body

impl<T> Borrow for Body

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Body

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> ErasedDestructor for Body

impl<T> From for Body

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Body

impl<T> PolicyExt for Body

fn and<P, B, E>(self: Self, other: P) -> And<T, P>
where
    T: Policy<B, E>,
    P: Policy<B, E>
fn or<P, B, E>(self: Self, other: P) -> Or<T, P>
where
    T: Policy<B, E>,
    P: Policy<B, E>

impl<T> WithSubscriber for Body

impl<T, U> Into for Body

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Body

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Body

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>