sum

Macro sum 

Source
macro_rules! sum {
    ($($body:tt)*) => { ... };
}
Expand description

Return sum of values of an iterator using Python’s list-comprehension style.

§Basic usage

// sum![f(x); for x in iter];
// Create an iterator and sum its values
let sum: u64 = sum![x*x; for x in 1..10];
assert_eq!(sum, 285);
// Same as iter![...].sum()

For more details, refer to the documentation of iter.