pub struct MacAddress(/* private fields */);Expand description
Implementations§
Source§impl MacAddress
impl MacAddress
Sourcepub const fn from_octets(octets: [u8; 6]) -> Self
pub const fn from_octets(octets: [u8; 6]) -> Self
Builds a MAC address directly from six octets. Always valid.
Sourcepub fn parse(value: &str) -> PrimitiveResult<Self>
pub fn parse(value: &str) -> PrimitiveResult<Self>
Parses a MAC address in aa:bb:cc:dd:ee:ff or aa-bb-cc-dd-ee-ff form.
The separator must be : or - and the same throughout. Returns an
error for an empty string, the wrong length, an inconsistent separator,
or a non-hex octet.
Sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Returns true if this is a multicast address (low bit of the first
octet set).
Sourcepub const fn is_unicast(&self) -> bool
pub const fn is_unicast(&self) -> bool
Returns true if this is a unicast address.
Sourcepub const fn is_local(&self) -> bool
pub const fn is_local(&self) -> bool
Returns true if this address is locally administered (second-lowest bit
of the first octet set), as opposed to a universally administered (OUI)
address.
Sourcepub const fn is_universal(&self) -> bool
pub const fn is_universal(&self) -> bool
Returns true if this address is universally administered.
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 moreimpl Copy for MacAddress
Source§impl Debug for MacAddress
impl Debug for MacAddress
Source§impl Display for MacAddress
impl Display for MacAddress
impl Eq for MacAddress
Source§impl From<MacAddress> for [u8; 6]
impl From<MacAddress> for [u8; 6]
Source§fn from(mac: MacAddress) -> Self
fn from(mac: MacAddress) -> Self
Converts to this type from the input type.
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
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