Skip to main content

Bools

Struct Bools 

Source
pub struct Bools<VC = Vec<u64>, TC = [u64; 2]> {
    pub values: VC,
    pub tail: TC,
}
Expand description

A store for maintaining Vec<bool>.

Packed bits are stored in values as complete u64 words. The tail holds [last_word, last_bits]: the partial word being filled and the count of valid bits in it. In the owned form tail is [u64; 2]; in the borrowed form it is &[u64] of length 2.

Fields§

§values: VC

The bundles of bits that form complete u64 values.

§tail: TC

[last_word, last_bits]: the partial word and the number of valid bits in it.

Implementations§

Source§

impl<VC: Len + IndexAs<u64>, TC: IndexAs<u64>> Bools<VC, TC>

Source

pub fn bits_at(&self, pos: usize, count: usize) -> u64

Reads count bits (at most 64) starting at bit pos, into the low bits of the result.

Bits at positions count and above in the result are zero.

Source§

impl<VC: for<'a> Push<&'a u64>> Bools<VC>

Source

pub fn push_bits(&mut self, bits: u64, count: usize)

Appends the low count bits of bits, for count at most 64.

Bits at positions count and above in bits must be zero.

Source

pub fn extend_bits_from<VC2: Len + IndexAs<u64>, TC2: IndexAs<u64>>( &mut self, other: &Bools<VC2, TC2>, range: Range<usize>, )

Appends the bits of other in range, a word at a time.

Trait Implementations§

Source§

impl<'a, VC: AsBytes<'a>> AsBytes<'a> for Bools<VC, &'a [u64]>

Source§

const SLICE_COUNT: usize

The number of byte slices this type produces.
Source§

fn get_byte_slice(&self, index: usize) -> (u64, &'a [u8])

Returns the index-th byte slice (alignment, data) by random access. Read more
Source§

fn as_bytes(&self) -> impl Iterator<Item = (u64, &'a [u8])>

Presents self as a sequence of byte slices, with their required alignment. Read more
Source§

impl<VC: BorrowIndexAs<u64>> Borrow for Bools<VC>

Source§

type Ref<'a> = bool

For each lifetime, a reference with that lifetime. Read more
Source§

type Borrowed<'a> = Bools<<VC as Borrow>::Borrowed<'a>, &'a [u64]> where VC: 'a

The type of a borrowed container. Read more
Source§

fn borrow<'a>(&'a self) -> Self::Borrowed<'a>

Converts a reference to the type to a borrowed variant. Read more
Source§

fn reborrow<'b, 'a: 'b>(thing: Self::Borrowed<'a>) -> Self::Borrowed<'b>
where VC: 'a,

Reborrows the borrowed type to a shorter lifetime. See Columnar::reborrow for details.
Source§

fn reborrow_ref<'b, 'a: 'b>(thing: Self::Ref<'a>) -> Self::Ref<'b>
where Self: 'a,

Reborrows the borrowed type to a shorter lifetime. See Columnar::reborrow for details.
Source§

impl<VC: Clear> Clear for Bools<VC>

Source§

fn clear(&mut self)

Clears self, without changing its capacity.
Source§

impl<VC: Clone, TC: Clone> Clone for Bools<VC, TC>

Source§

fn clone(&self) -> Bools<VC, TC>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<VC: PushIndexAs<u64>> Container for Bools<VC>

Source§

fn extend_from_self(&mut self, other: Self::Borrowed<'_>, range: Range<usize>)

Extends self by a range in other. Read more
Source§

fn reserve_for<'a, I>(&mut self, selves: I)
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Source§

fn with_capacity_for<'a, I>(selves: I) -> Self
where Self: 'a, I: Iterator<Item = Self::Borrowed<'a>> + Clone,

Allocates an empty container that can be extended by selves without reallocation. Read more
Source§

impl<VC: Copy, TC: Copy> Copy for Bools<VC, TC>

Source§

impl<VC: Debug, TC: Debug> Debug for Bools<VC, TC>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<VC: Default, TC: Default> Default for Bools<VC, TC>

Source§

fn default() -> Bools<VC, TC>

Returns the “default value” for a type. Read more
Source§

impl<'a, VC: FromBytes<'a>> FromBytes<'a> for Bools<VC, &'a [u64]>

Source§

const SLICE_COUNT: usize

The number of byte slices this type consumes when reconstructed.
Source§

fn from_bytes(bytes: &mut impl Iterator<Item = &'a [u8]>) -> Self

Reconstructs self from a sequence of correctly aligned and sized bytes slices. Read more
Source§

fn from_store(store: &DecodedStore<'a>, offset: &mut usize) -> Self

Reconstructs self from a DecodedStore, using direct random access at a given offset. Read more
Source§

fn element_sizes(sizes: &mut Vec<usize>) -> Result<(), String>

Reports the element sizes (in bytes) for each slice this type consumes. Read more
Source§

fn validate(slices: &[(&[u64], u8)]) -> Result<(), String>

Validates that the given slices are compatible with this type. Read more
Source§

impl<VC: Len + IndexAs<u64>, TC: IndexAs<u64>> Index for Bools<VC, TC>

Source§

type Ref = bool

The type returned by the get method. Read more
Source§

fn get(&self, index: usize) -> Self::Ref

Returns the reference type for location index. Read more
Source§

fn last(&self) -> Option<Self::Ref>
where Self: Len,

Source§

fn index_iter(&self) -> IterOwn<&Self> ⓘ

Converts &self into an iterator. Read more
Source§

fn into_index_iter(self) -> IterOwn<Self> ⓘ
where Self: Sized,

Converts self into an iterator. Read more
Source§

impl<VC: Len + IndexAs<u64>, TC: IndexAs<u64>> Index for &Bools<VC, TC>

Source§

type Ref = bool

The type returned by the get method. Read more
Source§

fn get(&self, index: usize) -> Self::Ref

Returns the reference type for location index. Read more
Source§

fn last(&self) -> Option<Self::Ref>
where Self: Len,

Source§

fn index_iter(&self) -> IterOwn<&Self> ⓘ

Converts &self into an iterator. Read more
Source§

fn into_index_iter(self) -> IterOwn<Self> ⓘ
where Self: Sized,

Converts self into an iterator. Read more
Source§

impl<VC: Len, TC: IndexAs<u64>> Len for Bools<VC, TC>

Source§

fn len(&self) -> usize

The number of contained elements.
Source§

fn is_empty(&self) -> bool

Whether this contains no elements.
Source§

impl<VC: PartialEq, TC: PartialEq> PartialEq for Bools<VC, TC>

Source§

fn eq(&self, other: &Bools<VC, TC>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a, VC: for<'b> Push<&'b u64>> Push<&'a bool> for Bools<VC>

Source§

fn push(&mut self, bit: &'a bool)

Pushes an item onto self.
Source§

fn extend(&mut self, iter: impl IntoIterator<Item = T>)

Pushes elements of an iterator onto self.
Source§

impl<VC: for<'a> Push<&'a u64>> Push<bool> for Bools<VC>

Source§

fn push(&mut self, bit: bool)

Pushes an item onto self.
Source§

fn extend(&mut self, iter: impl IntoIterator<Item = T>)

Pushes elements of an iterator onto self.
Source§

impl<VC: PartialEq, TC: PartialEq> StructuralPartialEq for Bools<VC, TC>

Auto Trait Implementations§

§

impl<VC, TC> Freeze for Bools<VC, TC>
where VC: Freeze, TC: Freeze,

§

impl<VC, TC> RefUnwindSafe for Bools<VC, TC>

§

impl<VC, TC> Send for Bools<VC, TC>
where VC: Send, TC: Send,

§

impl<VC, TC> Sync for Bools<VC, TC>
where VC: Sync, TC: Sync,

§

impl<VC, TC> Unpin for Bools<VC, TC>
where VC: Unpin, TC: Unpin,

§

impl<VC, TC> UnsafeUnpin for Bools<VC, TC>
where VC: UnsafeUnpin, TC: UnsafeUnpin,

§

impl<VC, TC> UnwindSafe for Bools<VC, TC>
where VC: UnwindSafe, TC: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T, C> BorrowIndexAs<T> for C
where C: for<'a> Borrow, <C as Borrow>::Ref<'a>: for<'a> CopyAs<T>,

Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<C> ContainerBytes for C
where C: Container + for<'a> Borrow, <C as Borrow>::Borrowed<'a>: for<'a> AsBytes<'a> + for<'a> FromBytes<'a>,

Source§

impl<T> CopyAs<T> for T
where T: Copy,

Source§

fn copy_as(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, S> IndexAs<S> for T
where T: Index, <T as Index>::Ref: CopyAs<S>,

Source§

fn index_as(&self, index: usize) -> S

Source§

fn last(&self) -> Option<T>
where Self: Len,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, C> PushIndexAs<T> for C
where C: BorrowIndexAs<T> + Container + for<'a> Push<&'a T>,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.