pub struct BitSetSize(/* private fields */);bsize only.Expand description
A bitset the length of a pointer.
I doubt there’s a good use for a type like this, but it’s here for the sake of completeness (though it is locked behind a feature flag that’s disabled by default).
Implementations§
Source§impl BitSetSize
impl BitSetSize
Sourcepub const CAPACITY: usize = 64usize
pub const CAPACITY: usize = 64usize
The capacity of a
BitSetSize.
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
Creates a new set that complements self.
This is the const alternative to
Neg::neg
or
Not::not
for
BitSetSizes.
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
BitSetSizes.
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
BitSetSizes.
Sourcepub const fn difference(self, rhs: Self) -> Self
pub const fn difference(self, rhs: Self) -> Self
Creates a new set with values that are in self, but not in rhs.
This is the const alternative to
Sub::sub
for
BitSetSizes.
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
BitSetSizes.
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
BitSetSizes.
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
BitSetSizes.
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_8(self, index: usize) -> Self
pub const fn masked_i_to_8(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_8(&mut self, index: usize)
pub const fn mask_i_to_8(&mut self, index: usize)
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..8
in their original states.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn cleared_i_to_8(self, index: usize) -> Self
pub const fn cleared_i_to_8(self, index: usize) -> Self
Creates a copy of this set without the bits with indices in the range
index..8.
§Panics
Panics if index >=Self::CAPACITY.
Sourcepub const fn clear_i_to_8(&mut self, index: usize)
pub const fn clear_i_to_8(&mut self, index: usize)
Clears bits
index..8,
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 BitSetSize
impl BitSetSize
Sourcepub const fn iter_indices<Direction>(&self) -> BitSetIndicesSize<'_, Direction>
Available on crate feature bSize only.
pub const fn iter_indices<Direction>(&self) -> BitSetIndicesSize<'_, Direction>
bSize only.Creates an iterator over the indices of the bits that are set in the set.
Source§impl BitSetSize
impl BitSetSize
Sourcepub const fn iter_bits<Direction>(&self) -> BitSetIterSize<'_, Direction>
Available on crate feature bSize only.
pub const fn iter_bits<Direction>(&self) -> BitSetIterSize<'_, Direction>
bSize only.Creates an iterator over the bits of the set.
Trait Implementations§
Source§impl BitAnd for BitSetSize
impl BitAnd for BitSetSize
Source§impl BitAndAssign for BitSetSize
impl BitAndAssign for BitSetSize
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&= operation. Read moreSource§impl BitOr for BitSetSize
impl BitOr for BitSetSize
Source§impl BitOrAssign for BitSetSize
impl BitOrAssign for BitSetSize
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|= operation. Read moreSource§impl BitXor for BitSetSize
impl BitXor for BitSetSize
Source§impl BitXorAssign for BitSetSize
impl BitXorAssign for BitSetSize
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^= operation. Read moreSource§impl Clone for BitSetSize
impl Clone for BitSetSize
Source§fn clone(&self) -> BitSetSize
fn clone(&self) -> BitSetSize
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BitSetSize
impl Debug for BitSetSize
Source§impl Default for BitSetSize
impl Default for BitSetSize
Source§fn default() -> BitSetSize
fn default() -> BitSetSize
Source§impl From<BitSetSize> for usize
impl From<BitSetSize> for usize
Source§fn from(value: BitSetSize) -> Self
fn from(value: BitSetSize) -> Self
Source§impl From<usize> for BitSetSize
impl From<usize> for BitSetSize
Source§impl Hash for BitSetSize
impl Hash for BitSetSize
Source§impl Neg for BitSetSize
impl Neg for BitSetSize
Source§impl Not for BitSetSize
impl Not for BitSetSize
Source§impl PartialEq for BitSetSize
impl PartialEq for BitSetSize
Source§impl Sub for BitSetSize
impl Sub for BitSetSize
Source§impl SubAssign for BitSetSize
impl SubAssign for BitSetSize
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-= operation. Read more