Struct eui48::MacAddress
source · #[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 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
§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<MacAddress> for MacAddress
impl PartialEq<MacAddress> for MacAddress
source§fn eq(&self, other: &MacAddress) -> bool
fn eq(&self, other: &MacAddress) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<MacAddress> for MacAddress
impl PartialOrd<MacAddress> for MacAddress
source§fn partial_cmp(&self, other: &MacAddress) -> Option<Ordering>
fn partial_cmp(&self, other: &MacAddress) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more