[][src]Crate cherries

Cherries

Cherries is a framework for logging operation history as json structure automatically.

Design

The Cherries Library provides Cherry<T> a operational expression node. Cherry<T> provides impl for basic ops traits and some useful functors (i.g. map, with). Cherry<T> logging every operation automatically in its field previous as JSON string.

extern crate cherries;
use cherries::node::{Leaf, Cherries};
 
// Creating leaf nodes.
let a = Leaf::new().value(1).name("a").build();
let b = Leaf::new().value(1).name("b").build();
 
// `c` holds log data automatically.
let c = a + b;
let c = c.labeled("c");
 // We can get expression log to call `to_json` method.
println!("{}", c.to_json());
//  {
//      "label":"c",
//      "value":2,
//      "unit":"dimensionless",
//      "subexpr":[
//          {
//              "label":"a",
//              "value":1,
//              "unit":"dimensionless"
//          },
//          {
//              "label":"b",
//              "value":1,
//              "unit":"dimensionless"
//          }
//      ]
//  }

Modules

cmp
fold
node
ops
validate

Macros

maximum

Fold left with max all given expression.

minimum

Fold left with min all given expression.

prod_all

Fold left with product all given expression.

sum_all

Fold left with addition all given expression.