Enum default_net::ip::IpNet
source · pub enum IpNet {
V4(Ipv4Net),
V6(Ipv6Net),
}
Expand description
Structure of IP Network
Variants§
Implementations§
source§impl IpNet
impl IpNet
sourcepub fn new(ip: IpAddr, prefix_len: u8) -> IpNet
pub fn new(ip: IpAddr, prefix_len: u8) -> IpNet
Construct a new IpNet instance from IP Address and Prefix Length
sourcepub fn new_with_netmask(ip: IpAddr, netmask: IpAddr) -> IpNet
pub fn new_with_netmask(ip: IpAddr, netmask: IpAddr) -> IpNet
Construct a new IpNet instance from IP Address and Network Mask
sourcepub fn prefix_len(&self) -> u8
pub fn prefix_len(&self) -> u8
Returns the prefix length.
sourcepub fn max_prefix_len(&self) -> u8
pub fn max_prefix_len(&self) -> u8
Returns the maximum valid prefix length.
Trait Implementations§
source§impl Ord for IpNet
impl Ord for IpNet
source§impl PartialEq for IpNet
impl PartialEq for IpNet
source§impl PartialOrd for IpNet
impl PartialOrd for IpNet
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 IpNet
impl Eq for IpNet
impl StructuralPartialEq for IpNet
Auto Trait Implementations§
impl RefUnwindSafe for IpNet
impl Send for IpNet
impl Sync for IpNet
impl Unpin for IpNet
impl UnwindSafe for IpNet
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