pub struct TaskGraph { /* private fields */ }Expand description
Builder for constructing a task DAG.
Tasks are added with add_task and dependency
edges with add_dependency. Call
build to validate the graph and compute an
ExecutionPlan.
Implementations§
Source§impl TaskGraph
impl TaskGraph
Sourcepub fn add_dependency(
&mut self,
from: TaskId,
to: TaskId,
) -> Result<(), FabricError>
pub fn add_dependency( &mut self, from: TaskId, to: TaskId, ) -> Result<(), FabricError>
Declare that to depends on from (i.e. from must complete before
to can start).
§Errors
Returns FabricError::IoError(-100) if either task ID does not
exist in the graph.
Sourcepub fn validate(&self) -> Result<(), FabricError>
pub fn validate(&self) -> Result<(), FabricError>
Validate the graph: check for cycles and unresolved data references.
§Errors
Returns FabricError::IoError(-101) if a cycle is detected.
Returns FabricError::IoError(-102) if a task has an input with no
upstream producer.
Sourcepub fn build(self) -> Result<ExecutionPlan, FabricError>
pub fn build(self) -> Result<ExecutionPlan, FabricError>
Validate and compute an ExecutionPlan with topologically sorted
waves. Consumes the graph.
§Errors
Returns the same errors as validate.
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 !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