diff --git a/src/modint.rs b/src/modint.rs index 1445f5b..b78ac7a 100644 --- a/src/modint.rs +++ b/src/modint.rs @@ -205,6 +205,17 @@ impl ModIntBase for StaticModInt { } } +impl FromStr for StaticModInt { + type Err = Infallible; + + #[inline] + fn from_str(s: &str) -> Result { + Ok(s.parse::() + .map(Self::new) + .unwrap_or_else(|_| todo!("parsing as an arbitrary precision integer?"))) + } +} + /// Represents a modulus. /// /// # Example @@ -494,7 +505,6 @@ impl Default for Barrett { /// [`DynamicModInt`]: ../struct.DynamicModInt.html pub trait ModIntBase: Default - + FromStr + From + From + From @@ -745,13 +755,6 @@ trait InternalImplementations: ModIntBase { Self::raw(0) } - #[inline] - fn from_str_impl(s: &str) -> Result { - Ok(s.parse::() - .map(Self::new) - .unwrap_or_else(|_| todo!("parsing as an arbitrary precision integer?"))) - } - #[inline] fn hash_impl(this: &Self, state: &mut impl Hasher) { this.val().hash(state) @@ -824,15 +827,6 @@ macro_rules! impl_basic_traits { } } - impl <$generic_param: $generic_param_bound> FromStr for $self { - type Err = Infallible; - - #[inline] - fn from_str(s: &str) -> Result { - Self::from_str_impl(s) - } - } - impl<$generic_param: $generic_param_bound, V: RemEuclidU32> From for $self { #[inline] fn from(from: V) -> Self {