#[repr(C)]pub struct MacAddress { /* private fields */ }
Expand description
A MAC address (EUI-48)
Implementations§
Source§impl MacAddress
impl MacAddress
Sourcepub const fn new(eui: Eui48) -> MacAddress
pub const fn new(eui: Eui48) -> MacAddress
Create a new MacAddress from [u8; 6]
.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ParseError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ParseError>
Create a new MacAddress from a byte slice.
Returns an error (without any description) if the slice doesn’t have the proper length.
Sourcepub fn nil() -> MacAddress
pub fn nil() -> MacAddress
Returns empty EUI-48 address
Sourcepub fn broadcast() -> MacAddress
pub fn broadcast() -> MacAddress
Returns ‘ff:ff:ff:ff:ff:ff’, a MAC broadcast address
Sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Returns true if the address is ‘ff:ff:ff:ff:ff:ff’
Sourcepub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Returns true if bit 1 of Y is 0 in address ‘xY:xx:xx:xx:xx:xx’
Sourcepub fn is_multicast(&self) -> bool
pub fn is_multicast(&self) -> bool
Returns true if bit 1 of Y is 1 in address ‘xY:xx:xx:xx:xx:xx’
Sourcepub fn is_universal(&self) -> bool
pub fn is_universal(&self) -> bool
Returns true if bit 2 of Y is 0 in address ‘xY:xx:xx:xx:xx:xx’
Sourcepub fn to_canonical(&self) -> String
pub fn to_canonical(&self) -> String
Returns a String representation in the format ‘00-00-00-00-00-00’
Sourcepub fn to_hex_string(&self) -> String
pub fn to_hex_string(&self) -> String
Returns a String representation in the format ‘00:00:00:00:00:00’
Sourcepub fn to_dot_string(&self) -> String
pub fn to_dot_string(&self) -> String
Returns a String representation in the format ‘0000.0000.0000’
Sourcepub fn to_hexadecimal(&self) -> String
pub fn to_hexadecimal(&self) -> String
Returns a String representation in the format ‘0x000000000000’
Sourcepub fn to_interfaceid(&self) -> String
pub fn to_interfaceid(&self) -> String
Returns a String representation in the EUI-64 interface ID format ‘0000:00ff:fe00:0000’
Sourcepub fn to_link_local(&self) -> String
pub fn to_link_local(&self) -> String
Returns a String representation in the IPv6 link local format ‘fe80::0000:00ff:fe00:0000’
Sourcepub fn to_string(&self, fmt: MacAddressFormat) -> String
pub fn to_string(&self, fmt: MacAddressFormat) -> String
Returns a String in the format selected by fmt
Sourcepub fn parse_str(s: &str) -> Result<MacAddress, ParseError>
pub fn parse_str(s: &str) -> Result<MacAddress, ParseError>
Parses a String representation from any format supported
Sourcepub fn to_array(&self) -> Eui48
pub fn to_array(&self) -> Eui48
Returns an array in Eui48. Works as an inverse function of new()
Sourcepub fn get_display_format() -> MacAddressFormat
pub fn get_display_format() -> MacAddressFormat
Returns Display MacAddressFormat, determined at compile time.
Trait Implementations§
Source§impl Clone for MacAddress
impl Clone for MacAddress
Source§fn clone(&self) -> MacAddress
fn clone(&self) -> MacAddress
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
Create a Default MacAddress (00-00-00-00-00-00)
Source§impl<'de> Deserialize<'de> for MacAddress
impl<'de> Deserialize<'de> for MacAddress
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize a MacAddress from canonical form using the serde crate
Source§impl Display for MacAddress
impl Display for MacAddress
Source§impl FromStr for MacAddress
impl FromStr for MacAddress
Source§fn from_str(us: &str) -> Result<MacAddress, ParseError>
fn from_str(us: &str) -> Result<MacAddress, ParseError>
Create a MacAddress from String
Source§type Err = ParseError
type Err = ParseError
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 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for MacAddress
impl PartialEq for MacAddress
Source§impl PartialOrd for MacAddress
impl PartialOrd for MacAddress
Source§impl Serialize for MacAddress
impl Serialize 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)