arrowpipe 0.1.0

Build complex pipelines easily
Documentation
  • Coverage
  • 100%
    11 out of 11 items documented1 out of 10 items with examples
  • Size
  • Source code size: 7.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.68 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • ibnz36/arrowpipe
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Brian3647

ArrowPipe: Build complex pipelines easily

An [Arrow] is a function composition system that can be used to create complex data processing pipelines.

Installation

Add the following to your Cargo.toml:

[dependencies]
arrowpipe = { git = "https://github.com/Brian3647/arrowpipe" }

Example

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);

Order of execution example:

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);

Why?

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.

License

This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).