From 483f336096ddd82e9322b0eee2fe61f62e1647bb Mon Sep 17 00:00:00 2001 From: Guillaume Binet Date: Sun, 22 Dec 2024 09:44:03 -0600 Subject: [PATCH] Adds a -= to the CuDuration. (#160) --- core/cu29_clock/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/cu29_clock/src/lib.rs b/core/cu29_clock/src/lib.rs index 692f7a75e..3f0b6f038 100644 --- a/core/cu29_clock/src/lib.rs +++ b/core/cu29_clock/src/lib.rs @@ -13,7 +13,7 @@ use quanta::{Clock, Mock}; use serde::{Deserialize, Serialize}; use std::convert::Into; use std::fmt::{Display, Formatter}; -use std::ops::{AddAssign, Div, Mul}; +use std::ops::{AddAssign, Div, Mul, SubAssign}; use std::sync::Arc; use std::time::Duration; @@ -92,6 +92,12 @@ impl AddAssign for CuDuration { } } +impl SubAssign for CuDuration { + fn sub_assign(&mut self, rhs: Self) { + self.0 -= rhs.0 + } +} + // a way to divide a duration by a scalar. // useful to compute averages for example. impl Div for CuDuration