pub struct Ipv6Net(pub Ipv6Network);Expand description
An Ipv6Net represents a IPv6 subnetwork, including the address and network mask.
Tuple Fields
0: Ipv6NetworkImplementations
sourceimpl Ipv6Net
impl Ipv6Net
sourcepub const VPC_IPV6_PREFIX_LENGTH: u8
pub const VPC_IPV6_PREFIX_LENGTH: u8
The length for all VPC IPv6 prefixes
sourcepub const VPC_SUBNET_IPV6_PREFIX_LENGTH: u8
pub const VPC_SUBNET_IPV6_PREFIX_LENGTH: u8
The prefix length for all VPC Sunets
sourcepub fn is_unique_local(&self) -> bool
pub fn is_unique_local(&self) -> bool
Return true if this subnetwork is in the IPv6 Unique Local Address
range defined in RFC 4193, e.g., fd00:/8
sourcepub fn is_vpc_prefix(&self) -> bool
pub fn is_vpc_prefix(&self) -> bool
Return true if this subnetwork is a valid VPC prefix.
This checks that the subnet is a unique local address, and has the VPC prefix length required.
sourcepub fn is_vpc_subnet(&self, vpc_prefix: &Ipv6Net) -> bool
pub fn is_vpc_subnet(&self, vpc_prefix: &Ipv6Net) -> bool
Return true if this subnetwork is a valid VPC Subnet, given the VPC’s
prefix.
Methods from Deref<Target = Ipv6Network>
sourcepub fn iter(&self) -> Ipv6NetworkIterator
pub fn iter(&self) -> Ipv6NetworkIterator
Returns an iterator over Ipv6Network. Each call to next will return the next
Ipv6Addr in the given network. None will be returned when there are no more
addresses.
sourcepub fn network(&self) -> Ipv6Addr
pub fn network(&self) -> Ipv6Addr
Returns the address of the network denoted by this Ipv6Network.
This means the lowest possible IPv6 address inside of the network.
Examples
use std::net::Ipv6Addr;
use ipnetwork::Ipv6Network;
let net: Ipv6Network = "2001:db8::/96".parse().unwrap();
assert_eq!(net.network(), Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0));sourcepub fn broadcast(&self) -> Ipv6Addr
pub fn broadcast(&self) -> Ipv6Addr
Returns the broadcast address of this Ipv6Network.
This means the highest possible IPv4 address inside of the network.
Examples
use std::net::Ipv6Addr;
use ipnetwork::Ipv6Network;
let net: Ipv6Network = "2001:db8::/96".parse().unwrap();
assert_eq!(net.broadcast(), Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0xffff, 0xffff));pub fn ip(&self) -> Ipv6Addr
pub fn prefix(&self) -> u8
sourcepub fn mask(&self) -> Ipv6Addr
pub fn mask(&self) -> Ipv6Addr
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".parse().unwrap();
assert_eq!(net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff));
let net: Ipv6Network = "ff01::0/32".parse().unwrap();
assert_eq!(net.mask(), Ipv6Addr::new(0xffff, 0xffff, 0, 0, 0, 0, 0, 0));sourcepub fn contains(&self, ip: Ipv6Addr) -> bool
pub fn contains(&self, ip: Ipv6Addr) -> bool
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)));sourcepub fn size(&self) -> u128
pub fn size(&self) -> u128
Returns number of possible host addresses in this Ipv6Network.
Examples
use std::net::Ipv6Addr;
use ipnetwork::Ipv6Network;
let net: Ipv6Network = "ff01::0/32".parse().unwrap();
assert_eq!(net.size(), 79228162514264337593543950336);
let tinynet: Ipv6Network = "ff01::0/128".parse().unwrap();
assert_eq!(tinynet.size(), 1);Trait Implementations
sourceimpl Deref for Ipv6Net
impl Deref for Ipv6Net
type Target = Ipv6Network
type Target = Ipv6Network
The resulting type after dereferencing.
sourceimpl<'de> Deserialize<'de> for Ipv6Net
impl<'de> Deserialize<'de> for Ipv6Net
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl JsonSchema for Ipv6Net
impl JsonSchema for Ipv6Net
sourcefn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
sourcefn json_schema(_: &mut SchemaGenerator) -> Schema
fn json_schema(_: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
sourcefn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
impl Copy for Ipv6Net
impl StructuralPartialEq for Ipv6Net
Auto Trait Implementations
impl RefUnwindSafe for Ipv6Net
impl Send for Ipv6Net
impl Sync for Ipv6Net
impl Unpin for Ipv6Net
impl UnwindSafe for Ipv6Net
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more