pub struct TaskGraph { /* private fields */ }Expand description
Global task graph with cycle detection (P2-9).
Tracks parent task → child task delegation edges. TaskGraph::link
refuses any edge that would close a cycle (a delegation loop that could
otherwise run forever), and TaskGraph::is_acyclic validates the whole
graph via a topological sweep.
Implementations§
Source§impl TaskGraph
impl TaskGraph
Sourcepub fn link(&mut self, parent: &str, child: &str) -> Result<(), ScaleError>
pub fn link(&mut self, parent: &str, child: &str) -> Result<(), ScaleError>
Record a parent → child delegation edge.
Returns ScaleError::CycleDetected if the edge would form a cycle
(including a self-link), leaving the graph unchanged.
Sourcepub fn would_cycle(&self, parent: &str, child: &str) -> bool
pub fn would_cycle(&self, parent: &str, child: &str) -> bool
Whether adding parent → child would create a cycle — true when child
is already an ancestor of parent.
Sourcepub fn is_acyclic(&self) -> bool
pub fn is_acyclic(&self) -> bool
Whether the whole graph is acyclic (Kahn’s algorithm).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskGraph
impl RefUnwindSafe for TaskGraph
impl Send for TaskGraph
impl Sync for TaskGraph
impl Unpin for TaskGraph
impl UnsafeUnpin for TaskGraph
impl UnwindSafe for TaskGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more