pub unsafe trait IntoByteSliceMut<'a>: IntoByteSlice<'a> + ByteSliceMut {
// Required method
fn into_byte_slice_mut(self) -> &'a mut [u8];
}
Expand description
A ByteSliceMut
that conveys no ownership, and so can be converted into a
mutable byte slice.
Some ByteSliceMut
types (notably, the standard library’s RefMut
type)
convey ownership, and so they cannot soundly be moved by-value into a byte
slice type (&mut [u8]
). Some methods in this crate’s API (such as
Ref::into_mut
) are only compatible with ByteSliceMut
types without
these ownership semantics.
Required Methods§
Sourcefn into_byte_slice_mut(self) -> &'a mut [u8]
fn into_byte_slice_mut(self) -> &'a mut [u8]
Coverts self
into a &mut [u8]
.
§Safety
The returned reference has the same address and length as self.deref()
and self.deref_mut()
.
Note that, combined with the safety invariant on ByteSlice
, this
safety invariant implies that the returned reference is “stable” in the
sense described in the ByteSlice
docs.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.