Struct rustable::MAC [−][src]
pub struct MAC(_, _);
Represents a MAC address used for Bluetooth devices.
Implementations
impl MAC
[src]
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'.