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]

[src]

Whether representing any address

[src]

Whether representing an IPv4 network

[src]

Whether representing an IPv6 network

impl AnyIpCidr
[src]

[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.

[src]

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

[src]

first address in the network as plain address

returns None for Any

[src]

first address in the network

returns None for Any

[src]

last address in the network as plain address

returns None for Any

[src]

last address in the network

returns None for Any

[src]

length in bits of the shared prefix of the contained addresses

returns None for Any

[src]

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

returns None for Any

[src]

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

returns None for Any

[src]

check whether an address is contained in the network

Trait Implementations

impl Clone for AnyIpCidr
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq for AnyIpCidr
[src]

[src]

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

[src]

This method tests for !=.

impl Eq for AnyIpCidr
[src]

impl PartialOrd for AnyIpCidr
[src]

[src]

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

[src]

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

[src]

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

[src]

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

[src]

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]

[src]

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

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl Hash for AnyIpCidr
[src]

[src]

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

1.3.0
[src]

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

impl Debug for AnyIpCidr
[src]

[src]

Formats the value using the given formatter.

impl Display for AnyIpCidr
[src]

[src]

Formats the value using the given formatter. Read more

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

impl FromStr for AnyIpCidr
[src]

The associated error which can be returned from parsing.

[src]

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

impl From<IpCidr> for AnyIpCidr
[src]

[src]

Performs the conversion.

impl From<Ipv4Cidr> for AnyIpCidr
[src]

[src]

Performs the conversion.

impl From<Ipv6Cidr> for AnyIpCidr
[src]

[src]

Performs the conversion.

impl BitString for AnyIpCidr
[src]

[src]

Get the ndxth bit. Read more

[src]

Set the ndxth bit to bit. Read more

[src]

Flips the ndxth bit. Read more

[src]

Current length of the bit string in bits.

[src]

Set current length to len. Read more

[src]

Append a bit. Read more

[src]

Create a new zero-length bit string. Read more

[src]

Length of the longest shared prefix of two bit strings.

[src]

Longest shared prefix of two bit strings.

[src]

Partial ordering on bit strings. Read more

[src]

Lexicographic ordering on bit strings. Read more

impl Serialize for AnyIpCidr
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for AnyIpCidr
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more