pub struct Node<T: Neighbors> { /* private fields */ }Expand description
An owning shared reference to a node.
This “anchors” the entire connected graph to the memory. In order to avoid cyclic ownership i.e. memory leaks, T should not contain references to other nodes through this type. If dropped, and no other Nodes to any single connected node are held elsewhere, the connected nodes will be dropped as well.
Returned by Node::new and Internode::upgrade.
Implementations§
Methods from Deref<Target = Internode<T>>§
Sourcepub fn lock(&self) -> Option<InternodeMutexGuard<'_, T>>
pub fn lock(&self) -> Option<InternodeMutexGuard<'_, T>>
Blocks until the internal Mutex can be locked and returns a guard to the value. Will be None if this Internode is dropped already.
Sourcepub fn outgoing(&self) -> impl '_ + Iterator<Item = Self>
pub fn outgoing(&self) -> impl '_ + Iterator<Item = Self>
Blocks until the internal Mutex can be locked and calls Neighbors::outgoing.
Sourcepub fn incoming(&self) -> impl '_ + Iterator<Item = Self>
pub fn incoming(&self) -> impl '_ + Iterator<Item = Self>
Blocks until the internal Mutex can be locked and calls Neighbors::incoming.
Sourcepub fn dfs_outgoing(&self) -> impl '_ + Iterator<Item = Self>
pub fn dfs_outgoing(&self) -> impl '_ + Iterator<Item = Self>
Performs a depth-first search by recursively calling Internode::outgoing. Includes the starting node first.
Sourcepub fn dfs_incoming(&self) -> impl '_ + Iterator<Item = Self>
pub fn dfs_incoming(&self) -> impl '_ + Iterator<Item = Self>
Performs a depth-first search by recursively calling Internode::incoming. Includes the starting node first.
Sourcepub fn bfs_outgoing(&self) -> impl '_ + Iterator<Item = Self>
pub fn bfs_outgoing(&self) -> impl '_ + Iterator<Item = Self>
Performs a breadth-first search by recursively calling Internode::outgoing. Includes the starting node first.
Sourcepub fn bfs_incoming(&self) -> impl '_ + Iterator<Item = Self>
pub fn bfs_incoming(&self) -> impl '_ + Iterator<Item = Self>
Performs a breadth-first search by recursively calling Internode::incoming. Includes the starting node first.