rose_bitsets/
lib.rs

1#![doc = include_str!("../README.md")]
2use rose_bitset_derive::BitSet;
3
4/// A set of 8 bits.
5#[cfg(feature = "b8")]
6#[derive(BitSet, Clone, Copy, Default, Eq, Hash, PartialEq)]
7#[bitset(debug, indices, iter, tests)]
8pub struct BitSet8(u8);
9
10/// A set of 16 bits.
11#[cfg(feature = "b16")]
12#[derive(BitSet, Clone, Copy, Default, Eq, Hash, PartialEq)]
13#[bitset(debug, indices, iter, tests)]
14pub struct BitSet16(u16);
15
16/// A set of 32 bits.
17#[cfg(feature = "b32")]
18#[derive(BitSet, Clone, Copy, Default, Eq, Hash, PartialEq)]
19#[bitset(debug, indices, iter, tests)]
20pub struct BitSet32(u32);
21
22/// A set of 64 bits.
23#[cfg(feature = "b64")]
24#[derive(BitSet, Clone, Copy, Default, Eq, Hash, PartialEq)]
25#[bitset(debug, indices, iter, tests)]
26pub struct BitSet64(u64);
27
28/// A set of 128 bits.
29#[cfg(feature = "b128")]
30#[derive(BitSet, Clone, Copy, Default, Eq, Hash, PartialEq)]
31#[bitset(debug, indices, iter, tests)]
32pub struct BitSet128(u128);
33
34/// A bitset the length of a pointer.
35///
36/// I doubt there's a good use for a type like this, but it's here for the sake of completeness
37/// (though it is locked behind a feature flag that's disabled by default).
38#[cfg(feature = "bsize")]
39#[derive(BitSet, Clone, Copy, Default, Eq, Hash, PartialEq)]
40#[bitset(debug, indices, iter, tests)]
41pub struct BitSetSize(usize);
42
43/// An iteration order that starts with the smallest end/items and ends with the largest.
44pub struct Ascending;
45
46/// An iteration order that starts with the largest end/items and ends with the smallest.
47pub struct Descending;