Trait BitCollector

Source
pub trait BitCollector: Sized {
    // Required method
    fn collect_bits(self) -> (Vec<u8>, usize);

    // Provided method
    fn try_collect_bytes(self) -> Result<Vec<u8>, &'static str> { ... }
}
Expand description

Functionality for Boolean iterators to collect their bits or bytes.

Required Methods§

Source

fn collect_bits(self) -> (Vec<u8>, usize)

Collect the bits of the iterator into a byte vector and a bit length.

Provided Methods§

Source

fn try_collect_bytes(self) -> Result<Vec<u8>, &'static str>

Try to collect the bits of the iterator into a clean byte vector.

This fails if the number of bits is not divisible by 8.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I: Iterator<Item = bool>> BitCollector for I