[][src]Struct heim_net::MacAddr8

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

MAC address in EUI-64 format.

Implementations

impl MacAddr8[src]

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

Creates a new MacAddr8 address from the bytes.

Example

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

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

Create a new nil MacAddr8.

Example

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

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

Create a new broadcast MacAddr8.

Example

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

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

Returns true if the address is nil.

Example

let addr = MacAddr8::new(0x00, 0x00, 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 = MacAddr8::new(0xFF, 0xFF, 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 = MacAddr8::new(0x00, 0x01, 0x44, 0x55, 0x66, 0x77, 0xCD, 0xEF);

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

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

Returns true if the address is multicast.

Example

let addr = MacAddr8::new(0x01, 0x00, 0x0C, 0xCC, 0xCC, 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 = MacAddr8::new(0x01, 0x00, 0x0C, 0xCC, 0xCC, 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 = MacAddr8::new(0x02, 0x00, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC);

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

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

Converts a MacAddr8 address to a byte slice.

Example

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

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

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

Consumes a MacAddr8 address and returns raw bytes.

Example

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

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

Trait Implementations

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

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

impl Clone for MacAddr8[src]

impl Copy for MacAddr8[src]

impl Debug for MacAddr8[src]

impl Default for MacAddr8[src]

impl Display for MacAddr8[src]

MacAddr8 can be displayed in different formats.

Example

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

assert_eq!(&format!("{}",    addr), "AB:0D:EF:12:34:56:78:9A");
assert_eq!(&format!("{:-}",  addr), "AB-0D-EF-12-34-56-78-9A");
assert_eq!(&format!("{:#}",  addr), "AB0D.EF12.3456.789A");

impl Eq for MacAddr8[src]

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

impl From<MacAddr8> for MacAddr[src]

impl FromStr for MacAddr8[src]

type Err = ParseError

The associated error which can be returned from parsing.

impl Hash for MacAddr8[src]

impl Ord for MacAddr8[src]

impl PartialEq<MacAddr8> for MacAddr8[src]

impl PartialOrd<MacAddr8> for MacAddr8[src]

impl StructuralEq for MacAddr8[src]

impl StructuralPartialEq for MacAddr8[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> ToHex for T where
    T: AsRef<[u8]>, 
[src]

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.