Filter

Trait Filter 

Source
pub trait Filter: Sized {
    // Required method
    fn is_match(&self, ip: IpAddr) -> bool;

    // Provided method
    fn or<F2: Filter>(self, right: F2) -> Or<Self, F2> { ... }
}
Expand description

Interface to define function that filters out IP address

When match is found, IP address is skipped from being selected as client’s IP (e.g. it is load balancer IP)

Required Methods§

Source

fn is_match(&self, ip: IpAddr) -> bool

Returns true if ip matches

Provided Methods§

Source

fn or<F2: Filter>(self, right: F2) -> Or<Self, F2>

Combines self with right filter in OR operation

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 Filter for IpAddr

Source§

fn is_match(&self, ip: IpAddr) -> bool

Source§

impl Filter for SocketAddr

Source§

fn is_match(&self, ip: IpAddr) -> bool

Source§

impl Filter for ()

Source§

fn is_match(&self, _: IpAddr) -> bool

NULL filter, never matching

Implementors§

Source§

impl Filter for Cidr

Source§

impl<F1: Filter, F2: Filter> Filter for Or<F1, F2>