@@ -35,25 +35,13 @@ impl Ascii {
35
35
self . chr
36
36
}
37
37
38
- /// Deprecated: use `as_byte` isntead.
39
- #[ deprecated = "use as_byte" ]
40
- pub fn to_byte ( self ) -> u8 {
41
- self . as_byte ( )
42
- }
43
-
44
38
/// Converts an ascii character into a `char`.
45
39
#[ inline]
46
40
#[ unstable = "recently renamed" ]
47
41
pub fn as_char ( & self ) -> char {
48
42
self . chr as char
49
43
}
50
44
51
- /// Deprecated: use `as_char` isntead.
52
- #[ deprecated = "use as_char" ]
53
- pub fn to_char ( self ) -> char {
54
- self . as_char ( )
55
- }
56
-
57
45
/// Convert to lowercase.
58
46
#[ inline]
59
47
#[ stable]
@@ -68,13 +56,6 @@ impl Ascii {
68
56
Ascii { chr : self . chr . to_ascii_uppercase ( ) }
69
57
}
70
58
71
- /// Compares two ascii characters of equality, ignoring case.
72
- #[ inline]
73
- #[ deprecated = "normalize with to_lowercase" ]
74
- pub fn eq_ignore_case ( self , other : Ascii ) -> bool {
75
- self . chr . eq_ignore_ascii_case ( & other. chr )
76
- }
77
-
78
59
// the following methods are like ctype, and the implementation is inspired by musl
79
60
80
61
/// Check if the character is a letter (a-z, A-Z)
@@ -281,26 +262,6 @@ impl OwnedAsciiCast<[u8]> for Vec<u8> {
281
262
pub trait AsciiStr for Sized ? {
282
263
/// Convert to a string.
283
264
fn as_str_ascii < ' a > ( & ' a self ) -> & ' a str ;
284
-
285
- /// Deprecated: use `to_lowercase`
286
- #[ deprecated="renamed `to_lowercase`" ]
287
- fn to_lower ( & self ) -> Vec < Ascii > ;
288
-
289
- /// Convert to vector representing a lower cased ascii string.
290
- #[ deprecated = "use iterators instead" ]
291
- fn to_lowercase ( & self ) -> Vec < Ascii > ;
292
-
293
- /// Deprecated: use `to_uppercase`
294
- #[ deprecated="renamed `to_uppercase`" ]
295
- fn to_upper ( & self ) -> Vec < Ascii > ;
296
-
297
- /// Convert to vector representing a upper cased ascii string.
298
- #[ deprecated = "use iterators instead" ]
299
- fn to_uppercase ( & self ) -> Vec < Ascii > ;
300
-
301
- /// Compares two Ascii strings ignoring case.
302
- #[ deprecated = "use iterators instead" ]
303
- fn eq_ignore_case ( & self , other : & [ Ascii ] ) -> bool ;
304
265
}
305
266
306
267
#[ experimental = "may be replaced by generic conversion traits" ]
@@ -309,31 +270,6 @@ impl AsciiStr for [Ascii] {
309
270
fn as_str_ascii < ' a > ( & ' a self ) -> & ' a str {
310
271
unsafe { mem:: transmute ( self ) }
311
272
}
312
-
313
- #[ inline]
314
- fn to_lower ( & self ) -> Vec < Ascii > {
315
- self . to_lowercase ( )
316
- }
317
-
318
- #[ inline]
319
- fn to_lowercase ( & self ) -> Vec < Ascii > {
320
- self . iter ( ) . map ( |a| a. to_lowercase ( ) ) . collect ( )
321
- }
322
-
323
- #[ inline]
324
- fn to_upper ( & self ) -> Vec < Ascii > {
325
- self . to_uppercase ( )
326
- }
327
-
328
- #[ inline]
329
- fn to_uppercase ( & self ) -> Vec < Ascii > {
330
- self . iter ( ) . map ( |a| a. to_uppercase ( ) ) . collect ( )
331
- }
332
-
333
- #[ inline]
334
- fn eq_ignore_case ( & self , other : & [ Ascii ] ) -> bool {
335
- self . iter ( ) . zip ( other. iter ( ) ) . all ( |( & a, & b) | a. eq_ignore_case ( b) )
336
- }
337
273
}
338
274
339
275
impl IntoString for Vec < Ascii > {
@@ -383,20 +319,10 @@ mod tests {
383
319
384
320
#[ test]
385
321
fn test_ascii ( ) {
386
- assert_eq ! ( 65u8 . to_ascii( ) . to_byte( ) , 65u8 ) ;
387
- assert_eq ! ( 65u8 . to_ascii( ) . to_char( ) , 'A' ) ;
388
- assert_eq ! ( 'A' . to_ascii( ) . to_char( ) , 'A' ) ;
389
- assert_eq ! ( 'A' . to_ascii( ) . to_byte( ) , 65u8 ) ;
390
-
391
- assert_eq ! ( 'A' . to_ascii( ) . to_lowercase( ) . to_char( ) , 'a' ) ;
392
- assert_eq ! ( 'Z' . to_ascii( ) . to_lowercase( ) . to_char( ) , 'z' ) ;
393
- assert_eq ! ( 'a' . to_ascii( ) . to_uppercase( ) . to_char( ) , 'A' ) ;
394
- assert_eq ! ( 'z' . to_ascii( ) . to_uppercase( ) . to_char( ) , 'Z' ) ;
395
-
396
- assert_eq ! ( '@' . to_ascii( ) . to_lowercase( ) . to_char( ) , '@' ) ;
397
- assert_eq ! ( '[' . to_ascii( ) . to_lowercase( ) . to_char( ) , '[' ) ;
398
- assert_eq ! ( '`' . to_ascii( ) . to_uppercase( ) . to_char( ) , '`' ) ;
399
- assert_eq ! ( '{' . to_ascii( ) . to_uppercase( ) . to_char( ) , '{' ) ;
322
+ assert_eq ! ( 65u8 . to_ascii( ) . as_byte( ) , 65u8 ) ;
323
+ assert_eq ! ( 65u8 . to_ascii( ) . as_char( ) , 'A' ) ;
324
+ assert_eq ! ( 'A' . to_ascii( ) . as_char( ) , 'A' ) ;
325
+ assert_eq ! ( 'A' . to_ascii( ) . as_byte( ) , 65u8 ) ;
400
326
401
327
assert ! ( '0' . to_ascii( ) . is_digit( ) ) ;
402
328
assert ! ( '9' . to_ascii( ) . is_digit( ) ) ;
@@ -417,24 +343,6 @@ mod tests {
417
343
let v = vec ! [ 40u8 , 32u8 , 59u8 ] ;
418
344
assert_eq ! ( v. as_slice( ) . to_ascii( ) , b) ;
419
345
assert_eq ! ( "( ;" . to_string( ) . as_slice( ) . to_ascii( ) , b) ;
420
-
421
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_lowercase( ) . into_string( ) , "abcdef&?#" . to_string( ) ) ;
422
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_uppercase( ) . into_string( ) , "ABCDEF&?#" . to_string( ) ) ;
423
-
424
- assert_eq ! ( "" . to_ascii( ) . to_lowercase( ) . into_string( ) , "" . to_string( ) ) ;
425
- assert_eq ! ( "YMCA" . to_ascii( ) . to_lowercase( ) . into_string( ) , "ymca" . to_string( ) ) ;
426
- let mixed = "abcDEFxyz:.;" . to_ascii ( ) ;
427
- assert_eq ! ( mixed. to_uppercase( ) . into_string( ) , "ABCDEFXYZ:.;" . to_string( ) ) ;
428
- }
429
-
430
- #[ test]
431
- fn test_ascii_vec_ng ( ) {
432
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_lowercase( ) . into_string( ) , "abcdef&?#" . to_string( ) ) ;
433
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_uppercase( ) . into_string( ) , "ABCDEF&?#" . to_string( ) ) ;
434
- assert_eq ! ( "" . to_ascii( ) . to_lowercase( ) . into_string( ) , "" . to_string( ) ) ;
435
- assert_eq ! ( "YMCA" . to_ascii( ) . to_lowercase( ) . into_string( ) , "ymca" . to_string( ) ) ;
436
- let mixed = "abcDEFxyz:.;" . to_ascii ( ) ;
437
- assert_eq ! ( mixed. to_uppercase( ) . into_string( ) , "ABCDEFXYZ:.;" . to_string( ) ) ;
438
346
}
439
347
440
348
#[ test]
0 commit comments