[−][src]Struct netaddr2::Netv6Addr
A structure representing an IPv6 network.
Internally, this structure includes two values; an Ipv6Addr
representing the network address (addr
), and another
representing the netmask (mask
).
Methods
impl Netv6Addr
[src]
pub const fn mask(&self) -> &Ipv6Addr
[src]
pub const fn addr(&self) -> &Ipv6Addr
[src]
pub fn new(addr: Ipv6Addr, mask: Ipv6Addr) -> Self
[src]
Create a new Netv6Addr
from the given addr
and mask
.
Masks the given addr
value with the given mask
before
the structure containing both is returned.
Examples
let network = Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0x42); let netmask = Ipv6Addr::new(0xff00, 0, 0, 0, 0, 0, 0, 0); let netaddr = Netv6Addr::new(network, netmask);
Trait Implementations
impl Clone for Netv6Addr
[src]
impl Contains for Netv6Addr
[src]
impl Copy for Netv6Addr
[src]
impl Debug for Netv6Addr
[src]
impl<'de> Deserialize<'de> for Netv6Addr
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl Display for Netv6Addr
[src]
impl Eq for Netv6Addr
[src]
impl From<Ipv6Addr> for Netv6Addr
[src]
impl From<Netv6Addr> for NetAddr
[src]
impl FromStr for Netv6Addr
[src]
type Err = Error
The associated error which can be returned from parsing.
fn from_str(string: &str) -> Result<Self>
[src]
Parse a Netv6Addr
from a string
Often used implicitly, this implementation allows for a few formats to be given:
- (Standard) CIDR format:
2001:db8:dead:beef::1/64
- Extended format:
2001:db8:dead:beef::1 ffff:ffff:ffff:ffff::
- Extended format (with a
/
delimiter):2001:db8:dead:beef::1/ffff:ffff:ffff:ffff::
Examples
let parsed: Netv6Addr = "2001:db8:dead:beef::1/32".parse().unwrap(); let addr: std::net::Ipv6Addr = "2001:db8::0".parse().unwrap(); let mask: std::net::Ipv6Addr = "ffff:ffff::0".parse().unwrap(); assert_eq!(parsed, Netv6Addr::new(addr, mask))
let parsed: Netv6Addr = "2001:db8:dead:beef::1 ffff:ffff::".parse().unwrap(); let addr: std::net::Ipv6Addr = "2001:db8::0".parse().unwrap(); let mask: std::net::Ipv6Addr = "ffff:ffff::0".parse().unwrap(); assert_eq!(parsed, Netv6Addr::new(addr, mask))
let parsed: Netv6Addr = "2001:db8:dead:beef::1/ffff:ffff::".parse().unwrap(); let addr: std::net::Ipv6Addr = "2001:db8::0".parse().unwrap(); let mask: std::net::Ipv6Addr = "ffff:ffff::0".parse().unwrap(); assert_eq!(parsed, Netv6Addr::new(addr, mask))
impl Hash for Netv6Addr
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Merge for Netv6Addr
[src]
impl Ord for Netv6Addr
[src]
fn cmp(&self, other: &Netv6Addr) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Netv6Addr> for Netv6Addr
[src]
impl PartialOrd<Netv6Addr> for Netv6Addr
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Netv6Addr
[src]
impl StructuralEq for Netv6Addr
[src]
impl StructuralPartialEq for Netv6Addr
[src]
Auto Trait Implementations
impl RefUnwindSafe for Netv6Addr
impl Send for Netv6Addr
impl Sync for Netv6Addr
impl Unpin for Netv6Addr
impl UnwindSafe for Netv6Addr
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,