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

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

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.

Implementations

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 );

Gets the underlying bool sequence object back out of a BoolAdapter.

Trait Implementations

The underlying block type used to store the bits of the vector.

The length of the slice in bits.

Gets the bit at position Read more

The length of the slice in blocks.

Gets the block at position, masked as necessary. Read more

Gets the block at position, without masking. Read more

Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Copies the bits into a new allocated BitVec. Read more

The underlying block type used to store the bits of the vector.

The length of the slice in bits.

Gets the bit at position Read more

The length of the slice in blocks.

Gets the block at position, masked as necessary. Read more

Gets the block at position, without masking. Read more

Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Copies the bits into a new allocated BitVec. Read more

The underlying block type used to store the bits of the vector.

The length of the slice in bits.

Gets the bit at position Read more

The length of the slice in blocks.

Gets the block at position, masked as necessary. Read more

Gets the block at position, without masking. Read more

Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Copies the bits into a new allocated BitVec. Read more

The underlying block type used to store the bits of the vector.

The length of the slice in bits.

Gets the bit at position Read more

The length of the slice in blocks.

Gets the block at position, masked as necessary. Read more

Gets the block at position, without masking. Read more

Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Copies the bits into a new allocated BitVec. Read more

Sets the bit at position to value. Read more

Sets the block at position to value. Read more

Sets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Sets the bit at position to value. Read more

Sets the block at position to value. Read more

Sets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Sets the bit at position to value. Read more

Sets the block at position to value. Read more

Sets count bits starting at bit index start, interpreted as a little-endian integer. Read more

Adds the given bit to the end of the bit vector.

Removes and returns the last bit, if any.

Pushes value 0 or more times until the size of the bit vector is block-aligned. Read more

Pushes the given block onto the end of the bit vector. Read more

Adds the given bit to the end of the bit vector.

Removes and returns the last bit, if any.

Pushes value 0 or more times until the size of the bit vector is block-aligned. Read more

Pushes the given block onto the end of the bit vector. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.