pub trait KeySet<K: Copy + Eq + Debug + 'static> {
// Required methods
fn len(&self) -> usize;
fn contains(&self, index: K) -> bool;
fn insert(&mut self, index: K) -> bool;
fn remove(&mut self, index: K) -> bool;
fn clear(&mut self);
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
A set of keys.
This is used to mark keys that have already been visited in algorithms.
Implementing this using a separate trait instead of relying on the ExtKeyMap trait allows to
use simpler set structures like bit sets with less friction.
Auto trait implementations
All types that implement [ExtKeyMap<()>] automatically implement this trait.
Required Methods§
sourcefn insert(&mut self, index: K) -> bool
fn insert(&mut self, index: K) -> bool
Inserts a key into the set.
Returns true if the value was not present in the set.