Crate arrowpipe

Source
Expand description

§ArrowPipe

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

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

§Multiple symbiotic Arrows:

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); // 2 -> 6

assert_eq!(second.shoot(1), 6);

Structs§

Arrow
The Arrow type. It is a function composition system that can be used to create complex data processing pipelines. It is composed of an essence and a list of symbiotic Arrows.

Type Aliases§

Essence
The essence of an Arrow is a function that takes a value of type T and returns a value of type U. This is the core of the Arrow.