pub struct Body(/* private fields */);
Expand description
The body type used in axum requests and responses.
Implementations§
§impl Body
impl Body
pub fn new<B>(body: B) -> Body
pub fn new<B>(body: B) -> Body
Create a new Body
that wraps another http_body::Body
.
pub fn from_stream<S>(stream: S) -> Body
pub fn from_stream<S>(stream: S) -> Body
Create a new Body
from a Stream
.
pub fn into_data_stream(self) -> BodyDataStream
pub fn into_data_stream(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.
Trait Implementations§
§impl From<BytesContentLoader> for Body
impl From<BytesContentLoader> for Body
§fn from(this: BytesContentLoader) -> Body
fn from(this: BytesContentLoader) -> Body
Converts to this type from the input type.
§impl From<StringContentLoader> for Body
impl From<StringContentLoader> for Body
§fn from(this: StringContentLoader) -> Body
fn from(this: StringContentLoader) -> Body
Converts to this type from the input type.
§impl<S> FromRequest<S> for Body
impl<S> FromRequest<S> for Body
§type Rejection = Infallible
type Rejection = Infallible
If the extractor fails it’ll use this “rejection” type. A rejection is
a kind of error that can be converted into a response.
§impl Body for Body
impl Body for Body
§impl IntoResponse for Body
impl IntoResponse for Body
§fn into_response(self) -> Response<Body>
fn into_response(self) -> Response<Body>
Create a response.
Auto Trait Implementations§
impl Freeze for Body
impl !RefUnwindSafe for Body
impl Send for Body
impl !Sync for Body
impl Unpin for Body
impl !UnwindSafe for Body
Blanket Implementations§
§impl<T> BodyExt for T
impl<T> BodyExt for T
§fn frame(&mut self) -> Frame<'_, Self> ⓘwhere
Self: Unpin,
fn frame(&mut self) -> Frame<'_, Self> ⓘwhere
Self: Unpin,
Returns a future that resolves to the next
Frame
, if any.§fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
fn boxed_unsync(self) -> UnsyncBoxBody<Self::Data, Self::Error>
Turn this body into a boxed trait object that is !Sync.
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more