u32 has built-in methods to convert from u8 buffers:
u32
u8
fn main() { let buf = [0, 0, 0, 1]; let num = u32::from_be_bytes(buf); assert_eq!(1, num); }
source