From e375173625c31e5fb2e37e61c773c802e6e8a539 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 5 Sep 2024 16:17:47 -0700 Subject: [PATCH] keep generic operators and only implement i64 convenience operator --- fixed_wide_vectors/src/macros/vector.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fixed_wide_vectors/src/macros/vector.rs b/fixed_wide_vectors/src/macros/vector.rs index c542dfe..6b24583 100644 --- a/fixed_wide_vectors/src/macros/vector.rs +++ b/fixed_wide_vectors/src/macros/vector.rs @@ -128,15 +128,15 @@ macro_rules! impl_vector { #[macro_export(local_inner_macros)] macro_rules! impl_vector_operator { ($trait: ident, $method: ident ) => { - impl> core::ops::$trait for Vector{ - type Output=Self; - fn $method(self,rhs:Self)->Self::Output{ + impl,U,V> core::ops::$trait> for Vector{ + type Output=Vector; + fn $method(self,rhs:Vector)->Self::Output{ self.map_zip(rhs,|(a,b)|a.$method(b)) } } - impl+Copy> core::ops::$trait for Vector{ + impl> core::ops::$trait for Vector{ type Output=Self; - fn $method(self,rhs:T)->Self::Output{ + fn $method(self,rhs:i64)->Self::Output{ self.map(|t|t.$method(rhs)) } } @@ -146,14 +146,14 @@ macro_rules! impl_vector_operator { #[macro_export(local_inner_macros)] macro_rules! impl_vector_assign_operator { ($trait: ident, $method: ident ) => { - impl core::ops::$trait for Vector{ - fn $method(&mut self,rhs:Self){ + impl,U> core::ops::$trait> for Vector{ + fn $method(&mut self,rhs:Vector){ self.array.iter_mut().zip(rhs.array) .for_each(|(a,b)|a.$method(b)) } } - impl core::ops::$trait for Vector{ - fn $method(&mut self,rhs:T){ + impl> core::ops::$trait for Vector{ + fn $method(&mut self,rhs:i64){ self.array.iter_mut() .for_each(|t|t.$method(rhs)) }