Elements

Struct Elements 

Source
pub struct Elements {
    pub nodes: Nodes,
    pub edges: Edges,
}
Expand description

A set of elment (node and edge) identifiers.

Fields§

§nodes: Nodes§edges: Edges

Implementations§

Source§

impl Elements

Source

pub fn new(nodes: Nodes, edges: Edges) -> Self

Source

pub fn from_nodes(nodes: Nodes) -> Self

Source

pub fn from_edges(edges: Edges) -> Self

Source

pub fn from_elements(elements: &[ElementID]) -> Self

Source§

impl Elements

Source

pub fn contains(&self, member: &ElementID) -> bool

Returns true if the set contains an element equal to the value.

Source

pub fn insert(&mut self, new_member: ElementID) -> bool

Inserts a value into the set, returning true if the value was not present in the set.

Source

pub fn insert_all(&mut self, other: &Elements)

Inserts all the elements from other into self.

Source

pub fn remove(&mut self, member: &ElementID) -> bool

Removes a value from the set, returning the value if it was present in the set.

Source

pub fn remove_all(&mut self, other: &Elements)

Removes all the elements in other from self.

Source

pub fn union(&self, other: &Elements) -> Elements

Returns the elements representing the union, i.e., all the elements in self or other.

Source

pub fn intersection(&self, other: &Elements) -> Elements

Returns the elements representing the intersection, i.e., all the elements in both self and other.

Source

pub fn difference(&self, other: &Elements) -> Elements

Returns the elements representing the difference, i.e., all the elements in self but not in other.

Source

pub fn symmetric_difference(&self, other: &Elements) -> Elements

Returns the elements representing the symmetric difference, i.e., all the elements in self or other, but not in both.

Source

pub fn form_union(&mut self, other: &Elements)

Updates self with the union of self and other.

Source

pub fn form_intersection(&mut self, other: &Elements)

Updates self with the intersection of self and other.

Source

pub fn form_difference(&mut self, other: &Elements)

Updates self with the difference of self and other.

Source

pub fn form_symmetric_difference(&mut self, other: &Elements)

Updates self with the symmetric difference of self and other.

Source

pub fn is_disjoint(&self, other: &Elements) -> bool

Returns true if self has no elements in common with other. This is equivalent to checking for an empty intersection.

Source

pub fn is_subset(&self, other: &Elements) -> bool

Returns true if self is a subset of other, i.e., other contains at least all the elements in self.

Source

pub fn is_superset(&self, other: &Elements) -> bool

Returns true if self is a superset of other, i.e., self contains at least all the elements in other.

Source

pub fn len(&self) -> usize

Returns the number of elements in self.

Source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

Source

pub fn clear(&mut self)

Removes all elements from the set.

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&ElementID) -> bool,

Retains only the elements specified by the predicate.

Trait Implementations§

Source§

impl Clone for Elements

Source§

fn clone(&self) -> Elements

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Elements

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Elements

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&Elements> for Elements

Source§

fn from(elements: &Elements) -> Self

Converts to this type from the input type.
Source§

impl From<(BTreeSet<NodeID>, BTreeSet<EdgeID>)> for Elements

Source§

fn from((nodes, edges): (Nodes, Edges)) -> Self

Converts to this type from the input type.
Source§

impl From<BTreeSet<EdgeID>> for Elements

Source§

fn from(edges: Edges) -> Self

Converts to this type from the input type.
Source§

impl From<BTreeSet<NodeID>> for Elements

Source§

fn from(nodes: Nodes) -> Self

Converts to this type from the input type.
Source§

impl Hash for Elements

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Elements

Source§

fn eq(&self, other: &Elements) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Elements

Source§

impl StructuralPartialEq for Elements

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.