Struct semtech_udp::MacAddress
source · [−]#[repr(C)]pub struct MacAddress(_);Expand description
MAC address in EUI-64 format.
Implementations
sourceimpl MacAddr8
impl MacAddr8
sourcepub const fn new(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8, g: u8, h: u8) -> MacAddr8
pub const fn new(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8, g: u8, h: u8) -> MacAddr8
Creates a new MacAddr8 address from the bytes.
Example
let addr = MacAddr8::new(0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF);sourcepub const fn broadcast() -> MacAddr8
pub const fn broadcast() -> MacAddr8
Create a new broadcast MacAddr8.
Example
let addr = MacAddr8::broadcast();
assert!(addr.is_broadcast());sourcepub fn is_nil(&self) -> bool
pub fn is_nil(&self) -> bool
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);sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
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);sourcepub const fn is_unicast(&self) -> bool
pub const fn is_unicast(&self) -> bool
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);sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
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);sourcepub const fn is_universal(&self) -> bool
pub const fn is_universal(&self) -> bool
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);sourcepub const fn is_local(&self) -> bool
pub const fn is_local(&self) -> bool
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);sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
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]);Trait Implementations
sourceimpl Display for MacAddr8
impl Display for MacAddr8
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");sourceimpl Ord for MacAddr8
impl Ord for MacAddr8
sourceimpl PartialOrd<MacAddr8> for MacAddr8
impl PartialOrd<MacAddr8> for MacAddr8
sourcefn partial_cmp(&self, other: &MacAddr8) -> Option<Ordering>
fn partial_cmp(&self, other: &MacAddr8) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Copy for MacAddr8
impl Eq for MacAddr8
impl StructuralEq for MacAddr8
impl StructuralPartialEq for MacAddr8
Auto Trait Implementations
impl RefUnwindSafe for MacAddr8
impl Send for MacAddr8
impl Sync for MacAddr8
impl Unpin for MacAddr8
impl UnwindSafe for MacAddr8
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more