Struct forest_bitfield::BitField
source · [−]pub struct BitField { /* private fields */ }
Expand description
A bit field with buffered insertion/removal that serializes to/from RLE+. Similar to
HashSet<usize>
, but more memory-efficient when long runs of 1s and 0s are present.
Implementations
Creates a new bit field from a RangeIterator
.
Returns true
if the bit field contains the bit at a given index.
Returns the index of the lowest bit present in the bit field.
Returns the index of the highest bit present in the bit field. Errors if no bits are set. Merges set/unset into ranges, so be cautious with use if set is pretty populated
Returns an iterator over the indices of the bit field’s set bits.
Returns an iterator over the indices of the bit field’s set bits if the number
of set bits in the bit field does not exceed max
. Returns an error otherwise.
Returns an iterator over the ranges of set bits that make up the bit field. The ranges are in ascending order, are non-empty, and don’t overlap.
Returns a slice of the bit field with the start index of set bits
and number of bits to include in the slice. Returns an error if the
bit field contains fewer than start + len
set bits.
Returns a new bit field containing the bits in self
that remain
after “cutting” out the bits in other
, and shifting remaining
bits to the left if necessary. For example:
lhs: xx-xxx--x
rhs: -xx-x----
cut: x x x--x
output: xxx--x
Returns the union of the given bit fields as a new bit field.
Returns true if self
overlaps with other
.
Returns true if the self
is a superset of other
.
Trait Implementations
Performs the &=
operation. Read more
Performs the |=
operation. Read more
Performs the ^=
operation. Read more
Deserialize this value from the given Serde deserializer. Read more
Creates a value from an iterator. Read more
Creates a value from an iterator. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for BitField
impl UnwindSafe for BitField
Blanket Implementations
Mutably borrows from an owned value. Read more