Struct ipnetwork::Ipv6Network [] [src]

pub struct Ipv6Network { /* fields omitted */ }

Methods

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

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));Run

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)));Run

Trait Implementations

impl Debug for Ipv6Network
[src]

Formats the value using the given formatter.

impl Clone for Ipv6Network
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for Ipv6Network
[src]

impl Hash for Ipv6Network
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

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

impl FromStr for Ipv6Network
[src]

The associated error which can be returned from parsing.

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

impl Display for Ipv6Network
[src]

Formats the value using the given formatter.