Trait NodeSet

Source
pub trait NodeSet<E>:
    Clone
    + Default
    + Eq {
    // Required methods
    fn len(&self) -> usize;
    fn insert(&mut self, edge: &E) -> bool;
    fn contains(&self, edge: &E) -> bool;
    fn remove(&mut self, edge: &E) -> bool;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Set of nodes

Required Methods§

Source

fn len(&self) -> usize

Get the number of nodes in the set

Source

fn insert(&mut self, edge: &E) -> bool

Add a node (the node to which edge points) to the set

Returns true if the element was added (i.e. not previously present).

Source

fn contains(&self, edge: &E) -> bool

Return true if the set contains the given node

Source

fn remove(&mut self, edge: &E) -> bool

Remove a node from the set

Returns true if the node was present in the set.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true iff there are no nodes in the set

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<E: Edge> NodeSet<E> for BTreeSet<NodeID>

Source§

fn len(&self) -> usize

Source§

fn insert(&mut self, edge: &E) -> bool

Source§

fn contains(&self, edge: &E) -> bool

Source§

fn remove(&mut self, edge: &E) -> bool

Source§

impl<E: Edge, S: Clone + Default + BuildHasher> NodeSet<E> for HashSet<NodeID, S>

Source§

fn len(&self) -> usize

Source§

fn insert(&mut self, edge: &E) -> bool

Source§

fn contains(&self, edge: &E) -> bool

Source§

fn remove(&mut self, edge: &E) -> bool

Implementors§