xarxa

Crates

git

Versions

default

Flavors

Skip to main content

HardwareAddress

Enum HardwareAddress 

Source
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

Source

pub const fn medium(&self) -> Medium

The medium this kind of address belongs to.

Source

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

The address as bytes. Empty for Ip.

Source

pub fn is_unicast(&self) -> bool

Query whether the address is an unicast address.

false for Ip.

Source

pub fn is_broadcast(&self) -> bool

Query whether the address is the broadcast address of its medium.

false for Ip.

Source

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.

Source

pub const fn ieee802154(&self) -> Option<Ieee802154Address>

The IEEE 802.15.4 address, or None if this is not one.

Source

pub const fn ethernet(&self) -> Option<EthernetAddress>

The Ethernet address, or None if this is not one.

Source

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.

Source

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

Source§

fn clone(&self) -> HardwareAddress

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HardwareAddress

Source§

impl Debug for HardwareAddress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for HardwareAddress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for HardwareAddress

Source§

impl From<Address> for HardwareAddress

Available on crate feature medium-ieee802154 only.
Source§

fn from(addr: Ieee802154Address) -> Self

Converts to this type from the input type.
Source§

impl From<Address> for HardwareAddress

Available on crate feature medium-ethernet only.
Source§

fn from(addr: EthernetAddress) -> Self

Converts to this type from the input type.
Source§

impl From<HardwareAddress> for RawHardwareAddress

Source§

fn from(addr: HardwareAddress) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for HardwareAddress

Source§

fn eq(&self, other: &HardwareAddress) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HardwareAddress

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.