pub trait SliceAsBytes: Sized {
// Required methods
fn slice_as_bytes(self_: &[Self]) -> &[u8] ⓘ;
unsafe fn slice_as_bytes_mut(self_: &mut [Self]) -> &mut [u8] ⓘ;
}
Expand description
Converts an slice of a data type to a slice of bytes.
Required Methods§
Sourcefn slice_as_bytes(self_: &[Self]) -> &[u8] ⓘ
fn slice_as_bytes(self_: &[Self]) -> &[u8] ⓘ
Returns slice of bytes for a slice of this data type.
Sourceunsafe fn slice_as_bytes_mut(self_: &mut [Self]) -> &mut [u8] ⓘ
unsafe fn slice_as_bytes_mut(self_: &mut [Self]) -> &mut [u8] ⓘ
Return the internal representation as a mutable slice
§Safety
If modified you are required to ensure the internal representation is valid and correct for the actual raw data
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.