1 2 3 4 5 6 7 8 9 10 11
use itertools::concat; pub trait Semigroup { fn combine(&self, b: &Self) -> Self; } impl Semigroup for Vec<i32> { fn combine(&self, b: &Self) -> Vec<i32> { concat(vec![self.clone(), b.clone()]) } }
1 2 3 4 5 6 7 8 9 10 11
use itertools::concat; pub trait Semigroup { fn combine(&self, b: &Self) -> Self; } impl Semigroup for Vec<i32> { fn combine(&self, b: &Self) -> Vec<i32> { concat(vec![self.clone(), b.clone()]) } }