[][src]Struct bv::adapter::BoolAdapter

pub struct BoolAdapter<Block, T> { /* fields omitted */ }

Adapts a sequence of bools (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 bools.

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.

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.

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.

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.

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, T, U> PartialEq<U> for BoolAdapter<Block, T> where
    Block: BlockType,
    U: Bits<Block = Block>,
    Self: Bits<Block = Block>, 
[src]

impl<Block: Debug, T: Debug> Debug for BoolAdapter<Block, T>[src]

impl<Block, T> Deref for BoolAdapter<Block, T>[src]

type Target = T

The resulting type after dereferencing.

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

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

impl<Block, T> RefUnwindSafe for BoolAdapter<Block, T> where
    Block: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]