pub enum HardwareAddress {
Ethernet(EthernetAddress),
Ip,
Ieee802154(Ieee802154Address),
}Expand description
A hardware (link-layer) address.
Which variants exist depends on the enabled medium-* features. In a build
that only drives Medium::Ip interfaces this type has a single variant and
takes up no space.
Variants§
Ethernet(EthernetAddress)
An Ethernet (MAC) address. Requires the medium-ethernet feature.
Ip
No address, for interfaces that send and receive bare IP packets.
Requires the medium-ip feature.
Ieee802154(Ieee802154Address)
An IEEE 802.15.4 address. Requires the medium-ieee802154 feature.
Implementations§
Source§impl HardwareAddress
impl HardwareAddress
Sourcepub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Query whether the address is an unicast address.
false for Ip.
Sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Query whether the address is the broadcast address of its medium.
false for Ip.
Sourcepub fn as_eui_64(&self) -> Option<[u8; 8]>
pub fn as_eui_64(&self) -> Option<[u8; 8]>
Convert the address to a modified EUI-64 interface identifier.
None for Ip, and for a short or absent 802.15.4 address.
Sourcepub const fn ieee802154(&self) -> Option<Ieee802154Address>
pub const fn ieee802154(&self) -> Option<Ieee802154Address>
The IEEE 802.15.4 address, or None if this is not one.
Sourcepub const fn ethernet(&self) -> Option<EthernetAddress>
pub const fn ethernet(&self) -> Option<EthernetAddress>
The Ethernet address, or None if this is not one.
Sourcepub fn to_driver(&self) -> Option<HardwareAddress>
pub fn to_driver(&self) -> Option<HardwareAddress>
Convert to the address type drivers report, crate::driver::HardwareAddress.
Returns None for an IEEE 802.15.4 address that is not an extended
address: drivers report extended addresses only.
Sourcepub fn from_driver(addr: HardwareAddress) -> Option<Self>
pub fn from_driver(addr: HardwareAddress) -> Option<Self>
Convert from the address type drivers report, crate::driver::HardwareAddress.
Returns None if the build does not have the medium-* feature the
address kind belongs to.
Trait Implementations§
Source§impl Clone for HardwareAddress
impl Clone for HardwareAddress
Source§fn clone(&self) -> HardwareAddress
fn clone(&self) -> HardwareAddress
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for HardwareAddress
Source§impl Debug for HardwareAddress
impl Debug for HardwareAddress
Source§impl Display for HardwareAddress
impl Display for HardwareAddress
impl Eq for HardwareAddress
Source§impl From<Address> for HardwareAddress
Available on crate feature medium-ieee802154 only.
impl From<Address> for HardwareAddress
medium-ieee802154 only.Source§fn from(addr: Ieee802154Address) -> Self
fn from(addr: Ieee802154Address) -> Self
Source§impl From<Address> for HardwareAddress
Available on crate feature medium-ethernet only.
impl From<Address> for HardwareAddress
medium-ethernet only.