Trait SetInterface

Source
pub trait SetInterface<T: Borrow<Q>, Q: ?Sized>: Sized {
    // Required methods
    fn contains(&self, item: &Q) -> bool;
    fn get(&self, item: &Q) -> Option<&T>;
    fn remove(&mut self, item: &Q) -> Option<T>;
}

Required Methods§

Source

fn contains(&self, item: &Q) -> bool

Returns true if the set contains item.

Source

fn get(&self, item: &Q) -> Option<&T>

Returns a reference to the contained element equal to the provided item or None if there isn’t one.

Source

fn remove(&mut self, item: &Q) -> Option<T>

Removes item from the set, returning it if it exists.

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<T: Hash + Eq + Borrow<Q>, B: BuildHasher, Q: Hash + Eq + ?Sized> SetInterface<T, Q> for HashSet<T, B>