Skip to main content

FromRequest

Trait FromRequest 

Source
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§

Source

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.

Source§

async fn from_request(ctx: &mut RequestCtx) -> Result<Option<T>, Error>

Implementors§