| Crates.io | arrowpipe |
| lib.rs | arrowpipe |
| version | 0.1.0 |
| created_at | 2023-11-13 20:03:12.986048+00 |
| updated_at | 2023-11-13 20:03:12.986048+00 |
| description | Build complex pipelines easily |
| homepage | https://github.com/Brian3647/arrowpipe |
| repository | https://github.com/Brian3647/arrowpipe |
| max_upload_size | |
| id | 1033971 |
| size | 7,538 |
An [Arrow] is a function composition system that can be used to create
complex data processing pipelines.
Add the following to your Cargo.toml:
[dependencies]
arrowpipe = { git = "https://github.com/Brian3647/arrowpipe" }
use arrowpipe::Arrow;
fn add_one(x: i32) -> i32 {
x + 1
}
fn double(x: i32) -> i32 {
x * 2
}
let mut arrow = Arrow::new(add_one);
arrow.symbiotize(Arrow::new(double));
arrow.symbiotize(Arrow::new(|x| x - 1));
assert_eq!(arrow.shoot(1), 3);
use arrowpipe::Arrow;
fn add_one(x: i32) -> i32 {
x + 1
}
let mut first = Arrow::new(add_one); // Second: 2 -> 3
first.symbiotize(Arrow::new(|x| x * 2)); // Third: 3 -> 6
let mut second = Arrow::new(add_one); // First: 1 -> 2
second.symbiotize(first);
assert_eq!(second.shoot(1), 6);
This is specially useful for long pipelines like a build system. With the Arrow struct, you can simply add another Arrow to an existing one to have a new step.
This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).