Trait FromRequest
pub trait FromRequest:
Sized
+ Send
+ 'static {
type Rejection;
// Required method
fn from_request(
req: Request,
) -> impl Future<Output = Result<Self, Self::Rejection>> + Send;
}Available on crate features
http and std only.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 owns only the request body and merely borrows the request parts, also
implement FromRequestBody to compose with a preceding FromOwnedRequestParts extractor.
If it doesn’t need to consume the request body at all, implement FromPartsStateRefPair
instead.
Required Associated Types§
type Rejection
type Rejection
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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".