Skip to content

Commit

Permalink
Add deprecated IntoBytes::as_bytes_mut (#987)
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 authored Mar 1, 2024
1 parent e6c0ff8 commit a59e8d1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3034,6 +3034,16 @@ 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)]
#[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`.
Expand Down

0 comments on commit a59e8d1

Please sign in to comment.