[−][src]Enum netaddr2::NetAddr
A structure representing an IP network.
Internally using the built-in std::net::IpAddr structures, this is a
simple data structure that can be used in a variety of situations.
Variants
V4(Netv4Addr)An IPv4 network.
V6(Netv6Addr)An IPv6 network.
Methods
impl NetAddr[src]
pub fn mask(&self) -> IpAddr[src]
Get the "netmask" part of the inner Netv4Addr or the Netv6Addr.
pub fn addr(&self) -> IpAddr[src]
Get the "network" part of the inner Netv4Addr or the Netv6Addr.
pub fn is_cidr(&self) -> bool[src]
Return whether the inner Netv4Addr or Netv6Addr is CIDR.
A Netv4Addr or Netv6Addr is CIDR if and only if its underlying
netmask is "left contigous"; that is, if its bit pattern is a given
number of ones followed by a remaining group of zeroes.
Trait Implementations
impl Broadcast for NetAddr[src]
type Output = Option<IpAddr>
The type of the broadcast address
fn broadcast(&self) -> Self::Output[src]
impl Clone for NetAddr[src]
impl Contains<IpAddr> for NetAddr[src]
impl Contains<Ipv4Addr> for NetAddr[src]
impl Contains<Ipv6Addr> for NetAddr[src]
impl Contains<NetAddr> for NetAddr[src]
impl Contains<NetAddr> for Netv4Addr[src]
impl Contains<NetAddr> for Netv6Addr[src]
impl Contains<Netv4Addr> for NetAddr[src]
impl Contains<Netv6Addr> for NetAddr[src]
impl Copy for NetAddr[src]
impl Debug for NetAddr[src]
impl<'de> Deserialize<'de> for NetAddr[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>[src]
impl Display for NetAddr[src]
impl Eq for NetAddr[src]
impl From<IpAddr> for NetAddr[src]
impl From<Ipv4Addr> for NetAddr[src]
impl From<Ipv6Addr> for NetAddr[src]
impl From<Netv4Addr> for NetAddr[src]
impl From<Netv6Addr> for NetAddr[src]
impl FromStr for NetAddr[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(string: &str) -> Result<Self>[src]
impl Hash for NetAddr[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Merge for NetAddr[src]
type Output = Option<Self>
The type of the result of the merge
fn merge(&self, other: &Self) -> Self::Output[src]
impl Ord for NetAddr[src]
fn cmp(&self, other: &NetAddr) -> Ordering[src]
#[must_use]
fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<NetAddr> for NetAddr[src]
impl PartialOrd<NetAddr> for NetAddr[src]
fn partial_cmp(&self, other: &NetAddr) -> Option<Ordering>[src]
fn lt(&self, other: &NetAddr) -> bool[src]
fn le(&self, other: &NetAddr) -> bool[src]
fn gt(&self, other: &NetAddr) -> bool[src]
fn ge(&self, other: &NetAddr) -> bool[src]
impl Serialize for NetAddr[src]
impl StructuralEq for NetAddr[src]
impl StructuralPartialEq for NetAddr[src]
Auto Trait Implementations
impl RefUnwindSafe for NetAddr
impl Send for NetAddr
impl Sync for NetAddr
impl Unpin for NetAddr
impl UnwindSafe for NetAddr
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>, [src]
T: Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,