Struct smallbitvec::SmallBitVec [] [src]

pub struct SmallBitVec { /* fields omitted */ }

A resizable bit vector, optimized for size and inline storage.

SmallBitVec is exactly one word wide. Depending on the required capacity, this word either stores the bits inline, or it stores a pointer to a separate buffer on the heap.

Methods

impl SmallBitVec
[src]

[src]

Create an empty vector.

[src]

Create a vector containing len bits, each set to val.

[src]

Create an empty vector with enough storage pre-allocated to store at least cap bits without resizing.

[src]

The number of bits stored in this bit vector.

[src]

Returns true if this vector contains no bits.

[src]

The number of bits that can be stored in this bit vector without re-allocating.

[src]

Get the nth bit in this bit vector.

[src]

Get the nth bit in this bit vector, without bounds checks.

[src]

Set the nth bit in this bit vector to val. Panics if the index is out of bounds.

[src]

Set the nth bit in this bit vector to val, without bounds checks.

[src]

Append a bit to the end of the vector.

use smallbitvec::SmallBitVec;
let mut v = SmallBitVec::new();
v.push(true);

assert_eq!(v.len(), 1);
assert_eq!(v.get(0), Some(true));

[src]

Remove the last bit from the vector and return it, if there is one.

use smallbitvec::SmallBitVec;
let mut v = SmallBitVec::new();
v.push(false);

assert_eq!(v.pop(), Some(false));
assert_eq!(v.len(), 0);
assert_eq!(v.pop(), None);

[src]

Remove and return the bit at index idx, shifting all later bits toward the front.

Panics if the index is out of bounds.

[src]

Remove all elements from the vector, without deallocating its buffer.

[src]

Reserve capacity for at least additional more elements to be inserted.

May reserve more space than requested, to avoid frequent reallocations.

Panics if the new capacity overflows usize.

Re-allocates only if self.capacity() < self.len() + additional.

Important traits for Iter<'a>
[src]

Returns an iterator that yields the bits of the vector in order, as bool values.

[src]

Returns true if all the bits in the vec are set to zero/false.

[src]

Returns true if all the bits in the vec are set to one/true.

[src]

If the vector owns a heap allocation, returns a pointer to the start of the allocation.

The layout of the data at this allocation is a private implementation detail.

Trait Implementations

impl Debug for SmallBitVec
[src]

[src]

Formats the value using the given formatter. Read more

impl PartialEq for SmallBitVec
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Eq for SmallBitVec
[src]

impl Drop for SmallBitVec
[src]

[src]

Executes the destructor for this type. Read more

impl Clone for SmallBitVec
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Index<usize> for SmallBitVec
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl Hash for SmallBitVec
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

impl Extend<bool> for SmallBitVec
[src]

[src]

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

impl FromIterator<bool> for SmallBitVec
[src]

[src]

Creates a value from an iterator. Read more

impl IntoIterator for SmallBitVec
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Important traits for IntoIter
[src]

Creates an iterator from a value. Read more

impl<'a> IntoIterator for &'a SmallBitVec
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Important traits for Iter<'a>
[src]

Creates an iterator from a value. Read more

Auto Trait Implementations

impl Send for SmallBitVec

impl Sync for SmallBitVec