Struct bitvec_rs::BitVec [] [src]

pub struct BitVec { /* fields omitted */ }

Bit vector with guaranteed [u8] representation and safe mutable access to this slice. Slices into the bit vector are guaranteed to have the unused bits on the last set to 0.

Methods

impl BitVec
[src]

Constructs an empty BitVec.

Constructs a BitVec from bytes.

Constructs a BitVec from a repeating bit value.

Returns a byte slice view of the data.

Invokes the given function on a mut byte slice view of the data. After f completes, the trailing unused bits of the last byte are automatically set to 0.

Consumes the self and returns the underlying Vec<u8> of length ceil(self.len()/8). The values of the bits in the last byte of Vec<u8> beyond the length of the BitVec are unspecified.

Returns the length of the bit vector.

Gets the bit at the given index.

Sets the bit at the given index. Panics if index exceeds length.

Swaps two elements in the BitVec.

Gets the bit at the given index without bounds checking.

Sets the bit at the given index without bounds checking.

Pushes a boolean to the end of the BitVec.

Pops a boolean from the end of the BitVec.

Clears the BitVec, removing all values.

Returns the number of booleans that the bitvec can hold without reallocating.

Reserves capacity for at least additional more booleans to be inserted in the given BitVec. The collection may reserve more space to avoid frequent reallocations.

Shorten a vector, dropping excess elements.

If len is greater than the vector's current length, this has no effect.

Reserves capacity for at least additional more booleans to be inserted in the given BitVec. The collection may reserve more space to avoid frequent reallocations.

Returns an iterator for the booleans in the array.

Trait Implementations

impl Clone for BitVec
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for BitVec
[src]

impl PartialEq<BitVec> for BitVec
[src]

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

This method tests for !=.

impl Debug for BitVec
[src]

Formats the value using the given formatter.

impl Display for BitVec
[src]

Formats the value using the given formatter. Read more

impl Extend<bool> for BitVec
[src]

Extends a collection with the contents of an iterator. Read more

impl<'a> Extend<&'a bool> for BitVec
[src]

Extends a collection with the contents of an iterator. Read more

impl Index<usize> for BitVec
[src]

The returned type after indexing

The method for the indexing (container[index]) operation