[][src]Struct fixedbitset::FixedBitSet

pub struct FixedBitSet { /* fields omitted */ }

FixedBitSet is a simple fixed size set of bits that each can be enabled (1 / true) or disabled (0 / false).

The bit set has a fixed capacity in terms of enabling bits (and the capacity can grow using the grow method).

Methods

impl FixedBitSet[src]

pub fn with_capacity(bits: usize) -> Self[src]

Create a new FixedBitSet with a specific number of bits, all initially clear.

pub fn grow(&mut self, bits: usize)[src]

Grow capacity to bits, all new bits initialized to zero

pub fn len(&self) -> usize[src]

Return the length of the FixedBitSet in bits.

pub fn contains(&self, bit: usize) -> bool[src]

Return true if the bit is enabled in the FixedBitSet, false otherwise.

Note: bits outside the capacity are always disabled.

Note: Also available with index syntax: bitset[bit].

pub fn clear(&mut self)[src]

Clear all bits.

pub fn insert(&mut self, bit: usize)[src]

Enable bit.

Panics if bit is out of bounds.

pub fn put(&mut self, bit: usize) -> bool[src]

Enable bit, and return its previous value.

Panics if bit is out of bounds.

pub fn set(&mut self, bit: usize, enabled: bool)[src]

Panics if bit is out of bounds.

pub fn copy_bit(&mut self, from: usize, to: usize)[src]

Copies boolean value from specified bit to the specified bit.

Panics if to is out of bounds.

pub fn count_ones<T: IndexRange>(&self, range: T) -> usize[src]

Count the number of set bits in the given bit range.

Use .. to count the whole content of the bitset.

Panics if the range extends past the end of the bitset.

pub fn set_range<T: IndexRange>(&mut self, range: T, enabled: bool)[src]

Sets every bit in the given range to the given state (enabled)

Use .. to toggle the whole bitset.

Panics if the range extends past the end of the bitset.

pub fn insert_range<T: IndexRange>(&mut self, range: T)[src]

Enables every bit in the given range.

Use .. to make the whole bitset ones.

Panics if the range extends past the end of the bitset.

pub fn as_slice(&self) -> &[u32][src]

View the bitset as a slice of u32 blocks

pub fn as_mut_slice(&mut self) -> &mut [u32][src]

View the bitset as a mutable slice of u32 blocks. Writing past the bitlength in the last will cause contains to return potentially incorrect results for bits past the bitlength.

Important traits for Ones<'a>
pub fn ones(&self) -> Ones[src]

Iterates over all enabled bits.

Iterator element is the index of the 1 bit, type usize.

Important traits for Intersection<'a>
pub fn intersection<'a>(&'a self, other: &'a FixedBitSet) -> Intersection<'a>[src]

Returns a lazy iterator over the intersection of two FixedBitSets

Important traits for Union<'a>
pub fn union<'a>(&'a self, other: &'a FixedBitSet) -> Union<'a>[src]

Returns a lazy iterator over the union of two FixedBitSets.

Important traits for Difference<'a>
pub fn difference<'a>(&'a self, other: &'a FixedBitSet) -> Difference<'a>[src]

Returns a lazy iterator over the difference of two FixedBitSets. The difference of a and b is the elements of a which are not in b.

Trait Implementations

impl Ord for FixedBitSet[src]

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

fn clamp(self, min: Self, max: Self) -> Self[src]

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

Restrict a value to a certain interval. Read more

impl Default for FixedBitSet[src]

impl Eq for FixedBitSet[src]

impl Clone for FixedBitSet[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Extend<usize> for FixedBitSet[src]

Sets the bit at index i to true for each item i in the input src.

impl PartialEq<FixedBitSet> for FixedBitSet[src]

impl PartialOrd<FixedBitSet> for FixedBitSet[src]

impl Hash for FixedBitSet[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

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

impl Debug for FixedBitSet[src]

impl<'a> BitAnd<&'a FixedBitSet> for &'a FixedBitSet[src]

type Output = FixedBitSet

The resulting type after applying the & operator.

impl<'a> BitOr<&'a FixedBitSet> for &'a FixedBitSet[src]

type Output = FixedBitSet

The resulting type after applying the | operator.

impl Index<usize> for FixedBitSet[src]

Return true if the bit is enabled in the bitset, or false otherwise.

Note: bits outside the capacity are always disabled, and thus indexing a FixedBitSet will not panic.

type Output = bool

The returned type after indexing.

impl FromIterator<usize> for FixedBitSet[src]

Return a FixedBitSet containing bits set to true for every bit index in the iterator, other bits are set to false.

Auto Trait Implementations

impl Send for FixedBitSet

impl Unpin for FixedBitSet

impl Sync for FixedBitSet

impl UnwindSafe for FixedBitSet

impl RefUnwindSafe for FixedBitSet

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]