Enum cidr::IpInet
[−]
[src]
pub enum IpInet { V4(Ipv4Inet), V6(Ipv6Inet), }
Inet
type representing either an IPv4 or an IPv6 host within a
network
Variants
V4(Ipv4Inet)
IPv4 host within network
V6(Ipv6Inet)
IPv6 host within network
Methods
impl IpInet
[src]
fn is_ipv4(&self) -> bool
[src]
Whether representing an IPv4 network
fn is_ipv6(&self) -> bool
[src]
Whether representing an IPv6 network
Trait Implementations
impl Inet for IpInet
[src]
type Address = IpAddr
Type for the underlying address (IpAddr
, Ipv4Addr
or Ipv6Addr
). Read more
type Cidr = IpCidr
Corresponding Cidr
type (representing only the network)
fn new(addr: Self::Address, len: u8) -> Result<Self, NetworkLengthTooLongError>
[src]
Create new host within a network from address and prefix length. If the network length exceeds the address length an error is returned. Read more
fn new_host(addr: Self::Address) -> Self
[src]
Create a network containing a single address as host and the network (network length = address length). Read more
fn next(&mut self) -> bool
[src]
increments host part (without changing the network part); returns true on wrap around Read more
fn network(&self) -> Self::Cidr
[src]
network (i.e. drops the host information)
fn address(&self) -> Self::Address
[src]
the host
fn first_address(&self) -> Self::Address
[src]
first address in the network as plain address
fn first(&self) -> Self
[src]
first address in the network
fn last_address(&self) -> Self::Address
[src]
last address in the network as plain address
fn last(&self) -> Self
[src]
last address in the network
fn network_length(&self) -> u8
[src]
length in bits of the shared prefix of the contained addresses
fn family(&self) -> Family
[src]
IP family of the contained address (Ipv4
or Ipv6
).
fn mask(&self) -> Self::Address
[src]
network mask: an pseudo address which has the first network length
bits set to 1 and the remaining to 0. Read more
fn contains(&self, addr: &Self::Address) -> bool
[src]
check whether an address is contained in the network
impl Display for IpInet
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl FromStr for IpInet
[src]
type Err = NetworkParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<IpInet, NetworkParseError>
[src]
Parses a string s
to return a value of this type. Read more
impl From<Ipv4Inet> for IpInet
[src]
impl From<Ipv6Inet> for IpInet
[src]
impl Serialize for IpInet
[src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
[src]
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for IpInet
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Clone for IpInet
[src]
fn clone(&self) -> IpInet
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for IpInet
[src]
fn eq(&self, __arg_0: &IpInet) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &IpInet) -> bool
[src]
This method tests for !=
.
impl Eq for IpInet
[src]
impl PartialOrd for IpInet
[src]
fn partial_cmp(&self, __arg_0: &IpInet) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &IpInet) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &IpInet) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &IpInet) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &IpInet) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for IpInet
[src]
fn cmp(&self, __arg_0: &IpInet) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl Hash for IpInet
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more