From b383e609988a7f171643a387a81c512cab1257be Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Fri, 17 Mar 2023 22:41:10 -0400 Subject: [PATCH] dd: implement Add for WriteStat --- src/uu/dd/src/progress.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/uu/dd/src/progress.rs b/src/uu/dd/src/progress.rs index 4fe04cb0e..ac7517c2c 100644 --- a/src/uu/dd/src/progress.rs +++ b/src/uu/dd/src/progress.rs @@ -379,6 +379,17 @@ impl std::ops::AddAssign for WriteStat { } } +impl std::ops::Add for WriteStat { + type Output = Self; + fn add(self, other: Self) -> Self { + Self { + writes_complete: self.writes_complete + other.writes_complete, + writes_partial: self.writes_partial + other.writes_partial, + bytes_total: self.bytes_total + other.bytes_total, + } + } +} + /// How much detail to report when printing transfer statistics. /// /// This corresponds to the available settings of the `status`