Skip to main content

AsBytes

Trait AsBytes 

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

Converts an instance of data type to a slice of bytes as u8.

Required Methods§

Source

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

Returns slice of bytes for this data type.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AsBytes for &str

Source§

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

Source§

impl AsBytes for Vec<u8>

Source§

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

Source§

impl AsBytes for [u8]

Source§

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

Source§

impl AsBytes for bool

Source§

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

Source§

impl AsBytes for f32

Source§

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

Source§

impl AsBytes for f64

Source§

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

Source§

impl AsBytes for i8

Source§

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

Source§

impl AsBytes for i16

Source§

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

Source§

impl AsBytes for i32

Source§

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

Source§

impl AsBytes for i64

Source§

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

Source§

impl AsBytes for str

Source§

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

Source§

impl AsBytes for u8

Source§

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

Source§

impl AsBytes for u16

Source§

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

Source§

impl AsBytes for u32

Source§

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

Source§

impl AsBytes for u64

Source§

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

Implementors§