Trait eclectic::set::Base [] [src]

pub trait Base: Collection + Iter {
    fn is_disjoint(&self, other: &Self) -> bool where Self: Sized;
    fn is_subset(&self, other: &Self) -> bool where Self: Sized;
    fn insert(&mut self, item: Self::Item) -> bool where Self: AddRemove;
    fn replace(&mut self, item: Self::Item) -> Option<Self::Item> where Self: AddRemove;

    fn is_superset(&self, other: &Self) -> bool where Self: Sized { ... }
}

Set functionality that is independent of an additional type parameter.

It is unusual to use this trait directly. Consider using Set instead.

This trait exists to prevent the ambiguity that would arise if its methods were instead implemented on Set. In that scenario, set.insert(item) would be ambiguous if the type of set were S and S: Set<Q> + Set<R>.

Required Methods

Checks if the set is disjoint from the given set.

self is disjoint from other if self contains none of other's items.

Checks if the set is a subset of the given set.

self is a subset of other if other contains all of self's items.

Inserts the given item into the set without replacement.

If the set contains an item that is equivalent to the given item, that item is not replaced with the given item.

Returns true if the given item was inserted into the set, false otherwise.

Inserts the given item into the set with replacement.

If the set contains an item that is equivalent to the given item, that item is replaced with the given item.

Returns the item that was replaced, or None if the set did not contain an equivalent item.

Provided Methods

Checks if the set is a superset of the given set.

self is a superset of other if self contains all of other's items.

Implementors