Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 318 Bytes

u32-from-u8-buffer.md

File metadata and controls

14 lines (10 loc) · 318 Bytes

u32 from u8 buffer

u32 has built-in methods to convert from u8 buffers:

fn main() {
    let buf = [0, 0, 0, 1];
    let num = u32::from_be_bytes(buf);

    assert_eq!(1, num);
}

source