Skip to main content

ClientIp

Trait ClientIp 

pub trait ClientIp {
    // Required method
    fn client_ip(&self) -> Option<IpAddr>;
}
Available on crate feature net only.
Expand description

Best-effort client-IP accessor, implemented per request/input type.

Deliberately has no ExtensionsRef bound and no blanket impl: a blanket would force one behaviour onto every extensions-carrying type (including IO/service wrappers) and block custom impls. Implement it explicitly per type instead — e.g. the http Request/Parts impls in rama-http-types delegate to client_ip, but other inputs may resolve their client IP differently.

Required Methods§

fn client_ip(&self) -> Option<IpAddr>

Best-effort client IP — see client_ip for the common resolution.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl ClientIp for Parts

§

impl<B> ClientIp for Request<B>