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
30
pub trait ExpandFront {
    fn expand_front(&mut self);
}

pub trait ExpandBack {
    fn expand_back(&mut self);
}

pub trait ShrinkFront {
    fn shrink_front(&mut self);
}

pub trait ShrinkBack {
    fn shrink_back(&mut self);
}

pub trait ElasticSlice {
    fn reset(&mut self);
    fn full_len(&self) -> usize;
    fn start(&self) -> usize;
    fn end(&self) -> usize;
    fn len(&self) -> usize { self.end() - self.start() }
    fn is_empty(&self) -> bool { self.start() == self.end() }
}

pub trait SliceHash {
    type Salt;
    type Hashed;
    fn hash(&self, x: Self::Salt) -> Self::Hashed;
}