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: Own;
    fn replace(&mut self, item: Self::Item) -> Option<Self::Item> where Self: Own;

    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 compilation errors that would occur due to ambiguous method calls if the methods were instead implemented on Set<Q>. For example, calling insert on a Set<Q> should not depend on Q.

Required Methods

fn is_disjoint(&self, other: &Self) -> bool where Self: Sized

Checks if the set is disjoint from the given set.

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

fn is_subset(&self, other: &Self) -> bool where Self: Sized

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.

fn insert(&mut self, item: Self::Item) -> bool where Self: Own

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.

fn replace(&mut self, item: Self::Item) -> Option<Self::Item> where Self: Own

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

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

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