Enum cidr::AnyIpCidr [] [src]

pub enum AnyIpCidr {
    Any,
    V4(Ipv4Cidr),
    V6(Ipv6Cidr),
}

Represents either an IPv4 or an IPv6 network or "any".

Allows for a bit string representation which treats "any" as the empty string, IPv4 as starting with false and IPv6 as starting with true. After the first bit the normal represenation for the picked address-family follows.

Setting the first bit always truncates the bit string to length 1.

The Cidr trait itself cannot be implemented because Any has no address family, but there is a very similar interface implemented directly.

Variants

"any" network containing all IPv4 and IPv6 addresses

IPv4 network

IPv6 network

Methods

impl AnyIpCidr
[src]

Whether representing any address

Whether representing an IPv4 network

Whether representing an IPv6 network

impl AnyIpCidr
[src]

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.

Create a network containing a single address (network length = address length).

first address in the network as plain address

returns None for Any

first address in the network

returns None for Any

last address in the network as plain address

returns None for Any

last address in the network

returns None for Any

length in bits of the shared prefix of the contained addresses

returns None for Any

IP family of the contained address (Ipv4 or Ipv6).

returns None for Any

network mask: an pseudo address which has the first network length bits set to 1 and the remaining to 0.

returns None for Any

check whether an address is contained in the network

Trait Implementations

impl Clone for AnyIpCidr
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for AnyIpCidr
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for AnyIpCidr
[src]

impl PartialOrd for AnyIpCidr
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for AnyIpCidr
[src]

This method returns an Ordering between self and other. Read more

impl Hash for AnyIpCidr
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Debug for AnyIpCidr
[src]

Formats the value using the given formatter.

impl Display for AnyIpCidr
[src]

Formats the value using the given formatter. Read more

impl Into<Option<IpCidr>> for AnyIpCidr
[src]

Performs the conversion.

impl From<Option<IpCidr>> for AnyIpCidr
[src]

Performs the conversion.

impl FromStr for AnyIpCidr
[src]

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

impl From<IpCidr> for AnyIpCidr
[src]

Performs the conversion.

impl From<Ipv4Cidr> for AnyIpCidr
[src]

Performs the conversion.

impl From<Ipv6Cidr> for AnyIpCidr
[src]

Performs the conversion.

impl BitString for AnyIpCidr
[src]

Get the ndxth bit. Read more

Set the ndxth bit to bit. Read more

Flips the ndxth bit. Read more

Current length of the bit string in bits.

Set current length to len. Read more

Append a bit. Read more

Create a new zero-length bit string. Read more

Length of the longest shared prefix of two bit strings.

Longest shared prefix of two bit strings.

Partial ordering on bit strings. Read more

Lexicographic ordering on bit strings. Read more