Collection

Trait Collection 

Source
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:

Required Associated Types§

Source

type Item

The type of elements stored in the collection.

Required Methods§

Source

fn contains(&self, point: &Self::Item) -> bool

Checks if an item is present in the collection.

§Arguments
  • point: A reference to the item to check for containment.
§Returns

true if the item is found in the collection, false otherwise.

Source

fn is_empty(&self) -> bool

Determines if the collection is empty.

§Returns
  • true if the collection contains no items.
  • false if the collection contains one or more items.

Implementations on Foreign Types§

Source§

impl<T: Ord + Clone> Collection for BTreeSet<T>

Source§

fn contains(&self, point: &Self::Item) -> bool

Checks if the BTreeSet contains the specified item. This is a direct wrapper around BTreeSet::contains.

Source§

fn is_empty(&self) -> bool

Checks if the BTreeSet is empty. This is a direct wrapper around BTreeSet::is_empty.

Source§

type Item = T

Source§

impl<T: PartialEq> Collection for Vec<T>

Source§

fn contains(&self, point: &Self::Item) -> bool

Checks if the Vec contains the specified item by iterating through its elements.

Source§

fn is_empty(&self) -> bool

Checks if the Vec is empty. This is a direct wrapper around Vec::is_empty.

Source§

type Item = T

Source§

impl<T: Hash + Eq + Clone, S: BuildHasher + Default> Collection for HashSet<T, S>

Source§

fn contains(&self, point: &Self::Item) -> bool

Checks if the HashSet contains the specified item. This is a direct wrapper around HashSet::contains.

Source§

fn is_empty(&self) -> bool

Checks if the HashSet is empty. This is a direct wrapper around HashSet::is_empty.

Source§

type Item = T

Implementors§

Source§

impl<T: ComplexElement> Collection for Complex<T>

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.

Source§

type Item = T

Source§

impl<T: Hash + Eq + Clone> Collection for Lattice<T>

Source§

type Item = T

Source§

impl<V: PartialOrd + Eq + Hash + Clone> Collection for Graph<V, Directed>

Source§

impl<V: PartialOrd + Eq + Hash + Clone> Collection for Graph<V, Undirected>

Source§

impl<const N: usize, F: Field + Copy + Sum<F>> Collection for Cloud<N, F>