Struct Body
pub struct Body { /* private fields */ }
An asynchronous request body.
Implementations
impl Body
fn as_bytes(&self) -> Option<&[u8]>Returns a reference to the internal data of the
Body.Noneis returned, if the underlying data is a stream.fn wrap_stream<S>(stream: S) -> Body where S: TryStream + Send + 'static, S::Error: Into<Box<dyn Error + Send + Sync>>, Bytes: From<S::Ok>,Wrap a futures
Streamin a box insideBody.Example
# use Body; # use futures_util; #Optional
This requires the
streamfeature to be enabled.fn wrap<B>(inner: B) -> Body where B: HttpBody + Send + Sync + 'static, B::Data: Into<Bytes>, B::Error: Into<Box<dyn Error + Send + Sync>>,Wrap a
HttpBodyin a box insideBody.Example
# use Body; # use futures_util; #
Trait Implementations
impl Body for Body
type Data = Bytes;type Error = Error;fn poll_frame(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>fn size_hint(&self) -> SizeHintfn is_end_stream(&self) -> bool
impl Debug for Body
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Body
fn default() -> Body
impl From<&'static [u8]> for Body
fn from(s: &'static [u8]) -> Body
impl From<&'static str> for Body
fn from(s: &'static str) -> Body
impl From<Bytes> for Body
fn from(bytes: Bytes) -> Body
impl From<File> for Body
fn from(file: File) -> Body
impl From<Response> for Body
fn from(r: Response) -> Body
impl From<String> for Body
fn from(s: String) -> Body
impl From<Vec<u8>> for Body
fn from(vec: Vec<u8>) -> Body
Auto Trait Implementations
impl !Freeze for Body
impl !RefUnwindSafe for Body
impl !UnwindSafe for Body
impl Send for Body
impl Sync for Body
impl Unpin for Body
impl UnsafeUnpin for Body
Blanket Implementations
impl<T> Any for Body
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> BodyExt for Body
where
T: Body + ?Sized,
impl<T> Borrow<T> for Body
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Body
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Body
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for Body
impl<T> PolicyExt for Body
where
T: ?Sized,
fn and<P, B, E>(self, other: P) -> And<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,fn or<P, B, E>(self, other: P) -> Or<T, P> where T: Sized + Policy<B, E>, P: Policy<B, E>,
impl<T> WithSubscriber for Body
impl<T, U> Into<U> for Body
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Body
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Body
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>