@@ -5,7 +5,7 @@ use serde::Serialize;
55
66use crate :: Occur ;
77
8- #[ derive( PartialEq , Clone , Serialize ) ]
8+ #[ derive( PartialEq , Eq , Hash , Clone , Serialize ) ]
99#[ serde( tag = "type" ) ]
1010#[ serde( rename_all = "snake_case" ) ]
1111pub enum UserInputLeaf {
@@ -120,15 +120,15 @@ impl Debug for UserInputLeaf {
120120 }
121121}
122122
123- #[ derive( Copy , Clone , Eq , PartialEq , Debug , Serialize ) ]
123+ #[ derive( Copy , Clone , Eq , PartialEq , Hash , Debug , Serialize ) ]
124124#[ serde( rename_all = "snake_case" ) ]
125125pub enum Delimiter {
126126 SingleQuotes ,
127127 DoubleQuotes ,
128128 None ,
129129}
130130
131- #[ derive( PartialEq , Clone , Serialize ) ]
131+ #[ derive( PartialEq , Eq , Hash , Clone , Serialize ) ]
132132#[ serde( rename_all = "snake_case" ) ]
133133pub struct UserInputLiteral {
134134 pub field_name : Option < String > ,
@@ -167,7 +167,7 @@ impl fmt::Debug for UserInputLiteral {
167167 }
168168}
169169
170- #[ derive( PartialEq , Debug , Clone , Serialize ) ]
170+ #[ derive( PartialEq , Eq , Hash , Debug , Clone , Serialize ) ]
171171#[ serde( tag = "type" , content = "value" ) ]
172172#[ serde( rename_all = "snake_case" ) ]
173173pub enum UserInputBound {
@@ -204,11 +204,11 @@ impl UserInputBound {
204204 }
205205}
206206
207- #[ derive( PartialEq , Clone , Serialize ) ]
207+ #[ derive( PartialEq , Eq , Hash , Clone , Serialize ) ]
208208#[ serde( into = "UserInputAstSerde" ) ]
209209pub enum UserInputAst {
210210 Clause ( Vec < ( Option < Occur > , UserInputAst ) > ) ,
211- Boost ( Box < UserInputAst > , f64 ) ,
211+ Boost ( Box < UserInputAst > , ordered_float :: OrderedFloat < f64 > ) ,
212212 Leaf ( Box < UserInputLeaf > ) ,
213213}
214214
@@ -230,9 +230,10 @@ impl From<UserInputAst> for UserInputAstSerde {
230230 fn from ( ast : UserInputAst ) -> Self {
231231 match ast {
232232 UserInputAst :: Clause ( clause) => UserInputAstSerde :: Bool { clauses : clause } ,
233- UserInputAst :: Boost ( underlying, boost) => {
234- UserInputAstSerde :: Boost { underlying, boost }
235- }
233+ UserInputAst :: Boost ( underlying, boost) => UserInputAstSerde :: Boost {
234+ underlying,
235+ boost : boost. into_inner ( ) ,
236+ } ,
236237 UserInputAst :: Leaf ( leaf) => UserInputAstSerde :: Leaf ( leaf) ,
237238 }
238239 }
@@ -391,7 +392,7 @@ mod tests {
391392 #[ test]
392393 fn test_boost_serialization ( ) {
393394 let inner_ast = UserInputAst :: Leaf ( Box :: new ( UserInputLeaf :: All ) ) ;
394- let boost_ast = UserInputAst :: Boost ( Box :: new ( inner_ast) , 2.5 ) ;
395+ let boost_ast = UserInputAst :: Boost ( Box :: new ( inner_ast) , 2.5 . into ( ) ) ;
395396 let json = serde_json:: to_string ( & boost_ast) . unwrap ( ) ;
396397 assert_eq ! (
397398 json,
@@ -418,7 +419,7 @@ mod tests {
418419 } ) ) ) ,
419420 ) ,
420421 ] ) ) ,
421- 2.5 ,
422+ 2.5 . into ( ) ,
422423 ) ;
423424 let json = serde_json:: to_string ( & boost_ast) . unwrap ( ) ;
424425 assert_eq ! (
0 commit comments