Struct ip_network::Ipv6Network [] [src]

pub struct Ipv6Network { /* fields omitted */ }

IPv6 Network

Methods

impl Ipv6Network
[src]

[src]

[src]

[src]

Returns network IP address (first address in range).

Examples

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

let ip = Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0);
let ip_network = Ipv6Network::from(ip, 32).unwrap();
assert_eq!(ip_network.get_network_address(), ip);

[src]

Returns network mask.

Examples

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

let ip = Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0);
let ip_network = Ipv6Network::from(ip, 32).unwrap();
assert_eq!(ip_network.get_netmask(), 32);

[src]

Returns true if given IP address is inside this network.

Examples

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

let ip_network = Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 64).unwrap();
assert!(ip_network.contains(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1)));
assert!(!ip_network.contains(Ipv6Addr::new(0x2001, 0xdb9, 0, 0, 0, 0, 0, 0)));

[src]

Returns network with smaller netmask by one.

Examples

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

let network = Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 32).unwrap();
assert_eq!(network.supernet(), Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 31).unwrap());

[src]

Returns Ipv6NetworkIterator over networks with netmask bigger one.

Examples

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

let network = Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 32).unwrap();
let mut iterator = network.subnets();
assert_eq!(iterator.next().unwrap(), Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 33).unwrap());
assert_eq!(iterator.last().unwrap(), Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0x8000, 0, 0, 0, 0, 0), 33).unwrap());

[src]

Returns Ipv6NetworkIterator over networks with defined netmask.

Examples

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

let network = Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 32).unwrap();
let mut iterator = network.subnets_with_prefix(33);
assert_eq!(iterator.next().unwrap(), Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0), 33).unwrap());
assert_eq!(iterator.last().unwrap(), Ipv6Network::from(Ipv6Addr::new(0x2001, 0xdb8, 0x8000, 0, 0, 0, 0, 0), 33).unwrap());

Trait Implementations

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

[src]

Formats the value using the given formatter.

impl Eq for Ipv6Network
[src]

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 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 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.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 Display for Ipv6Network
[src]

[src]

Formats the value using the given formatter. 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