pub struct MacAddr { /* private fields */ }Expand description
Validated 48-bit MAC address. Accepts the canonical aa:bb:cc:dd:ee:ff shape
(lowercase or uppercase), rejects anything else.
Implementations§
Source§impl MacAddr
impl MacAddr
Sourcepub const fn from_bytes(bytes: [u8; 6]) -> Self
pub const fn from_bytes(bytes: [u8; 6]) -> Self
Wrap raw bytes.
Sourcepub const fn bytes(&self) -> [u8; 6]
pub const fn bytes(&self) -> [u8; 6]
Borrow the underlying 6-byte representation. The VMM consumes this
to seed the virtio-net guest_mac; upstream keeps the getter narrow
so the raw bytes don’t leak into arbitrary code.
Sourcepub fn to_canonical_string(self) -> String
pub fn to_canonical_string(self) -> String
The wire-shape aa:bb:cc:dd:ee:ff representation.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MacAddr
impl<'de> Deserialize<'de> for MacAddr
Source§fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Copy for MacAddr
impl Eq 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<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