Struct interfaces::HardwareAddr
source · pub struct HardwareAddr(_);
Expand description
HardwareAddr represents a hardware address (commonly known as a MAC address) of a given interface.
Implementations§
source§impl HardwareAddr
impl HardwareAddr
sourcepub fn zero() -> HardwareAddr
pub fn zero() -> HardwareAddr
Returns a new, empty HardwareAddr
structure. This is equivalent to the MAC address
00:00:00:00:00:00
.
sourcepub fn as_string(&self) -> String
pub fn as_string(&self) -> String
Formats this hardware address in the standard MAC address format - 6 octets in hexadecimal format, each seperated by a colon.
let s = HardwareAddr::zero().as_string();
assert_eq!(s, "00:00:00:00:00:00");
sourcepub fn as_bare_string(&self) -> String
pub fn as_bare_string(&self) -> String
Formats this hardware address as a sequence of hexadecimal numbers without the seperating colons.
let s = HardwareAddr::zero().as_bare_string();
assert_eq!(s, "000000000000");
Trait Implementations§
source§impl Clone for HardwareAddr
impl Clone for HardwareAddr
source§fn clone(&self) -> HardwareAddr
fn clone(&self) -> HardwareAddr
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for HardwareAddr
impl Debug for HardwareAddr
source§impl Display for HardwareAddr
impl Display for HardwareAddr
source§impl Hash for HardwareAddr
impl Hash for HardwareAddr
source§impl PartialEq<HardwareAddr> for HardwareAddr
impl PartialEq<HardwareAddr> for HardwareAddr
source§fn eq(&self, other: &HardwareAddr) -> bool
fn eq(&self, other: &HardwareAddr) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Copy for HardwareAddr
impl Eq for HardwareAddr
impl StructuralEq for HardwareAddr
impl StructuralPartialEq for HardwareAddr
Auto Trait Implementations§
impl RefUnwindSafe for HardwareAddr
impl Send for HardwareAddr
impl Sync for HardwareAddr
impl Unpin for HardwareAddr
impl UnwindSafe for HardwareAddr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more