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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::Value;
pub trait Array {
type Element: Value;
#[must_use]
fn get(&self, i: usize) -> Option<&Self::Element>;
#[must_use]
fn get_mut(&mut self, i: usize) -> Option<&mut Self::Element>;
#[must_use]
fn pop(&mut self) -> Option<Self::Element>;
fn push(&mut self, e: Self::Element);
}
impl<T> Array for Vec<T>
where
T: Value,
{
type Element = T;
#[inline]
fn get(&self, i: usize) -> Option<&T> {
<[T]>::get(self, i)
}
#[inline]
fn get_mut(&mut self, i: usize) -> Option<&mut T> {
<[T]>::get_mut(self, i)
}
#[inline]
fn pop(&mut self) -> Option<T> {
Vec::pop(self)
}
#[inline]
fn push(&mut self, e: T) {
Vec::push(self, e)
}
}