pub struct BitVector { /* private fields */ }Expand description
A fast contiguous growable array of bits allocated on the heap
that allows storing and manipulating an arbitrary number of
bits. This collection is backed by a Vector<u8> which
manages the underlying memory.
§Getting Started
To get started add the deepmesa dependency to Cargo.toml and the use declaration in your source.
[dependencies]
deepmesa = "0.6.0"use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(128);
bv.push(true);
bv.push(false);
bv.push(true);
assert_eq!(bv.get(0), Some(true));
assert_eq!(bv.get(1), Some(false));
assert_eq!(bv.get(2), Some(true));In addition to the new() and
with_capacity() methods, the
bitvector! macro is also provided for convenient
initialization.
§Examples
use deepmesa_collections::BitVector;
use deepmesa_collections::bitvector;
let bv = bitvector![0,1,1,0];
assert_eq!(bv.len(), 4);§Memory Management
Memory is managed by an underlying Vec<u8> and all
methods operate on bytes whenever possible for
efficiency. Internally the BitVector maintains a count of the
number of bits currently held by the BitVector and the actual
number of bytes stored maybe greater than eight times the number
of bits. All bits stored past the number of active bits are zeroed
out but this is not guaranteed to be true in future versions of
the BitVector and should be relied up for correctness.
The BitVector can also return mutable and immutable pointers and
slices to the underlying Vec<u8>. Modifying
the underlying Vector can cause undefined behavior in the
BitVector.
§Slices
Slices are implemented by the BitSlice which is a
view into a range within the BitVector. A BitSlice
is a wrapper around a slice of bytes with the 4 most significant
bits of the slice length used to store the bit offset into the
first byte of the slice. The rest of the bits of the length are
used to store the length of the slice in bits.
Here is an illustrative example for BitVector with 16 bits:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
bitvec: [ 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1 ]
slice start = 10 len = 6 ^ ^
byte = 10/8 = 1 , offset = 10 % 8 = 2
offset bits = 0010
Slice pointer: 0011_0000 [ 48 bits ] 0000_0110The MSB of the offset is unused and must be always set to zero
because there is a
constraint
that the length must be no greater than isize::MAX and hence
cannot use more than 63 bits.
Implementations§
Source§impl BitVector
impl BitVector
Sourcepub fn new() -> BitVector
pub fn new() -> BitVector
Creates an empty BitVector with a capacity or 128 bits.
§Examples
use deepmesa_collections::BitVector;
let bv = BitVector::new();
assert_eq!(bv.capacity(), 128);Sourcepub fn with_capacity(capacity_bits: usize) -> BitVector
pub fn with_capacity(capacity_bits: usize) -> BitVector
Creates an empty BitVector with the specified capacity. If the specified capacity is not a multiple of 8, it is increased to be a multiple of 8
§Examples
use deepmesa_collections::BitVector;
let bv = BitVector::with_capacity(6);
assert_eq!(bv.capacity(), 8);Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of bits this BitVector can hold before new memory is allocated.
§Examples
use deepmesa_collections::BitVector;
let bv = BitVector::with_capacity(22);
assert_eq!(bv.capacity(), 24);pub fn truncate(&mut self, len: usize)
Sourcepub fn iter(&self) -> Iter<'_> ⓘ
pub fn iter(&self) -> Iter<'_> ⓘ
Returns an iterator over the bits of this
BitVector
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b101, None);
let mut iter = bv.iter();
assert_eq!(iter.next(), Some(true));
assert_eq!(iter.next(), Some(false));
assert_eq!(iter.next(), Some(true));
assert_eq!(iter.next(), None);Sourcepub fn iter_mut(&mut self) -> IterMut<'_> ⓘ
pub fn iter_mut(&mut self) -> IterMut<'_> ⓘ
Returns a mutable iterator that allows modifyingthe bits of
this BitVector
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
bv.push_u8(0b1011_1100, Some(8));
bv.push_u8(0b0011_1001, Some(8));
let iter = bv.iter_mut();
for mut bit in iter {
*bit = true;
}
assert_eq!(bv.read_u16(0), (0b1111_1111_1111_1111, 16));Sourcepub fn leading_ones(&self, start: usize) -> usize
pub fn leading_ones(&self, start: usize) -> usize
Counts the number of bits from the specified start index to
the first bit set to 0. Panics if start is non-zero and
greater than or equal to the length of the BitVector.
Returns 0 if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.leading_ones(0), 0);
bv.push_u8(0b1111_1000, Some(8));
bv.push_u8(0b0011_1101, Some(8));
assert_eq!(bv.leading_ones(0), 5);
assert_eq!(bv.leading_ones(8), 0);
assert_eq!(bv.leading_ones(10), 4);Sourcepub fn leading_zeros(&self, start: usize) -> usize
pub fn leading_zeros(&self, start: usize) -> usize
Counts the number of bits from the specified start index to
the first bit set to 1. Panics if start is non-zero and
greater than or equal to the length of the BitVector.
Returns 0 if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.leading_zeros(0), 0);
bv.push_u8(0b0000_0111, Some(8));
bv.push_u8(0b1100_0010, Some(8));
assert_eq!(bv.leading_zeros(0), 5);
assert_eq!(bv.leading_zeros(8), 0);
assert_eq!(bv.leading_zeros(10), 4);Sourcepub fn trailing_ones(&self, start: usize) -> usize
pub fn trailing_ones(&self, start: usize) -> usize
Counts the number of bits from end of the BitVector to the
specified start index or to the first bit set to 0
whichever is smaller. Panics if start is non-zero and greater
than or equal to the length of the BitVector.
Returns 0 if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.trailing_ones(0), 0);
bv.push_u8(0b1111_1000, Some(8));
bv.push_u8(0b0011_1111, Some(8));
assert_eq!(bv.trailing_ones(0), 6);
assert_eq!(bv.trailing_ones(8), 6);
assert_eq!(bv.leading_ones(12), 4);Sourcepub fn trailing_zeros(&self, start: usize) -> usize
pub fn trailing_zeros(&self, start: usize) -> usize
Counts the number of bits from end of the BitVector to the
specified start index or to the first bit set to 1
whichever is smaller. Panics if start is non-zero and greater
than or equal to the length of the BitVector.
Returns 0 if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.trailing_zeros(0), 0);
bv.push_u8(0b1111_1000, Some(8));
bv.push_u8(0b1100_0000, Some(8));
assert_eq!(bv.trailing_zeros(0), 6);
//assert_eq!(bv.trailing_zeros(8), 6);
//assert_eq!(bv.trailing_zeros(12), 4);Sourcepub fn count_ones(&self, start: usize) -> usize
pub fn count_ones(&self, start: usize) -> usize
Counts the number of bits from the specified start that are
set to 1 in the BitVector. Panics if start is non-zero and
greater than or equal to the length of the BitVector.
Returns 0 if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.count_ones(0), 0);
bv.push_u8(0b1111_1000, Some(8));
bv.push_u8(0b1100_0000, Some(8));
assert_eq!(bv.count_ones(0), 7);
assert_eq!(bv.count_ones(8), 2);
assert_eq!(bv.count_ones(12), 0);Sourcepub fn count_zeros(&self, start: usize) -> usize
pub fn count_zeros(&self, start: usize) -> usize
Counts the number of bits from the specified start that are
set to 0 in the BitVector. Panics if start is non-zero and
greater than or equal to the length of the BitVector.
Returns 0 if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.count_zeros(0), 0);
bv.push_u8(0b1111_1000, Some(8));
bv.push_u8(0b0000_1111, Some(8));
assert_eq!(bv.count_zeros(0), 7);
assert_eq!(bv.count_zeros(8), 4);
assert_eq!(bv.count_zeros(12), 0);Sourcepub fn first_zero(&self, start: usize) -> Option<usize>
pub fn first_zero(&self, start: usize) -> Option<usize>
Returns the index of the first bit after the specified start
that is set to 0. Returns None if the BitVector is empty
or if there are no zero bits.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.first_zero(0), None);
bv.push_u8(0b1111_1000, Some(8));
bv.push_u8(0b0000_1011, Some(8));
assert_eq!(bv.first_zero(0), Some(5));
assert_eq!(bv.first_zero(8), Some(8));
assert_eq!(bv.first_zero(12), Some(13));
assert_eq!(bv.first_zero(14), None);Sourcepub fn first_one(&self, start: usize) -> Option<usize>
pub fn first_one(&self, start: usize) -> Option<usize>
Returns the index of the first bit after the specified start
that is set to 1. Returns None if the BitVector is empty
or if there are no one bits.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.first_one(0), None);
bv.push_u8(0b0000_0111, Some(8));
bv.push_u8(0b1111_0100, Some(8));
assert_eq!(bv.first_one(0), Some(5));
assert_eq!(bv.first_one(8), Some(8));
assert_eq!(bv.first_one(12), Some(13));
assert_eq!(bv.first_one(14), None);Sourcepub fn last_zero(&self, start: usize) -> Option<usize>
pub fn last_zero(&self, start: usize) -> Option<usize>
Returns the index of the last bit set to 0 after the
specified start. Returns None if the BitVector is empty
or if there are no zero bits.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.last_zero(0), None);
bv.push_u8(0b1101_1011, Some(8));
assert_eq!(bv.last_zero(0), Some(5));
assert_eq!(bv.last_zero(6), None);Sourcepub fn last_one(&self, start: usize) -> Option<usize>
pub fn last_one(&self, start: usize) -> Option<usize>
Returns the index of the last bit set to 1 after the
specified start. Returns None if the BitVector is empty
or if there are no one bits.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.last_one(0), None);
bv.push_u8(0b0010_0100, Some(8));
assert_eq!(bv.last_one(0), Some(5));
assert_eq!(bv.last_one(6), None);Sourcepub fn first(&self) -> Option<BitRef<'_, bool>>
pub fn first(&self) -> Option<BitRef<'_, bool>>
Returns an immutable reference to the first bit in the
BitVector or None if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.first(), None);
bv.push_u8(0b0010_0100, Some(8));
assert_eq!(bv.first().as_deref(), Some(&false));Sourcepub fn first_mut(&mut self) -> Option<BitRefMut<'_, bool>>
pub fn first_mut(&mut self) -> Option<BitRefMut<'_, bool>>
Returns a mutable reference to the first bit in the
BitVector or None if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.first(), None);
bv.push_u8(0b0010_0100, Some(8));
assert_eq!(bv.first_mut().as_deref(), Some(&false));
*bv.first_mut().unwrap() = true;
assert_eq!(bv.first_mut().as_deref(), Some(&true));Sourcepub fn last(&self) -> Option<BitRef<'_, bool>>
pub fn last(&self) -> Option<BitRef<'_, bool>>
Returns an immutable reference to the last bit in the
BitVector or None if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.last(), None);
bv.push_u8(0b0010_0101, Some(8));
assert_eq!(bv.last().as_deref(), Some(&true));Sourcepub fn last_mut(&mut self) -> Option<BitRefMut<'_, bool>>
pub fn last_mut(&mut self) -> Option<BitRefMut<'_, bool>>
Returns a mutable reference to the last bit in the
BitVector or None if the BitVector is empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
assert_eq!(bv.first(), None);
bv.push_u8(0b0010_0101, Some(8));
assert_eq!(bv.last_mut().as_deref(), Some(&true));
*bv.last_mut().unwrap() = false;
assert_eq!(bv.last_mut().as_deref(), Some(&false));Sourcepub fn iter_ones(&self) -> IterOnes<'_> ⓘ
pub fn iter_ones(&self) -> IterOnes<'_> ⓘ
Iterates over all the bits in the BitVector that are set to
1.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
bv.push_u8(0b0010_0101, Some(8));
let mut iter = bv.iter_ones();
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), Some(5));
assert_eq!(iter.next(), Some(7));
assert_eq!(iter.next(), None);Sourcepub fn iter_zeros(&self) -> IterZeros<'_> ⓘ
pub fn iter_zeros(&self) -> IterZeros<'_> ⓘ
Iterates over all the bits in the BitVector that are set to
0.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(20);
bv.push_u8(0b1101_1010, Some(8));
let mut iter = bv.iter_zeros();
assert_eq!(iter.next(), Some(2));
assert_eq!(iter.next(), Some(5));
assert_eq!(iter.next(), Some(7));
assert_eq!(iter.next(), None);Sourcepub fn iter_u8(&self) -> IterU8<'_> ⓘ
pub fn iter_u8(&self) -> IterU8<'_> ⓘ
Returns an iterator that iterates over the
BitVector 8 bits at a time. Each invocation
of iter.next returns a u8 value and the number of bits
read.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
The iterator returns None if there are no more bits to return
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0101_1101_0011_1010, Some(16));
let mut iter = bv.iter_u8();
assert_eq!(iter.next(), Some((0b0101_1101, 8)));
assert_eq!(iter.next(), Some((0b0011_1010, 8)));
assert_eq!(iter.next(), None);Sourcepub fn iter_u16(&self) -> IterU16<'_> ⓘ
pub fn iter_u16(&self) -> IterU16<'_> ⓘ
Returns an iterator that iterates over the bitvector 16
bits at a time. Each invocation of iter.next returns a
u16 value and the number of bits read.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
The iterator returns None if there are no more bits to return
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0101_1101_0011_1010, Some(16));
let mut iter = bv.iter_u16();
assert_eq!(iter.next(), Some((0b0101_1101_0011_1010, 16)));
assert_eq!(iter.next(), None);Sourcepub fn iter_u32(&self) -> IterU32<'_> ⓘ
pub fn iter_u32(&self) -> IterU32<'_> ⓘ
Returns an iterator that iterates over the bitvector 32
bits at a time. Each invocation of iter.next returns a
u32 value and the number of bits read.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
The iterator returns None if there are no more bits to return
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0101_1101_0011_1010, Some(16));
bv.push_u16(0b1111_0011_1100_0000, Some(16));
let mut iter = bv.iter_u32();
assert_eq!(iter.next(), Some((0b0101_1101_0011_1010_1111_0011_1100_0000, 32)));
assert_eq!(iter.next(), None);Sourcepub fn iter_u64(&self) -> IterU64<'_> ⓘ
pub fn iter_u64(&self) -> IterU64<'_> ⓘ
Returns an iterator that iterates over the bitvector 64
bits at a time. Each invocation of iter.next returns a
u64 value and the number of bits read.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
The iterator returns None if there are no more bits to return
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u64(u64::MAX, Some(64));
let mut iter = bv.iter_u64();
assert_eq!(iter.next(), Some((u64::MAX, 64)));
assert_eq!(iter.next(), None);Sourcepub fn iter_u128(&self) -> IterU128<'_> ⓘ
pub fn iter_u128(&self) -> IterU128<'_> ⓘ
Returns an iterator that iterates over the bitvector 128
bits at a time. Each invocation of iter.next returns a
u128 value and the number of bits read.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
The iterator returns None if there are no more bits to return
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u64(u64::MAX, Some(64));
bv.push_u64(u64::MAX, Some(64));
let mut iter = bv.iter_u128();
assert_eq!(iter.next(), Some((u128::MAX, 128)));
assert_eq!(iter.next(), None);Sourcepub fn read_u8(&self, start: usize) -> (u8, usize)
pub fn read_u8(&self, start: usize) -> (u8, usize)
Reads upto 8 bits from this BitVector into
a u8 starting at the specified start position. This
method will panic if start is greater than or equal to
the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b0011_0110, Some(8));
let (val, read) = bv.read_u8(0);
assert_eq!(read, 8);
assert_eq!(val, 0b0011_0110);
let (val, read) = bv.read_u8(4);
assert_eq!(read, 4);
assert_eq!(val, 0b0000_0110);Sourcepub fn read_u16(&self, start: usize) -> (u16, usize)
pub fn read_u16(&self, start: usize) -> (u16, usize)
Reads upto 16 bits from this BitVector into
a u16 starting at the specified start position. This
method will panic if start is greater than or equal to
the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0011_0110_1100_0011, Some(16));
let (val, read) = bv.read_u16(0);
assert_eq!(read, 16);
assert_eq!(val, 0b0011_0110_1100_0011);
let (val, read) = bv.read_u16(4);
assert_eq!(read, 12);
assert_eq!(val, 0b0000_0110_1100_0011);Sourcepub fn read_u32(&self, start: usize) -> (u32, usize)
pub fn read_u32(&self, start: usize) -> (u32, usize)
Reads upto 32 bits from this BitVector into
a u32 starting at the specified start position. This
method will panic if start is greater than or equal to
the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0011_0110_1100_0011, Some(16));
bv.push_u16(0b1100_1010_0100_1100, Some(16));
let (val, read) = bv.read_u32(0);
assert_eq!(read, 32);
assert_eq!(val, 0b0011_0110_1100_0011_1100_1010_0100_1100);
let (val, read) = bv.read_u16(16);
assert_eq!(read, 16);
assert_eq!(val, 0b1100_1010_0100_1100);Sourcepub fn read_u64(&self, start: usize) -> (u64, usize)
pub fn read_u64(&self, start: usize) -> (u64, usize)
Reads upto 64 bits from this BitVector into
a u64 starting at the specified start position. This
method will panic if start is greater than or equal to
the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0011_0110_1100_0011, Some(16));
bv.push_u16(0b1100_1010_0100_1100, Some(16));
let (val, read) = bv.read_u64(20);
assert_eq!(read, 12);
assert_eq!(val, 0b1010_0100_1100);
let (val, read) = bv.read_u64(16);
assert_eq!(read, 16);
assert_eq!(val, 0b1100_1010_0100_1100);Sourcepub fn read_u128(&self, start: usize) -> (u128, usize)
pub fn read_u128(&self, start: usize) -> (u128, usize)
Reads upto 128 bits from this BitVector
into a u128 starting at the specified start
position. This method will panic if start is greater
than or equal to the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u16(0b0011_0110_1100_0011, Some(16));
bv.push_u16(0b1100_1010_0100_1100, Some(16));
let (val, read) = bv.read_u128(20);
assert_eq!(read, 12);
assert_eq!(val, 0b1010_0100_1100);
let (val, read) = bv.read_u128(16);
assert_eq!(read, 16);
assert_eq!(val, 0b1100_1010_0100_1100);Sourcepub fn read_bits_u8(&self, start: usize, max_bits: usize) -> (u8, usize)
pub fn read_bits_u8(&self, start: usize, max_bits: usize) -> (u8, usize)
Reads upto max_bits bits from this
BitVector into a u8 starting at the
specified start position. This method will panic if
max_bits is greater than 8 or if start is greater than
or equal to the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
Here is an illustrative example for a bitvector with 8 bits.
0 1 2 3 4 5 6 7
[ 0,0,1,1,0,1,1,0 ]
MSB [_______] LSB
^ Start = 2
value read = 0b1101Reading 4 bits from the start position of 2, results in a u8 value of decimal 13.
This method returns the read value as well as the number of bits read as a tuple.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
// Push 8 bits: 0b0011_0110
bv.push_u8(0b0011_0110, Some(8));
let (val, read) = bv.read_bits_u8(2, 4);
assert_eq!(read,4);
assert_eq!(val, 0b0000_1101);
assert_eq!(val, 13);Sourcepub fn read_bits_u16(&self, start: usize, max_bits: usize) -> (u16, usize)
pub fn read_bits_u16(&self, start: usize, max_bits: usize) -> (u16, usize)
Reads upto max_bits bits from this
BitVector into a u16 starting at the
specified start position. This method will panic if
max_bits is greater than 16 or if start is greater
than or equal to the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
Here is an illustrative example for a bitvector with 8 bits.
0 1 2 3 4 5 6 7
[ 0,0,1,1,0,1,1,0 ]
MSB [_______] LSB
^ Start = 2
value read = 0b1101Reading 4 bits from the start position of 2, results in a u16 value of decimal 13.
This method returns the read value as well as the number of bits read as a tuple.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
// Push 8 bits: 0b0011_0110
bv.push_u8(0b0011_0110, Some(8));
let (val, read) = bv.read_bits_u16(2, 4);
assert_eq!(read,4);
assert_eq!(val, 0b0000_1101);
assert_eq!(val, 13);Sourcepub fn read_bits_u32(&self, start: usize, max_bits: usize) -> (u32, usize)
pub fn read_bits_u32(&self, start: usize, max_bits: usize) -> (u32, usize)
Reads upto max_bits bits from this
BitVector into a u32 starting at the
specified start position. This method will panic if
max_bits is greater than 32 or if start is greater
than or equal to the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
Here is an illustrative example for a bitvector with 8 bits.
0 1 2 3 4 5 6 7
[ 0,0,1,1,0,1,1,0 ]
MSB [_______] LSB
^ Start = 2
value read = 0b1101Reading 4 bits from the start position of 2, results in a u32 value of decimal 13.
This method returns the read value as well as the number of bits read as a tuple.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
// Push 8 bits: 0b0011_0110
bv.push_u8(0b0011_0110, Some(8));
let (val, read) = bv.read_bits_u32(2, 4);
assert_eq!(read,4);
assert_eq!(val, 0b0000_1101);
assert_eq!(val, 13);Sourcepub fn read_bits_u64(&self, start: usize, max_bits: usize) -> (u64, usize)
pub fn read_bits_u64(&self, start: usize, max_bits: usize) -> (u64, usize)
Reads upto max_bits bits from this
BitVector into a u64 starting at the
specified start position. This method will panic if
max_bits is greater than 64 or if start is greater
than or equal to the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
Here is an illustrative example for a bitvector with 8 bits.
0 1 2 3 4 5 6 7
[ 0,0,1,1,0,1,1,0 ]
MSB [_______] LSB
^ Start = 2
value read = 0b1101Reading 4 bits from the start position of 2, results in a u64 value of decimal 13.
This method returns the read value as well as the number of bits read as a tuple.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
// Push 8 bits: 0b0011_0110
bv.push_u8(0b0011_0110, Some(8));
let (val, read) = bv.read_bits_u64(2, 4);
assert_eq!(read,4);
assert_eq!(val, 0b0000_1101);
assert_eq!(val, 13);Sourcepub fn read_bits_u128(&self, start: usize, max_bits: usize) -> (u128, usize)
pub fn read_bits_u128(&self, start: usize, max_bits: usize) -> (u128, usize)
Reads upto max_bits bits from this
BitVector into a u128 starting at the
specified start position. This method will panic if
max_bits is greater than 128 or if start is greater
than or equal to the length of the BitVector.
The bits are read from the lower to the higher index from the BitVector and shifted right, so the bit at the lower index is the MSB of returned value while the bit at the highest index is the LSB.
Here is an illustrative example for a bitvector with 8 bits.
0 1 2 3 4 5 6 7
[ 0,0,1,1,0,1,1,0 ]
MSB [_______] LSB
^ Start = 2
value read = 0b1101Reading 4 bits from the start position of 2, results in a u128 value of decimal 13.
This method returns the read value as well as the number of bits read as a tuple.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
// Push 8 bits: 0b0011_0110
bv.push_u8(0b0011_0110, Some(8));
let (val, read) = bv.read_bits_u128(2, 4);
assert_eq!(read,4);
assert_eq!(val, 0b0000_1101);
assert_eq!(val, 13);Sourcepub fn push_bits_u8(
&mut self,
val: u8,
bit_count: usize,
order: BitOrder,
) -> usize
pub fn push_bits_u8( &mut self, val: u8, bit_count: usize, order: BitOrder, ) -> usize
Pushes at most count bits from the specified u8 val to
the end of the BitVector. The bits to be pushed are
counted depending on the order. If the count is equal
to 8 the order is ignored and all bits are pushed from the
MSB (bit position 7) to the LSB (bit position 0). If the
count is less than 8, then the bits are pushed in the
specified Order as follows:
If the order is Msb0, the leading count bits starting from the
MSB (from bit position 7) are pushed to the end of the
BitVector
If the order is Lsb0, then trailing count bits starting from
the LSB (from bit position 0) are pushed to the end of the
BitVector.
This method will panic, if the count is greater than 8. If
the count is 0, then no bits are pushed and the method
has no effect.
§Examples
use deepmesa_collections::BitVector;
use deepmesa_collections::bitvec::BitOrder;
let mut bv = BitVector::new();
let val:u8 = 0b1100_0101;
bv.push_bits_u8(val, 3, BitOrder::Msb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], true);
assert_eq!(bv[2], false);
bv.clear();
bv.push_bits_u8(val, 3, BitOrder::Lsb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
Sourcepub fn push_bits_u16(
&mut self,
val: u16,
bit_count: usize,
order: BitOrder,
) -> usize
pub fn push_bits_u16( &mut self, val: u16, bit_count: usize, order: BitOrder, ) -> usize
Pushes at most count bits from the specified u16
val to the end of the BitVector. The bits to be pushed
are counted depending on the order. If the count is
equal to 16 the order is ignored and all bits are pushed
from the MSB (bit position 15) to the LSB (bit position
0). If the count is less than 16, then the bits are pushed
in the specified Order as follows:
If the order is Msb0, the leading count bits starting from the
MSB (from bit position 15) are pushed to the end of the
BitVector
If the order is Lsb0, then trailing count bits starting from
the LSB (from bit position 0) are pushed to the end of the
BitVector.
This method will panic, if the count is greater than
16. If the count is 0, then no bits are pushed and the
method has no effect.
§Examples
use deepmesa_collections::BitVector;
use deepmesa_collections::bitvec::BitOrder;
let mut bv = BitVector::new();
let val:u16 = 0b1100_0000_0000_0101;
bv.push_bits_u16(val, 3, BitOrder::Msb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], true);
assert_eq!(bv[2], false);
bv.clear();
bv.push_bits_u16(val, 3, BitOrder::Lsb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
Sourcepub fn push_bits_u32(
&mut self,
val: u32,
bit_count: usize,
order: BitOrder,
) -> usize
pub fn push_bits_u32( &mut self, val: u32, bit_count: usize, order: BitOrder, ) -> usize
Pushes at most count bits from the specified u32
val to the end of the BitVector. The bits to be pushed
are counted depending on the order. If the count is
equal to 32 the order is ignored and all bits are pushed
from the MSB (bit position 31) to the LSB (bit position
0). If the count is less than 32, then the bits are pushed
in the specified Order as follows:
If the order is Msb0, the leading count bits starting from the
MSB (from bit position 31) are pushed to the end of the
BitVector
If the order is Lsb0, then trailing count bits starting from
the LSB (from bit position 0) are pushed to the end of the
BitVector.
This method will panic, if the count is greater than
32. If the count is 0, then no bits are pushed and the
method has no effect.
§Examples
use deepmesa_collections::BitVector;
use deepmesa_collections::bitvec::BitOrder;
let mut bv = BitVector::new();
let val:u32 = 0b1100_0000_0000_0000_0000_0000_0000_0101;
bv.push_bits_u32(val, 3, BitOrder::Msb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], true);
assert_eq!(bv[2], false);
bv.clear();
bv.push_bits_u32(val, 3, BitOrder::Lsb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
Sourcepub fn push_bits_u64(
&mut self,
val: u64,
bit_count: usize,
order: BitOrder,
) -> usize
pub fn push_bits_u64( &mut self, val: u64, bit_count: usize, order: BitOrder, ) -> usize
Pushes at most count bits from the specified u64 val to
the end of the BitVector. The bits to be pushed are
counted depending on the order. If the count is equal
to 64 the order is ignored and all bits are pushed from the
MSB (bit position 63) to the LSB (bit position 0). If the
count is less than 64, then the bits are pushed in the
specified Order as follows:
If the order is Msb0, the leading count bits starting from the
MSB (from bit position 63) are pushed to the end of the
BitVector
If the order is Lsb0, then trailing count bits starting from
the LSB (from bit position 0) are pushed to the end of the
BitVector.
This method will panic, if the count is greater than
64. If the count is 0, then no bits are pushed and the
method has no effect.
§Examples
use deepmesa_collections::BitVector;
use deepmesa_collections::bitvec::BitOrder;
let mut bv = BitVector::new();
// 4 MSB bits are 1100 and 4 LSB bits are 0101
let val:u64 = 0xc0_00_00_00_00_00_00_05;
bv.push_bits_u64(val, 3, BitOrder::Msb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], true);
assert_eq!(bv[2], false);
bv.clear();
bv.push_bits_u64(val, 3, BitOrder::Lsb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
Sourcepub fn push_bits_u128(
&mut self,
val: u128,
bit_count: usize,
order: BitOrder,
) -> usize
pub fn push_bits_u128( &mut self, val: u128, bit_count: usize, order: BitOrder, ) -> usize
Pushes at most count bits from the specified u128
val to the end of the BitVector. The bits to be pushed
are counted depending on the order. If the count is
equal to 128 the order is ignored and all bits are pushed
from the MSB (bit position 127) to the LSB (bit position
0). If the count is less than 128, then the bits are
pushed in the specified Order as follows:
If the order is Msb0, the leading count bits starting from the
MSB (from bit position 127) are pushed to the end of the
BitVector
If the order is Lsb0, then trailing count bits starting from
the LSB (from bit position 0) are pushed to the end of the
BitVector.
This method will panic, if the count is greater than
128. If the count is 0, then no bits are pushed and the
method has no effect.
§Examples
use deepmesa_collections::BitVector;
use deepmesa_collections::bitvec::BitOrder;
let mut bv = BitVector::new();
// 4 MSB bits are 1100 and 4 LSB bits are 0101
let val:u128 = 0xc0_00_00_00_00_00_00_00_00_00_00_00_00_00_00_05;
bv.push_bits_u128(val, 3, BitOrder::Msb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], true);
assert_eq!(bv[2], false);
bv.clear();
bv.push_bits_u128(val, 3, BitOrder::Lsb0);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
Sourcepub fn push_u8(&mut self, val: u8, min_width: Option<usize>) -> usize
pub fn push_u8(&mut self, val: u8, min_width: Option<usize>) -> usize
Pushes bits from the specified u8 val excluding the
leading zeros unless the min_width is specified. The
min_width is the minimum number of bits to push
(including leading zeros for padding). If the min_width
is specified, then leading zeros are pushed before pushing
the bits in the u8 to the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
let val:u8 = 0b101;
bv.push_u8(val, None);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
bv.clear();
bv.push_u8(val, Some(5));
assert_eq!(bv.len(), 5);
assert_eq!(bv[0], false);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
assert_eq!(bv[3], false);
assert_eq!(bv[4], true);Sourcepub fn push_u16(&mut self, val: u16, min_width: Option<usize>) -> usize
pub fn push_u16(&mut self, val: u16, min_width: Option<usize>) -> usize
Pushes bits from the specified u16 val excluding the
leading zeros unless the min_width is specified. The
min_width is the minimum number of bits to push
(including leading zeros for padding). If the min_width
is specified, then leading zeros are pushed before pushing
the bits in the u16 to the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
let val:u16 = 0b101;
bv.push_u16(val, None);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
bv.clear();
bv.push_u16(val, Some(5));
assert_eq!(bv.len(), 5);
assert_eq!(bv[0], false);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
assert_eq!(bv[3], false);
assert_eq!(bv[4], true);Sourcepub fn push_u32(&mut self, val: u32, min_width: Option<usize>) -> usize
pub fn push_u32(&mut self, val: u32, min_width: Option<usize>) -> usize
Pushes bits from the specified u32 val excluding the
leading zeros unless the min_width is specified. The
min_width is the minimum number of bits to push
(including leading zeros for padding). If the min_width
is specified, then leading zeros are pushed before pushing
the bits in the u32 to the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
let val:u32 = 0b101;
bv.push_u32(val, None);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
bv.clear();
bv.push_u32(val, Some(5));
assert_eq!(bv.len(), 5);
assert_eq!(bv[0], false);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
assert_eq!(bv[3], false);
assert_eq!(bv[4], true);Sourcepub fn push_u64(&mut self, val: u64, min_width: Option<usize>) -> usize
pub fn push_u64(&mut self, val: u64, min_width: Option<usize>) -> usize
Pushes bits from the specified u64 val excluding the
leading zeros unless the min_width is specified. The
min_width is the minimum number of bits to push
(including leading zeros for padding). If the min_width
is specified, then leading zeros are pushed before pushing
the bits in the u64 to the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
let val:u64 = 0b101;
bv.push_u64(val, None);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
bv.clear();
bv.push_u64(val, Some(5));
assert_eq!(bv.len(), 5);
assert_eq!(bv[0], false);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
assert_eq!(bv[3], false);
assert_eq!(bv[4], true);Sourcepub fn push_u128(&mut self, val: u128, min_width: Option<usize>) -> usize
pub fn push_u128(&mut self, val: u128, min_width: Option<usize>) -> usize
Pushes bits from the specified u128 val excluding the
leading zeros unless the min_width is specified. The
min_width is the minimum number of bits to push
(including leading zeros for padding). If the min_width
is specified, then leading zeros are pushed before pushing
the bits in the u128 to the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
let val:u128 = 0b101;
bv.push_u128(val, None);
assert_eq!(bv.len(), 3);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
bv.clear();
bv.push_u128(val, Some(5));
assert_eq!(bv.len(), 5);
assert_eq!(bv[0], false);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
assert_eq!(bv[3], false);
assert_eq!(bv[4], true);Sourcepub fn as_bitslice(&self) -> &BitSlice
pub fn as_bitslice(&self) -> &BitSlice
Returns an immutable reference to a BitSlice containing all the bits of the BitVector. This call is equivalent to &bv[..].
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b1011_1100, None);
let slice = bv.as_bitslice();
assert_eq!(slice.len(), 8);
let slice = &bv[..];
assert_eq!(slice.len(), 8);Sourcepub fn as_mut_bitslice(&mut self) -> &mut BitSlice
pub fn as_mut_bitslice(&mut self) -> &mut BitSlice
Returns a mutable reference to a BitSlice containing all the bits of the BitVector. This call is equivalent to &mut bv[..].
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b1011_1100, None);
let slice = bv.as_mut_bitslice();
assert_eq!(slice.len(), 8);
let slice = &mut bv[..];
assert_eq!(slice.len(), 8);Sourcepub fn as_raw_slice(&self) -> &[u8] ⓘ
pub fn as_raw_slice(&self) -> &[u8] ⓘ
Returns an immutable slice of the underlying Vec<u8>
containing the u8 values that encode the bits of the
BitVector. Reading the bytes directly from this raw slice is
not recommended since the BitVector manages the bytes in the
underlying Vector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b0100_1101, Some(8));
let raw_slice = bv.as_raw_slice();
assert_eq!(raw_slice.len(), 1);
assert_eq!(raw_slice, &[0x4D]);Sourcepub fn as_mut_raw_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_raw_slice(&mut self) -> &mut [u8] ⓘ
Returns a mutable slice of the underlying Vec<u8>
containing the u8 values that encode the bits of the
BitVector. Reading from or modifying the bytes directly in
this raw slice is not recommended since the BitVector manages
the bytes in the underlying Vector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b0100_1101, Some(8));
let raw_slice = bv.as_mut_raw_slice();
assert_eq!(raw_slice.len(), 1);
assert_eq!(raw_slice, &[0x4D]);Sourcepub fn as_raw_ptr(&self) -> *const u8
pub fn as_raw_ptr(&self) -> *const u8
Returns a raw pointer to the underlying Vec<u8> containing
the u8 values that encode the bits of the BitVector. Reading
from the bytes directly from this raw pointer is not
recommended since the BitVector manages the bytes in the
underlying Vector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b0100_1101, Some(8));
let raw_ptr = bv.as_raw_ptr();Sourcepub fn as_mut_raw_ptr(&mut self) -> *mut u8
pub fn as_mut_raw_ptr(&mut self) -> *mut u8
Returns a mutable raw pointer to the underlying Vec<u8>
containing the u8 values that encode the bits of the
BitVector. Reading from or writing to the bytes directly in
this raw pointer is not recommended since the BitVector
manages the bytes in the underlying Vector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b0100_1101, Some(8));
let raw_ptr = bv.as_mut_raw_ptr();Sourcepub fn append(&mut self, other: &mut BitVector)
pub fn append(&mut self, other: &mut BitVector)
Moves all the bits of other into self, leaving other
empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b1101, None);
let mut other = BitVector::new();
other.push_u8(0b1111_0011, Some(8));
bv.append(&mut other);
assert_eq!(bv.len(), 12);
assert_eq!(other.len(), 0);Sourcepub fn extend_from_bitslice(&mut self, other: &BitSlice)
pub fn extend_from_bitslice(&mut self, other: &BitSlice)
Copies all the bits from the specified BitSlice into the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::new();
bv.push_u8(0b1101, None);
let mut other = BitVector::new();
other.push_u8(0b1111_0011, Some(8));
let other_slice = &other[..];
bv.extend_from_bitslice(other_slice);
assert_eq!(bv.len(), 12);Sourcepub fn from_bitslice(slice: &BitSlice) -> Self
pub fn from_bitslice(slice: &BitSlice) -> Self
Sourcepub fn repeat(bit: bool, len: usize) -> Self
pub fn repeat(bit: bool, len: usize) -> Self
Creates a new BitVector with a bit repeated len times
§Examples
use deepmesa_collections::BitVector;
let bv = BitVector::repeat(true, 4);
assert_eq!(bv.len(), 4);Sourcepub fn set(&mut self, index: usize, value: bool)
pub fn set(&mut self, index: usize, value: bool)
Sets the bit at the given index to 1 if bit is true, otherwise clears it. Panic if the index exceeds the length
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(22);
bv.push(true);
bv.push(false);
bv.push(true);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);
assert_eq!(bv[2], true);
bv.set(0, false);
bv.set(1, true);
bv.set(2, false);
assert_eq!(bv[0], false);
assert_eq!(bv[1], true);
assert_eq!(bv[2], false);Sourcepub fn get(&self, index: usize) -> Option<bool>
pub fn get(&self, index: usize) -> Option<bool>
Returns a boolean value indicating whether the bit at the
specified index is set or None if the index is greater than
or equal to the number of bits in the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(22);
bv.push(true);
bv.push(true);
bv.push(false);
assert_eq!(bv.get(0), Some(true));
assert_eq!(bv.get(1), Some(true));
assert_eq!(bv.get(2), Some(false));
assert_eq!(bv.get(3), None);pub fn get_mut(&mut self, index: usize) -> Option<BitRefMut<'_, bool>>
Sourcepub fn push(&mut self, bit: bool)
pub fn push(&mut self, bit: bool)
Pushes a single bit to the end of the BitVector.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(22);
bv.push(true);
bv.push(false);
assert_eq!(bv[0], true);
assert_eq!(bv[1], false);Sourcepub fn pop(&mut self) -> Option<bool>
pub fn pop(&mut self) -> Option<bool>
Removes the last bit from the BitVector or None if its empty.
§Examples
use deepmesa_collections::BitVector;
let mut bv = BitVector::with_capacity(22);
bv.push(true);
bv.push(false);
bv.push(true);
assert_eq!(bv.get(0), Some(true));
assert_eq!(bv.get(1), Some(false));
assert_eq!(bv.get(2), Some(true));
assert_eq!(bv.pop(), Some(true));
assert_eq!(bv.get(2), None);Trait Implementations§
Source§impl BitAndAssign<&BitSlice> for BitVector
impl BitAndAssign<&BitSlice> for BitVector
Source§fn bitand_assign(&mut self, rhs: &BitSlice)
fn bitand_assign(&mut self, rhs: &BitSlice)
&= operation. Read moreSource§impl BitAndAssign<&BitVector> for BitVector
impl BitAndAssign<&BitVector> for BitVector
Source§fn bitand_assign(&mut self, rhs: &BitVector)
fn bitand_assign(&mut self, rhs: &BitVector)
&= operation. Read moreSource§impl BitAndAssign<bool> for BitVector
impl BitAndAssign<bool> for BitVector
Source§fn bitand_assign(&mut self, rhs: bool)
fn bitand_assign(&mut self, rhs: bool)
&= operation. Read moreSource§impl BitAndAssign for BitVector
impl BitAndAssign for BitVector
Source§fn bitand_assign(&mut self, rhs: BitVector)
fn bitand_assign(&mut self, rhs: BitVector)
&= operation. Read moreSource§impl BitOrAssign<&BitSlice> for BitVector
impl BitOrAssign<&BitSlice> for BitVector
Source§fn bitor_assign(&mut self, rhs: &BitSlice)
fn bitor_assign(&mut self, rhs: &BitSlice)
|= operation. Read moreSource§impl BitOrAssign<&BitVector> for BitVector
impl BitOrAssign<&BitVector> for BitVector
Source§fn bitor_assign(&mut self, rhs: &BitVector)
fn bitor_assign(&mut self, rhs: &BitVector)
|= operation. Read moreSource§impl BitOrAssign<bool> for BitVector
impl BitOrAssign<bool> for BitVector
Source§fn bitor_assign(&mut self, rhs: bool)
fn bitor_assign(&mut self, rhs: bool)
|= operation. Read moreSource§impl BitOrAssign for BitVector
impl BitOrAssign for BitVector
Source§fn bitor_assign(&mut self, rhs: BitVector)
fn bitor_assign(&mut self, rhs: BitVector)
|= operation. Read moreSource§impl BitXorAssign<&BitSlice> for BitVector
impl BitXorAssign<&BitSlice> for BitVector
Source§fn bitxor_assign(&mut self, rhs: &BitSlice)
fn bitxor_assign(&mut self, rhs: &BitSlice)
^= operation. Read moreSource§impl BitXorAssign<&BitVector> for BitVector
impl BitXorAssign<&BitVector> for BitVector
Source§fn bitxor_assign(&mut self, rhs: &BitVector)
fn bitxor_assign(&mut self, rhs: &BitVector)
^= operation. Read moreSource§impl BitXorAssign<bool> for BitVector
impl BitXorAssign<bool> for BitVector
Source§fn bitxor_assign(&mut self, rhs: bool)
fn bitxor_assign(&mut self, rhs: bool)
^= operation. Read moreSource§impl BitXorAssign for BitVector
impl BitXorAssign for BitVector
Source§fn bitxor_assign(&mut self, rhs: BitVector)
fn bitxor_assign(&mut self, rhs: BitVector)
^= operation. Read more