From Macro to tortured Generic

This commit is contained in:
Timothy Warren 2020-02-14 12:30:09 -05:00
parent 16741c8c4d
commit d20cb06c87

View File

@ -52,10 +52,7 @@ impl<T: Unsigned> Frac<T> {
} }
} }
macro_rules! impl_mul { impl<T: Unsigned + Mul<Output = T>> Mul for Frac<T> {
($( $Type: ty ),* ) => {
$(
impl Mul for Frac<$Type> {
type Output = Self; type Output = Self;
fn mul(self, rhs: Self) -> Self { fn mul(self, rhs: Self) -> Self {
@ -69,11 +66,7 @@ macro_rules! impl_mul {
Self::new(numer, denom) Self::new(numer, denom)
} }
} }
}
)*
};
} }
impl_mul!(u8, u16, u32, u64, usize, u128);
impl<T: Unsigned> Neg for Frac<T> { impl<T: Unsigned> Neg for Frac<T> {
type Output = Self; type Output = Self;