pub struct BitSet64(/* private fields */);b64 only.Expand description
A set of 64 bits.
Implementations§
Source§impl BitSet64
impl BitSet64
Sourcepub const fn unit(index: usize) -> Self
pub const fn unit(index: usize) -> Self
Creates a set containing with only the bit at index set.
If index >=Self::CAPACITY, the resulting set will be empty.
Sourcepub const fn complement(self) -> Self
pub const fn complement(self) -> Self
Sourcepub const fn intersection(self, rhs: Self) -> Self
pub const fn intersection(self, rhs: Self) -> Self
Creates a new set with values that are in both self and rhs.
This is the const alternative to
BitAnd::bitand
for
BitSet64s.
Sourcepub const fn union(self, rhs: Self) -> Self
pub const fn union(self, rhs: Self) -> Self
Creates a new set with values that are in self or rhs.
This is the const alternative to
BitOr::bitor
for
BitSet64s.
Sourcepub const fn difference(self, rhs: Self) -> Self
pub const fn difference(self, rhs: Self) -> Self
Sourcepub const fn symmetric_difference(self, rhs: Self) -> Self
pub const fn symmetric_difference(self, rhs: Self) -> Self
Creates a new set with values that are in self or rhs, but not in both.
This is the const alternative to
BitXor::bitxor
for
BitSet64s.
Sourcepub const fn is(self, rhs: Self) -> bool
pub const fn is(self, rhs: Self) -> bool
Returns true if self is equal to rhs,
i.e., both sets have the same exact values.
This is the const alternative to
PartialEq::eq
for
BitSet64s.
Sourcepub const fn is_not(self, rhs: Self) -> bool
pub const fn is_not(self, rhs: Self) -> bool
Returns true if self is not equal to rhs,
i.e., the sets do not have exactly the same values.
This is the const alternative to
PartialEq::ne
for
BitSet64s.
Sourcepub const fn is_disjoint(self, rhs: Self) -> bool
pub const fn is_disjoint(self, rhs: Self) -> bool
Returns true if self has no elements in common with rhs. This is equivalent to
checking for an empty intersection.
Sourcepub const fn is_subset(self, rhs: Self) -> bool
pub const fn is_subset(self, rhs: Self) -> bool
Returns true if the set is a subset of another, i.e., rhs contains at least all
the values in self.
Sourcepub const fn is_strict_subset(self, rhs: Self) -> bool
pub const fn is_strict_subset(self, rhs: Self) -> bool
Returns true if the set is a strict subset of another, i.e., rhs contains all
the values in self and is larger than self.
Sourcepub const fn is_superset(self, rhs: Self) -> bool
pub const fn is_superset(self, rhs: Self) -> bool
Returns true if the set is a superset of another, i.e., self contains at least
all the values in rhs.
Sourcepub const fn is_strict_superset(self, rhs: Self) -> bool
pub const fn is_strict_superset(self, rhs: Self) -> bool
Returns true if the set is a strict superset of another, i.e., self contains all
the values in rhs and is larger than rhs.
Sourcepub const fn is_full(self) -> bool
pub const fn is_full(self) -> bool
Returns true if the set contains all Self::CAPACITY elements.
Sourcepub const fn get(self, index: usize) -> bool
pub const fn get(self, index: usize) -> bool
Gets the bit at index.
If index >=Self::CAPACITY, this will simply return false.
Sourcepub const fn min_index(self) -> usize
pub const fn min_index(self) -> usize
Returns the index of the least significant bit that is set.
If no bits are set, this returns Self::CAPACITY.
Sourcepub const fn max_index(self) -> usize
pub const fn max_index(self) -> usize
Returns the index of the most significant bit that is set.
§Panics
Panics if no bits are set. For a non-panicking alternative, see
max_index_checked.
Sourcepub const fn max_index_checked(self) -> Option<usize>
pub const fn max_index_checked(self) -> Option<usize>
Returns the index of the most significant bit that is set, or None if no bits
are set.
Sourcepub const fn masked_0_to_i(self, index: usize) -> Self
pub const fn masked_0_to_i(self, index: usize) -> Self
Creates a copy of this set that only has values less than index.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn mask_0_to_i(&mut self, index: usize)
pub const fn mask_0_to_i(&mut self, index: usize)
Sourcepub const fn masked_i_to_64(self, index: usize) -> Self
pub const fn masked_i_to_64(self, index: usize) -> Self
Creates a copy of this set that only has bits with indices greater than or equal to
index.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn mask_i_to_64(&mut self, index: usize)
pub const fn mask_i_to_64(&mut self, index: usize)
Removes any bits with indices outside the range
index..64.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn cleared_0_to_i(self, index: usize) -> Self
pub const fn cleared_0_to_i(self, index: usize) -> Self
Creates a copy of this set without the bits with indices in the range 0..index.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn clear_0_to_i(&mut self, index: usize)
pub const fn clear_0_to_i(&mut self, index: usize)
Clears bits 0..index, keeping bits
index..64
in their original states.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn cleared_i_to_64(self, index: usize) -> Self
pub const fn cleared_i_to_64(self, index: usize) -> Self
Creates a copy of this set without the bits with indices in the range
index..64.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn clear_i_to_64(&mut self, index: usize)
pub const fn clear_i_to_64(&mut self, index: usize)
Clears bits
index..64,
keeping bits 0..index in their original states.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn insert_quiet(&mut self, index: usize)
pub const fn insert_quiet(&mut self, index: usize)
Sets the bit at index to 1.
If you would like to know if the insertion succeeded, use insert
instead.
Sourcepub const fn insert(&mut self, index: usize) -> bool
pub const fn insert(&mut self, index: usize) -> bool
Sets the bit at index to 1. Returns whether the bit was not already set.
If the return value is not needed, use insert_quiet instead.
Sourcepub const fn replace_quiet(&mut self, index: usize, bit: bool)
pub const fn replace_quiet(&mut self, index: usize, bit: bool)
Sets the bit at index to bit.
If you would like to know the old value of the bit, use replace
instead.
Sourcepub const fn replace(&mut self, index: usize, bit: bool) -> bool
pub const fn replace(&mut self, index: usize, bit: bool) -> bool
Sets the bit at index to bit.
If the return value is not needed, use replace_quiet
instead.
Sourcepub const fn remove_quiet(&mut self, index: usize)
pub const fn remove_quiet(&mut self, index: usize)
Sets the bit at index to 0.
If you would like to know if the removal succeeded, use remove
instead.
Sourcepub const fn remove(&mut self, index: usize) -> bool
pub const fn remove(&mut self, index: usize) -> bool
Sets the bit at index to 0. Returns whether the bit was set.
If the return value is not needed, use remove_quiet instead.
Source§impl BitSet64
impl BitSet64
Sourcepub const fn iter_indices<Direction>(&self) -> BitSetIndices64<'_, Direction>
pub const fn iter_indices<Direction>(&self) -> BitSetIndices64<'_, Direction>
Creates an iterator over the indices of the bits that are set in the set.
Trait Implementations§
Source§impl BitAndAssign for BitSet64
impl BitAndAssign for BitSet64
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOrAssign for BitSet64
impl BitOrAssign for BitSet64
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl BitXorAssign for BitSet64
impl BitXorAssign for BitSet64
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreSource§impl SubAssign for BitSet64
impl SubAssign for BitSet64
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more