pub trait IpBitOr<RHS = Self> {
    type Output;
    fn bitor(self, rhs: RHS) -> Self::Output;
}
Expand description

Provides a bitor() method for Ipv4Addr and Ipv6Addr.

Examples

use std::net::{Ipv4Addr, Ipv6Addr};
use ipnet::IpBitOr;

let ip: Ipv4Addr = "10.1.1.1".parse().unwrap();
let mask: Ipv4Addr = "0.0.0.255".parse().unwrap();
let res: Ipv4Addr = "10.1.1.255".parse().unwrap();

assert_eq!(ip.bitor(mask), res);
assert_eq!(ip.bitor(0x000000ff), res);
 
let ip: Ipv6Addr = "fd00::1".parse().unwrap();
let mask: Ipv6Addr = "::ffff:ffff".parse().unwrap();
let res: Ipv6Addr = "fd00::ffff:ffff".parse().unwrap();

assert_eq!(ip.bitor(mask), res);
assert_eq!(ip.bitor(u128::from(0xffffffffu32)), res);

Associated Types

Required methods

Implementations on Foreign Types

Implementors