Function vec_i8

Source
pub fn vec_i8(bits: &Bits) -> Vec<i8>
Expand description

Converts a bit string to a vector of 8 bit signed integers.

If the length of the the bit string is not divisible by 8 it is sign-extended to the next length that is. Then it is converted.

ยงExample

let bits = Bits::new([0x10, 0xFE]);
let ibytes = bits_as::vec_i8(&bits);

assert_eq!(ibytes.len(), 2);
assert_eq!(ibytes, vec![0x10, 0xFEu8 as i8]);

let bits = Bits::from([0x10, 0x5E]);
let ibytes = bits_as::vec_i8(&bits);

assert_eq!(ibytes.len(), 2);
assert_eq!(ibytes, vec![0x10, 0xDEu8 as i8]);