Struct Body

struct Body(_)

The body type used in axum requests and responses.

Implementations

impl Body

fn new<B>(body: B) -> Self
where
    B: http_body::Body<Data = Bytes> + Send + 'static,
    <B as >::Error: Into<BoxError>

Create a new Body that wraps another http_body::Body.

fn empty() -> Self

Create an empty body.

fn from_stream<S>(stream: S) -> Self
where
    S: TryStream + Send + 'static,
    <S as >::Ok: Into<Bytes>,
    <S as >::Error: Into<BoxError>

Create a new Body from a Stream.

fn into_data_stream(self: Self) -> BodyDataStream

Convert the body into a Stream of data frames.

Non-data frames (such as trailers) will be discarded. Use http_body_util::BodyStream if you need a Stream of all frame types.

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) -> http_body::SizeHint
fn is_end_stream(self: &Self) -> bool

impl Debug for Body

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

impl Default for Body

fn default() -> Self

impl Freeze for Body

impl From for Body

fn from(buf: Vec<u8>) -> Self

impl From for Body

fn from(buf: String) -> Self

impl From for Body

fn from(_: ()) -> Self

impl From for Body

fn from(buf: std::borrow::Cow<'static, str>) -> Self

impl From for Body

fn from(buf: std::borrow::Cow<'static, [u8]>) -> Self

impl From for Body

fn from(buf: &'static str) -> Self

impl From for Body

fn from(buf: Bytes) -> Self

impl From for Body

fn from(buf: &'static [u8]) -> Self

impl IntoResponse for crate::body::Body

fn into_response(self: Self) -> Response

impl RefUnwindSafe for Body

impl Send for Body

impl Sync for Body

impl Unpin for Body

impl UnwindSafe for Body

impl<S> FromRequest for crate::body::Body

async fn from_request(req: Request, _: &S) -> Result<Self, <Self as >::Rejection>

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> From for Body

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Instrument for Body

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>