File tree 3 files changed +18
-0
lines changed
3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,12 @@ impl AsRef<Sequence> for Sequence {
131
131
}
132
132
}
133
133
134
+ impl AsRef < [ Element ] > for Sequence {
135
+ fn as_ref ( & self ) -> & [ Element ] {
136
+ self . elements . as_slice ( )
137
+ }
138
+ }
139
+
134
140
// This is more efficient than Sequence::new(), which will iterate over and convert each value to
135
141
// an Element for better ergonomics.
136
142
impl From < Vec < Element > > for Sequence {
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ impl AsRef<Sequence> for List {
52
52
}
53
53
}
54
54
55
+ impl AsRef < [ Element ] > for List {
56
+ fn as_ref ( & self ) -> & [ Element ] {
57
+ self . 0 . as_ref ( )
58
+ }
59
+ }
60
+
55
61
// Allows `for element in &list {...}` syntax
56
62
impl < ' a > IntoIterator for & ' a List {
57
63
type Item = & ' a Element ;
Original file line number Diff line number Diff line change @@ -52,6 +52,12 @@ impl AsRef<Sequence> for SExp {
52
52
}
53
53
}
54
54
55
+ impl AsRef < [ Element ] > for SExp {
56
+ fn as_ref ( & self ) -> & [ Element ] {
57
+ self . 0 . as_ref ( )
58
+ }
59
+ }
60
+
55
61
// Allows `for element in &sexp {...}` syntax
56
62
impl < ' a > IntoIterator for & ' a SExp {
57
63
type Item = & ' a Element ;
You can’t perform that action at this time.
0 commit comments