pub struct Ipv4Cidr { /* private fields */ }
Expand description
A specification of an IPv4 CIDR block, containing an address and a variable-length subnet masking prefix length.
Implementations§
§impl Cidr
impl Cidr
pub const fn new(address: Address, prefix_len: u8) -> Cidr
pub const fn new(address: Address, prefix_len: u8) -> Cidr
Create an IPv4 CIDR block from the given address and prefix length.
Panics
This function panics if the prefix length is larger than 32.
pub fn from_netmask(addr: Address, netmask: Address) -> Result<Cidr, Error>
pub fn from_netmask(addr: Address, netmask: Address) -> Result<Cidr, Error>
Create an IPv4 CIDR block from the given address and network mask.
pub const fn prefix_len(&self) -> u8
pub const fn prefix_len(&self) -> u8
Return the prefix length of this IPv4 CIDR block.
pub fn contains_addr(&self, addr: &Address) -> bool
pub fn contains_addr(&self, addr: &Address) -> bool
Query whether the subnetwork described by this IPv4 CIDR block contains the given address.
pub fn contains_subnet(&self, subnet: &Cidr) -> bool
pub fn contains_subnet(&self, subnet: &Cidr) -> bool
Query whether the subnetwork described by this IPv4 CIDR block contains the subnetwork described by the given IPv4 CIDR block.
Trait Implementations§
§impl Ord for Cidr
impl Ord for Cidr
§impl PartialOrd<Cidr> for Cidr
impl PartialOrd<Cidr> for Cidr
§fn partial_cmp(&self, other: &Cidr) -> Option<Ordering>
fn partial_cmp(&self, other: &Cidr) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Cidr
impl Eq for Cidr
impl StructuralEq for Cidr
impl StructuralPartialEq for Cidr
Auto Trait Implementations§
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