| Crates.io | plyne |
| lib.rs | plyne |
| version | 0.1.2 |
| created_at | 2025-09-01 01:20:31.400765+00 |
| updated_at | 2025-10-09 18:46:26.42676+00 |
| description | Based pipeline of async task system |
| homepage | |
| repository | https://github.com/xiao-e-yun/Plyne |
| max_upload_size | |
| id | 1819016 |
| size | 22,574 |
Based pipeline of async task system
Install
cargo add plyne
Define tasks
use plyne::{define_tasks, Input, Output};
define_tasks! {
TaskSystem // Name of the task system
pipelines { // Define pipelines
pipeline: Vec<u8>, // you can use APipelineInput or APipelineOutput
}
vars { // Define variables (you can use immutable ref or clone)
data: Vec<u8>,
config: Config,
}
tasks { // Define tasks
load_data,
parse_data,
}
}
async fn load_data(data: &Vec<u8>, pipeline: Input<Vec<u8>>) -> String {
for data in dataset.chunks(8) {
pipeline.send(chunk.to_vec());
}
}
async fn parse_data(a_pipeline: Output<Vec<u8>>, config: Config) -> Vec<u8> {
let mut results = String::new();
while let Some(data) = a_pipeline.recv().await {
... // parse data using config
}
}
Execute tasks
#[tokio::main]
async fn main() {
let context = TaskSystem::new(
vec![13,31,31,32,15,32,14,15,22,22,66,23,17,61],
Config { ... } // your config
).execute().await;
// read config changes, or side effects
}