AsBytes

Trait AsBytes 

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

Defines a zero-copy representation of Self as a sequence of bytes.

Required Methods§

Source

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

Returns a byte representation of self.

This method is intended to re-interpret the underlying memory as a sequence of bytes, and thus, should be zero-copy.

Implementations on Foreign Types§

Source§

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

Source§

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

Flattens a slice of byte arrays into a slice of bytes.

Source§

impl<const N: usize, const M: usize> AsBytes for [[u8; N]; M]

Source§

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

Flattens a two-dimensional array of bytes into a slice of bytes.

Implementors§