Struct rustable::MAC[][src]

pub struct MAC(_, _);

Represents a MAC address used for Bluetooth devices.

Implementations

impl MAC[src]

pub const fn new(mac: u64) -> Self[src]

Create a new MAC address from the number.

The least signficant 6 bytes are used to create the MAC.

Example

use rustbus::MAC;

let mac = MAC::new(0x010203A0B0C0);
println!("{}", mac); // prints '01:02:03:A0:B0:C0'.

Panics

Panics if the number given is greater than 2^48 - 1 (0xFFFFFFFFFFFF).

pub const fn from_parts(first_four: u32, last_two: u16) -> Self[src]

Create a new MAC from the first four octals and last two.

Example

use rustbus::MAC;

let mac = MAC::new(0x010203A0, 0xB0C0);
println!("{}", mac); // prints '01:02:03:A0:B0:C0'.

Trait Implementations

impl Clone for MAC[src]

impl Debug for MAC[src]

impl Display for MAC[src]

impl From<(u32, u16)> for MAC[src]

impl FromStr for MAC[src]

type Err = IDParseError

The associated error which can be returned from parsing.

impl Hash for MAC[src]

impl PartialEq<MAC> for MAC[src]

impl Copy for MAC[src]

impl Eq for MAC[src]

impl StructuralEq for MAC[src]

impl StructuralPartialEq for MAC[src]

Auto Trait Implementations

impl RefUnwindSafe for MAC

impl Send for MAC

impl Sync for MAC

impl Unpin for MAC

impl UnwindSafe for MAC

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> 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.