Trait num_bytes::TryFromBytes[][src]

pub trait TryFromBytes: Sized {
    fn try_from_le_bytes(bytes: &[u8]) -> Result<Self, TryFromSliceError>;
fn try_from_be_bytes(bytes: &[u8]) -> Result<Self, TryFromSliceError>; }
Expand description

Defines a type can be converted from a byte slice.

use num_bytes::TryFromBytes;
let a = [8,0,0,0];
let b = u32::try_from_le_bytes(&a).unwrap();
assert_eq!(b,8);

Required methods

Implementations on Foreign Types

Implementors