1 个不稳定版本
0.1.0 | 2023年4月4日 |
---|
820 在 并发
31KB
749 行
rs_taskflow
尝试在 Rust 中重新创建 https://github.com/cpp-taskflow/cpp-taskflow。
示例
#[derive_task((i32,), (i32,))]
struct FlowTask;
let mut flow = Flow::new();
let a = flow.new_task(FlowTask::new(|x: &i32| *x + 1));
let b = flow.new_task(FlowTask::new(|x: &i32| *x - 2));
let c = flow.new_task(FlowTask::new(|x: &i32| *x + 3));
flow.connect_output0_to_input0(&a, &b);
flow.connect_output0_to_input0(&b, &c);
let flow_exec = flow.execute().await;
let result = flow_exec.get_output_0(&c);
更完整的示例请参见 full_example_test.rs。
使用方法
安装
git clone https://github.com/mm318/rs_taskflow.git
构建
用于开发迭代
# disables use of the macros in rs_taskflow_derive
cargo test --no-default-features -- --nocapture
用于测试带更多调试信息的构建
cargo test -- --nocapture
用于测试发布构建
cargo test --release -- --nocapture
要求
使用 Ubuntu 20.04 和 Rust 1.64 开发。
使用 ubuntu-latest
和最新稳定的 Rust(由 actions-rs/toolchain@v1
获取)进行夜间测试。
依赖项
~2.3–4MB
~66K SLoC