pub trait ByteableByteArray: Copy {
const BINARY_SIZE: usize;
// Required methods
fn create_zeroed() -> Self;
fn as_byteslice_mut(&mut self) -> &mut [u8] ⓘ;
fn as_byteslice(&self) -> &[u8] ⓘ;
}Expand description
Trait for working with byte arrays.
This trait provides methods for creating zero-filled byte arrays and
accessing them as mutable or immutable byte slices. It is primarily
used as an associated type for the Byteable trait.
Required Associated Constants§
const BINARY_SIZE: usize
Required Methods§
Sourcefn create_zeroed() -> Self
fn create_zeroed() -> Self
Creates a new byte array filled with zeros.
Sourcefn as_byteslice_mut(&mut self) -> &mut [u8] ⓘ
fn as_byteslice_mut(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice reference to the underlying byte array.
Sourcefn as_byteslice(&self) -> &[u8] ⓘ
fn as_byteslice(&self) -> &[u8] ⓘ
Returns an immutable slice reference to the underlying byte array.
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.
Implementations on Foreign Types§
Source§impl<const SIZE: usize> ByteableByteArray for [u8; SIZE]
Implements ByteableByteArray for fixed-size arrays [u8; SIZE].
impl<const SIZE: usize> ByteableByteArray for [u8; SIZE]
Implements ByteableByteArray for fixed-size arrays [u8; SIZE].