ByteArray

Trait ByteArray 

Source
pub trait ByteArray {
    type Target;

    // Required methods
    fn capacity(&self) -> usize;
    fn slice(&self) -> &[u8] ;
    fn mut_slice(&mut self) -> &mut [u8] ;

    // Provided method
    fn zero(&mut self) { ... }
}
Expand description

A trait for types that represent byte arrays.

Required Associated Types§

Source

type Target

The target type of the byte array.

Required Methods§

Source

fn capacity(&self) -> usize

Returns the readable capacity of the byte array.

Source

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

Returns a reference to the byte array as a slice.

Source

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

Returns a mutable reference to the byte array as a slice.

Provided Methods§

Source

fn zero(&mut self)

Zeros out the contents of the byte array.

Implementations on Foreign Types§

Source§

impl ByteArray for Vec<u8>

Available on crate feature alloc only.
Source§

type Target = Vec<u8>

Source§

fn capacity(&self) -> usize

Source§

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

Source§

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

Source§

impl<const N: usize> ByteArray for [u8; N]

Source§

type Target = [u8; N]

Source§

fn capacity(&self) -> usize

Source§

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

Source§

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

Implementors§