Enum ipnet::IpNet [] [src]

pub enum IpNet {
    V4(Ipv4Net),
    V6(Ipv6Net),
}

An IP network address, either IPv4 or IPv6.

This enum can contain either an Ipv4Net or an Ipv6Net, see their respective documentation for more details.

Examples

use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use ipnet::{IpNet, Ipv4Net, Ipv6Net};
use std::str::FromStr;

let net_v4 = IpNet::from_str("10.1.1.0/24").unwrap();
let net_v6 = IpNet::from_str("fd00::/32").unwrap();
 
assert_eq!("10.1.1.0".parse(), Ok(net_v4.network()));
assert_eq!("fd00::".parse(), Ok(net_v6.network()));

Variants

Methods

impl IpNet
[src]

impl IpNet
[src]

Trait Implementations

impl Copy for IpNet
[src]

impl Clone for IpNet
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for IpNet
[src]

impl PartialEq for IpNet
[src]

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

This method tests for !=.

impl Debug for IpNet
[src]

Formats the value using the given formatter.

impl Hash for IpNet
[src]

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

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

impl PartialOrd for IpNet
[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 IpNet
[src]

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

🔬 This is a nightly-only experimental API. (ord_max_min)

Compares and returns the maximum of two values. Read more

🔬 This is a nightly-only experimental API. (ord_max_min)

Compares and returns the minimum of two values. Read more

impl Display for IpNet
[src]

Formats the value using the given formatter. Read more

impl FromStr for IpNet
[src]

The associated error which can be returned from parsing.

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