Skip to main content

KeySet

Trait KeySet 

Source
pub trait KeySet<K> {
    // Required methods
    fn len(&self) -> usize;
    fn contains(&self, key: &K) -> bool;
    fn for_each(&self, out: &mut dyn FnMut(&K));

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A set-like collection that can drive SetTrie traversal.

Required Methods§

Source

fn len(&self) -> usize

Number of keys in the set.

Source

fn contains(&self, key: &K) -> bool

Return whether the set contains key.

Source

fn for_each(&self, out: &mut dyn FnMut(&K))

Visit every key in the set.

Provided Methods§

Source

fn is_empty(&self) -> bool

Return whether the set contains no keys.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<K, S> KeySet<K> for HashSet<K, S>
where K: Eq + Hash, S: BuildHasher,

Source§

fn len(&self) -> usize

Source§

fn contains(&self, key: &K) -> bool

Source§

fn for_each(&self, out: &mut dyn FnMut(&K))

Source§

impl<K, T> KeySet<K> for &T
where T: KeySet<K> + ?Sized,

Source§

fn len(&self) -> usize

Source§

fn contains(&self, key: &K) -> bool

Source§

fn for_each(&self, out: &mut dyn FnMut(&K))

Implementors§