@@ -3,7 +3,7 @@ use core::{u8, u16, u32, u64, usize};
3
3
use core:: { f32, f64} ;
4
4
use core:: mem:: size_of;
5
5
use core:: num:: Wrapping ;
6
- #[ cfg( feature = "i128" ) ]
6
+ #[ cfg( has_i128 ) ]
7
7
use core:: { i128, u128} ;
8
8
9
9
use float:: FloatCore ;
@@ -44,7 +44,7 @@ pub trait ToPrimitive {
44
44
/// The default implementation converts through `to_i64()`. Types implementing
45
45
/// this trait should override this method if they can represent a greater range.
46
46
#[ inline]
47
- #[ cfg( feature = "i128" ) ]
47
+ #[ cfg( has_i128 ) ]
48
48
fn to_i128 ( & self ) -> Option < i128 > {
49
49
self . to_i64 ( ) . map ( From :: from)
50
50
}
@@ -84,7 +84,7 @@ pub trait ToPrimitive {
84
84
/// The default implementation converts through `to_u64()`. Types implementing
85
85
/// this trait should override this method if they can represent a greater range.
86
86
#[ inline]
87
- #[ cfg( feature = "i128" ) ]
87
+ #[ cfg( has_i128 ) ]
88
88
fn to_u128 ( & self ) -> Option < u128 > {
89
89
self . to_u64 ( ) . map ( From :: from)
90
90
}
@@ -142,7 +142,7 @@ macro_rules! impl_to_primitive_int {
142
142
fn to_i16 -> i16 ;
143
143
fn to_i32 -> i32 ;
144
144
fn to_i64 -> i64 ;
145
- #[ cfg( feature = "i128" ) ]
145
+ #[ cfg( has_i128 ) ]
146
146
fn to_i128 -> i128 ;
147
147
}
148
148
@@ -152,7 +152,7 @@ macro_rules! impl_to_primitive_int {
152
152
fn to_u16 -> u16 ;
153
153
fn to_u32 -> u32 ;
154
154
fn to_u64 -> u64 ;
155
- #[ cfg( feature = "i128" ) ]
155
+ #[ cfg( has_i128 ) ]
156
156
fn to_u128 -> u128 ;
157
157
}
158
158
@@ -169,7 +169,7 @@ impl_to_primitive_int!(i8);
169
169
impl_to_primitive_int ! ( i16 ) ;
170
170
impl_to_primitive_int ! ( i32 ) ;
171
171
impl_to_primitive_int ! ( i64 ) ;
172
- #[ cfg( feature = "i128" ) ]
172
+ #[ cfg( has_i128 ) ]
173
173
impl_to_primitive_int ! ( i128 ) ;
174
174
175
175
macro_rules! impl_to_primitive_uint_to_int {
@@ -211,7 +211,7 @@ macro_rules! impl_to_primitive_uint {
211
211
fn to_i16 -> i16 ;
212
212
fn to_i32 -> i32 ;
213
213
fn to_i64 -> i64 ;
214
- #[ cfg( feature = "i128" ) ]
214
+ #[ cfg( has_i128 ) ]
215
215
fn to_i128 -> i128 ;
216
216
}
217
217
@@ -221,7 +221,7 @@ macro_rules! impl_to_primitive_uint {
221
221
fn to_u16 -> u16 ;
222
222
fn to_u32 -> u32 ;
223
223
fn to_u64 -> u64 ;
224
- #[ cfg( feature = "i128" ) ]
224
+ #[ cfg( has_i128 ) ]
225
225
fn to_u128 -> u128 ;
226
226
}
227
227
@@ -238,7 +238,7 @@ impl_to_primitive_uint!(u8);
238
238
impl_to_primitive_uint ! ( u16 ) ;
239
239
impl_to_primitive_uint ! ( u32 ) ;
240
240
impl_to_primitive_uint ! ( u64 ) ;
241
- #[ cfg( feature = "i128" ) ]
241
+ #[ cfg( has_i128 ) ]
242
242
impl_to_primitive_uint ! ( u128 ) ;
243
243
244
244
macro_rules! impl_to_primitive_float_to_float {
@@ -324,7 +324,7 @@ macro_rules! impl_to_primitive_float {
324
324
fn to_i16 -> i16 ;
325
325
fn to_i32 -> i32 ;
326
326
fn to_i64 -> i64 ;
327
- #[ cfg( feature = "i128" ) ]
327
+ #[ cfg( has_i128 ) ]
328
328
fn to_i128 -> i128 ;
329
329
}
330
330
@@ -334,7 +334,7 @@ macro_rules! impl_to_primitive_float {
334
334
fn to_u16 -> u16 ;
335
335
fn to_u32 -> u32 ;
336
336
fn to_u64 -> u64 ;
337
- #[ cfg( feature = "i128" ) ]
337
+ #[ cfg( has_i128 ) ]
338
338
fn to_u128 -> u128 ;
339
339
}
340
340
@@ -391,7 +391,7 @@ pub trait FromPrimitive: Sized {
391
391
/// The default implementation converts through `from_i64()`. Types implementing
392
392
/// this trait should override this method if they can represent a greater range.
393
393
#[ inline]
394
- #[ cfg( feature = "i128" ) ]
394
+ #[ cfg( has_i128 ) ]
395
395
fn from_i128 ( n : i128 ) -> Option < Self > {
396
396
n. to_i64 ( ) . and_then ( FromPrimitive :: from_i64)
397
397
}
@@ -436,7 +436,7 @@ pub trait FromPrimitive: Sized {
436
436
/// The default implementation converts through `from_u64()`. Types implementing
437
437
/// this trait should override this method if they can represent a greater range.
438
438
#[ inline]
439
- #[ cfg( feature = "i128" ) ]
439
+ #[ cfg( has_i128 ) ]
440
440
fn from_u128 ( n : u128 ) -> Option < Self > {
441
441
n. to_u64 ( ) . and_then ( FromPrimitive :: from_u64)
442
442
}
@@ -464,14 +464,14 @@ macro_rules! impl_from_primitive {
464
464
#[ inline] fn from_i16( n: i16 ) -> Option <$T> { n. $to_ty( ) }
465
465
#[ inline] fn from_i32( n: i32 ) -> Option <$T> { n. $to_ty( ) }
466
466
#[ inline] fn from_i64( n: i64 ) -> Option <$T> { n. $to_ty( ) }
467
- #[ cfg( feature = "i128" ) ]
467
+ #[ cfg( has_i128 ) ]
468
468
#[ inline] fn from_i128( n: i128 ) -> Option <$T> { n. $to_ty( ) }
469
469
470
470
#[ inline] fn from_u8( n: u8 ) -> Option <$T> { n. $to_ty( ) }
471
471
#[ inline] fn from_u16( n: u16 ) -> Option <$T> { n. $to_ty( ) }
472
472
#[ inline] fn from_u32( n: u32 ) -> Option <$T> { n. $to_ty( ) }
473
473
#[ inline] fn from_u64( n: u64 ) -> Option <$T> { n. $to_ty( ) }
474
- #[ cfg( feature = "i128" ) ]
474
+ #[ cfg( has_i128 ) ]
475
475
#[ inline] fn from_u128( n: u128 ) -> Option <$T> { n. $to_ty( ) }
476
476
477
477
#[ inline] fn from_f32( n: f32 ) -> Option <$T> { n. $to_ty( ) }
@@ -485,14 +485,14 @@ impl_from_primitive!(i8, to_i8);
485
485
impl_from_primitive ! ( i16 , to_i16) ;
486
486
impl_from_primitive ! ( i32 , to_i32) ;
487
487
impl_from_primitive ! ( i64 , to_i64) ;
488
- #[ cfg( feature = "i128" ) ]
488
+ #[ cfg( has_i128 ) ]
489
489
impl_from_primitive ! ( i128 , to_i128) ;
490
490
impl_from_primitive ! ( usize , to_usize) ;
491
491
impl_from_primitive ! ( u8 , to_u8) ;
492
492
impl_from_primitive ! ( u16 , to_u16) ;
493
493
impl_from_primitive ! ( u32 , to_u32) ;
494
494
impl_from_primitive ! ( u64 , to_u64) ;
495
- #[ cfg( feature = "i128" ) ]
495
+ #[ cfg( has_i128 ) ]
496
496
impl_from_primitive ! ( u128 , to_u128) ;
497
497
impl_from_primitive ! ( f32 , to_f32) ;
498
498
impl_from_primitive ! ( f64 , to_f64) ;
@@ -515,15 +515,15 @@ impl<T: ToPrimitive> ToPrimitive for Wrapping<T> {
515
515
fn to_i16 -> i16 ;
516
516
fn to_i32 -> i32 ;
517
517
fn to_i64 -> i64 ;
518
- #[ cfg( feature = "i128" ) ]
518
+ #[ cfg( has_i128 ) ]
519
519
fn to_i128 -> i128 ;
520
520
521
521
fn to_usize -> usize ;
522
522
fn to_u8 -> u8 ;
523
523
fn to_u16 -> u16 ;
524
524
fn to_u32 -> u32 ;
525
525
fn to_u64 -> u64 ;
526
- #[ cfg( feature = "i128" ) ]
526
+ #[ cfg( has_i128 ) ]
527
527
fn to_u128 -> u128 ;
528
528
529
529
fn to_f32 -> f32 ;
@@ -548,15 +548,15 @@ impl<T: FromPrimitive> FromPrimitive for Wrapping<T> {
548
548
fn from_i16( i16 ) ;
549
549
fn from_i32( i32 ) ;
550
550
fn from_i64( i64 ) ;
551
- #[ cfg( feature = "i128" ) ]
551
+ #[ cfg( has_i128 ) ]
552
552
fn from_i128( i128 ) ;
553
553
554
554
fn from_usize( usize ) ;
555
555
fn from_u8( u8 ) ;
556
556
fn from_u16( u16 ) ;
557
557
fn from_u32( u32 ) ;
558
558
fn from_u64( u64 ) ;
559
- #[ cfg( feature = "i128" ) ]
559
+ #[ cfg( has_i128 ) ]
560
560
fn from_u128( u128 ) ;
561
561
562
562
fn from_f32( f32 ) ;
@@ -605,14 +605,14 @@ impl_num_cast!(u8, to_u8);
605
605
impl_num_cast ! ( u16 , to_u16) ;
606
606
impl_num_cast ! ( u32 , to_u32) ;
607
607
impl_num_cast ! ( u64 , to_u64) ;
608
- #[ cfg( feature = "i128" ) ]
608
+ #[ cfg( has_i128 ) ]
609
609
impl_num_cast ! ( u128 , to_u128) ;
610
610
impl_num_cast ! ( usize , to_usize) ;
611
611
impl_num_cast ! ( i8 , to_i8) ;
612
612
impl_num_cast ! ( i16 , to_i16) ;
613
613
impl_num_cast ! ( i32 , to_i32) ;
614
614
impl_num_cast ! ( i64 , to_i64) ;
615
- #[ cfg( feature = "i128" ) ]
615
+ #[ cfg( has_i128 ) ]
616
616
impl_num_cast ! ( i128 , to_i128) ;
617
617
impl_num_cast ! ( isize , to_isize) ;
618
618
impl_num_cast ! ( f32 , to_f32) ;
@@ -680,9 +680,9 @@ macro_rules! impl_as_primitive {
680
680
( $T: ty => { $( $U: ty ) ,* } ) => {
681
681
impl_as_primitive!( @ $T => { $( $U ) ,* } ) ;
682
682
impl_as_primitive!( @ $T => { u8 , u16 , u32 , u64 , usize } ) ;
683
- impl_as_primitive!( @ $T => #[ cfg( feature = "i128" ) ] impl u128 ) ;
683
+ impl_as_primitive!( @ $T => #[ cfg( has_i128 ) ] impl u128 ) ;
684
684
impl_as_primitive!( @ $T => { i8 , i16 , i32 , i64 , isize } ) ;
685
- impl_as_primitive!( @ $T => #[ cfg( feature = "i128" ) ] impl i128 ) ;
685
+ impl_as_primitive!( @ $T => #[ cfg( has_i128 ) ] impl i128 ) ;
686
686
} ;
687
687
}
688
688
@@ -694,9 +694,9 @@ impl_as_primitive!(u32 => { f32, f64 });
694
694
impl_as_primitive ! ( i32 => { f32 , f64 } ) ;
695
695
impl_as_primitive ! ( u64 => { f32 , f64 } ) ;
696
696
impl_as_primitive ! ( i64 => { f32 , f64 } ) ;
697
- #[ cfg( feature = "i128" ) ]
697
+ #[ cfg( has_i128 ) ]
698
698
impl_as_primitive ! ( u128 => { f32 , f64 } ) ;
699
- #[ cfg( feature = "i128" ) ]
699
+ #[ cfg( has_i128 ) ]
700
700
impl_as_primitive ! ( i128 => { f32 , f64 } ) ;
701
701
impl_as_primitive ! ( usize => { f32 , f64 } ) ;
702
702
impl_as_primitive ! ( isize => { f32 , f64 } ) ;
0 commit comments