File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ pub struct JsonInvocation {
1616 //
1717 // This is necessary to easily correlate this invocation with logs or other data.
1818 pub start_time : u64 ,
19+ #[ serde( deserialize_with = "null_as_f64_nan" ) ]
1920 pub duration_including_children_sec : f64 ,
2021 pub children : Vec < JsonNode > ,
2122}
@@ -28,6 +29,7 @@ pub enum JsonNode {
2829 type_ : String ,
2930 debug_repr : String ,
3031
32+ #[ serde( deserialize_with = "null_as_f64_nan" ) ]
3133 duration_excluding_children_sec : f64 ,
3234 system_stats : JsonStepSystemStats ,
3335
@@ -88,5 +90,11 @@ pub struct JsonInvocationSystemStats {
8890#[ derive( Serialize , Deserialize ) ]
8991#[ serde( rename_all = "snake_case" ) ]
9092pub struct JsonStepSystemStats {
93+ #[ serde( deserialize_with = "null_as_f64_nan" ) ]
9194 pub cpu_utilization_percent : f64 ,
9295}
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