File tree Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Expand file tree Collapse file tree 1 file changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,17 @@ impl<M: Modulus> ModIntBase for StaticModInt<M> {
205205 }
206206}
207207
208+ impl < M : Modulus > FromStr for StaticModInt < M > {
209+ type Err = Infallible ;
210+
211+ #[ inline]
212+ fn from_str ( s : & str ) -> Result < Self , Infallible > {
213+ Ok ( s. parse :: < i64 > ( )
214+ . map ( Self :: new)
215+ . unwrap_or_else ( |_| todo ! ( "parsing as an arbitrary precision integer?" ) ) )
216+ }
217+ }
218+
208219/// Represents a modulus.
209220///
210221/// # Example
@@ -494,7 +505,6 @@ impl Default for Barrett {
494505/// [`DynamicModInt`]: ../struct.DynamicModInt.html
495506pub trait ModIntBase :
496507 Default
497- + FromStr
498508 + From < i8 >
499509 + From < i16 >
500510 + From < i32 >
@@ -745,13 +755,6 @@ trait InternalImplementations: ModIntBase {
745755 Self :: raw ( 0 )
746756 }
747757
748- #[ inline]
749- fn from_str_impl ( s : & str ) -> Result < Self , Infallible > {
750- Ok ( s. parse :: < i64 > ( )
751- . map ( Self :: new)
752- . unwrap_or_else ( |_| todo ! ( "parsing as an arbitrary precision integer?" ) ) )
753- }
754-
755758 #[ inline]
756759 fn hash_impl ( this : & Self , state : & mut impl Hasher ) {
757760 this. val ( ) . hash ( state)
@@ -824,15 +827,6 @@ macro_rules! impl_basic_traits {
824827 }
825828 }
826829
827- impl <$generic_param: $generic_param_bound> FromStr for $self {
828- type Err = Infallible ;
829-
830- #[ inline]
831- fn from_str( s: & str ) -> Result <Self , Infallible > {
832- Self :: from_str_impl( s)
833- }
834- }
835-
836830 impl <$generic_param: $generic_param_bound, V : RemEuclidU32 > From <V > for $self {
837831 #[ inline]
838832 fn from( from: V ) -> Self {
You can’t perform that action at this time.
0 commit comments