[][src]Struct eui48::MacAddress

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

A MAC address (EUI-48)

Implementations

impl MacAddress[src]

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

Create a new MacAddress from [u8; 6].

pub fn from_bytes(bytes: &[u8]) -> Result<Self, ParseError>[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 'fe80::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(&self) -> &[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 Clone for MacAddress[src]

impl Copy for MacAddress[src]

impl Debug for MacAddress[src]

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

Debug format for MacAddress is HexString notation

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

impl Default for MacAddress[src]

fn default() -> MacAddress[src]

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

impl<'de> Deserialize<'de> for MacAddress[src]

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>[src]

Deserialize a MacAddress from canonical form using the serde crate

impl Display for MacAddress[src]

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

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

impl Encodable for MacAddress[src]

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

Encode a MacAddress using the default format

impl Eq for MacAddress[src]

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 Hash for MacAddress[src]

impl Ord for MacAddress[src]

impl PartialEq<MacAddress> for MacAddress[src]

impl PartialOrd<MacAddress> for MacAddress[src]

impl Serialize for MacAddress[src]

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>[src]

Serialize a MacAddress in the default format using the serde crate

impl StructuralEq for MacAddress[src]

impl StructuralPartialEq for MacAddress[src]

Auto Trait Implementations

impl RefUnwindSafe for MacAddress

impl Send for MacAddress

impl Sync for MacAddress

impl Unpin for MacAddress

impl UnwindSafe for MacAddress

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.