Difference between `BitVec` and `BitVec<T, O>`?
avdb13 opened this issue · 1 comments
avdb13 commented
The following compiles:
pub struct BitMap {
inner: Receiver<Vec<u8>>,
rare_bits: BitVec<u8, Msb0>,
}
impl BitMap {
async fn recv(&mut self) {
let next = self.inner.recv().await.unwrap();
let rhs = BitVec::from_vec(next);
self.rare_bits.bitxor_assign(rhs);
}
}
But the following doesn't:
pub struct BitMap {
inner: Receiver<Vec<u8>>,
rare_bits: BitVec,
}
impl BitMap {
async fn recv(&mut self) {
let next = self.inner.recv().await.unwrap();
let rhs = BitVec::from_vec(next);
// no implementation for `BitSlice ^= BitVec<u8, _>`
self.rare_bits.bitxor_assign(rhs);
}
}
What are the semantic differences here?
mina86 commented
The default is to use usize
and Lsb0
so in the second example rare_bits
is of type BitVec<usize, Lsb0>
.