@@ -119,16 +119,16 @@ pub fn from_u32(i: u32) -> Option<char> {
119
119
/// ```
120
120
#[ inline]
121
121
#[ unstable( feature = "core" , reason = "pending integer conventions" ) ]
122
- pub fn from_digit ( num : uint , radix : uint ) -> Option < char > {
122
+ pub fn from_digit ( num : u32 , radix : u32 ) -> Option < char > {
123
123
if radix > 36 {
124
124
panic ! ( "from_digit: radix is too high (maximum 36)" ) ;
125
125
}
126
126
if num < radix {
127
127
unsafe {
128
128
if num < 10 {
129
- Some ( transmute ( ( '0' as uint + num) as u32 ) )
129
+ Some ( transmute ( '0' as u32 + num) )
130
130
} else {
131
- Some ( transmute ( ( 'a' as uint + num - 10 ) as u32 ) )
131
+ Some ( transmute ( 'a' as u32 + num - 10 ) )
132
132
}
133
133
}
134
134
} else {
@@ -164,7 +164,7 @@ pub trait CharExt {
164
164
/// ```
165
165
#[ unstable( feature = "core" ,
166
166
reason = "pending integer conventions" ) ]
167
- fn is_digit ( self , radix : uint ) -> bool ;
167
+ fn is_digit ( self , radix : u32 ) -> bool ;
168
168
169
169
/// Converts a character to the corresponding digit.
170
170
///
@@ -189,7 +189,7 @@ pub trait CharExt {
189
189
/// ```
190
190
#[ unstable( feature = "core" ,
191
191
reason = "pending integer conventions" ) ]
192
- fn to_digit ( self , radix : uint ) -> Option < uint > ;
192
+ fn to_digit ( self , radix : u32 ) -> Option < u32 > ;
193
193
194
194
/// Returns an iterator that yields the hexadecimal Unicode escape of a character, as `char`s.
195
195
///
@@ -275,7 +275,7 @@ pub trait CharExt {
275
275
/// assert_eq!(n, 2);
276
276
/// ```
277
277
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
278
- fn len_utf8 ( self ) -> uint ;
278
+ fn len_utf8 ( self ) -> usize ;
279
279
280
280
/// Returns the number of bytes this character would need if encoded in UTF-16.
281
281
///
@@ -287,7 +287,7 @@ pub trait CharExt {
287
287
/// assert_eq!(n, 1);
288
288
/// ```
289
289
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
290
- fn len_utf16 ( self ) -> uint ;
290
+ fn len_utf16 ( self ) -> usize ;
291
291
292
292
/// Encodes this character as UTF-8 into the provided byte buffer, and then returns the number
293
293
/// of bytes written.
@@ -317,7 +317,7 @@ pub trait CharExt {
317
317
/// assert_eq!(result, None);
318
318
/// ```
319
319
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
320
- fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < uint > ;
320
+ fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < usize > ;
321
321
322
322
/// Encodes this character as UTF-16 into the provided `u16` buffer, and then returns the
323
323
/// number of `u16`s written.
@@ -347,27 +347,27 @@ pub trait CharExt {
347
347
/// assert_eq!(result, None);
348
348
/// ```
349
349
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
350
- fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < uint > ;
350
+ fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < usize > ;
351
351
}
352
352
353
353
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
354
354
impl CharExt for char {
355
355
#[ unstable( feature = "core" ,
356
356
reason = "pending integer conventions" ) ]
357
- fn is_digit ( self , radix : uint ) -> bool {
357
+ fn is_digit ( self , radix : u32 ) -> bool {
358
358
self . to_digit ( radix) . is_some ( )
359
359
}
360
360
361
361
#[ unstable( feature = "core" ,
362
362
reason = "pending integer conventions" ) ]
363
- fn to_digit ( self , radix : uint ) -> Option < uint > {
363
+ fn to_digit ( self , radix : u32 ) -> Option < u32 > {
364
364
if radix > 36 {
365
365
panic ! ( "to_digit: radix is too high (maximum 36)" ) ;
366
366
}
367
367
let val = match self {
368
- '0' ... '9' => self as uint - ( '0' as uint ) ,
369
- 'a' ... 'z' => self as uint + 10 - ( 'a' as uint ) ,
370
- 'A' ... 'Z' => self as uint + 10 - ( 'A' as uint ) ,
368
+ '0' ... '9' => self as u32 - '0' as u32 ,
369
+ 'a' ... 'z' => self as u32 - 'a' as u32 + 10 ,
370
+ 'A' ... 'Z' => self as u32 - 'A' as u32 + 10 ,
371
371
_ => return None ,
372
372
} ;
373
373
if val < radix { Some ( val) }
@@ -396,7 +396,7 @@ impl CharExt for char {
396
396
397
397
#[ inline]
398
398
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
399
- fn len_utf8 ( self ) -> uint {
399
+ fn len_utf8 ( self ) -> usize {
400
400
let code = self as u32 ;
401
401
match ( ) {
402
402
_ if code < MAX_ONE_B => 1 ,
@@ -408,22 +408,22 @@ impl CharExt for char {
408
408
409
409
#[ inline]
410
410
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
411
- fn len_utf16 ( self ) -> uint {
411
+ fn len_utf16 ( self ) -> usize {
412
412
let ch = self as u32 ;
413
413
if ( ch & 0xFFFF_u32 ) == ch { 1 } else { 2 }
414
414
}
415
415
416
416
#[ inline]
417
417
#[ unstable( feature = "core" ,
418
418
reason = "pending decision about Iterator/Writer/Reader" ) ]
419
- fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < uint > {
419
+ fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < usize > {
420
420
encode_utf8_raw ( self as u32 , dst)
421
421
}
422
422
423
423
#[ inline]
424
424
#[ unstable( feature = "core" ,
425
425
reason = "pending decision about Iterator/Writer/Reader" ) ]
426
- fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < uint > {
426
+ fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < usize > {
427
427
encode_utf16_raw ( self as u32 , dst)
428
428
}
429
429
}
@@ -435,7 +435,7 @@ impl CharExt for char {
435
435
/// and a `None` will be returned.
436
436
#[ inline]
437
437
#[ unstable( feature = "core" ) ]
438
- pub fn encode_utf8_raw ( code : u32 , dst : & mut [ u8 ] ) -> Option < uint > {
438
+ pub fn encode_utf8_raw ( code : u32 , dst : & mut [ u8 ] ) -> Option < usize > {
439
439
// Marked #[inline] to allow llvm optimizing it away
440
440
if code < MAX_ONE_B && dst. len ( ) >= 1 {
441
441
dst[ 0 ] = code as u8 ;
@@ -467,7 +467,7 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> Option<uint> {
467
467
/// and a `None` will be returned.
468
468
#[ inline]
469
469
#[ unstable( feature = "core" ) ]
470
- pub fn encode_utf16_raw ( mut ch : u32 , dst : & mut [ u16 ] ) -> Option < uint > {
470
+ pub fn encode_utf16_raw ( mut ch : u32 , dst : & mut [ u16 ] ) -> Option < usize > {
471
471
// Marked #[inline] to allow llvm optimizing it away
472
472
if ( ch & 0xFFFF_u32 ) == ch && dst. len ( ) >= 1 {
473
473
// The BMP falls through (assuming non-surrogate, as it should)
@@ -499,7 +499,7 @@ enum EscapeUnicodeState {
499
499
Backslash ,
500
500
Type ,
501
501
LeftBrace ,
502
- Value ( uint ) ,
502
+ Value ( usize ) ,
503
503
RightBrace ,
504
504
Done ,
505
505
}
0 commit comments