pub struct SubNet { /* private fields */ }Expand description
Implementations§
Source§impl SubNet
impl SubNet
Sourcepub fn new_from_net_addr(addr: &NetAddr, mask: Option<u8>) -> Self
pub fn new_from_net_addr(addr: &NetAddr, mask: Option<u8>) -> Self
| Construct from a given network start | and number of bits (CIDR mask). | | ———– | @param[in] addr | | Network start. Must be IPv4 or IPv6,
| otherwise an invalid subnet is created. |
|---|
| @param[in] mask |
| | CIDR mask, must be in [0, 32] for IPv4 | addresses and in [0, 128] for | | IPv6 addresses. Otherwise an invalid | subnet is created. |
Sourcepub fn new_from_net_addr_and_mask(addr: &NetAddr, mask: &NetAddr) -> Self
pub fn new_from_net_addr_and_mask(addr: &NetAddr, mask: &NetAddr) -> Self
| Construct from a given network start | and mask. | | ———– | @param[in] addr | | Network start. Must be IPv4 or IPv6,
| otherwise an invalid subnet is created. |
|---|
| @param[in] mask |
|
| Network mask, must be of the same type
| as addr and not contain 0-bits followed
| by 1-bits. Otherwise an invalid subnet
| is created.
|
Sourcepub fn match_(&self, addr: &NetAddr) -> bool
pub fn match_(&self, addr: &NetAddr) -> bool
| @return | | True if this subnet is valid, the specified | address is valid, and the specified | address belongs in this subnet. |
pub fn to_string(&self) -> String
pub fn is_valid(&self) -> bool
pub fn sanity_check(&self) -> bool
Trait Implementations§
Source§impl Ord for SubNet
impl Ord for SubNet
Source§impl PartialOrd for SubNet
impl PartialOrd for SubNet
impl Eq for SubNet
Auto Trait Implementations§
impl Freeze for SubNet
impl RefUnwindSafe for SubNet
impl Send for SubNet
impl Sync for SubNet
impl Unpin for SubNet
impl UnwindSafe for SubNet
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
Source§impl<T> CallHasher for T
impl<T> CallHasher for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.