@@ -44,7 +44,7 @@ impl<M: Modulus> StaticModInt<M> {
4444
4545 /// Creates a new `StaticModInt`.
4646 #[ inline]
47- pub fn new < T : IntoRepresentative > ( val : T ) -> Self {
47+ pub fn new < T : RemEuclidU32 > ( val : T ) -> Self {
4848 Self :: raw ( val. into_representative ( M :: VALUE ) )
4949 }
5050
@@ -159,7 +159,7 @@ impl<I: Id> DynamicModInt<I> {
159159 }
160160
161161 #[ inline]
162- pub fn new < T : IntoRepresentative > ( val : T ) -> Self {
162+ pub fn new < T : RemEuclidU32 > ( val : T ) -> Self {
163163 <Self as ModIntBase >:: new ( val)
164164 }
165165
@@ -286,7 +286,7 @@ pub trait ModIntBase:
286286 fn inv ( self ) -> Self ;
287287
288288 #[ inline]
289- fn new < T : IntoRepresentative > ( val : T ) -> Self {
289+ fn new < T : RemEuclidU32 > ( val : T ) -> Self {
290290 Self :: raw ( val. into_representative ( Self :: modulus ( ) ) )
291291 }
292292
@@ -305,14 +305,14 @@ pub trait ModIntBase:
305305 }
306306}
307307
308- pub trait IntoRepresentative {
308+ pub trait RemEuclidU32 {
309309 fn into_representative ( self , modulus : u32 ) -> u32 ;
310310}
311311
312312macro_rules! impl_into_representative_for_small_signed {
313313 ( $( $ty: tt) ,* ) => {
314314 $(
315- impl IntoRepresentative for $ty {
315+ impl RemEuclidU32 for $ty {
316316 #[ inline]
317317 fn into_representative( self , modulus: u32 ) -> u32 {
318318 ( self as i64 ) . rem_euclid( i64 :: from( modulus) ) as _
@@ -324,7 +324,7 @@ macro_rules! impl_into_representative_for_small_signed {
324324
325325impl_into_representative_for_small_signed ! ( i8 , i16 , i32 , i64 , isize ) ;
326326
327- impl IntoRepresentative for i128 {
327+ impl RemEuclidU32 for i128 {
328328 #[ inline]
329329 fn into_representative ( self , modulus : u32 ) -> u32 {
330330 self . rem_euclid ( i128:: from ( modulus) ) as _
@@ -334,7 +334,7 @@ impl IntoRepresentative for i128 {
334334macro_rules! impl_into_representative_for_small_unsigned {
335335 ( $( $ty: tt) ,* ) => {
336336 $(
337- impl IntoRepresentative for $ty {
337+ impl RemEuclidU32 for $ty {
338338 #[ inline]
339339 fn into_representative( self , modulus: u32 ) -> u32 {
340340 self as u32 % modulus
@@ -347,7 +347,7 @@ macro_rules! impl_into_representative_for_small_unsigned {
347347macro_rules! impl_into_representative_for_large_unsigned {
348348 ( $( $ty: tt) ,* ) => {
349349 $(
350- impl IntoRepresentative for $ty {
350+ impl RemEuclidU32 for $ty {
351351 #[ inline]
352352 fn into_representative( self , modulus: u32 ) -> u32 {
353353 ( self % ( modulus as $ty) ) as _
@@ -469,7 +469,7 @@ macro_rules! impl_basic_traits {
469469 }
470470 }
471471
472- impl <$generic_param: $generic_param_bound, V : IntoRepresentative > From <V > for $self {
472+ impl <$generic_param: $generic_param_bound, V : RemEuclidU32 > From <V > for $self {
473473 #[ inline]
474474 fn from( from: V ) -> Self {
475475 Self :: new( from)
0 commit comments