RLEBits

Trait RLEBits 

Source
pub trait RLEBits {
    // Required methods
    fn get_bit(&self, bit: usize) -> Result<bool, OutOfRange>;
    fn set_bit(&mut self, bit: usize, value: bool) -> Result<(), OutOfRange>;
    fn run_lengths<'a, R: RangeBounds<usize>>(
        &'a self,
        range: R,
    ) -> Result<RLE<'a>, OutOfRange>;
}
Expand description

A trait that allows reading, setting and iterating bits by their run lengths.

Required Methods§

Source

fn get_bit(&self, bit: usize) -> Result<bool, OutOfRange>

Gets the bit at the provided index, if it is within range.

Source

fn set_bit(&mut self, bit: usize, value: bool) -> Result<(), OutOfRange>

Sets the bit at the provided index, if it is within range.

Source

fn run_lengths<'a, R: RangeBounds<usize>>( &'a self, range: R, ) -> Result<RLE<'a>, OutOfRange>

Returns an iterator over run lengths of the bits within the provided range.

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.

Implementations on Foreign Types§

Source§

impl RLEBits for [usize]

Source§

fn get_bit(&self, bit: usize) -> Result<bool, OutOfRange>

Source§

fn set_bit(&mut self, bit: usize, value: bool) -> Result<(), OutOfRange>

Source§

fn run_lengths<'a, R: RangeBounds<usize>>( &'a self, range: R, ) -> Result<RLE<'a>, OutOfRange>

Implementors§