Struct bv::adapter::BoolAdapter [−][src]
pub struct BoolAdapter<Block, T> { /* fields omitted */ }
Expand description
Adapts a sequence of bool
s (e.g., &[bool]
) to emulate a bit
vector.
In particular, this adapter implements Bits
, BitsMut
, and
BitsPush
as appropriate. It implement PartialEq<T>
for all
T: Bits<Block=Block>
. It does not, however, implement slicing, so
slice before you adapt.
Note that a bare Vec<bool>
or &[bool]
already implements Bits
,
etc., with a Block
type of u8
. This means that it is only
compatible with other u8
-based bit vectors. BoolAdapter
is instead
parametrized by the block type, so it works with bit vectors, slices,
and adapters of any uniform block type.
Implementations
Creates a new BoolAdapter
from an underlying sequence of bool
s.
Note that the BoolAdapter
derefs to the underlying bool
sequence.
Examples
use bv::BitSliceable; use bv::adapter::BoolAdapter; let array = [0b101usize]; let bv1 = BoolAdapter::new(vec![true, false, true]); let bv2 = array.bit_slice(0..3); assert_eq!( bv1, bv2 );
Gets the underlying bool
sequence object back out of a BoolAdapter
.
Trait Implementations
Sets the block at position
to value
. Read more
Sets the block at position
to value
. Read more
Sets the block at position
to value
. Read more
Auto Trait Implementations
impl<Block, T> RefUnwindSafe for BoolAdapter<Block, T> where
Block: RefUnwindSafe,
T: RefUnwindSafe,
impl<Block, T> Send for BoolAdapter<Block, T> where
Block: Send,
T: Send,
impl<Block, T> Sync for BoolAdapter<Block, T> where
Block: Sync,
T: Sync,
impl<Block, T> Unpin for BoolAdapter<Block, T> where
Block: Unpin,
T: Unpin,
impl<Block, T> UnwindSafe for BoolAdapter<Block, T> where
Block: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more