Struct eui48::MacAddress
[−]
[src]
pub struct MacAddress { /* fields omitted */ }
A MAC address (EUI-48)
Methods
impl MacAddress
[src]
fn new(eui: Eui48) -> MacAddress
Create a new MacAddress from [u8; 6]
.
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.
fn nil() -> MacAddress
Returns empty EUI-48 address
fn broadcast() -> MacAddress
Returns 'ff:ff:ff:ff:ff:ff', a MAC broadcast address
fn is_nil(&self) -> bool
Returns true if the address is '00:00:00:00:00:00'
fn is_broadcast(&self) -> bool
Returns true if the address is 'ff:ff:ff:ff:ff:ff'
fn is_unicast(&self) -> bool
Returns true if bit 1 of Y is 1 in address 'xY:xx:xx:xx:xx:xx'
fn is_multicast(&self) -> bool
Returns true if bit 1 of Y is 1 in address 'xY:xx:xx:xx:xx:xx'
fn is_universal(&self) -> bool
Returns true if bit 2 of Y is 0 in address 'xY:xx:xx:xx:xx:xx'
fn is_local(&self) -> bool
Returns true if bit 2 of Y is 1 in address 'xY:xx:xx:xx:xx:xx'
fn to_canonical(&self) -> String
Returns a String representation in the format '00-00-00-00-00-00'
fn to_hex_string(&self) -> String
Returns a String representation in the format '00:00:00:00:00:00'
fn to_dot_string(&self) -> String
Returns a String representation in the format '0000.0000.0000'
fn to_hexadecimal(&self) -> String
Returns a String representation in the format '0x000000000000'
fn to_string(&self, fmt: MacAddressFormat) -> String
Returns a String in the format selected by fmt
fn parse_str(s: &str) -> Result<MacAddress, ParseError>
Parses a String representation from any format supported
fn as_bytes<'a>(&'a self) -> &'a [u8]
Return the internal structure as a slice of bytes
Trait Implementations
impl Copy for MacAddress
[src]
impl Clone for MacAddress
[src]
fn clone(&self) -> MacAddress
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl FromStr for MacAddress
[src]
type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(us: &str) -> Result<MacAddress, ParseError>
Create a MacAddress from String
impl Default for MacAddress
[src]
fn default() -> MacAddress
Create a Default MacAddress (00-00-00-00-00-00)
impl Debug for MacAddress
[src]
impl Display for MacAddress
[src]
impl PartialEq for MacAddress
[src]
fn eq(&self, other: &MacAddress) -> bool
Define PartialEq as eui equal
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for MacAddress
[src]
impl Ord for MacAddress
[src]
fn cmp(&self, other: &MacAddress) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
ord_max_min
)Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
ord_max_min
)Compares and returns the minimum of two values. Read more
impl PartialOrd for MacAddress
[src]
fn partial_cmp(&self, other: &MacAddress) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Encodable for MacAddress
[src]
fn encode<E: Encoder>(&self, e: &mut E) -> Result<(), E::Error>
Encode a MacAddress as canonical form
impl Decodable for MacAddress
[src]
fn decode<D: Decoder>(d: &mut D) -> Result<MacAddress, D::Error>
Decode a MacAddress from a string in canonical form
impl Serialize for MacAddress
[src]
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
Serialize a MacAddress as canonical form using the serde crate
impl<'de> Deserialize<'de> for MacAddress
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize a MacAddress from canonical form using the serde crate