Struct ipnetwork::Ipv6Network [] [src]

pub struct Ipv6Network { /* fields omitted */ }

Represents a network range where the IP addresses are of v6

Methods

impl Ipv6Network
[src]

[src]

Constructs a new Ipv6Network from any Ipv6Addr and a prefix denoting the network size. If the prefix is larger than 128 this will return an IpNetworkError::InvalidPrefix.

[src]

[src]

[src]

Returns the mask for this Ipv6Network. That means the prefix most significant bits will be 1 and the rest 0

Examples

use std::net::Ipv6Addr;
use ipnetwork::Ipv6Network;

let net: Ipv6Network = "ff01::0/32".parse().unwrap();
assert_eq!(net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0, 0, 0, 0, 0, 0));

[src]

Checks if a given Ipv6Addr is in this Ipv6Network

Examples

use std::net::Ipv6Addr;
use ipnetwork::Ipv6Network;

let net: Ipv6Network = "ff01::0/32".parse().unwrap();
assert!(net.contains(Ipv6Addr::new(0xff01, 0, 0, 0, 0, 0, 0, 0x1)));
assert!(!net.contains(Ipv6Addr::new(0xffff, 0, 0, 0, 0, 0, 0, 0x1)));

Trait Implementations

impl Debug for Ipv6Network
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Ipv6Network
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Ipv6Network
[src]

impl Hash for Ipv6Network
[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 PartialEq for Ipv6Network
[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 Ipv6Network
[src]

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

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl FromStr for Ipv6Network
[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<Ipv6Addr> for Ipv6Network
[src]

[src]

Performs the conversion.

impl Display for Ipv6Network
[src]

[src]

Formats the value using the given formatter. Read more

impl From<Ipv6Network> for IpNetwork
[src]

[src]

Performs the conversion.

Auto Trait Implementations

impl Send for Ipv6Network

impl Sync for Ipv6Network