[−][src]Struct fixed_bitset::Bitset
A set of unsigned integers whose size is fixed at compile-time.
A Bitset
can only store unsigned integers less than N
, where N
is a compile-time integer
from typenum
. A Bitset
uses a single bit to indicate the presence or absence of each value.
Methods
impl<N, B> Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
pub fn new() -> Self
[src]
Returns an empty bitset.
pub fn contains(&self, value: usize) -> bool
[src]
Returns true
if the bitset contains a value.
Panics if value >= N
.
pub fn insert(&mut self, value: usize)
[src]
Inserts a value into the bitset.
If that value already exists in the bitset, this function has no effect.
Panics if value >= N
.
pub fn remove(&mut self, value: usize)
[src]
Removes a value from the bitset.
If that value does not already exist in the bitset, this function has no effect.
Panics if value >= N
.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the bitset contains no bits.
pub fn len(&self) -> usize
[src]
Returns the number of values contained in the bitset.
pub fn iter(&self) -> impl '_ + Iterator<Item = usize> + Clone
[src]
Returns an iterator over the values in the bitset.
pub fn clear(&mut self)
[src]
Clears the bitset, removing all values.
pub fn union<'a>(&'a self, other: &'a Self) -> impl 'a + Iterator<Item = usize>
[src]
Returns an iterator over self | other
.
pub fn intersection<'a>(
&'a self,
other: &'a Self
) -> impl 'a + Iterator<Item = usize>
[src]
&'a self,
other: &'a Self
) -> impl 'a + Iterator<Item = usize>
Returns an iterator over self & other
.
pub fn symmetric_difference<'a>(
&'a self,
other: &'a Self
) -> impl 'a + Iterator<Item = usize>
[src]
&'a self,
other: &'a Self
) -> impl 'a + Iterator<Item = usize>
Returns an iterator over self ^ other
.
pub fn difference<'a>(
&'a self,
other: &'a Self
) -> impl 'a + Iterator<Item = usize>
[src]
&'a self,
other: &'a Self
) -> impl 'a + Iterator<Item = usize>
Returns an iterator over self - other
.
pub fn is_disjoint(&self, other: &Self) -> bool
[src]
Returns true
if self
has no elements in common with other
.
This is more efficient than self.intersection(other).next().is_none()
.
pub fn is_subset(&self, other: &Self) -> bool
[src]
Returns true
if every element in self
exists in other
.
pub fn is_superset(&self, other: &Self) -> bool
[src]
Returns true
if every element in other
exists in self
.
Trait Implementations
impl<N, B> Copy for Bitset<N, B> where
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
GenericArray<B, <N as CeilDiv<B::Size>>::Output>: Copy,
[src]
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
GenericArray<B, <N as CeilDiv<B::Size>>::Output>: Copy,
impl<N, B> PartialEq<Bitset<N, B>> for Bitset<N, B> where
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<N, B> Default for Bitset<N, B> where
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
impl<N, B> Clone for Bitset<N, B> where
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<N, B> Eq for Bitset<N, B> where
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
impl<N, B> Debug for Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
impl<'a, 'b, N, B> Sub<&'b Bitset<N, B>> for &'a Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
Difference
type Output = Bitset<N, B>
The resulting type after applying the -
operator.
fn sub(self, other: &'b Bitset<N, B>) -> Self::Output
[src]
impl<N, B, '_> SubAssign<&'_ Bitset<N, B>> for Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Difference
fn sub_assign(&mut self, other: &Self)
[src]
impl<'a, 'b, N, B> BitAnd<&'b Bitset<N, B>> for &'a Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
Intersection
type Output = Bitset<N, B>
The resulting type after applying the &
operator.
fn bitand(self, other: &'b Bitset<N, B>) -> Self::Output
[src]
impl<'a, 'b, N, B> BitOr<&'b Bitset<N, B>> for &'a Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
Union
type Output = Bitset<N, B>
The resulting type after applying the |
operator.
fn bitor(self, other: &'b Bitset<N, B>) -> Self::Output
[src]
impl<'a, 'b, N, B> BitXor<&'b Bitset<N, B>> for &'a Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Bitset<N, B>: Clone,
Symmetric Difference
type Output = Bitset<N, B>
The resulting type after applying the ^
operator.
fn bitxor(self, other: &'b Bitset<N, B>) -> Self::Output
[src]
impl<N, B, '_> BitAndAssign<&'_ Bitset<N, B>> for Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Intersection
fn bitand_assign(&mut self, other: &Self)
[src]
impl<N, B, '_> BitOrAssign<&'_ Bitset<N, B>> for Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Union
fn bitor_assign(&mut self, other: &Self)
[src]
impl<N, B, '_> BitXorAssign<&'_ Bitset<N, B>> for Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
Symmetric Difference
fn bitxor_assign(&mut self, other: &Self)
[src]
impl<N, B> FromIterator<usize> for Bitset<N, B> where
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
[src]
B: Primitive,
N: Unsigned + CeilDiv<B::Size>,
<N as CeilDiv<B::Size>>::Output: ArrayLength<B>,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = usize>,
[src]
T: IntoIterator<Item = usize>,
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same for T
[src]
type Output = T
Should always be Self