From 8bccc2fe66017a19e609446465e4cc0cc430b0c1 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 16 Sep 2024 14:06:37 -0700 Subject: [PATCH] Time assign operators --- src/integer.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/integer.rs b/src/integer.rs index e865063..03e953c 100644 --- a/src/integer.rs +++ b/src/integer.rs @@ -95,6 +95,19 @@ macro_rules! impl_time_additive_operator { impl_time_additive_operator!(core::ops::Add,add); impl_time_additive_operator!(core::ops::Sub,sub); impl_time_additive_operator!(core::ops::Rem,rem); +macro_rules! impl_time_additive_assign_operator { + ($trait:ty, $method:ident) => { + impl $trait for Time{ + #[inline] + fn $method(&mut self,rhs:Self){ + self.0.$method(rhs.0) + } + } + }; +} +impl_time_additive_assign_operator!(core::ops::AddAssign,add_assign); +impl_time_additive_assign_operator!(core::ops::SubAssign,sub_assign); +impl_time_additive_assign_operator!(core::ops::RemAssign,rem_assign); impl std::ops::Mul for Time{ type Output=Ratio,fixed_wide::fixed::Fixed<2,64>>; #[inline]