Module boolean_list

Module boolean_list 

Source
Expand description

§Boolean List Implementation

Provides a straightforward BitArray implementation using a Vec<bool> for storage. This implementation prioritizes simplicity and debugging ease over memory efficiency.

§Overview

BoolBitArray stores each bit as a separate boolean value in a vector, making bit manipulation operations straightforward but using more memory than packed bit representations.

§Characteristics

  • Memory usage: 1 byte per bit (8x overhead compared to packed storage)
  • Performance: Fast individual bit access and modification
  • Debugging: Easy to inspect and understand bit patterns
  • Simplicity: Straightforward implementation of BitArray trait

§Use Cases

Best suited for:

  • Development and debugging where clarity is important
  • Applications where memory usage is not critical
  • Frequent individual bit access operations

§Examples

use flexfloat::bitarray::{BitArray, BoolBitArray};

let mut bits = BoolBitArray::from_bits(&[true, false, true]);
bits[1] = true;  // Direct bit modification
assert_eq!(bits[1], true);

// Range operations
let sub_range = bits.get_range(0..2).unwrap();
assert_eq!(sub_range.to_bits(), vec![true, true]);

Structs§

BoolBitArray
A BitArray implementation using Vec<bool> for bit storage.