Skip to content

Commit

Permalink
Add deprecated IntoBytes::as_bytes_mut
Browse files Browse the repository at this point in the history
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
  • Loading branch information
joshlf committed Mar 1, 2024
1 parent e6c0ff8 commit f3db9b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3034,6 +3034,15 @@ pub unsafe trait IntoBytes {
unsafe { slice::from_raw_parts_mut(slf.cast::<u8>(), 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`.
Expand Down

0 comments on commit f3db9b5

Please sign in to comment.