[][src]Enum macaddr::MacAddr

pub enum MacAddr {
    V6(MacAddr6),
    V8(MacAddr8),
}

A MAC address, either in EUI-48 or EUI-64 format.

Variants

V6(MacAddr6)V8(MacAddr8)

Methods

impl MacAddr[src]

pub fn is_v6(&self) -> bool[src]

Returns true if the address is MacAddr6 address.

Example

let addr = MacAddr::from([0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);

assert_eq!(addr.is_v6(), true);
assert_eq!(addr.is_v8(), false);

pub fn is_v8(&self) -> bool[src]

Returns true if the address is MacAddr8 address.

Example

let addr = MacAddr::from([0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67, 0x89, 0xAB]);

assert_eq!(addr.is_v6(), false);
assert_eq!(addr.is_v8(), true);

pub fn as_bytes(&self) -> &[u8][src]

Converts a MacAddr address to a byte slice.

Length of the returned slice is depends on the enum member used.

Example

let addr = MacAddr::from([0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);

assert_eq!(addr.as_bytes(), &[0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);

Trait Implementations

impl PartialEq<MacAddr> for MacAddr[src]

impl From<MacAddr6> for MacAddr[src]

impl From<MacAddr8> for MacAddr[src]

impl From<[u8; 6]> for MacAddr[src]

impl From<[u8; 8]> for MacAddr[src]

impl Clone for MacAddr[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Ord for MacAddr[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

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

Restrict a value to a certain interval. Read more

impl Eq for MacAddr[src]

impl Copy for MacAddr[src]

impl PartialOrd<MacAddr> for MacAddr[src]

impl Debug for MacAddr[src]

impl FromStr for MacAddr[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Hash for MacAddr[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

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

Auto Trait Implementations

impl Send for MacAddr

impl Sync for MacAddr

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]