pub struct DependencyQueue<N: Hash + Eq, E: Hash + Eq, V> { /* private fields */ }Implementations§
Source§impl<N: Hash + Eq, E: Hash + Eq, V> DependencyQueue<N, E, V>
impl<N: Hash + Eq, E: Hash + Eq, V> DependencyQueue<N, E, V>
Sourcepub fn new() -> DependencyQueue<N, E, V>
pub fn new() -> DependencyQueue<N, E, V>
Creates a new dependency queue with 0 packages.
Source§impl<N: Hash + Eq + Clone, E: Eq + Hash + Clone, V> DependencyQueue<N, E, V>
impl<N: Hash + Eq + Clone, E: Eq + Hash + Clone, V> DependencyQueue<N, E, V>
Sourcepub fn queue(
&mut self,
key: N,
value: V,
dependencies: impl IntoIterator<Item = (N, E)>,
)
pub fn queue( &mut self, key: N, value: V, dependencies: impl IntoIterator<Item = (N, E)>, )
Adds a new ndoe and its dependencies to this queue.
The key specified is a new node in the dependency graph, and the node
depend on all the dependencies iterated by dependencies. Each
dependency is a node/edge pair, where edges can be thought of as
productions from nodes (aka if it’s just () it’s just waiting for the
node to finish).
An optional value can also be associated with key which is reclaimed
when the node is ready to go.
Sourcepub fn queue_finished(&mut self)
pub fn queue_finished(&mut self)
All nodes have been added, calculate some internal metadata and prepare
for dequeue.
Sourcepub fn dequeue(&mut self) -> Option<(N, V)>
pub fn dequeue(&mut self) -> Option<(N, V)>
Dequeues a package that is ready to be built.
A package is ready to be built when it has 0 un-built dependencies. If
None is returned then no packages are ready to be built.
Sourcepub fn finish(&mut self, node: &N, edge: &E) -> Vec<&N>
pub fn finish(&mut self, node: &N, edge: &E) -> Vec<&N>
Indicate that something has finished.
Calling this function indicates that the node has produced edge. All
remaining work items which only depend on this node/edge pair are now
candidates to start their job.
Returns the nodes that are now allowed to be dequeued as a result of finishing this node.