pub trait FromRequest: Sized {
type Error: Respondable;
// Required method
fn from_request(req: Request) -> Result<Self, Self::Error>;
}
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
.
Required Associated Types§
type Error: Respondable
Required Methods§
fn from_request(req: Request) -> Result<Self, Self::Error>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.