File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pub struct JsonInvocation {
16
16
//
17
17
// This is necessary to easily correlate this invocation with logs or other data.
18
18
pub start_time : u64 ,
19
+ #[ serde( deserialize_with = "null_as_f64_nan" ) ]
19
20
pub duration_including_children_sec : f64 ,
20
21
pub children : Vec < JsonNode > ,
21
22
}
@@ -28,6 +29,7 @@ pub enum JsonNode {
28
29
type_ : String ,
29
30
debug_repr : String ,
30
31
32
+ #[ serde( deserialize_with = "null_as_f64_nan" ) ]
31
33
duration_excluding_children_sec : f64 ,
32
34
system_stats : JsonStepSystemStats ,
33
35
@@ -88,5 +90,11 @@ pub struct JsonInvocationSystemStats {
88
90
#[ derive( Serialize , Deserialize ) ]
89
91
#[ serde( rename_all = "snake_case" ) ]
90
92
pub struct JsonStepSystemStats {
93
+ #[ serde( deserialize_with = "null_as_f64_nan" ) ]
91
94
pub cpu_utilization_percent : f64 ,
92
95
}
96
+
97
+ fn null_as_f64_nan < ' de , D : serde:: Deserializer < ' de > > ( d : D ) -> Result < f64 , D :: Error > {
98
+ use serde:: Deserialize as _;
99
+ Option :: < f64 > :: deserialize ( d) . map ( |f| f. unwrap_or ( f64:: NAN ) )
100
+ }
You can’t perform that action at this time.
0 commit comments