From f3db9b51f6a45ed8e571fcf618e33260a712669f 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index b4bf6b69cbf..9153df0fdd7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3034,6 +3034,15 @@ 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)] + 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`.