Skip to main content

dependency_order

Function dependency_order 

Source
pub fn dependency_order(
    target: &str,
    requires_of: impl Fn(&str) -> Option<Vec<String>>,
) -> Result<Vec<String>, DepError>
Expand description

Resolve the run order for target and its transitive Requires:: each dependency comes before the task that needs it, target comes last, and every task appears at most once (a diamond runs its shared dependency once). This is the sequencing mdtask-core does not do inside invocation; the caller supplies requires_of, which returns a task’s declared dependency names, or None if the name is not a known task (so a typo in Requires: is a hard error, not a silent skip). Pure: no filesystem or process access.

The traversal is iterative (an explicit work stack, not native recursion), so a pathologically deep chain cannot overflow the call stack and abort the process.