Trait aes_rust::to_bytes::ToBytes

source ·
pub trait ToBytes {
    // Required method
    fn to_bytes(&self) -> &[u8] ;
}
Expand description

This trait is used in the encosure schemes as the type of input.

It provides the to_bytes function that turns the value provided into a &[u8].

Required Methods§

source

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

This function turns &self into &[u8] (a slice of bytes).

§Examples
assert_eq!("ABC".to_bytes(), [65, 66, 67]);
assert_eq!([0, 1, 2, 3].to_bytes(), [0, 1, 2, 3]);

Implementations on Foreign Types§

source§

impl ToBytes for &str

source§

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

source§

impl ToBytes for &[u8]

source§

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

source§

impl ToBytes for String

source§

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

source§

impl ToBytes for Vec<u8>

source§

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

source§

impl<'a, const N: usize> ToBytes for &'a [u8; N]

source§

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

source§

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

source§

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

Implementors§