Struct bv::BitSliceMut[][src]

pub struct BitSliceMut<'a, Block> { /* fields omitted */ }
Expand description

A mutable slice of a bit-vector; akin to &'a mut [bool] but packed.

Examples

use bv::*;

let mut array = [0b00110101u16];

{
    let mut slice = BitSliceMut::from_slice(&mut array);
    assert_eq!( slice[0], true );
    assert_eq!( slice[1], false );

    slice.set_bit(0, false);
}

assert_eq!( array[0], 0b00110100u16 );

Implementations

Creates a BitSliceMut from a mutable array slice of blocks.

The size is always a multiple of Block::nbits(). If you want a different size, slice.

Creates a BitSliceMut 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.

Precondition

  • the first Block::ceil_div_nbits(len + offset) words of bits safe to read and write.

The number of bits in the slice.

Returns whether there are no bits in the slice.

Converts a mutable bit slice to immutable.

Trait Implementations

The type of the slice produced.

Slices or re-slices the given object. Read more

The type of the slice produced.

Slices or re-slices the given object. Read more

The type of the slice produced.

Slices or re-slices the given object. Read more

The type of the slice produced.

Slices or re-slices the given object. Read more

The type of the slice produced.

Slices or re-slices the given object. Read more

The type of the slice produced.

Slices or re-slices the given object. 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

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

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

The length of the slice in blocks.

Gets the block at position, without masking. 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

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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 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.