fn apply_ip_mask(ip: IpAddr, mask: &[u8], invert: bool, set: bool) -> IpAddr {
    debug_assert!(mask.len() == 16);
    let mut bytes: [u8; 16] = match ip {
        IpAddr::V4(ip) => ip.to_ipv6_compatible().octets(),
        IpAddr::V6(ip) => ip.octets(),
    };
    apply_ip_mask_bytes(&mut bytes, mask, invert, set);
    let masked_ip = Ipv6Addr::from(bytes);
    match ip.is_ipv4() {
        false => IpAddr::V6(masked_ip),
        true => {
            let bytes = masked_ip.octets();
            IpAddr::V4(Ipv4Addr::new(bytes[12], bytes[13], bytes[14], bytes[15]))
        }
    }
}
/// Apply the given mask to the given IP address. See IpNet::apply_mask for
/// details on behavior.
Apply the given mask to the given IP address.
Apply the given mask to the given IP address .
fn apply_ip_mask(ip: IpAddr, mask: &[u8], invert: bool, set: bool) -> IpAddr {
    debug_assert!(mask.len() == 16);
    let mut bytes: [u8; 16] = match ip {
        IpAddr::V4(ip) => ip.to_ipv6_compatible().octets(),
        IpAddr::V6(ip) => ip.octets(),
    };
    apply_ip_mask_bytes(&mut bytes, mask, invert, set);
    let masked_ip = Ipv6Addr::from(bytes);
    match ip.is_ipv4() {
        false => IpAddr::V6(masked_ip),
        true => {
            let bytes = masked_ip.octets();
            IpAddr::V4(Ipv4Addr::new(bytes[12], bytes[13], bytes[14], bytes[15]))
        }
    }
}
fn apply_ip_mask ( ip : IpAddr , mask : & [ u8 ] , invert : bool , set : bool ) -> IpAddr { debug_assert ! ( mask len ( ) 16 ) ; let mut bytes : [ u8 ; 16 ] = match ip { IpAddr :: V4 ( ip ) => ip . to_ipv6_compatible ( ) . octets ( ) , IpAddr :: V6 ( ip ) => ip . octets ( ) , } ; apply_ip_mask_bytes ( & mut bytes , mask , invert , set ) ; let masked_ip = Ipv6Addr :: from ( bytes ) ; match ip . is_ipv4 ( ) { false => IpAddr :: V6 ( masked_ip ) , true => { let bytes = masked_ip . octets ( ) ; IpAddr :: V4 ( Ipv4Addr :: new ( bytes [ 12 ] , bytes [ 13 ] , bytes [ 14 ] , bytes [ 15 ] ) ) } } }
Apply the given mask to the given IP address.
Apply the given mask to the given IP address .
ip
IpAddr
mask
&[u8]
invert
bool
set
bool
ip
IpAddr
mask
&[u8]
invert
bool
set
bool