@@ -63,10 +63,11 @@ pub enum UnionElement {
63
63
Index ( i64 ) ,
64
64
}
65
65
66
- type Iter < ' a > = Box < dyn Iterator < Item = & ' a Value > + ' a > ;
66
+ // NodeList is an iterator over references to Values named after the Nodelist term in the spec.
67
+ type NodeList < ' a > = Box < dyn Iterator < Item = & ' a Value > + ' a > ;
67
68
68
69
impl Path {
69
- pub fn find < ' a > ( & ' a self , input : & ' a Value ) -> Iter < ' a > {
70
+ pub fn find < ' a > ( & ' a self , input : & ' a Value ) -> NodeList < ' a > {
70
71
match self {
71
72
Path :: Root => Box :: new ( std:: iter:: once ( input) ) ,
72
73
Path :: Sel ( left, sel) => Box :: new ( left. find ( input) . flat_map ( move |v| sel. find ( v) ) ) ,
@@ -75,7 +76,7 @@ impl Path {
75
76
}
76
77
77
78
impl Selector {
78
- pub fn find < ' a > ( & ' a self , input : & ' a Value ) -> Iter < ' a > {
79
+ pub fn find < ' a > ( & ' a self , input : & ' a Value ) -> NodeList < ' a > {
79
80
match self {
80
81
Selector :: Union ( indices) => Box :: new ( indices. iter ( ) . flat_map ( move |i| i. find ( input) ) ) ,
81
82
Selector :: DotName ( name) => Box :: new ( input. get ( name) . into_iter ( ) ) ,
@@ -89,7 +90,7 @@ impl Selector {
89
90
}
90
91
91
92
impl UnionElement {
92
- pub fn find < ' a > ( & self , v : & ' a Value ) -> Iter < ' a > {
93
+ pub fn find < ' a > ( & self , v : & ' a Value ) -> NodeList < ' a > {
93
94
match self {
94
95
UnionElement :: Name ( name) => Box :: new ( v. get ( name) . into_iter ( ) ) ,
95
96
UnionElement :: Slice ( slice) => {
0 commit comments