Struct fixedbitset::FixedBitSet [−][src]
pub struct FixedBitSet { /* fields omitted */ }
Expand description
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).
Implementations
impl FixedBitSet
[src]
impl FixedBitSet
[src]pub fn with_capacity(bits: usize) -> Self
[src]
pub fn with_capacity(bits: usize) -> Self
[src]Create a new FixedBitSet with a specific number of bits, all initially clear.
pub fn contains(&self, bit: usize) -> bool
[src]
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 put(&mut self, bit: usize) -> bool
[src]
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 toggle(&mut self, bit: usize)
[src]
pub fn toggle(&mut self, bit: usize)
[src]Toggle bit
(inverting its state).
Panics if bit is out of bounds
pub fn copy_bit(&mut self, from: usize, to: usize)
[src]
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]
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]
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]
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_mut_slice(&mut self) -> &mut [u32]
[src]
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.
pub fn ones(&self) -> Ones<'_>ⓘ
[src]
pub fn ones(&self) -> Ones<'_>ⓘ
[src]Iterates over all enabled bits.
Iterator element is the index of the 1
bit, type usize
.
pub fn intersection<'a>(&'a self, other: &'a FixedBitSet) -> Intersection<'a>ⓘNotable traits for Intersection<'a>
impl<'a> Iterator for Intersection<'a> type Item = usize;
[src]
pub fn intersection<'a>(&'a self, other: &'a FixedBitSet) -> Intersection<'a>ⓘNotable traits for Intersection<'a>
impl<'a> Iterator for Intersection<'a> type Item = usize;
[src]Returns a lazy iterator over the intersection of two FixedBitSet
s
pub fn union<'a>(&'a self, other: &'a FixedBitSet) -> Union<'a>ⓘ
[src]
pub fn union<'a>(&'a self, other: &'a FixedBitSet) -> Union<'a>ⓘ
[src]Returns a lazy iterator over the union of two FixedBitSet
s.
pub fn difference<'a>(&'a self, other: &'a FixedBitSet) -> Difference<'a>ⓘNotable traits for Difference<'a>
impl<'a> Iterator for Difference<'a> type Item = usize;
[src]
pub fn difference<'a>(&'a self, other: &'a FixedBitSet) -> Difference<'a>ⓘNotable traits for Difference<'a>
impl<'a> Iterator for Difference<'a> type Item = usize;
[src]Returns a lazy iterator over the difference of two FixedBitSet
s. The difference of a
and b
is the elements of a
which are not in b
.
pub fn symmetric_difference<'a>(
&'a self,
other: &'a FixedBitSet
) -> SymmetricDifference<'a>ⓘNotable traits for SymmetricDifference<'a>
impl<'a> Iterator for SymmetricDifference<'a> type Item = usize;
[src]
pub fn symmetric_difference<'a>(
&'a self,
other: &'a FixedBitSet
) -> SymmetricDifference<'a>ⓘNotable traits for SymmetricDifference<'a>
impl<'a> Iterator for SymmetricDifference<'a> type Item = usize;
[src]Returns a lazy iterator over the symmetric difference of two FixedBitSet
s.
The symmetric difference of a
and b
is the elements of one, but not both, sets.
pub fn union_with(&mut self, other: &FixedBitSet)
[src]
pub fn union_with(&mut self, other: &FixedBitSet)
[src]In-place union of two FixedBitSet
s.
pub fn intersect_with(&mut self, other: &FixedBitSet)
[src]
pub fn intersect_with(&mut self, other: &FixedBitSet)
[src]In-place intersection of two FixedBitSet
s.
pub fn symmetric_difference_with(&mut self, other: &FixedBitSet)
[src]
pub fn symmetric_difference_with(&mut self, other: &FixedBitSet)
[src]In-place symmetric difference of two FixedBitSet
s.
pub fn is_disjoint(&self, other: &FixedBitSet) -> bool
[src]
pub fn is_disjoint(&self, other: &FixedBitSet) -> bool
[src]Returns true
if self
has no elements in common with other
. This
is equivalent to checking for an empty intersection.
pub fn is_subset(&self, other: &FixedBitSet) -> bool
[src]
pub fn is_subset(&self, other: &FixedBitSet) -> bool
[src]Returns true
if the set is a subset of another, i.e. other
contains
at least all the values in self
.
pub fn is_superset(&self, other: &FixedBitSet) -> bool
[src]
pub fn is_superset(&self, other: &FixedBitSet) -> bool
[src]Returns true
if the set is a superset of another, i.e. self
contains
at least all the values in other
.
Trait Implementations
impl<'a> BitAnd<&'a FixedBitSet> for &'a FixedBitSet
[src]
impl<'a> BitAnd<&'a FixedBitSet> for &'a FixedBitSet
[src]type Output = FixedBitSet
type Output = FixedBitSet
The resulting type after applying the &
operator.
fn bitand(self, other: &FixedBitSet) -> FixedBitSet
[src]
fn bitand(self, other: &FixedBitSet) -> FixedBitSet
[src]Performs the &
operation. Read more
impl<'a> BitAndAssign<FixedBitSet> for FixedBitSet
[src]
impl<'a> BitAndAssign<FixedBitSet> for FixedBitSet
[src]fn bitand_assign(&mut self, other: Self)
[src]
fn bitand_assign(&mut self, other: Self)
[src]Performs the &=
operation. Read more
impl<'a> BitOr<&'a FixedBitSet> for &'a FixedBitSet
[src]
impl<'a> BitOr<&'a FixedBitSet> for &'a FixedBitSet
[src]type Output = FixedBitSet
type Output = FixedBitSet
The resulting type after applying the |
operator.
fn bitor(self, other: &FixedBitSet) -> FixedBitSet
[src]
fn bitor(self, other: &FixedBitSet) -> FixedBitSet
[src]Performs the |
operation. Read more
impl<'a> BitOrAssign<FixedBitSet> for FixedBitSet
[src]
impl<'a> BitOrAssign<FixedBitSet> for FixedBitSet
[src]fn bitor_assign(&mut self, other: Self)
[src]
fn bitor_assign(&mut self, other: Self)
[src]Performs the |=
operation. Read more
impl<'a> BitXor<&'a FixedBitSet> for &'a FixedBitSet
[src]
impl<'a> BitXor<&'a FixedBitSet> for &'a FixedBitSet
[src]type Output = FixedBitSet
type Output = FixedBitSet
The resulting type after applying the ^
operator.
fn bitxor(self, other: &FixedBitSet) -> FixedBitSet
[src]
fn bitxor(self, other: &FixedBitSet) -> FixedBitSet
[src]Performs the ^
operation. Read more
impl<'a> BitXorAssign<FixedBitSet> for FixedBitSet
[src]
impl<'a> BitXorAssign<FixedBitSet> for FixedBitSet
[src]fn bitxor_assign(&mut self, other: Self)
[src]
fn bitxor_assign(&mut self, other: Self)
[src]Performs the ^=
operation. Read more
impl Clone for FixedBitSet
[src]
impl Clone for FixedBitSet
[src]impl Debug for FixedBitSet
[src]
impl Debug for FixedBitSet
[src]impl Default for FixedBitSet
[src]
impl Default for FixedBitSet
[src]fn default() -> FixedBitSet
[src]
fn default() -> FixedBitSet
[src]Returns the “default value” for a type. Read more
impl Extend<usize> for FixedBitSet
[src]
impl Extend<usize> for FixedBitSet
[src]Sets the bit at index i to true for each item i in the input src.
fn extend<I: IntoIterator<Item = usize>>(&mut self, src: I)
[src]
fn extend<I: IntoIterator<Item = usize>>(&mut self, src: I)
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl FromIterator<usize> for FixedBitSet
[src]
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.
fn from_iter<I: IntoIterator<Item = usize>>(src: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = usize>>(src: I) -> Self
[src]Creates a value from an iterator. Read more
impl Hash for FixedBitSet
[src]
impl Hash for FixedBitSet
[src]impl Index<usize> for FixedBitSet
[src]
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.
impl Ord for FixedBitSet
[src]
impl Ord for FixedBitSet
[src]impl PartialEq<FixedBitSet> for FixedBitSet
[src]
impl PartialEq<FixedBitSet> for FixedBitSet
[src]fn eq(&self, other: &FixedBitSet) -> bool
[src]
fn eq(&self, other: &FixedBitSet) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &FixedBitSet) -> bool
[src]
fn ne(&self, other: &FixedBitSet) -> bool
[src]This method tests for !=
.
impl PartialOrd<FixedBitSet> for FixedBitSet
[src]
impl PartialOrd<FixedBitSet> for FixedBitSet
[src]fn partial_cmp(&self, other: &FixedBitSet) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &FixedBitSet) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for FixedBitSet
[src]
impl StructuralEq for FixedBitSet
[src]
impl StructuralPartialEq for FixedBitSet
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more