use std::ops::{Add, Mul}; use num_traits::Inv; #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub struct Tuple(pub A, pub B); impl Add for Tuple where A: Add, B: Add { type Output = Self; fn add(self, rhs: Self) -> Self { Self(self.0+rhs.0, self.1+rhs.1) } } impl Mul for Tuple where A: Mul, B: Mul { type Output = Self; fn mul(self, rhs: Self) -> Self { Self(self.0*rhs.0, self.1*rhs.1) } } impl Inv for Tuple where A: Inv, B: Inv { type Output = Self; fn inv(self) -> Self { Self(self.0.inv(), self.1.inv()) } }