Struct sux::bits::bit_vec::CountBitVec

source ·
pub struct CountBitVec<B = Vec<usize>> { /* private fields */ }
Expand description

An immutable bit vector with a constant-time implementation of BitCount.

Implementations§

source§

impl<B> CountBitVec<B>

source

pub unsafe fn from_raw_parts(data: B, len: usize, number_of_ones: usize) -> Self

§Safety

len must be between 0 (included) the number of bits in data (included). No test is performed on the number of ones.

source

pub fn into_raw_parts(self) -> (B, usize, usize)

source§

impl<B: AsRef<[usize]>> CountBitVec<B>

source

pub fn get(&self, index: usize) -> bool

Trait Implementations§

source§

impl<B: AsRef<[usize]>> AsRef<[usize]> for CountBitVec<B>

source§

fn as_ref(&self) -> &[usize]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<B> BitCount for CountBitVec<B>

source§

fn count(&self) -> usize

Return the number of ones in the underlying bit vector.
source§

impl<B> BitLength for CountBitVec<B>

source§

fn len(&self) -> usize

Return the length in bits of the underlying bit vector.
source§

impl<B: Clone> Clone for CountBitVec<B>

source§

fn clone(&self) -> CountBitVec<B>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<B> ConvertTo<BitVec<B>> for CountBitVec<B>

Forget the number of ones.

source§

impl<B, D> ConvertTo<CountBitVec<D>> for CountBitVec<B>
where B: ConvertTo<D>,

Provide conversion betweeen bit vectors whose backends are convertible into one another.

Many implementations of this trait are then used to implement by delegation a corresponding From.

source§

impl ConvertTo<CountBitVec> for BitVec<Vec<usize>>

Compute the number of ones and return a CountBitVec.

source§

impl<B> CopyType for CountBitVec<B>

§

type Copy = Deep

source§

impl<B> CopyType for CountBitVec<B>
where B: MemSize, usize: MemSize,

§

type Copy = False

source§

impl<B: Debug> Debug for CountBitVec<B>

source§

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

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

impl<B> DeserializeInner for CountBitVec<B>

source§

fn _deserialize_full_inner( backend: &mut impl ReadWithPos ) -> Result<Self, Error>

§

type DeserType<'epserde_desertype> = CountBitVec<<B as DeserializeInner>::DeserType<'epserde_desertype>>

The deserialization type associated with this type. It can be retrieved conveniently with the alias DeserType.
source§

fn _deserialize_eps_inner<'a>( backend: &mut SliceWithPos<'a> ) -> Result<Self::DeserType<'a>, Error>

source§

impl From<BitVec> for CountBitVec<Vec<usize>>

Compute the number of ones and return a CountBitVec.

source§

fn from(bitmap: BitVec<Vec<usize>>) -> Self

Converts to this type from the input type.
source§

impl<B> From<CountBitVec<B>> for BitVec<B>

Forget the number of ones.

source§

fn from(cb: CountBitVec<B>) -> Self

Converts to this type from the input type.
source§

impl<B: AsRef<[usize]>> Index<usize> for CountBitVec<B>

§

type Output = bool

The returned type after indexing.
source§

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

Performs the indexing (container[index]) operation. Read more
source§

impl<B> MemDbgImpl for CountBitVec<B>

source§

fn _mem_dbg_rec_on( &self, _memdbg_writer: &mut impl Write, _memdbg_total_size: usize, _memdbg_max_depth: usize, _memdbg_prefix: &mut String, _memdbg_is_last: bool, _memdbg_flags: DbgFlags ) -> Result

source§

impl<B> MemSize for CountBitVec<B>
where B: MemSize, usize: MemSize,

source§

fn mem_size(&self, _memsize_flags: SizeFlags) -> usize

Return the (recursively computed) overall memory size of the structure in bytes.
source§

impl<B: ReprHash> ReprHash for CountBitVec<B>

source§

fn repr_hash(hasher: &mut impl Hasher, offset_of: &mut usize)

Accumulate representional information in hasher assuming to be positioned at offset_of.
source§

fn repr_hash_val(&self, hasher: &mut impl Hasher, offset_of: &mut usize)

Call ReprHash::repr_hash on a value.
source§

impl<B: AsRef<[usize]>> Select for CountBitVec<B>

source§

unsafe fn select_unchecked(&self, rank: usize) -> usize

Return the position of the one of given rank. Read more
source§

fn select(&self, rank: usize) -> Option<usize>

Return the position of the one of given rank, or None if no such bit exist.
source§

impl<B: AsRef<[usize]>> SelectHinted for CountBitVec<B>

source§

unsafe fn select_hinted_unchecked( &self, rank: usize, pos: usize, rank_at_pos: usize ) -> usize

Select the one of given rank, provided the position of a preceding one and its rank. Read more
source§

fn select_hinted( &self, rank: usize, pos: usize, rank_at_pos: usize ) -> Option<usize>

Select the one of given rank, provided the position of a preceding one and its rank.
source§

impl<B: AsRef<[usize]>> SelectZero for CountBitVec<B>

source§

unsafe fn select_zero_unchecked(&self, rank: usize) -> usize

Return the position of the zero of given rank. Read more
source§

fn select_zero(&self, rank: usize) -> Option<usize>

Return the position of the zero of given rank, or None if no such bit exist.
source§

impl<B: AsRef<[usize]>> SelectZeroHinted for CountBitVec<B>

source§

unsafe fn select_zero_hinted_unchecked( &self, rank: usize, pos: usize, rank_at_pos: usize ) -> usize

Select the zero of given rank, provided the position of a preceding zero and its rank. Read more
source§

fn select_zero_hinted( &self, rank: usize, pos: usize, rank_at_pos: usize ) -> Option<usize>

Select the zero of given rank, provided the position of a preceding zero and its rank.
source§

impl<B> SerializeInner for CountBitVec<B>

source§

const IS_ZERO_COPY: bool = _

Inner constant used by the derive macros to keep track recursively of whether the type satisfies the conditions for being zero-copy. It is checked at runtime against the trait implemented by the type, and if a ZeroCopy type has this constant set to false serialization will panic.
source§

const ZERO_COPY_MISMATCH: bool = _

Inner constant used by the derive macros to keep track of whether all fields of a type are zero-copy but neither the attribute #[zero_copy] nor the attribute #[deep_copy] was specified. It is checked at runtime, and if it is true a warning will be issued, as the type could be zero-copy, which would be more efficient.
source§

fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>

Serialize this structure using the given backend.
source§

impl<B: TypeHash> TypeHash for CountBitVec<B>

source§

fn type_hash(hasher: &mut impl Hasher)

Accumulate type information in hasher.
source§

fn type_hash_val(&self, hasher: &mut impl Hasher)

Call TypeHash::type_hash on a value.

Auto Trait Implementations§

§

impl<B> Freeze for CountBitVec<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for CountBitVec<B>
where B: RefUnwindSafe,

§

impl<B> Send for CountBitVec<B>
where B: Send,

§

impl<B> Sync for CountBitVec<B>
where B: Sync,

§

impl<B> Unpin for CountBitVec<B>
where B: Unpin,

§

impl<B> UnwindSafe for CountBitVec<B>
where B: 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> BitFieldSlice<usize> for T
where T: AsRef<[usize]>,

source§

unsafe fn get_unchecked(&self, index: usize) -> usize

Return the value at the specified index. Read more
source§

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

Return the value at the specified index. Read more
source§

impl<T> BitFieldSliceCore<usize> for T
where T: AsRef<[usize]>,

source§

fn bit_width(&self) -> usize

Return the width of the slice. All elements stored in the slice must fit within this bit width.
source§

fn len(&self) -> usize

Return the length of the slice.
source§

fn is_empty(&self) -> bool

Return if the slice has length zero
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> 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> CastableFrom<T> for T

source§

fn cast_from(value: T) -> T

Call Self as W
source§

impl<T, U> CastableInto<U> for T
where U: CastableFrom<T>,

source§

fn cast(self) -> U

Call W::cast_from(self)
source§

impl<B, const LOG2_ONES_PER_INVENTORY: usize> ConvertTo<SelectFixed1<B, Vec<usize>, LOG2_ONES_PER_INVENTORY>> for B
where B: SelectHinted + BitCount + AsRef<[usize]>,

source§

fn convert_to( self ) -> Result<SelectFixed1<B, Vec<usize>, LOG2_ONES_PER_INVENTORY>, Error>

source§

impl<B, const LOG2_ONES_PER_INVENTORY: usize, const LOG2_U64_PER_SUBINVENTORY: usize> ConvertTo<SelectFixed2<B, Vec<u64>, LOG2_ONES_PER_INVENTORY, LOG2_U64_PER_SUBINVENTORY>> for B

source§

fn convert_to( self ) -> Result<SelectFixed2<B, Vec<u64>, LOG2_ONES_PER_INVENTORY, LOG2_U64_PER_SUBINVENTORY>, Error>

source§

impl<B, const LOG2_ZEROS_PER_INVENTORY: usize> ConvertTo<SelectZeroFixed1<B, Vec<usize>, LOG2_ZEROS_PER_INVENTORY>> for B

source§

fn convert_to( self ) -> Result<SelectZeroFixed1<B, Vec<usize>, LOG2_ZEROS_PER_INVENTORY>, Error>

source§

impl<B, const LOG2_ZEROS_PER_INVENTORY: usize, const LOG2_U64_PER_SUBINVENTORY: usize> ConvertTo<SelectZeroFixed2<B, Vec<u64>, LOG2_ZEROS_PER_INVENTORY, LOG2_U64_PER_SUBINVENTORY>> for B

source§

fn convert_to( self ) -> Result<SelectZeroFixed2<B, Vec<u64>, LOG2_ZEROS_PER_INVENTORY, LOG2_U64_PER_SUBINVENTORY>, Error>

source§

impl<T> Deserialize for T

source§

fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>

Fully deserialize a structure of this type from the given backend.
source§

fn deserialize_eps( backend: &[u8] ) -> Result<<T as DeserializeInner>::DeserType<'_>, Error>

ε-copy deserialize a structure of this type from the given backend.
source§

fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>

Commodity method to fully deserialize from a file.
source§

fn load_mem<'a>( path: impl AsRef<Path> ) -> Result<MemCase<Self::DeserType<'a>>, Error>

Load a file into heap-allocated memory and ε-deserialize a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
source§

fn load_mmap<'a>( path: impl AsRef<Path>, flags: Flags ) -> Result<MemCase<Self::DeserType<'a>>, Error>

Load a file into mmap()-allocated memory and ε-deserialize a data structure from it, returning a MemCase containing the data structure and the memory. Excess bytes are zeroed out. Read more
source§

fn mmap<'a>( path: impl AsRef<Path>, flags: Flags ) -> Result<MemCase<Self::DeserType<'a>>, Error>

Memory map a file and ε-deserialize a data structure from it, returning a MemCase containing the data structure and the memory mapping. Read more
source§

impl<T> DowncastableFrom<T> for T

source§

fn downcast_from(value: T) -> T

Truncate the current UnsignedInt to a possibly smaller size
source§

impl<T, U> DowncastableInto<U> for T
where U: DowncastableFrom<T>,

source§

fn downcast(self) -> U

Call W::downcast_from(self)
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> MemDbg for T
where T: MemDbgImpl,

source§

fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>

Write to stdout debug infos about the structure memory usage, expanding all levels of nested structures.
source§

fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags ) -> Result<(), Error>

Write to a core::fmt::Write debug infos about the structure memory usage, expanding all levels of nested structures.
source§

fn mem_dbg_depth( &self, total_size: usize, max_depth: usize, flags: DbgFlags ) -> Result<(), Error>

Write to stdout debug infos about the structure memory usage, but expanding only up to max_depth levels of nested structures.
source§

fn mem_dbg_depth_on( &self, writer: &mut impl Write, total_size: usize, max_depth: usize, prefix: &mut String, field_name: Option<&str>, is_last: bool, flags: DbgFlags ) -> Result<(), Error>

Write to a core::fmt::Write debug infos about the structure memory usage, but expanding only up to max_depth levels of nested structures.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Serialize for T

source§

fn serialize_on_field_write( &self, backend: &mut impl WriteWithNames ) -> Result<(), Error>

Serialize the type using the given WriteWithNames.

source§

fn serialize(&self, backend: &mut impl WriteNoStd) -> Result<usize, Error>

Serialize the type using the given backend.
source§

fn serialize_with_schema( &self, backend: &mut impl WriteNoStd ) -> Result<Schema, Error>

Serialize the type using the given backend and return a schema describing the data that has been written. Read more
source§

fn store(&self, path: impl AsRef<Path>) -> Result<(), Error>

Commodity method to serialize to a file.
source§

impl<T> Splat<T> for T

source§

fn splat(value: T) -> T

source§

impl<T> To<T> for T

source§

fn to(self) -> T

source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> UpcastableFrom<T> for T

source§

fn upcast_from(value: T) -> T

Extend the current UnsignedInt to a possibly bigger size.
source§

impl<T, U> UpcastableInto<U> for T
where U: UpcastableFrom<T>,

source§

fn upcast(self) -> U

Call W::upcast_from(self)
source§

impl<T> DeepCopy for T
where T: CopyType<Copy = Deep>,