pub trait IpPrefixCovering<P> {
    // Provided method
    fn covers(&self, other: &P) -> bool { ... }
}
Expand description

A trait to check the prefix coverage

Provided Methods§

source

fn covers(&self, other: &P) -> bool

Checks the coverage of this prefix against a set of addresses

Difference with PartialEq

Two prefixes could be different but equivalent regarding to the range of addresses they cover.

use ipnet::Ipv4Net;
let a = "1.1.1.1/16".parse::<Ipv4Net>().unwrap();
let b = "1.1.2.2/16".parse::<Ipv4Net>().unwrap();
assert!( a != b ); // host addr are different
assert! (a.covers(&b) && b.covers(&a)); // but prefixes are equivalent

Implementations on Foreign Types§

source§

impl IpPrefixCovering<Ipv6Prefix> for Ipv6Net

source§

impl IpPrefixCovering<Ipv6Prefix56> for Ipv6Net

source§

impl IpPrefixCovering<Ipv4Prefix> for Ipv4Net

source§

impl IpPrefixCovering<Ipv4Addr> for Ipv4Net

source§

impl IpPrefixCovering<Ipv6Prefix120> for Ipv6Net

source§

impl IpPrefixCovering<Ipv6Addr> for Ipv6Net

Implementors§