1 2 3 4 5 6 7 8 9 10 11 12 13
pub trait Collection<T> { fn len(&self) -> usize; fn is_empty(&self) -> bool { self.len() == 0 } fn contains(&self, other: &T) -> bool where T: PartialEq; } pub trait CollectionMut<T>: Collection<T> { fn clear(&mut self); }