[][src]Struct fixed_bitset::Bitset

pub struct Bitset<N, B = usize> where
    B: Primitive,
    N: CeilDiv<B::Size>,
    <N as CeilDiv<B::Size>>::Output: ArrayLength<B>, 
{ /* fields omitted */ }

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]

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]

Returns an iterator over self & other.

pub fn symmetric_difference<'a>(
    &'a self,
    other: &'a Self
) -> impl 'a + Iterator<Item = usize>
[src]

Returns an iterator over self ^ other.

pub fn difference<'a>(
    &'a self,
    other: &'a Self
) -> impl 'a + Iterator<Item = usize>
[src]

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]

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]

#[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]

impl<N, B> Clone for Bitset<N, B> where
    B: Primitive,
    N: CeilDiv<B::Size>,
    <N as CeilDiv<B::Size>>::Output: ArrayLength<B>, 
[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]

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]

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]

Difference

type Output = Bitset<N, B>

The resulting type after applying the - operator.

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]

Difference

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]

Intersection

type Output = Bitset<N, B>

The resulting type after applying the & operator.

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]

Union

type Output = Bitset<N, B>

The resulting type after applying the | operator.

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]

Symmetric Difference

type Output = Bitset<N, B>

The resulting type after applying the ^ operator.

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]

Intersection

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]

Union

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]

Symmetric Difference

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]

Auto Trait Implementations

impl<N, B> Send for Bitset<N, B> where
    B: Send

impl<N, B> Sync for Bitset<N, B> where
    B: Sync

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same for T[src]

type Output = T

Should always be Self