WritableHashSetExt

Trait WritableHashSetExt 

Source
pub trait WritableHashSetExt<V: 'static, H: 'static>: Writable<Target = HashSet<V, H>> {
    // Provided methods
    fn clear(&mut self) { ... }
    fn retain(&mut self, f: impl FnMut(&V) -> bool) { ... }
    fn insert(&mut self, k: V) -> bool
       where V: Eq + Hash,
             H: BuildHasher { ... }
    fn extend(&mut self, iter: impl IntoIterator<Item = V>)
       where V: Eq + Hash,
             H: BuildHasher { ... }
    fn remove(&mut self, k: &V) -> bool
       where V: Eq + Hash,
             H: BuildHasher { ... }
}
Expand description

An extension trait for Writable<HashSet<V, H>> that provides some convenience methods.

Provided Methods§

Source

fn clear(&mut self)

Clear the hash set.

Source

fn retain(&mut self, f: impl FnMut(&V) -> bool)

Retain only the elements specified by the predicate.

Source

fn insert(&mut self, k: V) -> bool
where V: Eq + Hash, H: BuildHasher,

Inserts a value into the set. Returns true if the value was not already present.

Source

fn extend(&mut self, iter: impl IntoIterator<Item = V>)
where V: Eq + Hash, H: BuildHasher,

Extends the set with the values from the given iterator.

Source

fn remove(&mut self, k: &V) -> bool
where V: Eq + Hash, H: BuildHasher,

Removes a value from the set. Returns true if the value was present.

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<V: 'static, H: 'static, R> WritableHashSetExt<V, H> for R
where R: Writable<Target = HashSet<V, H>>,