Trait num_bytes::FromBytes[][src]

pub trait FromBytes<const T: usize>: Sized {
    fn from_le_bytes(bytes: [u8; T]) -> Self;
fn from_be_bytes(bytes: [u8; T]) -> Self; }
Expand description

Defines a type can be converted from a bytes array.

use num_bytes::FromBytes;
let a = [8,0,0,0];
let b = i32::from_le_bytes(a);
assert_eq!(b, 8);

isize and usize implementations compile to implement FromBytes<2>, FromBytes<4> or FromBytes<8> depending on your system.

It simply says FromBytes<8> in documentation because the machine which has compiled the documentation is 64 bit.

Required methods

Implementations on Foreign Types

Implementors