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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
use super::abc::*;
impl Type for Vec<BType> {
fn iclone(&self) -> BType {
BType(
box self.into_iter()
.map(|v| v.0.iclone())
.collect::<Vec<BType>>()
)
}
}
impl AsBool for Vec<BType> {
fn to_bool(&self) -> bool {
!self.is_empty()
}
}
impl AsIterable for Vec<BType> {
fn try_as_iterable(&self) -> Option<&IIterable> {
Some(self)
}
}
impl AsComposable for Vec<BType> {
fn try_as_composable(&self) -> Option<&IComposable> {
Some(self)
}
}
impl IIterable for Vec<BType> {
fn is_empty(&self) -> bool {
Vec::is_empty(self)
}
fn ivalues(&self) -> VIterator {
VIterator { me: self.iter() }
}
}
impl IComposable for Vec<BType> {
fn get_attr(&self, id: &str) -> Option<BType> {
match id {
"length" => Some(ex(self.len() as i64)),
_ => None
}
}
}