From 875305bdc3fe394cf60687b14d221b8618ac242a Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Fri, 16 Aug 2019 15:57:38 +0200 Subject: [PATCH] remove Frac: LeEqU bounds from struct Fixed, leave them for impl --- src/lib.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 233d243..a9532b5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -323,32 +323,38 @@ assert_eq!(two_point_75.to_string(), \"2.8\"); [typenum crate]: https://crates.io/crates/typenum "; #[repr(transparent)] - pub struct $Fixed { + pub struct $Fixed { bits: $Inner, phantom: PhantomData, } ); - impl Clone for $Fixed { + impl Clone for $Fixed { #[inline] fn clone(&self) -> $Fixed { - Self::from_bits(self.to_bits()) + $Fixed { + bits: self.bits, + phantom: PhantomData, + } } } - impl Copy for $Fixed {} + impl Copy for $Fixed {} - impl Default for $Fixed { + impl Default for $Fixed { #[inline] fn default() -> $Fixed { - Self::from_bits(<$Inner>::default()) + $Fixed { + bits: <$Inner>::default(), + phantom: PhantomData + } } } - impl Hash for $Fixed { + impl Hash for $Fixed { #[inline] fn hash(&self, state: &mut H) { - self.to_bits().hash(state); + self.bits.hash(state); } }