pub struct MacAddr(/* private fields */);Expand description
A 48-bit hardware address.
Ordered and hashable, so a host’s addresses can be kept in a sorted map and rendered in the same order twice.
Implementations§
Source§impl MacAddr
impl MacAddr
Sourcepub const ZERO: Self
pub const ZERO: Self
The all-zero address, which names no station: what an ARP request carries as the target hardware address it asks for, and what a reader takes as “not stated”.
Sourcepub const fn new(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8) -> Self
pub const fn new(a: u8, b: u8, c: u8, d: u8, e: u8, f: u8) -> Self
Creates a MacAddr from six octets, most significant first.
Sourcepub const fn is_locally_administered(self) -> bool
pub const fn is_locally_administered(self) -> bool
Whether this address was assigned locally, not allocated to a manufacturer, as the second-least-significant bit of the first octet marks.
There is no OUI to look up for one, so vendor returns None. A device
randomizing its address produces them, so one host may answer under a series
of unrelated addresses.
Sourcepub const fn is_multicast(self) -> bool
pub const fn is_multicast(self) -> bool
Whether this is a group address, as the least significant bit of the first octet marks.
Sourcepub const fn is_broadcast(self) -> bool
pub const fn is_broadcast(self) -> bool
Whether this is BROADCAST.
Trait Implementations§
impl Copy for MacAddr
impl Eq for MacAddr
Source§impl FromStr for MacAddr
impl FromStr for MacAddr
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Reads 00:1a:2b:3c:4d:5e, in either case, and the same address written
with - between the octets.
The colon form is what Unix tooling prints and fmt::Display writes; the
hyphen form is what Windows and most printed labels use.
Source§type Err = MacAddrParseError
type Err = MacAddrParseError
Source§impl Ord for MacAddr
impl Ord for MacAddr
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for MacAddr
impl PartialOrd for MacAddr
impl StructuralPartialEq for MacAddr
Auto Trait Implementations§
impl Freeze for MacAddr
impl RefUnwindSafe for MacAddr
impl Send for MacAddr
impl Sync for MacAddr
impl Unpin for MacAddr
impl UnsafeUnpin for MacAddr
impl UnwindSafe for MacAddr
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more