3 releases (breaking)

0.3.0 Nov 30, 2019
0.2.0 Jan 13, 2019
0.1.0 Jan 11, 2019

#682 in Concurrency

Download history 1/week @ 2024-02-19 4/week @ 2024-02-26 54/week @ 2024-04-01

54 downloads per month

MIT license

13KB
314 lines

futures-dagtask

A task queue based on a directed acyclic graph that allows you to specify dependencies for concurrent tasks.

Usage

use futures::future;
use futures_dagtask::TaskGraph;

let mut graph = TaskGraph::new();
let zero = graph.add_task(&[], future::ready::<u32>(0))?;
let one = graph.add_task(&[], future::ready::<u32>(1))?;
let two = graph.add_task(&[one], future::ready::<u32>(2))?;

let (add, exec) = graph.execute();

// spawn(exec.for_each(drop));

let _three = add.add_task(&[two], future::ready(3)).await?;

In this example, zero and one will be executed concurrently, but two will be executed after one is completed.

Due to the simplicity of design, we will never have circular dependencies.

License

This project is licensed under the MIT license.

Dependencies

~0.7–1MB
~18K SLoC