[−][src]Struct bv::adapter::BoolAdapter
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.
Methods
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]
type Block = Block
The underlying block type used to store the bits of the vector.
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
fn to_bit_vec(&self) -> BitVec<Self::Block>
[src]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a mut Vec<bool>>
[src]
type Block = Block
The underlying block type used to store the bits of the vector.
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
fn to_bit_vec(&self) -> BitVec<Self::Block>
[src]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a mut [bool]>
[src]
type Block = Block
The underlying block type used to store the bits of the vector.
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
fn to_bit_vec(&self) -> BitVec<Self::Block>
[src]
impl<'a, Block: BlockType> Bits for BoolAdapter<Block, &'a [bool]>
[src]
type Block = Block
The underlying block type used to store the bits of the vector.
fn bit_len(&self) -> u64
[src]
fn get_bit(&self, position: u64) -> bool
[src]
fn block_len(&self) -> usize
[src]
fn get_block(&self, position: usize) -> Self::Block
[src]
fn get_raw_block(&self, position: usize) -> Self::Block
[src]
fn get_bits(&self, start: u64, count: usize) -> Self::Block
[src]
fn to_bit_vec(&self) -> BitVec<Self::Block>
[src]
impl<Block: BlockType> BitsMut for BoolAdapter<Block, Vec<bool>>
[src]
fn set_bit(&mut self, position: u64, value: bool)
[src]
fn set_block(&mut self, position: usize, value: Self::Block)
[src]
fn set_bits(&mut self, start: u64, count: usize, value: Self::Block)
[src]
impl<'a, Block: BlockType> BitsMut for BoolAdapter<Block, &'a mut Vec<bool>>
[src]
fn set_bit(&mut self, position: u64, value: bool)
[src]
fn set_block(&mut self, position: usize, value: Self::Block)
[src]
fn set_bits(&mut self, start: u64, count: usize, value: Self::Block)
[src]
impl<'a, Block: BlockType> BitsMut for BoolAdapter<Block, &'a mut [bool]>
[src]
fn set_bit(&mut self, position: u64, value: bool)
[src]
fn set_block(&mut self, position: usize, value: Self::Block)
[src]
fn set_bits(&mut self, start: u64, count: usize, value: Self::Block)
[src]
impl<Block: BlockType> BitsPush for BoolAdapter<Block, Vec<bool>>
[src]
fn push_bit(&mut self, value: bool)
[src]
fn pop_bit(&mut self) -> Option<bool>
[src]
fn align_block(&mut self, value: bool)
[src]
fn push_block(&mut self, value: Self::Block)
[src]
impl<'a, Block: BlockType> BitsPush for BoolAdapter<Block, &'a mut Vec<bool>>
[src]
fn push_bit(&mut self, value: bool)
[src]
fn pop_bit(&mut self) -> Option<bool>
[src]
fn align_block(&mut self, value: bool)
[src]
fn push_block(&mut self, value: Self::Block)
[src]
impl<Block: Clone, T: Clone> Clone for BoolAdapter<Block, T>
[src]
fn clone(&self) -> BoolAdapter<Block, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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>,
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]
Auto Trait Implementations
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,
impl<Block, T> RefUnwindSafe for BoolAdapter<Block, T> where
Block: RefUnwindSafe,
T: RefUnwindSafe,
Block: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,