[][src]Struct eui48::MacAddress

#[repr(C)]
pub struct MacAddress { /* fields omitted */ }

A MAC address (EUI-48)

Methods

impl MacAddress
[src]

pub fn new(eui: Eui48) -> MacAddress
[src]

Create a new MacAddress from [u8; 6].

pub fn from_bytes(bytes: &[u8]) -> Result<Self, ()>
[src]

Create a new MacAddress from a byte slice.

Returns an error (without any description) if the slice doesn't have the proper length.

pub fn nil() -> MacAddress
[src]

Returns empty EUI-48 address

pub fn broadcast() -> MacAddress
[src]

Returns 'ff:ff:ff:ff:ff:ff', a MAC broadcast address

pub fn is_nil(&self) -> bool
[src]

Returns true if the address is '00:00:00:00:00:00'

pub fn is_broadcast(&self) -> bool
[src]

Returns true if the address is 'ff:ff:ff:ff:ff:ff'

pub fn is_unicast(&self) -> bool
[src]

Returns true if bit 1 of Y is 0 in address 'xY:xx:xx:xx:xx:xx'

pub fn is_multicast(&self) -> bool
[src]

Returns true if bit 1 of Y is 1 in address 'xY:xx:xx:xx:xx:xx'

pub fn is_universal(&self) -> bool
[src]

Returns true if bit 2 of Y is 0 in address 'xY:xx:xx:xx:xx:xx'

pub fn is_local(&self) -> bool
[src]

Returns true if bit 2 of Y is 1 in address 'xY:xx:xx:xx:xx:xx'

pub fn to_canonical(&self) -> String
[src]

Returns a String representation in the format '00-00-00-00-00-00'

pub fn to_hex_string(&self) -> String
[src]

Returns a String representation in the format '00:00:00:00:00:00'

pub fn to_dot_string(&self) -> String
[src]

Returns a String representation in the format '0000.0000.0000'

pub fn to_hexadecimal(&self) -> String
[src]

Returns a String representation in the format '0x000000000000'

pub fn to_interfaceid(&self) -> String
[src]

Returns a String representation in the EUI-64 interface ID format '0000:00ff:fe00:0000'

Returns a String representation in the IPv6 link local format 'ff80::0000:00ff:fe00:0000'

pub fn to_string(&self, fmt: MacAddressFormat) -> String
[src]

Returns a String in the format selected by fmt

pub fn parse_str(s: &str) -> Result<MacAddress, ParseError>
[src]

Parses a String representation from any format supported

pub fn as_bytes<'a>(&'a self) -> &'a [u8]
[src]

Return the internal structure as a slice of bytes

pub fn to_array(&self) -> Eui48
[src]

Returns an array in Eui48. Works as an inverse function of new()

pub fn get_display_format() -> MacAddressFormat
[src]

Returns Display MacAddressFormat, determined at compile time.

Trait Implementations

impl Eq for MacAddress
[src]

impl PartialOrd<MacAddress> for MacAddress
[src]

impl Copy for MacAddress
[src]

impl Default for MacAddress
[src]

fn default() -> MacAddress
[src]

Create a Default MacAddress (00-00-00-00-00-00)

impl PartialEq<MacAddress> for MacAddress
[src]

impl Clone for MacAddress
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for MacAddress
[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl Debug for MacAddress
[src]

fn fmt(&self, f: &mut Formatter) -> Result
[src]

Debug format for MacAddress is HexString notation

impl Display for MacAddress
[src]

fn fmt(&self, f: &mut Formatter) -> Result
[src]

Display format is canonical format (00-00-00-00-00-00)

impl Hash for MacAddress
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. 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>
[src]

Create a MacAddress from String

impl Encodable for MacAddress
[src]

fn encode<E: Encoder>(&self, e: &mut E) -> Result<(), E::Error>
[src]

Encode a MacAddress as canonical form

impl Decodable for MacAddress
[src]

fn decode<D: Decoder>(d: &mut D) -> Result<MacAddress, D::Error>
[src]

Decode a MacAddress from a string in canonical form

Auto Trait Implementations

impl Send for MacAddress

impl Sync for MacAddress

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]