[][src]Struct clusterphobia::clustering::cluster::Cluster

pub struct Cluster<C: Chopped, M: Chopped> { /* fields omitted */ }

Groups zero or more members into a category as part of a Clustering.

While the members could be Copyable structs, typically they are integer ids the caller can use to obtain the real objects.

  • C : Type of the Cluster Category.
  • M : Type of the Cluster Members.

Methods

impl<C: Chopped, M: Chopped> Cluster<C, M>[src]

pub fn empty(category: C) -> Self[src]

Create an empty cluster.

pub fn with_member(category: C, member: M) -> Self[src]

Create a cluster containing a single member.

pub fn len(&self) -> usize[src]

Count of members in the cluster

pub fn is_empty(&self) -> bool[src]

Is the Cluster empty?

pub fn get_category(&self) -> C[src]

Get the Cluster category.

pub fn get_members(&self) -> &HashSet<M>[src]

Get the members of the cluster.

pub fn is_member(&self, item: &M) -> bool[src]

Determines if the given item is a member of the cluster.

pub fn add_member(&mut self, item: M) -> bool[src]

Adds a new member to the cluster.

  • returns true if a new item was added,
  • returns false if the item was already present in the Cluster.

pub fn remove_member(&mut self, item: &M) -> bool[src]

Removes a member from the cluster.

  • returns true item was removed,
  • returns false if the item is not present in the Cluster.

pub fn merge(&mut self, other: &mut Self)[src]

Merge two clusters, removing all members from the second and inserting them into the first.

Trait Implementations

impl<C: Clone + Chopped, M: Clone + Chopped> Clone for Cluster<C, M>[src]

impl<C: Chopped, M: Chopped> Eq for Cluster<C, M>[src]

impl<C: Chopped, M: Chopped> Ord for Cluster<C, M>[src]

impl<C: Chopped, M: Chopped> PartialEq<Cluster<C, M>> for Cluster<C, M>[src]

impl<C: Chopped, M: Chopped> PartialOrd<Cluster<C, M>> for Cluster<C, M>[src]

impl<C: Chopped, M: Chopped> Debug for Cluster<C, M>[src]

Auto Trait Implementations

impl<C, M> Send for Cluster<C, M> where
    C: Send,
    M: Send

impl<C, M> Sync for Cluster<C, M> where
    C: Sync,
    M: Sync

impl<C, M> Unpin for Cluster<C, M> where
    C: Unpin,
    M: Unpin

impl<C, M> UnwindSafe for Cluster<C, M> where
    C: UnwindSafe,
    M: UnwindSafe

impl<C, M> RefUnwindSafe for Cluster<C, M> where
    C: RefUnwindSafe,
    M: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,