ToBytes

Trait ToBytes 

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

A trait for types that can be converted to a little-endian byte slice

Required Methods§

Source

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

Returns a slice of this type’s bytes in little-endian order

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ToBytes for f32

Source§

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

Source§

impl ToBytes for f64

Source§

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

Source§

impl ToBytes for i8

Source§

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

Source§

impl ToBytes for i16

Source§

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

Source§

impl ToBytes for i32

Source§

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

Source§

impl ToBytes for i64

Source§

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

Source§

impl ToBytes for u8

Source§

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

Source§

impl ToBytes for u16

Source§

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

Source§

impl ToBytes for u32

Source§

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

Source§

impl ToBytes for u64

Source§

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

Source§

impl ToBytes for f16

Source§

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

Implementors§