From a5be8e0a510520d2fed7ef5aa47eb6d4bb76da30 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Fri, 1 Mar 2024 09:57:42 -0800 Subject: [PATCH] Add deprecated IntoBytes::as_bytes_mut This was renamed to `as_mut_bytes` in #870. This commit adds the old name back as a `#[doc(hidden)]`, `#[deprecated]` alias to ease the transition. Closes #986 --- src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b4bf6b69cb..04b0ef89ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3034,6 +3034,16 @@ pub unsafe trait IntoBytes { unsafe { slice::from_raw_parts_mut(slf.cast::(), len) } } + #[deprecated(since = "0.8.0", note = "`IntoBytes::as_bytes_mut` was renamed to `as_mut_bytes`")] + #[doc(hidden)] + #[inline] + fn as_bytes_mut(&mut self) -> &mut [u8] + where + Self: FromBytes + NoCell, + { + self.as_mut_bytes() + } + /// Writes a copy of `self` to `bytes`. /// /// If `bytes.len() != size_of_val(self)`, `write_to` returns `None`.