pub struct BitVec<B = Vec<usize>> { /* private fields */ }
Expand description
A bit vector.
Implementations§
source§impl<B> BitVec<B>
impl<B> BitVec<B>
sourcepub unsafe fn from_raw_parts(data: B, len: usize) -> Self
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).
pub fn into_raw_parts(self) -> (B, usize)
source§impl<B: AsRef<[usize]>> BitVec<B>
impl<B: AsRef<[usize]>> BitVec<B>
sourcepub fn count_ones(&self) -> usize
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.
sourcepub fn with_count(self, number_of_ones: usize) -> CountBitVec<B>
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>
impl<B: AsRef<[usize]>> BitVec<B>
pub fn get(&self, index: usize) -> bool
sourcepub unsafe fn get_unchecked(&self, index: usize) -> bool
pub unsafe fn get_unchecked(&self, index: usize) -> bool
§Safety
index
must be between 0 (included) and BitVec::len
(excluded).
Trait Implementations§
source§impl<B, C> ConvertTo<AtomicBitVec<C>> for BitVec<B>where
B: ConvertTo<C>,
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
.
fn convert_to(self) -> Result<AtomicBitVec<C>>
source§impl<B> ConvertTo<BitVec<B>> for CountBitVec<B>
impl<B> ConvertTo<BitVec<B>> for CountBitVec<B>
Forget the number of ones.
fn convert_to(self) -> Result<BitVec<B>>
source§impl<B, C> ConvertTo<BitVec<C>> for AtomicBitVec<B>where
B: ConvertTo<C>,
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
.
fn convert_to(self) -> Result<BitVec<C>>
source§impl ConvertTo<CountBitVec> for BitVec<Vec<usize>>
impl ConvertTo<CountBitVec> for BitVec<Vec<usize>>
Compute the number of ones and return a CountBitVec
.
fn convert_to(self) -> Result<CountBitVec<Vec<usize>>>
source§impl<B> DeserializeInner for BitVec<B>
impl<B> DeserializeInner for BitVec<B>
fn _deserialize_full_inner( backend: &mut impl ReadWithPos ) -> Result<Self, Error>
§type DeserType<'epserde_desertype> = BitVec<<B as DeserializeInner>::DeserType<'epserde_desertype>>
type DeserType<'epserde_desertype> = BitVec<<B as DeserializeInner>::DeserType<'epserde_desertype>>
DeserType
.fn _deserialize_eps_inner<'a>( backend: &mut SliceWithPos<'a> ) -> Result<Self::DeserType<'a>, Error>
source§impl<'a> From<AtomicBitVec<&'a [AtomicUsize]>> for BitVec<&'a [usize]>
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
fn from(bm: AtomicBitVec<&'a [AtomicUsize]>) -> Self
source§impl From<AtomicBitVec> for BitVec<Vec<usize>>
impl From<AtomicBitVec> for BitVec<Vec<usize>>
Provide conversion from standard to atomic bit vectors.
source§fn from(bm: AtomicBitVec<Vec<AtomicUsize>>) -> Self
fn from(bm: AtomicBitVec<Vec<AtomicUsize>>) -> Self
source§impl<'a> From<BitVec<&'a [usize]>> for AtomicBitVec<&'a [AtomicUsize]>
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§impl From<BitVec> for AtomicBitVec<Vec<AtomicUsize>>
impl From<BitVec> for AtomicBitVec<Vec<AtomicUsize>>
Provide conversion from standard to atomic bit vectors.
source§impl From<BitVec> for CountBitVec<Vec<usize>>
impl From<BitVec> for CountBitVec<Vec<usize>>
Compute the number of ones and return a CountBitVec
.
source§impl<B> From<CountBitVec<B>> for BitVec<B>
impl<B> From<CountBitVec<B>> for BitVec<B>
Forget the number of ones.
source§fn from(cb: CountBitVec<B>) -> Self
fn from(cb: CountBitVec<B>) -> Self
source§impl<B> MemDbgImpl for BitVec<B>
impl<B> MemDbgImpl for BitVec<B>
source§impl<B: AsRef<[usize]>> SelectHinted for BitVec<B>
impl<B: AsRef<[usize]>> SelectHinted for BitVec<B>
source§impl<B: AsRef<[usize]>> SelectZeroHinted for BitVec<B>
impl<B: AsRef<[usize]>> SelectZeroHinted for BitVec<B>
source§impl<B> SerializeInner for BitVec<B>
impl<B> SerializeInner for BitVec<B>
source§const IS_ZERO_COPY: bool = _
const IS_ZERO_COPY: bool = _
ZeroCopy
type has this constant set to false
serialization will panic.source§const ZERO_COPY_MISMATCH: bool = _
const ZERO_COPY_MISMATCH: bool = _
#[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<()>
fn _serialize_inner(&self, backend: &mut impl WriteWithNames) -> Result<()>
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> BitFieldSlice<usize> for T
impl<T> BitFieldSlice<usize> for T
source§impl<T> BitFieldSliceCore<usize> for T
impl<T> BitFieldSliceCore<usize> for T
source§impl<T> BitFieldSliceMut<usize> for T
impl<T> BitFieldSliceMut<usize> for T
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, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
source§impl<B, const LOG2_ONES_PER_INVENTORY: usize> ConvertTo<SelectFixed1<B, Vec<usize>, LOG2_ONES_PER_INVENTORY>> for B
impl<B, const LOG2_ONES_PER_INVENTORY: usize> ConvertTo<SelectFixed1<B, Vec<usize>, LOG2_ONES_PER_INVENTORY>> for B
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
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
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
impl<B, const LOG2_ZEROS_PER_INVENTORY: usize> ConvertTo<SelectZeroFixed1<B, Vec<usize>, LOG2_ZEROS_PER_INVENTORY>> for B
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
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
fn convert_to( self ) -> Result<SelectZeroFixed2<B, Vec<u64>, LOG2_ZEROS_PER_INVENTORY, LOG2_U64_PER_SUBINVENTORY>, Error>
source§impl<T> Deserialize for T
impl<T> Deserialize for T
source§fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>
fn deserialize_full(backend: &mut impl ReadNoStd) -> Result<T, Error>
source§fn deserialize_eps(
backend: &[u8]
) -> Result<<T as DeserializeInner>::DeserType<'_>, Error>
fn deserialize_eps( backend: &[u8] ) -> Result<<T as DeserializeInner>::DeserType<'_>, Error>
source§fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>
fn load_full(path: impl AsRef<Path>) -> Result<Self, Error>
source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
source§impl<T> MemDbg for Twhere
T: MemDbgImpl,
impl<T> MemDbg for Twhere
T: MemDbgImpl,
source§fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
fn mem_dbg(&self, flags: DbgFlags) -> Result<(), Error>
source§fn mem_dbg_on(
&self,
writer: &mut impl Write,
flags: DbgFlags
) -> Result<(), Error>
fn mem_dbg_on( &self, writer: &mut impl Write, flags: DbgFlags ) -> Result<(), Error>
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>
fn mem_dbg_depth( &self, total_size: usize, max_depth: usize, flags: DbgFlags ) -> Result<(), Error>
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>
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>
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
impl<T> Pointable for T
source§impl<T> Serialize for T
impl<T> Serialize for T
source§fn serialize_on_field_write(
&self,
backend: &mut impl WriteWithNames
) -> Result<(), Error>
fn serialize_on_field_write( &self, backend: &mut impl WriteWithNames ) -> Result<(), Error>
Serialize the type using the given WriteWithNames
.