Trait ToBytes

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

A cheap conversion from typed data to a byte slice.

Given some data, returns the byte representation of that data. No copy of the data should be performed.

See also the FromBytes trait.

Required Methods§

Source

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

Converts the provided data to bytes.

Implementations on Foreign Types§

Source§

impl ToBytes for str

Source§

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

Source§

impl ToBytes for ()

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 ToBytes for [u8]

Source§

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

Source§

impl<T: ToBytes> ToBytes for &T

Source§

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

Source§

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

Source§

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

Implementors§