nybbles

Function pack_to

Source
pub fn pack_to(nibbles: &[u8], out: &mut [u8])
Expand description

Packs the nibbles into the given slice.

See Nibbles::pack for more information.

§Panics

Panics if the slice is not at least (self.len() + 1) / 2 bytes long.

§Examples

let nibbles = Nibbles::from_nibbles(&[0x0A, 0x0B, 0x0C, 0x0D]);
let mut packed = [0; 2];
nibbles.pack_to(&mut packed);
assert_eq!(packed[..], [0xAB, 0xCD]);