Trait RequestExt

Source
pub trait RequestExt {
    // Required methods
    fn params(&self) -> &Params;
    fn route(&self) -> &str;
    fn remote_addr(&self) -> SocketAddr;
    fn app_context<T: Send + Sync + 'static>(&self) -> Option<Arc<T>>;
}
Expand description

Extensions to the request object for accessing the route parameters, remote address

Required Methods§

Source

fn params(&self) -> &Params

The route parameters if any.

Source

fn route(&self) -> &str

The matched route pattern

Source

fn remote_addr(&self) -> SocketAddr

The remote address for the request, also respects X-Forwarded-For

Source

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

Contains the application context when created with into_service_with_context

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 RequestExt for Request<Body>

Source§

fn params(&self) -> &Params

Source§

fn remote_addr(&self) -> SocketAddr

Source§

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

Source§

fn route(&self) -> &str

Implementors§