pub trait IntoIterGlobalNodes: Sized + Copy {
type Iter: Iterator<Item = Node>;
// Required methods
fn iter_nodes(self) -> Self::Iter;
fn controller_id(self) -> Endpoint;
// Provided methods
fn iter_global_nodes(self) -> GlobalNodeIter<Self> ⓘ { ... }
fn extended(self, other: impl IntoIterGlobalNodes) -> Option<NodeCluster> { ... }
fn to_local_cluster(self) -> NodeCluster { ... }
fn one(&self) -> GlobalNode { ... }
}
Expand description
This lets us be agnostic whether a primitive (such as flows_to
) is called
with a GlobalNode
or &NodeCluster
.
Note that while GlobalNode
implements this trait NodeCluster
does
not do so directly, but it’s reference &NodeCluster
does.
Required Associated Types§
Sourcetype Iter: Iterator<Item = Node>
type Iter: Iterator<Item = Node>
The iterator returned by Self::iter_nodes
Required Methods§
Sourcefn iter_nodes(self) -> Self::Iter
fn iter_nodes(self) -> Self::Iter
iterate over the local nodes
Sourcefn controller_id(self) -> Endpoint
fn controller_id(self) -> Endpoint
The controller id all of these nodes are located in.
Provided Methods§
Sourcefn iter_global_nodes(self) -> GlobalNodeIter<Self> ⓘ
fn iter_global_nodes(self) -> GlobalNodeIter<Self> ⓘ
Iterate all nodes as globally identified one’s.
The invariant of this iterator is that all controller_id()
s of the
nodes in the iterator is the same as self.controller_id()
.
Sourcefn extended(self, other: impl IntoIterGlobalNodes) -> Option<NodeCluster>
fn extended(self, other: impl IntoIterGlobalNodes) -> Option<NodeCluster>
A convenience method for gathering multiple node(cluster)s together.
Returns None
if the controller id’s don’t match or both iterators are empty.
Sourcefn to_local_cluster(self) -> NodeCluster
fn to_local_cluster(self) -> NodeCluster
Collect the iterator into a cluster
Sourcefn one(&self) -> GlobalNode
fn one(&self) -> GlobalNode
Get a node from this cluster. No guarantees are made as to which is returned, however a custer is guaranteed to contain at least one node, so this method will never panic.
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.