Struct stack_bitset::StackBitSet
source · [−]pub struct StackBitSet<const N: usize> where
[(); usize_count(N)]: Sized, { /* private fields */ }
Expand description
BitSet with compile-time size. It does not require any allocation and is entirely stored on the stack.
The only field is an array of usize
. Each element is stored in a bit
Examples
use stack_bitset::StackBitSet;
let mut a: StackBitSet<42> = StackBitSet::new();
a.set(12).unwrap();
assert!(a.get(12).unwrap());
Implementations
sourceimpl<const N: usize> StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> StackBitSet<N> where
[(); usize_count(N)]: Sized,
pub fn iter(&self) -> StackBitSetIterator<'_, N>ⓘNotable traits for StackBitSetIterator<'a, N>impl<'a, const N: usize> Iterator for StackBitSetIterator<'a, N> where
[(); usize_count(N)]: Sized, type Item = usize;
[(); usize_count(N)]: Sized, type Item = usize;
pub fn iter_limit(&self, limit: usize) -> StackBitSetIterator<'_, N>ⓘNotable traits for StackBitSetIterator<'a, N>impl<'a, const N: usize> Iterator for StackBitSetIterator<'a, N> where
[(); usize_count(N)]: Sized, type Item = usize;
[(); usize_count(N)]: Sized, type Item = usize;
sourcepub fn get(&self, idx: usize) -> Result<bool, StackBitSetError>
pub fn get(&self, idx: usize) -> Result<bool, StackBitSetError>
Returns whether the elements at index idx
in the bitset is set
sourceimpl<const N: usize> StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> StackBitSet<N> where
[(); usize_count(N)]: Sized,
pub fn union<const M: usize>(
&self,
other: &StackBitSet<M>
) -> StackBitSet<{ const_min(N, M) }> where
[(); usize_count(M)]: Sized,
[(); usize_count(const_min(N, M))]: Sized,
pub fn intersection<const M: usize>(
&self,
other: &StackBitSet<M>
) -> StackBitSet<{ const_min(N, M) }> where
[(); usize_count(M)]: Sized,
[(); usize_count(const_min(N, M))]: Sized,
pub fn difference<const M: usize>(
&self,
other: &StackBitSet<M>
) -> StackBitSet<{ const_min(N, M) }> where
[(); usize_count(M)]: Sized,
[(); usize_count(const_min(N, M))]: Sized,
pub fn complement(&self) -> StackBitSet<N>
pub fn is_subset<const M: usize>(&self, other: &StackBitSet<M>) -> bool where
[(); usize_count(M)]: Sized,
pub fn is_equal<const M: usize>(&self, other: &StackBitSet<M>) -> bool where
[(); usize_count(M)]: Sized,
pub fn is_superset<const M: usize>(&self, other: &StackBitSet<M>) -> bool where
[(); usize_count(M)]: Sized,
Trait Implementations
sourceimpl<const N: usize, const M: usize> Add<&StackBitSet<M>> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
[(); usize_count(M)]: Sized,
[(); usize_count(const_min(N, M))]: Sized,
impl<const N: usize, const M: usize> Add<&StackBitSet<M>> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
[(); usize_count(M)]: Sized,
[(); usize_count(const_min(N, M))]: Sized,
type Output = StackBitSet<{ const_min(N, M) }>
type Output = StackBitSet<{ const_min(N, M) }>
The resulting type after applying the +
operator.
sourcefn add(self, other: &StackBitSet<M>) -> Self::Output
fn add(self, other: &StackBitSet<M>) -> Self::Output
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<f32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<f32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: f32) -> StackBitSet<N>
fn add(self, other: f32) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<f64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<f64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: f64) -> StackBitSet<N>
fn add(self, other: f64) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<i128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<i128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: i128) -> StackBitSet<N>
fn add(self, other: i128) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<i16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<i16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: i16) -> StackBitSet<N>
fn add(self, other: i16) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<i32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<i32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: i32) -> StackBitSet<N>
fn add(self, other: i32) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<i64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<i64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: i64) -> StackBitSet<N>
fn add(self, other: i64) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<i8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<i8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: i8) -> StackBitSet<N>
fn add(self, other: i8) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<isize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<isize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: isize) -> StackBitSet<N>
fn add(self, other: isize) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<u128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<u128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: u128) -> StackBitSet<N>
fn add(self, other: u128) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<u16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<u16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: u16) -> StackBitSet<N>
fn add(self, other: u16) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<u32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<u32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: u32) -> StackBitSet<N>
fn add(self, other: u32) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<u64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<u64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: u64) -> StackBitSet<N>
fn add(self, other: u64) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<u8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<u8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: u8) -> StackBitSet<N>
fn add(self, other: u8) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Add<usize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Add<usize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the +
operator.
sourcefn add(self, other: usize) -> StackBitSet<N>
fn add(self, other: usize) -> StackBitSet<N>
Performs the +
operation. Read more
sourceimpl<const N: usize> Clone for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Clone for StackBitSet<N> where
[(); usize_count(N)]: Sized,
sourcefn clone(&self) -> StackBitSet<N>
fn clone(&self) -> StackBitSet<N>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<const N: usize> Debug for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Debug for StackBitSet<N> where
[(); usize_count(N)]: Sized,
sourceimpl<const N: usize> Default for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Default for StackBitSet<N> where
[(); usize_count(N)]: Sized,
sourceimpl<const N: usize> Sub<f32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<f32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: f32) -> StackBitSet<N>
fn sub(self, other: f32) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<f64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<f64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: f64) -> StackBitSet<N>
fn sub(self, other: f64) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<i128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<i128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: i128) -> StackBitSet<N>
fn sub(self, other: i128) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<i16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<i16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: i16) -> StackBitSet<N>
fn sub(self, other: i16) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<i32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<i32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: i32) -> StackBitSet<N>
fn sub(self, other: i32) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<i64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<i64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: i64) -> StackBitSet<N>
fn sub(self, other: i64) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<i8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<i8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: i8) -> StackBitSet<N>
fn sub(self, other: i8) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<isize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<isize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: isize) -> StackBitSet<N>
fn sub(self, other: isize) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<u128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<u128> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: u128) -> StackBitSet<N>
fn sub(self, other: u128) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<u16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<u16> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: u16) -> StackBitSet<N>
fn sub(self, other: u16) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<u32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<u32> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: u32) -> StackBitSet<N>
fn sub(self, other: u32) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<u64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<u64> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: u64) -> StackBitSet<N>
fn sub(self, other: u64) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<u8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<u8> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: u8) -> StackBitSet<N>
fn sub(self, other: u8) -> StackBitSet<N>
Performs the -
operation. Read more
sourceimpl<const N: usize> Sub<usize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
impl<const N: usize> Sub<usize> for StackBitSet<N> where
[(); usize_count(N)]: Sized,
type Output = StackBitSet<N>
type Output = StackBitSet<N>
The resulting type after applying the -
operator.
sourcefn sub(self, other: usize) -> StackBitSet<N>
fn sub(self, other: usize) -> StackBitSet<N>
Performs the -
operation. Read more
impl<const N: usize> Copy for StackBitSet<N> where
[(); usize_count(N)]: Sized,
Auto Trait Implementations
impl<const N: usize> RefUnwindSafe for StackBitSet<N>
impl<const N: usize> Send for StackBitSet<N>
impl<const N: usize> Sync for StackBitSet<N>
impl<const N: usize> Unpin for StackBitSet<N>
impl<const N: usize> UnwindSafe for StackBitSet<N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more