Skip to content

Commit

Permalink
Rename into_array to octets.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Mar 27, 2022
1 parent 4c2305a commit 74100e3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
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

0 comments on commit 74100e3

Please sign in to comment.