Skip to main content

RequestLike

Trait RequestLike 

Source
pub trait RequestLike {
    // Required methods
    fn uri(&self) -> Uri;
    fn is_same_uri(&self, other: &Uri) -> bool;
    fn method(&self) -> &Method;
    fn headers(&self) -> &HeaderMap;
}
Expand description

Allows using either Request or request::Parts, or your own newtype.

Required Methods§

Source

fn uri(&self) -> Uri

Same as req.uri().clone()

Source

fn is_same_uri(&self, other: &Uri) -> bool

Whether the effective request URI matches the other URI

It can be naive string comparison, nothing fancy

Source

fn method(&self) -> &Method

Same as req.method()

Source

fn headers(&self) -> &HeaderMap

Same as req.headers()

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl RequestLike for Parts

Source§

fn uri(&self) -> Uri

Source§

fn is_same_uri(&self, other: &Uri) -> bool

Source§

fn method(&self) -> &Method

Source§

fn headers(&self) -> &HeaderMap

Source§

impl<Body> RequestLike for Request<Body>

Source§

fn uri(&self) -> Uri

Source§

fn is_same_uri(&self, other: &Uri) -> bool

Source§

fn method(&self) -> &Method

Source§

fn headers(&self) -> &HeaderMap

Implementors§