Enum cidr::IpCidr
[−]
[src]
pub enum IpCidr { V4(Ipv4Cidr), V6(Ipv6Cidr), }
Cidr
type representing either an IPv4 or an IPv6 network
Variants
V4(Ipv4Cidr)
IPv4 network
V6(Ipv6Cidr)
IPv6 network
Methods
impl IpCidr
[src]
fn is_ipv4(&self) -> bool
Whether representing an IPv4 network
fn is_ipv6(&self) -> bool
Whether representing an IPv6 network
Trait Implementations
impl Cidr for IpCidr
[src]
type Address = IpAddr
Type for the underlying address (IpAddr
, Ipv4Addr
or Ipv6Addr
). Read more
type Inet = IpInet
Corresponding Inet
type (representing an address + a network containing it) Read more
fn new(addr: Self::Address, len: u8) -> Result<Self, NetworkParseError>
Create new network from address and prefix length. If the network length exceeds the address length or the address is not the first address in the network ("host part not zero") an error is returned. Read more
fn new_host(addr: Self::Address) -> Self
Create a network containing a single address (network length = address length).
fn first_address(&self) -> Self::Address
first address in the network as plain address
fn first(&self) -> Self::Inet
first address in the network
fn last_address(&self) -> Self::Address
last address in the network as plain address
fn last(&self) -> Self::Inet
last address in the network
fn network_length(&self) -> u8
length in bits of the shared prefix of the contained addresses
fn family(&self) -> Family
IP family of the contained address (Ipv4
or Ipv6
).
fn mask(&self) -> Self::Address
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
check whether an address is contained in the network
fn iter(&self) -> InetIterator<Self::Inet>
Iterate over all addresses in the range. With IPv6 addresses this can produce really long iterations (up to 2128 addresses). Read more
impl Display for IpCidr
[src]
impl FromStr for IpCidr
[src]
type Err = NetworkParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<IpCidr, NetworkParseError>
Parses a string s
to return a value of this type. Read more
impl From<Ipv4Cidr> for IpCidr
[src]
impl From<Ipv6Cidr> for IpCidr
[src]
impl Clone for IpCidr
[src]
fn clone(&self) -> IpCidr
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl PartialEq for IpCidr
[src]
fn eq(&self, __arg_0: &IpCidr) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &IpCidr) -> bool
This method tests for !=
.
impl Eq for IpCidr
[src]
impl PartialOrd for IpCidr
[src]
fn partial_cmp(&self, __arg_0: &IpCidr) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &IpCidr) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &IpCidr) -> bool
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: &IpCidr) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &IpCidr) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for IpCidr
[src]
fn cmp(&self, __arg_0: &IpCidr) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl Hash for IpCidr
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more