use hamon::errors::Result;
use hamon::ext::DecoratorExt;
use hamon::prelude::*;
pub struct Add {
pub val: i32,
}
impl Decorator<i32, i32> for Add {
fn produce(&mut self, previous: i32) -> Result<i32> {
Ok(self.val + previous)
}
}
fn main() {
let pl1 = Builder::new(10)
.step(Add { val: 5 }.when(|_v| true)) .collect();
let pl2 = Builder::new(10)
.step(Add { val: 5 }.when(|_v| false)) .collect();
println!("{:<10}: produces output {:?}", "[PIPELINE1]", pl1);
println!("{:<10}: produces output {:?}", "[PIPELINE2]", pl2);
}