Enum rustc_index::bit_set::Chunk
source · Variants§
Zeros(u16)
A chunk that is all zeros; we don’t represent the zeros explicitly.
Ones(u16)
A chunk that is all ones; we don’t represent the ones explicitly.
Mixed(u16, u16, Rc<[u64; 32]>)
A chunk that has a mix of zeros and ones, which are represented explicitly and densely. It never has all zeros or all ones.
If this is the final chunk there may be excess, unused words. This turns out to be both simpler and have better performance than allocating the minimum number of words, largely because we avoid having to store the length, which would make this type larger. These excess words are always be zero, as are any excess bits in the final in-use word.
The second field is the count of 1s set in the chunk, and must satisfy
0 < count < chunk_domain_size
.
The words are within an Rc
because it’s surprisingly common to
duplicate an entire chunk, e.g. in ChunkedBitSet::clone_from()
, or
when a Mixed
chunk is union’d into a Zeros
chunk. When we do need
to modify a chunk we use Rc::make_mut
.
Implementations§
Trait Implementations§
impl Eq for Chunk
impl StructuralEq for Chunk
impl StructuralPartialEq for Chunk
Auto Trait Implementations§
impl RefUnwindSafe for Chunk
impl !Send for Chunk
impl !Sync for Chunk
impl Unpin for Chunk
impl UnwindSafe for Chunk
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes
Size for each variant:
Zeros
: 2 bytesOnes
: 2 bytesMixed
: 14 bytes