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 @@ -206,6 +206,17 @@ impl<M: Modulus> ModIntBase for StaticModInt<M> {
206
206
}
207
207
}
208
208
209
+ impl < M : Modulus > FromStr for StaticModInt < M > {
210
+ type Err = Infallible ;
211
+
212
+ #[ inline]
213
+ fn from_str ( s : & str ) -> Result < Self , Infallible > {
214
+ Ok ( s. parse :: < i64 > ( )
215
+ . map ( Self :: new)
216
+ . unwrap_or_else ( |_| todo ! ( "parsing as an arbitrary precision integer?" ) ) )
217
+ }
218
+ }
219
+
209
220
/// Represents a modulus.
210
221
///
211
222
/// # Example
@@ -512,7 +523,6 @@ impl Default for Barrett {
512
523
/// [`DynamicModInt`]: ../struct.DynamicModInt.html
513
524
pub trait ModIntBase :
514
525
Default
515
- + FromStr
516
526
+ From < i8 >
517
527
+ From < i16 >
518
528
+ From < i32 >
@@ -763,13 +773,6 @@ trait InternalImplementations: ModIntBase {
763
773
Self :: raw ( 0 )
764
774
}
765
775
766
- #[ inline]
767
- fn from_str_impl ( s : & str ) -> Result < Self , Infallible > {
768
- Ok ( s. parse :: < i64 > ( )
769
- . map ( Self :: new)
770
- . unwrap_or_else ( |_| todo ! ( "parsing as an arbitrary precision integer?" ) ) )
771
- }
772
-
773
776
#[ inline]
774
777
fn hash_impl ( this : & Self , state : & mut impl Hasher ) {
775
778
this. val ( ) . hash ( state)
@@ -842,15 +845,6 @@ macro_rules! impl_basic_traits {
842
845
}
843
846
}
844
847
845
- impl <$generic_param: $generic_param_bound> FromStr for $self {
846
- type Err = Infallible ;
847
-
848
- #[ inline]
849
- fn from_str( s: & str ) -> Result <Self , Infallible > {
850
- Self :: from_str_impl( s)
851
- }
852
- }
853
-
854
848
impl <$generic_param: $generic_param_bound, V : RemEuclidU32 > From <V > for $self {
855
849
#[ inline]
856
850
fn from( from: V ) -> Self {
You can’t perform that action at this time.
0 commit comments