pub struct MacAddress(/* private fields */);Expand description
Mac Address
Implementations§
Source§impl MacAddress
impl MacAddress
Sourcepub const fn new6(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8) -> Self
pub const fn new6(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8) -> Self
Construct a new MacAddress instance from 6 components
Sourcepub const fn from_slice(mac: &[u8]) -> Result<Self, ParseMacError>
pub const fn from_slice(mac: &[u8]) -> Result<Self, ParseMacError>
Construct a new MacAddress instance from slice
Sourcepub fn is_universal(&self) -> bool
pub fn is_universal(&self) -> bool
Returns true if the MacAddr is a universally administered addresses (UAA).
Sourcepub fn is_local(&self) -> bool
pub fn is_local(&self) -> bool
Returns true if the MacAddr is a locally administered addresses (LAA).
Sourcepub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Returns true if the MacAddr is a unicast address.
Sourcepub fn is_multicast(&self) -> bool
pub fn is_multicast(&self) -> bool
Returns true if the MacAddr is a multicast address.
Sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Returns true if the MacAddr is a broadcast address.
pub fn octets(&self) -> [u8; 6]
pub fn to_u64(&self) -> u64
Trait Implementations§
Source§impl Clone for MacAddress
impl Clone for MacAddress
Source§fn clone(&self) -> MacAddress
fn clone(&self) -> MacAddress
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 MacAddress
impl Debug for MacAddress
Source§impl Default for MacAddress
impl Default for MacAddress
Source§fn default() -> MacAddress
fn default() -> MacAddress
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MacAddress
Available on crate feature serde only.
impl<'de> Deserialize<'de> for MacAddress
Available on crate feature
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the MAC address.
It deserializes it from either a byte array (of size 6) or a string. If the format is self-descriptive (like JSON or MessagePack), it auto-detects it. If not, it obeys the human-readable property of the deserializer.
Source§impl Display for MacAddress
impl Display for MacAddress
Source§impl From<MacAddr> for MacAddress
Available on crate feature pnet only.
impl From<MacAddr> for MacAddress
Available on crate feature
pnet only.Source§impl FromStr for MacAddress
impl FromStr for MacAddress
Source§impl Hash for MacAddress
impl Hash for MacAddress
Source§impl Ord for MacAddress
impl Ord for MacAddress
Source§fn cmp(&self, other: &MacAddress) -> Ordering
fn cmp(&self, other: &MacAddress) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for MacAddress
impl PartialEq for MacAddress
Source§fn eq(&self, other: &MacAddress) -> bool
fn eq(&self, other: &MacAddress) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for MacAddress
impl PartialOrd for MacAddress
Source§impl Serialize for MacAddress
Available on crate feature serde only.
impl Serialize for MacAddress
Available on crate feature
serde only.Source§impl Sub for &MacAddress
impl Sub for &MacAddress
Source§impl Sub for MacAddress
impl Sub for MacAddress
Source§impl TryFrom<&[u8]> for MacAddress
impl TryFrom<&[u8]> for MacAddress
Source§impl TryFrom<&str> for MacAddress
impl TryFrom<&str> for MacAddress
impl Copy for MacAddress
impl Eq for MacAddress
impl StructuralPartialEq for MacAddress
Auto Trait Implementations§
impl Freeze for MacAddress
impl RefUnwindSafe for MacAddress
impl Send for MacAddress
impl Sync for MacAddress
impl Unpin for MacAddress
impl UnsafeUnpin for MacAddress
impl UnwindSafe for MacAddress
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