Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/addr6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,28 @@ impl MacAddr6 {
///
/// assert_eq!(addr.into_array(), [0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);
/// ```
#[deprecated(
since = "1.1.0",
note = "Renamed to `octets` to mirror the standard library's `IpAddr` types."
)]
pub const fn into_array(self) -> [u8; 6] {
self.0
}

/// Returns the six eight-bit integers the MAC address consists of.
///
/// ## Example
///
/// ```rust
/// # use macaddr::MacAddr6;
/// let addr = MacAddr6::new(0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67);
///
/// assert_eq!(addr.octets(), [0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67]);
/// ```
#[allow(clippy::trivially_copy_pass_by_ref)]
pub const fn octets(&self) -> [u8; 6] {
self.0
}
}

impl FromStr for MacAddr6 {
Expand Down
19 changes: 19 additions & 0 deletions src/addr8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,28 @@ impl MacAddr8 {
///
/// assert_eq!(addr.into_array(), [0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67, 0x89, 0xAB]);
/// ```
#[deprecated(
since = "1.1.0",
note = "Renamed to `octets` to mirror the standard library's `IpAddr` types."
)]
pub const fn into_array(self) -> [u8; 8] {
self.0
}

/// Returns the eight eight-bit integers the MAC address consists of.
///
/// ## Example
///
/// ```rust
/// # use macaddr::MacAddr8;
/// let addr = MacAddr8::new(0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67, 0x89, 0xAB);
///
/// assert_eq!(addr.octets(), [0xAC, 0xDE, 0x48, 0x23, 0x45, 0x67, 0x89, 0xAB]);
/// ```
#[allow(clippy::trivially_copy_pass_by_ref)]
pub const fn octets(&self) -> [u8; 8] {
self.0
}
}

impl FromStr for MacAddr8 {
Expand Down