pub enum IpCidr {
Ipv4(Ipv4Cidr),
Ipv6(Ipv6Cidr),
}
Expand description
A specification of a CIDR block, containing an address and a variable-length subnet masking prefix length.
Variants§
Implementations§
Source§impl Cidr
impl Cidr
Sourcepub fn new(addr: Address, prefix_len: u8) -> Cidr
pub fn new(addr: Address, prefix_len: u8) -> Cidr
Create a CIDR block from the given address and prefix length.
§Panics
This function panics if the given prefix length is invalid for the given address.
Sourcepub const fn prefix_len(&self) -> u8
pub const fn prefix_len(&self) -> u8
Return the prefix length of this CIDR block.
Sourcepub fn contains_addr(&self, addr: &Address) -> bool
pub fn contains_addr(&self, addr: &Address) -> bool
Query whether the subnetwork described by this CIDR block contains the given address.
Sourcepub fn contains_subnet(&self, subnet: &Cidr) -> bool
pub fn contains_subnet(&self, subnet: &Cidr) -> bool
Query whether the subnetwork described by this CIDR block contains the subnetwork described by the given CIDR block.
Trait Implementations§
Source§impl Ord for Cidr
impl Ord for Cidr
Source§impl PartialOrd for Cidr
impl PartialOrd for Cidr
impl Copy for Cidr
impl Eq for Cidr
impl StructuralPartialEq for Cidr
Auto Trait Implementations§
impl Freeze for Cidr
impl RefUnwindSafe for Cidr
impl Send for Cidr
impl Sync for Cidr
impl Unpin for Cidr
impl UnwindSafe for Cidr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more