[][src]Struct heim_net::MacAddr6

#[repr(C)]pub struct MacAddr6(_);

MAC address in EUI-48 format.

Implementations

impl MacAddr6[src]

pub const fn new(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8) -> MacAddr6[src]

Creates a new MacAddr6 address from the bytes.

Example

let addr = MacAddr6::new(0x01, 0x23, 0x45, 0x67, 0x89, 0xAB);

pub const fn nil() -> MacAddr6[src]

Create a new nil MacAddr6.

Example

let addr = MacAddr6::nil();
assert!(addr.is_nil());

pub const fn broadcast() -> MacAddr6[src]

Create a new broadcast MacAddr6.

Example

let addr = MacAddr6::broadcast();
assert!(addr.is_broadcast());

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

Returns true if the address is nil.

Example

let addr = MacAddr6::new(0x00, 0x00, 0x00, 0x00, 0x00, 0x00);

assert_eq!(addr.is_nil(), true);

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

Returns true if the address is broadcast.

Example

let addr = MacAddr6::new(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);

assert_eq!(addr.is_broadcast(), true);

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

Returns true if the address is unicast.

Example

let addr = MacAddr6::new(0x00, 0x01, 0x44, 0x55, 0x66, 0x77);

assert_eq!(addr.is_unicast(), true);

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

Returns true if the address is multicast.

Example

let addr = MacAddr6::new(0x01, 0x00, 0x0C, 0xCC, 0xCC, 0xCC);

assert_eq!(addr.is_multicast(), true);

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

Returns true if the address is universally administered address (UAA).

Example

let addr = MacAddr6::new(0x01, 0x00, 0x0C, 0xCC, 0xCC, 0xCC);

assert_eq!(addr.is_universal(), true);

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

Returns true if the address is locally administered (LAA).

Example

let addr = MacAddr6::new(0x02, 0x00, 0x0C, 0xCC, 0xCC, 0xCC);

assert_eq!(addr.is_local(), true);

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

Converts a MacAddr6 address to a byte slice.

Example

let addr = MacAddr6::new(0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67);

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

pub const fn into_array(self) -> [u8; 6][src]

Consumes MacAddr6 address and returns raw bytes array.

Example

let addr = MacAddr6::new(0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67);

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

Trait Implementations

impl AsMut<[u8]> for MacAddr6[src]

impl AsRef<[u8]> for MacAddr6[src]

impl Clone for MacAddr6[src]

impl Copy for MacAddr6[src]

impl Debug for MacAddr6[src]

impl Default for MacAddr6[src]

impl Display for MacAddr6[src]

MacAddr6 can be displayed in different formats.

Example

let addr = MacAddr6::new(0xab, 0x0d, 0xef, 0x12, 0x34, 0x56);

assert_eq!(&format!("{}",    addr), "AB:0D:EF:12:34:56");
assert_eq!(&format!("{:-}",  addr), "AB-0D-EF-12-34-56");
assert_eq!(&format!("{:#}",  addr), "AB0.DEF.123.456");

impl Eq for MacAddr6[src]

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

impl From<MacAddr6> for MacAddr[src]

impl FromStr for MacAddr6[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Hash for MacAddr6[src]

impl Ord for MacAddr6[src]

impl PartialEq<MacAddr6> for MacAddr6[src]

impl PartialOrd<MacAddr6> for MacAddr6[src]

impl StructuralEq for MacAddr6[src]

impl StructuralPartialEq for MacAddr6[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.