pub fn array_to_unsigned<T>(parts: &[u8]) -> Result<T>Expand description
Join a Vec of u8s into an unsigned integer
Say you have the array [0b00000110, 0b10110101] and want to use it as a u32.
This function sets it together to a integer type of your choosing:
1717 (binary: 00000000 00000000 00000110 10110101).
If the array is not long enough, the number will be padded with null bytes.
ยงExamples
let x: [u8; 2] = [0b00000110, 0b10110101];
assert_eq!(array_to_unsigned::<u32>(&x).unwrap(), 1717);