checked_sum
Utility crate for summing up iterators in a safe way. The CheckedSum
trait is implemented for any iterator of items implementing CheckedAdd
,
which in turn is implemented for all integer primitives but can also be
implemented for other types like newtypes wrapping integers.
use CheckedSum;
// If the sum fits into the type, it is returned
let numbers = vec!;
assert_eq!;
// If the sum overflows, `None` is returned
let numbers = vec!;
assert_eq!;