Skip to main content

FromRequest

Trait FromRequest 

Source
pub trait FromRequest: Sized {
    // Required method
    fn from_request<'life0, 'async_trait>(
        ctx: &'life0 Context,
    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A type that can be extracted from the request context.

Every extractor borrows &Context; the request body is buffered and cached, so multiple body-reading extractors on the same handler are fine.

Required Methods§

Source

fn from_request<'life0, 'async_trait>( ctx: &'life0 Context, ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl FromRequest for Context

The full request context — the identity extractor, so existing |ctx: Context| async move { … } handlers keep working unchanged.

Source§

impl<T: DeserializeOwned + Send> FromRequest for Json<T>

Source§

impl<T: DeserializeOwned + Send> FromRequest for Path<T>

Source§

impl<T: DeserializeOwned + Send> FromRequest for Query<T>

Source§

impl<T: DeserializeOwned + Validate + Send> FromRequest for Valid<T>