diff --git a/src/addr6.rs b/src/addr6.rs index 289b9d7..1f801ca 100644 --- a/src/addr6.rs +++ b/src/addr6.rs @@ -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 { diff --git a/src/addr8.rs b/src/addr8.rs index 9c33d76..1f96c09 100644 --- a/src/addr8.rs +++ b/src/addr8.rs @@ -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 {