pub trait Collection {
type Item;
// Required methods
fn contains(&self, point: &Self::Item) -> bool;
fn is_empty(&self) -> bool;
}Expand description
A trait for collections that support basic set operations.
This trait defines fundamental operations applicable to various collection types, focusing on item containment and checking for emptiness.
§Type Parameters
Item: The type of elements contained within the collection.
§Implementations
Implementations are provided for:
HashSet<T, S>: WhereT: Hash + Eq + CloneandS: BuildHasher + Default.BTreeSet<T>: WhereT: Ord + Clone.Vec<T>: WhereT: PartialEq.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T, S> Collection for HashSet<T, S>
impl<T, S> Collection for HashSet<T, S>
Source§fn contains(&self, point: &<HashSet<T, S> as Collection>::Item) -> bool
fn contains(&self, point: &<HashSet<T, S> as Collection>::Item) -> bool
Checks if the HashSet contains the specified item.
This is a direct wrapper around HashSet::contains.
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Checks if the HashSet is empty.
This is a direct wrapper around HashSet::is_empty.
type Item = T
Source§impl<T> Collection for BTreeSet<T>
impl<T> Collection for BTreeSet<T>
Source§fn contains(&self, point: &<BTreeSet<T> as Collection>::Item) -> bool
fn contains(&self, point: &<BTreeSet<T> as Collection>::Item) -> bool
Checks if the BTreeSet contains the specified item.
This is a direct wrapper around BTreeSet::contains.
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Checks if the BTreeSet is empty.
This is a direct wrapper around BTreeSet::is_empty.
type Item = T
Source§impl<T> Collection for Vec<T>where
T: PartialEq,
impl<T> Collection for Vec<T>where
T: PartialEq,
Implementors§
Source§impl<T> Collection for Complex<T>where
T: ComplexElement,
Implementation of Collection for complexes.
impl<T> Collection for Complex<T>where
T: ComplexElement,
Implementation of Collection for complexes.
Provides basic set-theoretic operations for checking element membership and complex emptiness. Note that containment is based on ID equality, so elements must have been added to the complex to be considered contained.