Struct ipaddr::Ipv4Mask[][src]

pub struct Ipv4Mask(_);

A valid IPv4 mask.

Methods

impl Ipv4Mask
[src]

Return the mask as a prefix length;

assert_eq!(Ipv4Mask::try_from(0).unwrap().prefixlen(), 0);
assert_eq!(Ipv4Mask::try_from(0xffff_ffff).unwrap().prefixlen(), 32);
assert_eq!(Ipv4Mask::try_from(0xfff8_0000).unwrap().prefixlen(), 13);

Create an Ipv4Mask from a prefix length.

assert_eq!(Ipv4Mask::from_prefixlen(0).unwrap(), Ipv4Mask::try_from(0).unwrap());
assert_eq!(Ipv4Mask::from_prefixlen(32).unwrap(), Ipv4Mask::try_from(0xffff_ffff).unwrap());
assert_eq!(Ipv4Mask::from_prefixlen(13).unwrap(), Ipv4Mask::try_from(0xfff8_0000).unwrap());

Return a human readable representation of the IPv4 mask.

let mask = Ipv4Mask::try_from(0xfff8_0000).unwrap();
assert_eq!(mask.to_string(), "255.248.0.0".to_string());

Trait Implementations

impl From<Ipv4Mask> for Ipv4Address
[src]

Performs the conversion.

impl<'a> From<&'a Ipv4Mask> for Ipv4Address
[src]

Performs the conversion.

impl Copy for Ipv4Mask
[src]

impl Clone for Ipv4Mask
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

impl Hash for Ipv4Mask
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Display for Ipv4Mask
[src]

Formats the value using the given formatter. Read more

impl Debug for Ipv4Mask
[src]

Formats the value using the given formatter. Read more

impl AsRef<u32> for Ipv4Mask
[src]

Performs the conversion.

impl From<Ipv4Mask> for u32
[src]

Performs the conversion.

impl<'a> From<&'a Ipv4Mask> for u32
[src]

Performs the conversion.

impl TryFrom<u32> for Ipv4Mask
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<'a> TryFrom<&'a u32> for Ipv4Mask
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl TryFrom<Ipv4Address> for Ipv4Mask
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl<'a> TryFrom<&'a Ipv4Address> for Ipv4Mask
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

impl Not for Ipv4Mask
[src]

The resulting type after applying the ! operator.

Performs the unary ! operation.

impl<'a> Not for &'a Ipv4Mask
[src]

The resulting type after applying the ! operator.

Performs the unary ! operation.

impl LowerHex for Ipv4Mask
[src]

Formats the value using the given formatter.

impl UpperHex for Ipv4Mask
[src]

Formats the value using the given formatter.

impl Binary for Ipv4Mask
[src]

Formats the value using the given formatter.

impl BitAnd<Ipv4Mask> for Ipv4Address
[src]

The resulting type after applying the & operator.

Performs the & operation.

impl<'a> BitAnd<Ipv4Mask> for &'a Ipv4Address
[src]

The resulting type after applying the & operator.

Performs the & operation.

impl<'a> BitAnd<&'a Ipv4Mask> for Ipv4Address
[src]

The resulting type after applying the & operator.

Performs the & operation.

impl<'a, 'b> BitAnd<&'a Ipv4Mask> for &'b Ipv4Address
[src]

The resulting type after applying the & operator.

Performs the & operation.

impl FromStr for Ipv4Mask
[src]

The associated error which can be returned from parsing.

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

Auto Trait Implementations

impl Send for Ipv4Mask

impl Sync for Ipv4Mask