@@ -104,42 +104,42 @@ impl<TNodeId, TVal> AsRef<Key<TNodeId>> for ClosestValue<TNodeId, TVal> {
104
104
105
105
/// A key that can be returned from the `closest_keys` function, which indicates if the key matches the
106
106
/// predicate or not.
107
- pub struct PredicateKey < TNodeId : Clone > {
107
+ pub struct PredicateKey < TNodeId > {
108
108
pub key : Key < TNodeId > ,
109
109
pub predicate_match : bool ,
110
110
}
111
111
112
- impl < TNodeId : Clone > From < PredicateKey < TNodeId > > for Key < TNodeId > {
112
+ impl < TNodeId > From < PredicateKey < TNodeId > > for Key < TNodeId > {
113
113
fn from ( key : PredicateKey < TNodeId > ) -> Self {
114
114
key. key
115
115
}
116
116
}
117
117
118
- impl < TNodeId : Clone , TVal > From < PredicateValue < TNodeId , TVal > > for PredicateKey < TNodeId > {
119
- fn from ( value : PredicateValue < TNodeId , TVal > ) -> Self {
120
- PredicateKey {
121
- key : value. key ,
122
- predicate_match : value. predicate_match ,
123
- }
124
- }
125
- }
126
-
127
118
/// A value being returned from a predicate closest iterator.
128
- pub struct PredicateValue < TNodeId : Clone , TVal > {
119
+ pub struct PredicateValue < TNodeId , TVal > {
129
120
pub key : Key < TNodeId > ,
130
121
pub predicate_match : bool ,
131
122
pub value : TVal ,
132
123
}
133
124
134
- impl < TNodeId : Clone , TVal > AsRef < Key < TNodeId > > for PredicateValue < TNodeId , TVal > {
125
+ impl < TNodeId , TVal > AsRef < Key < TNodeId > > for PredicateValue < TNodeId , TVal > {
135
126
fn as_ref ( & self ) -> & Key < TNodeId > {
136
127
& self . key
137
128
}
138
129
}
139
130
140
- impl < TNodeId : Clone , TVal > From < PredicateValue < TNodeId , TVal > > for Key < TNodeId > {
141
- fn from ( key : PredicateValue < TNodeId , TVal > ) -> Self {
142
- key. key
131
+ impl < TNodeId , TVal > PredicateValue < TNodeId , TVal > {
132
+ pub fn to_key_value ( self ) -> ( PredicateKey < TNodeId > , TVal ) {
133
+ let PredicateValue {
134
+ key,
135
+ predicate_match,
136
+ value,
137
+ } = self ;
138
+ let key = PredicateKey {
139
+ key,
140
+ predicate_match,
141
+ } ;
142
+ ( key, value)
143
143
}
144
144
}
145
145
0 commit comments