Trait axum_core::extract::FromRequest
source · pub trait FromRequest<S, M = ViaRequest>: Sized {
type Rejection: IntoResponse;
// Required method
fn from_request<'life0, 'async_trait>(
req: Request,
state: &'life0 S,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Rejection>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Types that can be created from requests.
Extractors that implement FromRequest
can consume the request body and can thus only be run
once for handlers.
If your extractor doesn’t need to consume the request body then you should implement
FromRequestParts
and not FromRequest
.
See axum::extract
for more general docs about extractors.
Required Associated Types§
sourcetype Rejection: IntoResponse
type Rejection: IntoResponse
If the extractor fails it’ll use this “rejection” type. A rejection is a kind of error that can be converted into a response.
Required Methods§
Object Safety§
This trait is not object safe.