File tree 1 file changed +11
-17
lines changed
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> {
205
205
}
206
206
}
207
207
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
+
208
219
/// Represents a modulus.
209
220
///
210
221
/// # Example
@@ -494,7 +505,6 @@ impl Default for Barrett {
494
505
/// [`DynamicModInt`]: ../struct.DynamicModInt.html
495
506
pub trait ModIntBase :
496
507
Default
497
- + FromStr
498
508
+ From < i8 >
499
509
+ From < i16 >
500
510
+ From < i32 >
@@ -745,13 +755,6 @@ trait InternalImplementations: ModIntBase {
745
755
Self :: raw ( 0 )
746
756
}
747
757
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
-
755
758
#[ inline]
756
759
fn hash_impl ( this : & Self , state : & mut impl Hasher ) {
757
760
this. val ( ) . hash ( state)
@@ -824,15 +827,6 @@ macro_rules! impl_basic_traits {
824
827
}
825
828
}
826
829
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
-
836
830
impl <$generic_param: $generic_param_bound, V : RemEuclidU32 > From <V > for $self {
837
831
#[ inline]
838
832
fn from( from: V ) -> Self {
You can’t perform that action at this time.
0 commit comments