diff --git a/src/modint.rs b/src/modint.rs index 8aa5220..2c5ffab 100644 --- a/src/modint.rs +++ b/src/modint.rs @@ -206,6 +206,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 @@ -512,7 +523,6 @@ impl Default for Barrett { /// [`DynamicModInt`]: ../struct.DynamicModInt.html pub trait ModIntBase: Default - + FromStr + From + From + From @@ -763,13 +773,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) @@ -842,15 +845,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 {