Struct fixedbitset::FixedBitSet
[−]
[src]
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]
impl FixedBitSet
pub fn with_capacity(bits: usize) -> Self
[src]
pub fn with_capacity(bits: usize) -> Self
Create a new FixedBitSet with a specific number of bits, all initially clear.
pub fn grow(&mut self, bits: usize)
[src]
pub fn grow(&mut self, bits: usize)
Grow capacity to bits, all new bits initialized to zero
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Return the length of the FixedBitSet
in bits.
pub fn contains(&self, bit: usize) -> bool
[src]
pub fn contains(&self, bit: usize) -> bool
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]
pub fn clear(&mut self)
Clear all bits.
pub fn insert(&mut self, bit: usize)
[src]
pub fn insert(&mut self, bit: usize)
Enable bit
.
Panics if bit is out of bounds.
pub fn put(&mut self, bit: usize) -> bool
[src]
pub fn put(&mut self, bit: usize) -> bool
Enable bit
, and return its previous value.
Panics if bit is out of bounds.
pub fn set(&mut self, bit: usize, enabled: bool)
[src]
pub fn set(&mut self, bit: usize, enabled: bool)
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)
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
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)
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)
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]
pub fn as_slice(&self) -> &[u32]
View the bitset as a slice of u32
blocks
pub fn as_mut_slice(&mut self) -> &mut [u32]
[src]
pub fn as_mut_slice(&mut self) -> &mut [u32]
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]
pub fn ones(&self) -> Ones
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]
pub fn intersection<'a>(&'a self, other: &'a FixedBitSet) -> Intersection<'a>
Returns a lazy iterator over the intersection of two FixedBitSet
s
ⓘImportant traits for Union<'a>pub fn union<'a>(&'a self, other: &'a FixedBitSet) -> Union<'a>
[src]
pub fn union<'a>(&'a self, other: &'a FixedBitSet) -> Union<'a>
Returns a lazy iterator over the union of two FixedBitSet
s.
ⓘImportant traits for Difference<'a>pub fn difference<'a>(&'a self, other: &'a FixedBitSet) -> Difference<'a>
[src]
pub fn difference<'a>(&'a self, other: &'a FixedBitSet) -> Difference<'a>
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
.
Trait Implementations
impl Debug for FixedBitSet
[src]
impl Debug for FixedBitSet
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for FixedBitSet
[src]
impl PartialEq for FixedBitSet
fn eq(&self, __arg_0: &FixedBitSet) -> bool
[src]
fn eq(&self, __arg_0: &FixedBitSet) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &FixedBitSet) -> bool
[src]
fn ne(&self, __arg_0: &FixedBitSet) -> bool
This method tests for !=
.
impl Eq for FixedBitSet
[src]
impl Eq for FixedBitSet
impl PartialOrd for FixedBitSet
[src]
impl PartialOrd for FixedBitSet
fn partial_cmp(&self, __arg_0: &FixedBitSet) -> Option<Ordering>
[src]
fn partial_cmp(&self, __arg_0: &FixedBitSet) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &FixedBitSet) -> bool
[src]
fn lt(&self, __arg_0: &FixedBitSet) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &FixedBitSet) -> bool
[src]
fn le(&self, __arg_0: &FixedBitSet) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &FixedBitSet) -> bool
[src]
fn gt(&self, __arg_0: &FixedBitSet) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &FixedBitSet) -> bool
[src]
fn ge(&self, __arg_0: &FixedBitSet) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for FixedBitSet
[src]
impl Ord for FixedBitSet
fn cmp(&self, __arg_0: &FixedBitSet) -> Ordering
[src]
fn cmp(&self, __arg_0: &FixedBitSet) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for FixedBitSet
[src]
impl Hash for FixedBitSet
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for FixedBitSet
[src]
impl Default for FixedBitSet
fn default() -> FixedBitSet
[src]
fn default() -> FixedBitSet
Returns the "default value" for a type. Read more
impl Clone for FixedBitSet
[src]
impl Clone for FixedBitSet
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Index<usize> for FixedBitSet
[src]
impl Index<usize> for FixedBitSet
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.
fn index(&self, bit: usize) -> &bool
[src]
fn index(&self, bit: usize) -> &bool
Performs the indexing (container[index]
) operation.
impl Extend<usize> for FixedBitSet
[src]
impl Extend<usize> for FixedBitSet
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)
Extends a collection with the contents of an iterator. Read more
impl FromIterator<usize> for FixedBitSet
[src]
impl FromIterator<usize> for FixedBitSet
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
Creates a value from an iterator. Read more
impl<'a> BitAnd for &'a FixedBitSet
[src]
impl<'a> BitAnd for &'a FixedBitSet
type Output = FixedBitSet
The resulting type after applying the &
operator.
fn bitand(self, other: &FixedBitSet) -> FixedBitSet
[src]
fn bitand(self, other: &FixedBitSet) -> FixedBitSet
Performs the &
operation.
impl<'a> BitOr for &'a FixedBitSet
[src]
impl<'a> BitOr for &'a FixedBitSet
type Output = FixedBitSet
The resulting type after applying the |
operator.
fn bitor(self, other: &FixedBitSet) -> FixedBitSet
[src]
fn bitor(self, other: &FixedBitSet) -> FixedBitSet
Performs the |
operation.
Auto Trait Implementations
impl Send for FixedBitSet
impl Send for FixedBitSet
impl Sync for FixedBitSet
impl Sync for FixedBitSet