pub enum IpNet {
V4 {
addr: Ipv4Addr,
prefix_len: u8,
},
V6 {
addr: Ipv6Addr,
prefix_len: u8,
},
}Expand description
An IP network in CIDR notation, or a single host address (/32 or /128).
IPv4-mapped IPv6 addresses are normalised to IPv4 at parse time so that
::ffff:10.0.0.0/8 and 10.0.0.0/8 behave identically.
Variants§
Implementations§
Source§impl IpNet
impl IpNet
Sourcepub fn parse(s: &str) -> Result<Self, FilterError>
pub fn parse(s: &str) -> Result<Self, FilterError>
Parse an address or CIDR prefix string.
§Errors
Returns FilterError::InvalidIp if the string cannot be parsed.
Trait Implementations§
impl Eq for IpNet
impl StructuralPartialEq for IpNet
Auto Trait Implementations§
impl Freeze 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§
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more