File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ impl TryFrom<serde_json::Value> for Value {
8
8
}
9
9
}
10
10
11
+ impl TryFrom < & serde_json:: Value > for Value {
12
+ type Error = EvaluationError ;
13
+
14
+ fn try_from ( value : & serde_json:: Value ) -> Result < Self , Self :: Error > {
15
+ json_value_to_value ( value)
16
+ }
17
+ }
18
+
11
19
fn json_value_to_value ( value : & serde_json:: Value ) -> EvaluationResult < Value > {
12
20
match value {
13
21
serde_json:: Value :: Bool ( value) => Ok ( Value :: Bool ( * value) ) ,
@@ -96,9 +104,8 @@ mod tests {
96
104
) ,
97
105
) ;
98
106
99
- let actual_value: Value = json. try_into ( ) . unwrap ( ) ;
100
-
101
- assert_eq ! ( expected_value, actual_value) ;
107
+ assert_eq ! ( expected_value, Value :: try_from( & json) . unwrap( ) ) ;
108
+ assert_eq ! ( expected_value, Value :: try_from( json) . unwrap( ) ) ;
102
109
}
103
110
104
111
#[ test]
You can’t perform that action at this time.
0 commit comments