Struct sux::bits::bit_vec::BitVec

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

A bit vector.

Implementations§

source§

impl BitVec<Vec<usize>>

source

pub fn new(len: usize) -> Self

Create a new bit vector of length len.

source

pub fn capacity(&self) -> usize

source

pub fn push(&mut self, b: bool)

source

pub fn extend(&mut self, i: impl IntoIterator<Item = bool>)

source

pub fn resize(&mut self, new_len: usize, value: bool)

source§

impl<B> BitVec<B>

source

pub fn len(&self) -> usize

Return the number of bits in this bit vector.

source

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

§Safety

len must be between 0 (included) the number of bits in data (included).

source

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

source§

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

source

pub fn count_ones(&self) -> usize

Return the number of bits set to 1 in this bit vector.

If the feature “rayon” is enabled, this function is parallelized.

source

pub fn with_count(self, number_of_ones: usize) -> CountBitVec<B>

Return a CountBitVec with the same data as this bit vector and the assuming the given number of ones.

§Warning

No control is performed on the number of ones, unless debug assertions are enabled.

source§

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

source

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

source

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

§Safety

index must be between 0 (included) and BitVec::len (excluded).

source§

impl<B: AsRef<[usize]> + AsMut<[usize]>> BitVec<B>

source

pub fn set(&mut self, index: usize, value: bool)

source

pub unsafe fn set_unchecked(&mut self, index: usize, value: bool)

§Safety

index must be between 0 (included) and BitVec::len (excluded).

source

pub fn fill(&mut self, value: bool)

source

pub fn flip(&mut self)

Trait Implementations§

source§

impl<B: AsMut<[usize]>> AsMut<[usize]> for BitVec<B>

source§

fn as_mut(&mut self) -> &mut [usize]

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

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

source§

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

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

impl<B: AsRef<[usize]>> BitCount for BitVec<B>

source§

fn count(&self) -> usize

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

impl<B> BitLength for BitVec<B>

source§

fn len(&self) -> usize

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

impl<B: Clone> Clone for BitVec<B>

source§

fn clone(&self) -> BitVec<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, C> ConvertTo<AtomicBitVec<C>> for BitVec<B>
where B: ConvertTo<C>,

Provide conversion from bit vectors to atomic bit vectors whose backends are convertible.

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

source§

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

Forget the number of ones.

source§

impl<B, C> ConvertTo<BitVec<C>> for AtomicBitVec<B>
where B: ConvertTo<C>,

Provide conversion from atomic bit vectors to bit vectors whose backends are convertible.

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 BitVec<B>
where B: MemSize, usize: MemSize,

§

type Copy = False

source§

impl<B> CopyType for BitVec<B>

§

type Copy = Deep

source§

impl<B: Debug> Debug for BitVec<B>

source§

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

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

impl<B> DeserializeInner for BitVec<B>

source§

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

§

type DeserType<'epserde_desertype> = BitVec<<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 Display for BitVec<Vec<usize>>

source§

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

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

impl<'a> From<AtomicBitVec<&'a [AtomicUsize]>> for BitVec<&'a [usize]>

Provide conversion from references to atomic bit vectors to references to standard bit vectors.

source§

fn from(bm: AtomicBitVec<&'a [AtomicUsize]>) -> Self

Converts to this type from the input type.
source§

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

Provide conversion from standard to atomic bit vectors.

source§

fn from(bm: AtomicBitVec<Vec<AtomicUsize>>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<BitVec<&'a [usize]>> for AtomicBitVec<&'a [AtomicUsize]>

Provide conversion from references to standard bit vectors to references to atomic bit vectors.

source§

fn from(bm: BitVec<&'a [usize]>) -> Self

Converts to this type from the input type.
source§

impl From<BitVec> for AtomicBitVec<Vec<AtomicUsize>>

Provide conversion from standard to atomic bit vectors.

source§

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

Converts to this type from the input type.
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 FromIterator<bool> for BitVec<Vec<usize>>

source§

fn from_iter<T: IntoIterator<Item = bool>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl<B: AsRef<[usize]>> Index<usize> for BitVec<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<'a> IntoIterator for &'a BitVec<Vec<usize>>

§

type IntoIter = BitIterator<'a, Vec<usize>>

Which kind of iterator are we turning this into?
§

type Item = bool

The type of the elements being iterated over.
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<B> MemDbgImpl for BitVec<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 BitVec<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 BitVec<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 BitVec<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 BitVec<B>

source§

unsafe fn select_hinted_unchecked( &self, rank: usize, hint_pos: usize, hint_rank: 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, hint_pos: usize, hint_rank: 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 BitVec<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 BitVec<B>

source§

unsafe fn select_zero_hinted_unchecked( &self, rank: usize, hint_pos: usize, hint_rank: 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, hint_pos: usize, hint_rank: usize ) -> Option<usize>

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

impl<B> SerializeInner for BitVec<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 BitVec<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 BitVec<B>
where B: Freeze,

§

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

§

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

§

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

§

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

§

impl<B> UnwindSafe for BitVec<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> BitFieldSliceMut<usize> for T
where T: AsMut<[usize]> + AsRef<[usize]>,

source§

unsafe fn set_unchecked(&mut self, index: usize, value: usize)

Set the element of the slice at the specified index. No bounds checking is performed. Read more
source§

fn reset(&mut self)

Set all values to zero
source§

fn set(&mut self, index: usize, value: W)

Set the element of the slice at the specified index. 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> 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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>,