pub struct BitVec { /* private fields */ }Expand description
Compact bit vector backed by a packed Vec<u8>.
Bit ordering (LOAD-BEARING - this is part of the FFI wire format):
bit i lives in byte i / 8, position i % 8, LSB-first within the
byte. Setting bit 0 of an empty 8-bit byte yields 0b0000_0001. The FFI
ABI’s defined_bitvec and any borrowed Bool column data depend on this
exact layout. Do not change.
Implementations§
Source§impl BitVec
impl BitVec
pub fn repeat(len: usize, value: bool) -> Self
pub fn from_slice(slice: &[bool]) -> Self
pub fn empty() -> Self
pub fn from_fn(len: usize, f: impl FnMut(usize) -> bool) -> Self
pub fn take(&self, n: usize) -> BitVec
pub fn extend(&mut self, other: &BitVec)
pub fn push(&mut self, bit: bool)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Sourcepub fn as_packed_bytes(&self) -> &[u8] ⓘ
pub fn as_packed_bytes(&self) -> &[u8] ⓘ
Borrow the packed byte representation.
Length is len.div_ceil(8) bytes. Bit ordering is LSB-first within
each byte (see type-level doc). Used by the FFI marshal path to hand
guests a zero-copy view of bool columns and option-defined bitmaps.
pub fn get(&self, idx: usize) -> bool
pub fn set(&mut self, idx: usize, value: bool)
pub fn iter(&self) -> BitVecIter ⓘ
pub fn and(&self, other: &Self) -> Self
pub fn to_vec(&self) -> Vec<bool>
pub fn count_ones(&self) -> usize
pub fn all_ones(&self) -> bool
pub fn count_zeros(&self) -> usize
pub fn any(&self) -> bool
pub fn none(&self) -> bool
pub fn not(&self) -> Self
pub fn or(&self, other: &Self) -> Self
pub fn is_owned(&self) -> bool
pub fn with_capacity(capacity: usize) -> Self
Sourcepub fn try_into_raw(self) -> Result<(Vec<u8>, usize), Self>
pub fn try_into_raw(self) -> Result<(Vec<u8>, usize), Self>
Try to extract the underlying bytes Vec without cloning.
Returns Ok((Vec<u8>, len)) if this is the sole owner, Err(self) otherwise.
Sourcepub fn from_raw(bits: Vec<u8>, len: usize) -> Self
pub fn from_raw(bits: Vec<u8>, len: usize) -> Self
Reconstruct a BitVec from raw parts previously obtained via try_into_raw.
pub fn reorder(&mut self, indices: &[usize])
Trait Implementations§
Source§impl DataBitVec for BitVec
impl DataBitVec for BitVec
fn spawn(&self, capacity: usize) -> Self
fn push(&mut self, bit: bool)
fn get(&self, idx: usize) -> bool
fn set(&mut self, idx: usize, value: bool)
fn len(&self) -> usize
fn clear(&mut self)
fn extend_from(&mut self, other: &Self)
fn count_ones(&self) -> usize
fn iter(&self) -> impl Iterator<Item = bool> + '_
fn capacity(&self) -> usize
fn take(&self, n: usize) -> Self
fn is_empty(&self) -> bool
fn count_zeros(&self) -> usize
Source§impl<'de> Deserialize<'de> for BitVec
impl<'de> Deserialize<'de> for BitVec
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl StructuralPartialEq for BitVec
Auto Trait Implementations§
impl Freeze for BitVec
impl RefUnwindSafe for BitVec
impl Send for BitVec
impl Sync for BitVec
impl Unpin for BitVec
impl UnsafeUnpin for BitVec
impl UnwindSafe for BitVec
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more