I am using the bitvec::prelude::BitVec package and want to perform some bitwise manipulations such as &, i.e. BitAnd. When scrolling the documentation, I've noticed that the source code unexpectedly reveals that this call would require a mutable reference to self, as well as using the &= operator in the function body. Do I misinterpret something here, or is the & operator really changing the value of the left hand side object?
From bitvec-1.0.0/src/vec/ops.rs:
#[cfg(not(tarpaulin_include))]
impl<T, O, Rhs> BitAnd<Rhs> for BitVec<T, O>
where
T: BitStore,
O: BitOrder,
BitSlice<T, O>: BitAndAssign<Rhs>,
{
type Output = Self;
fn bitand(mut self, rhs: Rhs) -> Self::Output {
self &= rhs;
self
}
}
I am using the
bitvec::prelude::BitVec
package and want to perform some bitwise manipulations such as&
, i.e.BitAnd
. When scrolling the documentation, I've noticed that the source code unexpectedly reveals that this call would require a mutable reference to self, as well as using the&=
operator in the function body. Do I misinterpret something here, or is the&
operator really changing the value of the left hand side object?From
bitvec-1.0.0/src/vec/ops.rs
: