Struct bv::adapter::BoolAdapter [−][src]
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
impl<Block: BlockType, T> BoolAdapter<Block, T>
[src][−]
pub fn new(bits: T) -> Self
[src][−]
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 );
pub fn into_inner(self) -> T
[src][−]
Gets the underlying bool
sequence object back out of a BoolAdapter
.
Trait Implementations
impl<Block: BlockType> Bits for BoolAdapter<Block, Vec<bool>>
[src][+]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a mut Vec<bool>>
[src][+]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a mut [bool]>
[src][+]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a [bool]>
[src][+]
impl<Block: BlockType> BitsMut for BoolAdapter<Block, Vec<bool>>
[src][+]
impl<'a, Block: BlockType> BitsMut for BoolAdapter<Block, &'a mut Vec<bool>>
[src][+]
impl<'a, Block: BlockType> BitsMut for BoolAdapter<Block, &'a mut [bool]>
[src][+]
impl<Block: BlockType> BitsPush for BoolAdapter<Block, Vec<bool>>
[src][+]
impl<'a, Block: BlockType> BitsPush for BoolAdapter<Block, &'a mut Vec<bool>>
[src][+]
impl<Block: Clone, T: Clone> Clone for BoolAdapter<Block, T>
[src][+]
impl<Block: Debug, T: Debug> Debug for BoolAdapter<Block, T>
[src][+]
impl<Block, T> Deref for BoolAdapter<Block, T>
[src][+]
impl<Block, T> DerefMut for BoolAdapter<Block, T>
[src][+]
impl<Block, T, U> PartialEq<U> for BoolAdapter<Block, T> where
Block: BlockType,
U: Bits<Block = Block>,
Self: Bits<Block = Block>,
[src][+]
Block: BlockType,
U: Bits<Block = Block>,
Self: Bits<Block = Block>,
Auto Trait Implementations
impl<Block, T> RefUnwindSafe for BoolAdapter<Block, T> where
Block: RefUnwindSafe,
T: RefUnwindSafe,
Block: RefUnwindSafe,
T: RefUnwindSafe,
impl<Block, T> Send for BoolAdapter<Block, T> where
Block: Send,
T: Send,
Block: Send,
T: Send,
impl<Block, T> Sync for BoolAdapter<Block, T> where
Block: Sync,
T: Sync,
Block: Sync,
T: Sync,
impl<Block, T> Unpin for BoolAdapter<Block, T> where
Block: Unpin,
T: Unpin,
Block: Unpin,
T: Unpin,
impl<Block, T> UnwindSafe for BoolAdapter<Block, T> where
Block: UnwindSafe,
T: UnwindSafe,
Block: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,