pub struct TaskGraph { /* private fields */ }Expand description
A directed acyclic graph of compute tasks.
Implementations§
Source§impl TaskGraph
impl TaskGraph
Sourcepub fn add_task(&mut self, task: ComputeTask)
pub fn add_task(&mut self, task: ComputeTask)
Add a task to the graph. Replaces any existing task with the same name.
Sourcepub fn remove_task(&mut self, name: &str)
pub fn remove_task(&mut self, name: &str)
Remove a task by name.
Sourcepub fn topological_sort(&self) -> Result<Vec<String>, String>
pub fn topological_sort(&self) -> Result<Vec<String>, String>
Topological sort using Kahn’s algorithm.
Returns Ok(order) where order is a valid execution order, or
Err(cycle) naming one task involved in a cycle.
Sourcepub fn critical_path(&self) -> Vec<String>
pub fn critical_path(&self) -> Vec<String>
Compute the critical path (longest chain by estimated_ms).
Returns the list of task names on the critical path.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more