frunk::semigroupFunction combine_all_option
source pub fn combine_all_option<T>(xs: &[T]) -> Option<T>
Expand description
Given a sequence of xs
, combine them and return the total
If the sequence is empty, returns None. Otherwise, returns Some(total).
ยงExamples
use frunk::semigroup::combine_all_option;
let v1 = &vec![1, 2, 3];
assert_eq!(combine_all_option(v1), Some(6));
let v2: Vec<i16> = Vec::new(); assert_eq!(combine_all_option(&v2), None);