FromBytes

Trait FromBytes 

Source
pub trait FromBytes {
    const N: usize;

    // Required methods
    fn from_be_bytes(bytes: [u8; Self::N]) -> Self;
    fn from_le_bytes(bytes: [u8; Self::N]) -> Self;
    fn from_ne_bytes(bytes: [u8; Self::N]) -> Self;
}

Required Associated Constants§

Source

const N: usize

Required Methods§

Source

fn from_be_bytes(bytes: [u8; Self::N]) -> Self

Source

fn from_le_bytes(bytes: [u8; Self::N]) -> Self

Source

fn from_ne_bytes(bytes: [u8; Self::N]) -> Self

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 FromBytes for f32

Source§

const N: usize = 4usize

Source§

fn from_be_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 4]) -> Self

Source§

impl FromBytes for f64

Source§

const N: usize = 8usize

Source§

fn from_be_bytes(bytes: [u8; 8]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 8]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 8]) -> Self

Source§

impl FromBytes for i8

Source§

const N: usize = 1usize

Source§

fn from_be_bytes(bytes: [u8; 1]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 1]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 1]) -> Self

Source§

impl FromBytes for i16

Source§

const N: usize = 2usize

Source§

fn from_be_bytes(bytes: [u8; 2]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 2]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 2]) -> Self

Source§

impl FromBytes for i32

Source§

const N: usize = 4usize

Source§

fn from_be_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 4]) -> Self

Source§

impl FromBytes for i64

Source§

const N: usize = 8usize

Source§

fn from_be_bytes(bytes: [u8; 8]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 8]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 8]) -> Self

Source§

impl FromBytes for i128

Source§

const N: usize = 16usize

Source§

fn from_be_bytes(bytes: [u8; 16]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 16]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 16]) -> Self

Source§

impl FromBytes for isize

Source§

const N: usize = 4usize

Source§

fn from_be_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 4]) -> Self

Source§

impl FromBytes for u8

Source§

const N: usize = 1usize

Source§

fn from_be_bytes(bytes: [u8; 1]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 1]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 1]) -> Self

Source§

impl FromBytes for u16

Source§

const N: usize = 2usize

Source§

fn from_be_bytes(bytes: [u8; 2]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 2]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 2]) -> Self

Source§

impl FromBytes for u32

Source§

const N: usize = 4usize

Source§

fn from_be_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 4]) -> Self

Source§

impl FromBytes for u64

Source§

const N: usize = 8usize

Source§

fn from_be_bytes(bytes: [u8; 8]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 8]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 8]) -> Self

Source§

impl FromBytes for u128

Source§

const N: usize = 16usize

Source§

fn from_be_bytes(bytes: [u8; 16]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 16]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 16]) -> Self

Source§

impl FromBytes for usize

Source§

const N: usize = 4usize

Source§

fn from_be_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_le_bytes(bytes: [u8; 4]) -> Self

Source§

fn from_ne_bytes(bytes: [u8; 4]) -> Self

Implementors§