Skip to content

Commit

Permalink
changed Progress:status and Progress:seconds_remaining to be Options
Browse files Browse the repository at this point in the history
  • Loading branch information
anmenaga committed Jan 15, 2025
1 parent fa6ba24 commit 097b71b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions dsc_lib/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub seconds_remaining: Option<u64>,
}

pub struct ProgressBar {
Expand All @@ -58,10 +58,6 @@ pub struct ProgressBar {
emit_json: bool
}

fn is_default<T: Default + PartialEq>(t: &T) -> bool {
t == &T::default()
}

impl ProgressBar {
pub fn new(emit_json: bool) -> ProgressBar {
ProgressBar {
Expand Down

0 comments on commit 097b71b

Please sign in to comment.