Trait RequestExtensions

Source
pub trait RequestExtensions {
    // Required methods
    fn captures(&self) -> Option<&Captures>;
    fn data<T: Send + Sync + 'static>(&self) -> Option<Data<T>>;

    // Provided method
    fn parsed_captures<C: FromCaptures>(&self) -> Result<C> { ... }
}
Expand description

Extensions to http::Request and http::request::Parts to support easy access to captures and State object

Required Methods§

Source

fn captures(&self) -> Option<&Captures>

Any captures provided by the matching Regex for the current path

Source

fn data<T: Send + Sync + 'static>(&self) -> Option<Data<T>>

Copy of any data passed into the router builder using data or wrapped_data

Provided Methods§

Source

fn parsed_captures<C: FromCaptures>(&self) -> Result<C>

Positional captures parsed into FromStr types, in tuple format

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 RequestExtensions for Parts

Source§

fn captures(&self) -> Option<&Captures>

Source§

fn data<T: Send + Sync + 'static>(&self) -> Option<Data<T>>

Implementors§