Function scale_bits::scale::encode_using_format_to
source · pub fn encode_using_format_to<I: ExactSizeIterator<Item = bool>>(
it: I,
format: Format,
out: &mut Vec<u8>
)
Expand description
SCALE encode an iterator of booleans with a known size into a bit sequence using the given format.
Example
use scale_bits::scale::{
encode_using_format_to,
format::{ Format, StoreFormat, OrderFormat },
};
let bits = vec![true, true, false, true];
let mut encoded = Vec::new();
encode_using_format_to(
bits.into_iter(),
Format::new(StoreFormat::U8, OrderFormat::Msb0),
&mut encoded
);