Time assign operators

This commit is contained in:
Quaternions 2024-09-16 14:06:37 -07:00
parent 0d8ab36031
commit 8bccc2fe66

View File

@ -95,6 +95,19 @@ macro_rules! impl_time_additive_operator {
impl_time_additive_operator!(core::ops::Add,add); impl_time_additive_operator!(core::ops::Add,add);
impl_time_additive_operator!(core::ops::Sub,sub); impl_time_additive_operator!(core::ops::Sub,sub);
impl_time_additive_operator!(core::ops::Rem,rem); 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{ impl std::ops::Mul for Time{
type Output=Ratio<fixed_wide::fixed::Fixed<2,64>,fixed_wide::fixed::Fixed<2,64>>; type Output=Ratio<fixed_wide::fixed::Fixed<2,64>,fixed_wide::fixed::Fixed<2,64>>;
#[inline] #[inline]