#bit-set #stores #backing #supporting #multiple #bs

no-std bitarr

A fast and efficient Rust implementation of a BitSet, supporting multiple backing stores

3 unstable releases

0.2.0 Feb 4, 2023
0.1.2 Feb 4, 2023
0.1.1 Jan 29, 2023

#1037 in Data structures

Download history 27/week @ 2024-01-01 13/week @ 2024-01-08 29/week @ 2024-02-19 10/week @ 2024-02-26 8/week @ 2024-03-04 22/week @ 2024-03-11

69 downloads per month
Used in cargo-featurex

MIT license

41KB
969 lines

BitArr

Crates.io docs.rs

A fast and efficient Rust implementation of a BitSet, supporting multiple backing stores.

Usage

To use BitArr in your project, add the following to your Cargo.toml:

[dependencies]
bitarr = "0"

Example

use bitarr::BitSet;

let mut bs = BitSet::from(0u16);
bs.set(3);
bs.set(7);

assert_eq!(bs.get(3), Some(true));
assert_eq!(bs.get(7), Some(true));
assert_eq!(bs.get(2), Some(false));

Documentation

API documentation can be found on docs.rs.

License

BitArr is distributed under the terms of the MIT license.

See LICENSE for details.


lib.rs:

BitSet

A compact data structure for storing bits.

The BitSet struct is a low-level data structure that stores a sequence of bits and provides methods for accessing and manipulating those bits.

It supports operations such as setting and clearing individual bits, and computing the union and intersection of two bit sets.

Examples

let mut bs = BitSet::from(0u8);

bs.set(3);
bs.set(7);

assert_eq!(bs.get(3), Some(true));
assert_eq!(bs.get(7), Some(true));
assert_eq!(bs.get(2), Some(false));

No runtime deps

Features