1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub trait Collection
{
type Item;
fn size(&self) -> usize;
fn is_empty(&self) -> bool{self.size() == 0}
}
pub trait MutableCollection: Collection
{
fn push(&mut self, item: Self::Item) -> ();
fn pop(&mut self) -> Option<Self::Item>;
fn insert_at(&mut self, index: usize, item: Self::Item) -> ();
fn remove_at(&mut self, index:usize) -> Option<Self::Item>;
}
pub trait Sliceable{
type Item;
fn as_mut_slice(&mut self) -> &mut [Self::Item];
}