33
I'd suggest using the byteorder crate (which also works in a no-std environment): use byteorder::{BigEndian, ReadBytesExt}; // 1.2.7 fn main() { let mut buf: &[u8] = &[0, 0, 0, 1]; let num = buf.read_u32::<BigEndian>().unwrap(); assert_eq!(1, num); } This handles oddly-sized slic...