pub fn encode<T: PartialEq + Default + Copy + Encoder<T>, W: Write, I: Iterator<Item = T>>( writer: &mut W, iterator: I, num_bits: u32, ) -> Result<()>