[][src]Macro cherries::sum_all

macro_rules! sum_all {
    ( $head:expr, $( $tail:expr ),* ) => { ... };
}

Fold left with addition all given expression.

The difference from normal addition is that all nodes are recorded in a single node sub-expression.

Examples

    let a = Leaf::new().value(2).name("a").build();
    let b = Leaf::new().value(3).name("b").build();
    let c = Leaf::new().value(4).name("c").build();
    let d = Leaf::new().value(1).name("d").build();
    let res = sum_all!(a, b, c, d);
    assert_eq!(&10, res.quantity());