wolf_crypto::buf

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>

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§