pub enum IpNet {
V4 {
network: u32,
mask: u32,
prefix_len: u8,
},
V6 {
network: u128,
mask: u128,
prefix_len: u8,
},
}Expand description
Canonicalized IPv4 or IPv6 CIDR network block.
Variants§
V4
IPv4 network represented as (masked_network, bitmask, prefix_len).
Fields
V6
IPv6 network represented as (masked_network, bitmask, prefix_len).
Implementations§
Source§impl IpNet
Inherent constructors and membership checks for IpNet.
impl IpNet
Inherent constructors and membership checks for IpNet.
Sourcepub fn parse(spec: &str) -> Result<Self, IpFilterError>
pub fn parse(spec: &str) -> Result<Self, IpFilterError>
Parses a single IP address or CIDR specification (for example "10.0.0.0/8", "192.168.1.5", "::ffff:10.0.0.0/104").
IPv4-mapped IPv6 addresses and subnets (>= /96 inside ::ffff:0:0/96) are canonicalized to IPv4.
§Arguments
&str- IP or CIDR string.
§Returns
Result<Self, IpFilterError>- Canonicalized CIDR block or parse error.
Trait Implementations§
impl Copy for IpNet
impl Eq for IpNet
impl StructuralPartialEq for IpNet
Auto Trait Implementations§
impl Forget for IpNet
impl Freeze for IpNet
impl Move for IpNet
impl RefUnwindSafe for IpNet
impl Send for IpNet
impl Sync for IpNet
impl Unpin for IpNet
impl UnsafeUnpin for IpNet
impl UnwindSafe for IpNet
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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> 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§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.