Struct bv::BitSlice
[−]
[src]
pub struct BitSlice<'a, Block> { /* fields omitted */ }A slice of a bit-vector; akin to &'a [bool] but packed.
Methods
impl<'a, Block: BlockType> BitSlice<'a, Block>[src]
pub unsafe fn from_raw_parts(bits: *const Block, offset: u8, len: u64) -> Self[src]
Creates a BitSlice from a pointer to its data, an offset where the bits start, and the
number of available bits.
This is unsafe because the size of the passed-in buffer is not
checked. It must hold at least offset + len bits or the resulting behavior is undefined.
pub fn from_slice(blocks: &'a [Block]) -> Self[src]
Creates a BitSlice from an array slice of blocks.
The size is always a multiple of
Block::nbits(). If you want a different size, slice.
pub fn len(&self) -> u64[src]
The number of bits in the slice.
pub fn is_empty(&self) -> bool[src]
Returns whether there are no bits in the slice.
ⓘImportant traits for BitSliceBlockIter<'a, Block>pub fn block_iter(self) -> BitSliceBlockIter<'a, Block>[src]
Gets an iterator over the blocks of the slice.
Note that this iterates over whole blocks, with a partial block only at the end. That
means that if the bit-slice offset is non-zero, these blocks may not correspond to the
blocks retrieved by Bits::get_block.
Trait Implementations
impl<'a, Block: Copy> Copy for BitSlice<'a, Block>[src]
impl<'a, Block: Clone> Clone for BitSlice<'a, Block>[src]
fn clone(&self) -> BitSlice<'a, Block>[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl<'a, Block: BlockType> Bits for BitSlice<'a, Block>[src]
type Block = Block
The underlying block type used to store the bits of the vector.
fn bit_len(&self) -> u64[src]
The length of the slice in bits.
fn bit_offset(&self) -> u8[src]
The number of bits into the first block that the bit vector starts. Must be less than Block::nbits(). Read more
fn get_block(&self, position: usize) -> Self::Block[src]
Gets the block at position Read more
fn block_len(&self) -> usize[src]
The length of the slice in blocks.
fn get_bit(&self, position: u64) -> bool[src]
Gets the bit at position Read more
fn get_bits(&self, start: u64, count: usize) -> Self::Block[src]
Gets count bits starting at bit index start, interpreted as a little-endian integer. Read more
impl<'a, Block: BlockType> Index<u64> for BitSlice<'a, Block>[src]
type Output = bool
The returned type after indexing.
fn index(&self, index: u64) -> &bool[src]
Performs the indexing (container[index]) operation.
impl<'a, Block: BlockType> BitSliceable<Range<u64>> for BitSlice<'a, Block>[src]
type Slice = Self
The type of the slice.
fn bit_slice(self, range: Range<u64>) -> Self[src]
(Re-)slices the given object.
impl<'a, Block: BlockType> BitSliceable<RangeInclusive<u64>> for BitSlice<'a, Block>[src]
type Slice = Self
The type of the slice.
fn bit_slice(self, range: RangeInclusive<u64>) -> Self[src]
(Re-)slices the given object.
impl<'a, Block: BlockType> BitSliceable<RangeFrom<u64>> for BitSlice<'a, Block>[src]
type Slice = Self
The type of the slice.
fn bit_slice(self, range: RangeFrom<u64>) -> Self[src]
(Re-)slices the given object.
impl<'a, Block: BlockType> BitSliceable<RangeTo<u64>> for BitSlice<'a, Block>[src]
type Slice = Self
The type of the slice.
fn bit_slice(self, range: RangeTo<u64>) -> Self[src]
(Re-)slices the given object.
impl<'a, Block: BlockType> BitSliceable<RangeToInclusive<u64>> for BitSlice<'a, Block>[src]
type Slice = Self
The type of the slice.
fn bit_slice(self, range: RangeToInclusive<u64>) -> Self[src]
(Re-)slices the given object.
impl<'a, Block: BlockType> BitSliceable<RangeFull> for BitSlice<'a, Block>[src]
type Slice = Self
The type of the slice.
fn bit_slice(self, _: RangeFull) -> Self[src]
(Re-)slices the given object.
impl<'a, Block: BlockType> PartialEq for BitSlice<'a, Block>[src]
fn eq(&self, other: &BitSlice<Block>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl<'a, Block: BlockType> Eq for BitSlice<'a, Block>[src]
impl<'a, Block: BlockType> PartialOrd for BitSlice<'a, Block>[src]
fn partial_cmp(&self, other: &BitSlice<Block>) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Rhs) -> bool1.0.0[src]
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Rhs) -> bool1.0.0[src]
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
impl<'a, Block: BlockType> Ord for BitSlice<'a, Block>[src]
fn cmp(&self, other: &Self) -> Ordering[src]
This method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
Compares and returns the minimum of two values. Read more
impl<'a, Block: BlockType + Hash> Hash for BitSlice<'a, Block>[src]
fn hash<H: Hasher>(&self, state: &mut H)[src]
Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher]. Read more