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 @@ -206,6 +206,17 @@ impl<M: Modulus> ModIntBase for StaticModInt<M> {
206206 }
207207}
208208
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+
209220/// Represents a modulus.
210221///
211222/// # Example
@@ -512,7 +523,6 @@ impl Default for Barrett {
512523/// [`DynamicModInt`]: ../struct.DynamicModInt.html
513524pub trait ModIntBase :
514525 Default
515- + FromStr
516526 + From < i8 >
517527 + From < i16 >
518528 + From < i32 >
@@ -763,13 +773,6 @@ trait InternalImplementations: ModIntBase {
763773 Self :: raw ( 0 )
764774 }
765775
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-
773776 #[ inline]
774777 fn hash_impl ( this : & Self , state : & mut impl Hasher ) {
775778 this. val ( ) . hash ( state)
@@ -842,15 +845,6 @@ macro_rules! impl_basic_traits {
842845 }
843846 }
844847
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-
854848 impl <$generic_param: $generic_param_bound, V : RemEuclidU32 > From <V > for $self {
855849 #[ inline]
856850 fn from( from: V ) -> Self {
You can’t perform that action at this time.
0 commit comments