ByteableByteArray

Trait ByteableByteArray 

Source
pub trait ByteableByteArray {
    // 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 Methods§

Source

fn create_zeroed() -> Self

Creates a new byte array filled with zeros.

Source

fn as_byteslice_mut(&mut self) -> &mut [u8]

Returns a mutable slice reference to the underlying byte array.

Source

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].

Source§

fn create_zeroed() -> Self

Source§

fn as_byteslice_mut(&mut self) -> &mut [u8]

Source§

fn as_byteslice(&self) -> &[u8]

Implementors§