Struct eui48::MacAddress
source · #[repr(C)]pub struct MacAddress { /* private fields */ }
Expand description
A MAC address (EUI-48)
Implementations
sourceimpl MacAddress
impl MacAddress
sourcepub fn new(eui: Eui48) -> MacAddress
pub fn new(eui: Eui48) -> MacAddress
Create a new MacAddress from [u8; 6]
.
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, ()>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, ()>
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 1 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_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
Trait Implementations
sourceimpl Clone for MacAddress
impl Clone for MacAddress
sourcefn clone(&self) -> MacAddress
fn clone(&self) -> MacAddress
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for MacAddress
impl Debug for MacAddress
sourceimpl Decodable for MacAddress
impl Decodable for MacAddress
sourceimpl Default for MacAddress
impl Default for MacAddress
sourcefn default() -> MacAddress
fn default() -> MacAddress
Create a Default MacAddress (00-00-00-00-00-00)
sourceimpl Display for MacAddress
impl Display for MacAddress
sourceimpl Encodable for MacAddress
impl Encodable for MacAddress
sourceimpl FromStr for MacAddress
impl FromStr for MacAddress
sourcefn 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
sourceimpl Hash for MacAddress
impl Hash for MacAddress
sourceimpl Ord for MacAddress
impl Ord for MacAddress
sourcefn cmp(&self, other: &MacAddress) -> Ordering
fn cmp(&self, other: &MacAddress) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl PartialEq<MacAddress> for MacAddress
impl PartialEq<MacAddress> for MacAddress
sourcefn eq(&self, other: &MacAddress) -> bool
fn eq(&self, other: &MacAddress) -> bool
sourceimpl PartialOrd<MacAddress> for MacAddress
impl PartialOrd<MacAddress> for MacAddress
sourcefn partial_cmp(&self, other: &MacAddress) -> Option<Ordering>
fn partial_cmp(&self, other: &MacAddress) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more