4 releases
0.1.3 | Aug 22, 2019 |
---|---|
0.1.2 | Aug 22, 2019 |
0.1.1 | Aug 22, 2019 |
0.1.0 | Aug 22, 2019 |
#152 in #closures
6KB
72 lines
pipeline-macro
A crate to create a pipeline in Rust.
How to use it ?
- Define a pipeline with type in input and type in output
- Use
run
method to run this pipeline
Basic example:
let pipeline = pipeline! {
i32
=> add2
=> div_by_3
=> mul_by_83
;-> f64
};
let result = pipeline.run(3); // ~= 110.6666..
Closure example:
let pipeline = pipeline! {
i32
=> |i: i32| i + 2
=> div_by_3
=> mul_by_83
;-> f64
};
let result = pipeline.run(3); // ~= 110.6666..
How to build ?
cargo build
How to run tests ?
cargo test
lib.rs
:
How to use pipeline_macro
?
- Define a pipeline with type in input and type in ouput
- Use
run
method to run this pipeline
Basic example:
use pipeline_macro::*;
let pipeline = pipeline! {
i32
=> add2
=> div_by_3
=> mul_by_83
;-> f64
};
let result = pipeline.run(3); // ~= 110.6666..
Closure example:
use pipeline_macro::*;
let pipeline = pipeline! {
i32
=> |i: i32| i + 2
=> div_by_3
=> mul_by_83
;-> f64
};
let result = pipeline.run(3); // ~= 110.6666..