File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,8 @@ define_valid_range_type! {
131131 pub struct NonZeroI32Inner ( i32 as u32 in 1 ..=0xffff_ffff ) ;
132132 pub struct NonZeroI64Inner ( i64 as u64 in 1 ..=0xffffffff_ffffffff ) ;
133133 pub struct NonZeroI128Inner ( i128 as u128 in 1 ..=0xffffffffffffffff_ffffffffffffffff ) ;
134+
135+ pub struct NonZeroCharInner ( char as u32 in 1 ..=0x10ffff ) ;
134136}
135137
136138#[ cfg( target_pointer_width = "16" ) ]
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ impl_zeroable_primitive!(
7979 NonZeroI64Inner ( i64 ) ,
8080 NonZeroI128Inner ( i128 ) ,
8181 NonZeroIsizeInner ( isize ) ,
82+ NonZeroCharInner ( char ) ,
8283) ;
8384
8485/// A value that is known not to equal zero.
Original file line number Diff line number Diff line change @@ -22,20 +22,19 @@ mod u64;
2222mod u8;
2323
2424mod bignum;
25-
2625mod const_from;
2726mod dec2flt;
27+ mod float_iter_sum_identity;
2828mod flt2dec;
29+ mod ieee754;
2930mod int_log;
3031mod int_sqrt;
3132mod midpoint;
33+ mod nan;
34+ mod niche_types;
3235mod ops;
3336mod wrapping;
3437
35- mod float_iter_sum_identity;
36- mod ieee754;
37- mod nan;
38-
3938/// Adds the attribute to all items in the block.
4039macro_rules! cfg_block {
4140 ( $( #[ $attr: meta] { $( $it: item) * } ) * ) => { $( $(
Original file line number Diff line number Diff line change 1+ use core:: num:: NonZero ;
2+
3+ #[ test]
4+ fn test_new_from_zero_is_none ( ) {
5+ assert_eq ! ( NonZero :: <char >:: new( 0 as char ) , None ) ;
6+ }
7+
8+ #[ test]
9+ fn test_new_from_extreme_is_some ( ) {
10+ assert ! ( NonZero :: <char >:: new( 1 as char ) . is_some( ) ) ;
11+ assert ! ( NonZero :: <char >:: new( char :: MAX ) . is_some( ) ) ;
12+ }
You can’t perform that action at this time.
0 commit comments