Struct ipaddr::Ipv6Mask [−][src]
pub struct Ipv6Mask(_);
Methods
impl Ipv6Mask
[src]
impl Ipv6Mask
pub fn prefixlen(&self) -> u32
[src]
pub fn prefixlen(&self) -> u32
Return the prefix length that correspond to this mask.
let mask = Ipv6Mask::from_str("ffff:ffff:ffff:ffff::").unwrap(); assert_eq!(mask.prefixlen(), 64);
pub fn from_prefixlen(prefixlen: u8) -> Result<Self, InvalidMask>
[src]
pub fn from_prefixlen(prefixlen: u8) -> Result<Self, InvalidMask>
Create an Ipv6Mask
corresponding to the given prefix length
let mask = Ipv6Mask::from_prefixlen(64).unwrap(); assert_eq!(u128::from(mask), 0xffff_ffff_ffff_ffff_0000_0000_0000_0000);
pub fn formatter<'a, W: Write>(&self, writer: &'a mut W) -> Ipv6Formatter<'a, W>
[src]
pub fn formatter<'a, W: Write>(&self, writer: &'a mut W) -> Ipv6Formatter<'a, W>
Create a formatter to stringify this IPv6 mask.
See Ipv6Formatter<'a, W>
for more details.
pub fn to_string(&self) -> String
[src]
pub fn to_string(&self) -> String
Return a string representation of this IPv6 address. There are several ways to represent an IPv6 address. This method uses the convention documented in RFC5952:
- lower case
- the longest sequence of zeros is replaced by
::
- no leading zero (
fe80::123
instead offe80::0123
)
For other formatting options, use formatter()
.
let mask = Ipv6Mask::from_prefixlen(64).unwrap(); assert_eq!(mask.to_string(), "ffff:ffff:ffff:ffff::"); // the same representation is used in the Display implementation assert_eq!(format!("{}", mask), "ffff:ffff:ffff:ffff::");
Trait Implementations
impl From<Ipv6Mask> for Ipv6Address
[src]
impl From<Ipv6Mask> for Ipv6Address
impl<'a> From<&'a Ipv6Mask> for Ipv6Address
[src]
impl<'a> From<&'a Ipv6Mask> for Ipv6Address
impl Copy for Ipv6Mask
[src]
impl Copy for Ipv6Mask
impl Clone for Ipv6Mask
[src]
impl Clone for Ipv6Mask
fn clone(&self) -> Ipv6Mask
[src]
fn clone(&self) -> Ipv6Mask
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl PartialEq for Ipv6Mask
[src]
impl PartialEq for Ipv6Mask
fn eq(&self, other: &Ipv6Mask) -> bool
[src]
fn eq(&self, other: &Ipv6Mask) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Ipv6Mask) -> bool
[src]
fn ne(&self, other: &Ipv6Mask) -> bool
This method tests for !=
.
impl Eq for Ipv6Mask
[src]
impl Eq for Ipv6Mask
impl Hash for Ipv6Mask
[src]
impl Hash for Ipv6Mask
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Display for Ipv6Mask
[src]
impl Display for Ipv6Mask
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Debug for Ipv6Mask
[src]
impl Debug for Ipv6Mask
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl AsRef<u128> for Ipv6Mask
[src]
impl AsRef<u128> for Ipv6Mask
impl From<Ipv6Mask> for u128
[src]
impl From<Ipv6Mask> for u128
impl<'a> From<&'a Ipv6Mask> for u128
[src]
impl<'a> From<&'a Ipv6Mask> for u128
impl TryFrom<u128> for Ipv6Mask
[src]
impl TryFrom<u128> for Ipv6Mask
type Error = InvalidMask
try_from
)The type returned in the event of a conversion error.
fn try_from(value: u128) -> Result<Ipv6Mask, Self::Error>
[src]
fn try_from(value: u128) -> Result<Ipv6Mask, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<&'a u128> for Ipv6Mask
[src]
impl<'a> TryFrom<&'a u128> for Ipv6Mask
type Error = InvalidMask
try_from
)The type returned in the event of a conversion error.
fn try_from(value: &'a u128) -> Result<Ipv6Mask, Self::Error>
[src]
fn try_from(value: &'a u128) -> Result<Ipv6Mask, Self::Error>
try_from
)Performs the conversion.
impl TryFrom<Ipv6Address> for Ipv6Mask
[src]
impl TryFrom<Ipv6Address> for Ipv6Mask
type Error = InvalidMask
try_from
)The type returned in the event of a conversion error.
fn try_from(value: Ipv6Address) -> Result<Ipv6Mask, Self::Error>
[src]
fn try_from(value: Ipv6Address) -> Result<Ipv6Mask, Self::Error>
try_from
)Performs the conversion.
impl<'a> TryFrom<&'a Ipv6Address> for Ipv6Mask
[src]
impl<'a> TryFrom<&'a Ipv6Address> for Ipv6Mask
type Error = InvalidMask
try_from
)The type returned in the event of a conversion error.
fn try_from(value: &'a Ipv6Address) -> Result<Ipv6Mask, Self::Error>
[src]
fn try_from(value: &'a Ipv6Address) -> Result<Ipv6Mask, Self::Error>
try_from
)Performs the conversion.
impl Not for Ipv6Mask
[src]
impl Not for Ipv6Mask
type Output = Ipv6Address
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
fn not(self) -> Self::Output
Performs the unary !
operation.
impl<'a> Not for &'a Ipv6Mask
[src]
impl<'a> Not for &'a Ipv6Mask
type Output = Ipv6Address
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
fn not(self) -> Self::Output
Performs the unary !
operation.
impl LowerHex for Ipv6Mask
[src]
impl LowerHex for Ipv6Mask
impl UpperHex for Ipv6Mask
[src]
impl UpperHex for Ipv6Mask
impl Binary for Ipv6Mask
[src]
impl Binary for Ipv6Mask
impl BitAnd<Ipv6Mask> for Ipv6Address
[src]
impl BitAnd<Ipv6Mask> for Ipv6Address
type Output = Ipv6Address
The resulting type after applying the &
operator.
fn bitand(self, rhs: Ipv6Mask) -> Self::Output
[src]
fn bitand(self, rhs: Ipv6Mask) -> Self::Output
Performs the &
operation.
impl<'a> BitAnd<Ipv6Mask> for &'a Ipv6Address
[src]
impl<'a> BitAnd<Ipv6Mask> for &'a Ipv6Address
type Output = Ipv6Address
The resulting type after applying the &
operator.
fn bitand(self, rhs: Ipv6Mask) -> Self::Output
[src]
fn bitand(self, rhs: Ipv6Mask) -> Self::Output
Performs the &
operation.
impl<'a> BitAnd<&'a Ipv6Mask> for Ipv6Address
[src]
impl<'a> BitAnd<&'a Ipv6Mask> for Ipv6Address
type Output = Ipv6Address
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'a Ipv6Mask) -> Self::Output
[src]
fn bitand(self, rhs: &'a Ipv6Mask) -> Self::Output
Performs the &
operation.
impl<'a, 'b> BitAnd<&'a Ipv6Mask> for &'b Ipv6Address
[src]
impl<'a, 'b> BitAnd<&'a Ipv6Mask> for &'b Ipv6Address
type Output = Ipv6Address
The resulting type after applying the &
operator.
fn bitand(self, rhs: &'a Ipv6Mask) -> Self::Output
[src]
fn bitand(self, rhs: &'a Ipv6Mask) -> Self::Output
Performs the &
operation.
impl FromStr for Ipv6Mask
[src]
impl FromStr for Ipv6Mask