[−][src]Enum macaddr::MacAddr
A MAC address, either in EUI-48 or EUI-64 format.
Variants
V6(MacAddr6)
V8(MacAddr8)
Methods
impl MacAddr
[src]
pub fn is_v6(&self) -> bool
[src]
Returns true
if the address is MacAddr6
address.
Example
let addr = MacAddr::from([0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]); assert_eq!(addr.is_v6(), true); assert_eq!(addr.is_v8(), false);
pub fn is_v8(&self) -> bool
[src]
Returns true
if the address is MacAddr8
address.
Example
let addr = MacAddr::from([0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67, 0x89, 0xAB]); assert_eq!(addr.is_v6(), false); assert_eq!(addr.is_v8(), true);
pub fn as_bytes(&self) -> &[u8]
[src]
Converts a MacAddr
address to a byte slice.
Length of the returned slice is depends on the enum member used.
Example
let addr = MacAddr::from([0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]); assert_eq!(addr.as_bytes(), &[0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);
Trait Implementations
impl PartialEq<MacAddr> for MacAddr
[src]
impl From<MacAddr6> for MacAddr
[src]
impl From<MacAddr8> for MacAddr
[src]
impl From<[u8; 6]> for MacAddr
[src]
impl From<[u8; 8]> for MacAddr
[src]
impl Clone for MacAddr
[src]
fn clone(&self) -> MacAddr
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for MacAddr
[src]
fn cmp(&self, other: &MacAddr) -> Ordering
[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
fn clamp(self, min: Self, max: Self) -> Self
[src]
🔬 This is a nightly-only experimental API. (
clamp
)Restrict a value to a certain interval. Read more
impl Eq for MacAddr
[src]
impl Copy for MacAddr
[src]
impl PartialOrd<MacAddr> for MacAddr
[src]
fn partial_cmp(&self, other: &MacAddr) -> Option<Ordering>
[src]
fn lt(&self, other: &MacAddr) -> bool
[src]
fn le(&self, other: &MacAddr) -> bool
[src]
fn gt(&self, other: &MacAddr) -> bool
[src]
fn ge(&self, other: &MacAddr) -> bool
[src]
impl Debug for MacAddr
[src]
impl FromStr for MacAddr
[src]
type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Hash for MacAddr
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,