Skip to main content

FromRequest

Trait FromRequest 

Source
pub trait FromRequest<S>: Sized {
    // Required method
    fn from_request(req: &Request, state: &S) -> Result<Self, Rejection>;
}
Expand description

Types that can be extracted from a navigation, used as arguments of hooks and loads.

Extraction is synchronous and runs before the handler’s future is created. What an extractor reads from the Request (path, query, params) decides when the load reruns.

Required Methods§

Source

fn from_request(req: &Request, state: &S) -> Result<Self, Rejection>

Extracts the value from the request and the app state.

§Errors

The Rejection is handled like one returned from the hook or load itself: an error renders the nearest error page, a redirect navigates elsewhere.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§