Trait dds_bridge::SmallSet

source ·
pub trait SmallSet<T>: Copy + Eq + BitAnd + BitOr + BitXor + Not + Sub {
    const EMPTY: Self;
    const ALL: Self;

    // 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 method
    fn is_empty(self) -> bool { ... }
}
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

Object Safety§

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 = _