pub trait FromRequestParts: Sized + Send {
type Error: IntoResponse;
// Required method
fn from_request_parts(parts: &Parts) -> Result<Self, Self::Error>;
}Expand description
Extract a value from request metadata (URI, headers, extensions).
Implementors can be used as handler arguments. Multiple FromRequestParts
extractors can appear in a single handler since they don’t consume the body.
Required Associated Types§
Sourcetype Error: IntoResponse
type Error: IntoResponse
The error type returned when extraction fails.
Required Methods§
Sourcefn from_request_parts(parts: &Parts) -> Result<Self, Self::Error>
fn from_request_parts(parts: &Parts) -> Result<Self, Self::Error>
Extract this type from the request parts.
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.
Implementations on Foreign Types§
Source§impl FromRequestParts for HeaderMap
impl FromRequestParts for HeaderMap
Source§impl FromRequestParts for Method
Extracts the HTTP method from the request.
impl FromRequestParts for Method
Extracts the HTTP method from the request.
Source§impl FromRequestParts for Uri
Extracts the request URI.
impl FromRequestParts for Uri
Extracts the request URI.