refactor: make DagRunner interface single-threaded
This commit is contained in:
1 parent
d83a815ed0
commit
e4fc0b0d44
25 files changed
+416
-617
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ impl Value { async fn run(&self) -> i32 { self.0 } }
|
||||
#[task]
|
||||
impl Add { async fn run(a: &i32, b: &i32) -> i32 { a + b } }
|
||||
|
||||
let dag = DagRunner::new();
|
||||
let mut dag = DagRunner::new();
|
||||
let x = dag.add_task(Value(2));
|
||||
let y = dag.add_task(Value(3));
|
||||
let sum = dag.add_task(Add).depends_on((x, y));
|
||||
|
||||
@@ -8,7 +8,7 @@ Most DAG libraries check for cycles when you execute the graph:
|
||||
|
||||
```rust
|
||||
// Other libraries: cycle detected at RUNTIME
|
||||
let dag = DagRunner::new();
|
||||
let mut dag = DagRunner::new();
|
||||
let a = dag.add_task(TaskA);
|
||||
let b = dag.add_task(TaskB);
|
||||
a.depends_on(b);
|
||||
@@ -20,7 +20,7 @@ dag.run(|fut| async move { tokio::spawn(fut).await.unwrap() })
|
||||
|
||||
```rust
|
||||
// dagx: cycle prevented at COMPILE TIME
|
||||
let dag = DagRunner::new();
|
||||
let mut dag = DagRunner::new();
|
||||
let a_builder = dag.add_task(TaskA);
|
||||
let b_builder = dag.add_task(TaskB);
|
||||
|
||||
|
||||
Reference in new issue
Block a user