Function frunk::monoid::combine_all [] [src]

pub fn combine_all<T>(xs: &Vec<T>) -> T where
    T: Monoid + Semigroup + Clone

Given a sequence of xs, combine them and return the total

Examples


assert_eq!(combine_all(&vec![Some(1), Some(3)]), Some(4));

let empty_vec_opt_int:  Vec<Option<i32>> = Vec::new();
assert_eq!(combine_all(&empty_vec_opt_int), None);

let vec_of_some_strings = vec![Some(String::from("Hello")), Some(String::from(" World"))];
assert_eq!(combine_all(&vec_of_some_strings), Some(String::from("Hello World")));Run