enum Chunk {
Zeros(u16),
Ones(u16),
Mixed(u16, u16, Rc<[u64; 32]>),
}
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 StructuralPartialEq for Chunk
Auto Trait Implementations§
impl Freeze for Chunk
impl RefUnwindSafe for Chunk
impl !Send for Chunk
impl !Sync for Chunk
impl Unpin for Chunk
impl UnwindSafe for Chunk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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