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", so this trait is not object safe.

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§