Trait eclectic::set::Set [] [src]

pub trait Set<Q: ?Sized = Self::Item>: Base {
    fn contains(&self, item: &Q) -> bool;
    fn remove(&mut self, item: &Q) -> bool where Self: AddRemove;
}

A set.

A set is a collection that prohibits duplicate items according to some criteria.

The type parameter Q represents an "equivalence" type that can be used to look up items in the set. For example, given a Set<Item = String>, it is usually possible to look up items using a str. When omitted, Q defaults to Self::Item.

Required Methods

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

Checks if the set contains an item that is equivalent to the given item.

fn remove(&mut self, item: &Q) -> bool where Self: AddRemove

Removes the item in the set that is equivalent to the given item.

Returns true if the set contained such an item, false otherwise.

Implementors