pub trait FromRequest: Sized + Send {
// Required method
fn from_request(
ctx: &mut RequestCtx,
) -> impl Future<Output = Result<Self, Error>> + Send;
}Expand description
Types that can be produced from the request. Implemented by all extractors
and by Dep<T> (see dep module).
Required Methods§
fn from_request( ctx: &mut RequestCtx, ) -> impl Future<Output = Result<Self, Error>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> FromRequest for Option<T>where
T: FromRequest,
Optional extraction: Some when the inner extractor succeeds, None on
ANY extraction failure. For genuinely optional inputs — the canonical use
is optional auth (Option<CurrentUser> on a route that also accepts a
signed URL). Do NOT use it to paper over malformed required input: the
failure reason is discarded by design.
impl<T> FromRequest for Option<T>where
T: FromRequest,
Optional extraction: Some when the inner extractor succeeds, None on
ANY extraction failure. For genuinely optional inputs — the canonical use
is optional auth (Option<CurrentUser> on a route that also accepts a
signed URL). Do NOT use it to paper over malformed required input: the
failure reason is discarded by design.