SmallSet

Trait SmallSet 

Source
pub trait SmallSet<T>:
    Copy
    + Eq
    + BitAnd
    + BitOr
    + BitXor
    + Not
    + Sub {
    const EMPTY: Self;
    const ALL: Self;
Show 13 methods // Required methods fn len(self) -> usize; fn contains(self, value: T) -> bool; fn insert(&mut self, value: T) -> bool; fn remove(&mut self, value: T) -> bool; fn toggle(&mut self, value: T) -> bool; fn iter(self) -> impl Iterator<Item = T>; // Provided methods fn is_empty(self) -> bool { ... } fn set(&mut self, value: T, condition: bool) { ... } fn intersection(self, rhs: Self) -> <Self as BitAnd>::Output { ... } fn union(self, rhs: Self) -> <Self as BitOr>::Output { ... } fn difference(self, rhs: Self) -> <Self as Sub>::Output { ... } fn symmetric_difference(self, rhs: Self) -> <Self as BitXor>::Output { ... } fn complement(self) -> <Self as Not>::Output { ... }
}
Expand description

A bitset whose size is known at compile time

Required Associated Constants§

Source

const EMPTY: Self

The empty set

Source

const ALL: Self

The set containing all possible values

Required Methods§

Source

fn len(self) -> usize

The number of elements in the set

Source

fn contains(self, value: T) -> bool

Whether the set contains a value

Source

fn insert(&mut self, value: T) -> bool

Insert a value into the set

Source

fn remove(&mut self, value: T) -> bool

Remove a value from the set

Source

fn toggle(&mut self, value: T) -> bool

Toggle a value in the set

Source

fn iter(self) -> impl Iterator<Item = T>

Iterate over the values in the set

Provided Methods§

Source

fn is_empty(self) -> bool

Whether the set is empty

Source

fn set(&mut self, value: T, condition: bool)

Conditionally insert/remove a value from the set

Source

fn intersection(self, rhs: Self) -> <Self as BitAnd>::Output

Intersection of two sets

Source

fn union(self, rhs: Self) -> <Self as BitOr>::Output

Union of two sets

Source

fn difference(self, rhs: Self) -> <Self as Sub>::Output

Difference of two sets

Source

fn symmetric_difference(self, rhs: Self) -> <Self as BitXor>::Output

Symmetric difference of two sets

Source

fn complement(self) -> <Self as Not>::Output

Complement of the set

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl SmallSet<u8> for Holding

Source§

const EMPTY: Self

Source§

const ALL: Self

Source§

impl SmallSet<Card> for Hand

Source§

const EMPTY: Self

Source§

const ALL: Self