Skip to main content

FromRequest

Trait FromRequest 

Source
pub trait FromRequest: Sized {
    type Filter: Filter<Error = Rejection>;

    // Required method
    fn new() -> Self::Filter;

    // Provided methods
    fn is_body() -> bool { ... }
    fn is_optional() -> bool { ... }
    fn is_query() -> bool { ... }
    fn content_type() -> &'static str { ... }
}

Required Associated Types§

Source

type Filter: Filter<Error = Rejection>

Extract should be (Self,),

Required Methods§

Source

fn new() -> Self::Filter

Provided Methods§

Source

fn is_body() -> bool

It’s true iff the type represents whole request body.

It returns true for Json<T> and Form<T>.

Source

fn is_optional() -> bool

It’s true if the type is optional.

It returns true for Option<T>.

Source

fn is_query() -> bool

It’s true iff the type represents whole request query.

It returns true for Query<T>.

Source

fn content_type() -> &'static str

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: 'static + FromRequest + Send, T::Filter: Send + Sync + Filter<Extract = (T,), Error = Rejection>,

Implementors§

Source§

impl FromRequest for FormData

Available on crate feature multipart only.
Source§

impl FromRequest for Ws

Available on crate feature websocket only.
Source§

impl<T> FromRequest for Form<T>
where T: 'static + Send + DeserializeOwned,

Source§

impl<T> FromRequest for Json<T>
where T: 'static + Send + DeserializeOwned,

Source§

impl<T> FromRequest for Query<T>
where T: 'static + Send + DeserializeOwned,