Skip to main content

FromRequest

Trait FromRequest 

Source
pub trait FromRequest:
    Sized
    + Send
    + 'static {
    // Required method
    fn from_request(request: Arc<Request>) -> BoxedFuture<Result<Self>>;
}
Expand description

Something a handler parameter can be built from.

Required Methods§

Source

fn from_request(request: Arc<Request>) -> BoxedFuture<Result<Self>>

Build Self from the request, or fail with the error the client should see (a 400 for a malformed body, a 422 for a failed contract).

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 FromRequest for Arc<Request>

The whole request.

Source§

impl<T: FromRequest> FromRequest for Option<T>

An extractor that never fails: Option<T> is None when T would have errored. For inputs that are genuinely optional.

Source§

impl<T: FromRequest> FromRequest for Result<T>

Hands the extraction error to the handler instead of short-circuiting, for actions that want to answer a bad request themselves.

Implementors§