pub struct RawBody<B = Body>(pub B);
Expand description
Extractor that extracts the raw request body.
Example
use axum::{
extract::RawBody,
routing::get,
Router,
};
use futures::StreamExt;
async fn handler(RawBody(body): RawBody) {
// ...
}
let app = Router::new().route("/users", get(handler));
Tuple Fields
0: B
Trait Implementations
sourceimpl<B> FromRequest<B> for RawBody<B> where
B: Send,
impl<B> FromRequest<B> for RawBody<B> where
B: Send,
type Rejection = BodyAlreadyExtracted
type Rejection = BodyAlreadyExtracted
If the extractor fails it’ll use this “rejection” type. A rejection is a kind of error that can be converted into a response. Read more
sourcefn from_request<'life0, 'async_trait>(
req: &'life0 mut RequestParts<B>
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn from_request<'life0, 'async_trait>(
req: &'life0 mut RequestParts<B>
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Perform the extraction.
Auto Trait Implementations
impl<B> RefUnwindSafe for RawBody<B> where
B: RefUnwindSafe,
impl<B> Send for RawBody<B> where
B: Send,
impl<B> Sync for RawBody<B> where
B: Sync,
impl<B> Unpin for RawBody<B> where
B: Unpin,
impl<B> UnwindSafe for RawBody<B> where
B: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more