From 097b71b6b27a36a2b9b65f4c538c7dfc31a5f49a Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 14 Jan 2025 20:23:13 -0800 Subject: [PATCH] changed Progress:status and Progress:seconds_remaining to be Options --- dsc_lib/src/util.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/dsc_lib/src/util.rs b/dsc_lib/src/util.rs index ee2dfaf1..9f5f7d8a 100644 --- a/dsc_lib/src/util.rs +++ b/dsc_lib/src/util.rs @@ -43,11 +43,11 @@ impl Default for DscSettingValue { #[derive(Default, Debug, Clone, Serialize)] pub struct Progress { pub activity: String, - #[serde(default, skip_serializing_if = "is_default")] - pub status: String, pub percent_complete: u16, - #[serde(default, skip_serializing_if = "is_default")] - pub seconds_remaining: u64, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub seconds_remaining: Option, } pub struct ProgressBar { @@ -58,10 +58,6 @@ pub struct ProgressBar { emit_json: bool } -fn is_default(t: &T) -> bool { - t == &T::default() -} - impl ProgressBar { pub fn new(emit_json: bool) -> ProgressBar { ProgressBar {