@@ -62,8 +62,8 @@ impl Ascii {
62
62
Ascii { chr : ASCII_LOWER_MAP [ self . chr as uint ] }
63
63
}
64
64
65
+ /// Deprecated: use `to_uppercase`
65
66
#[ inline]
66
- #[ allow( missing_doc) ]
67
67
#[ deprecated="renamed to `to_uppercase`" ]
68
68
pub fn to_upper ( self ) -> Ascii {
69
69
self . to_uppercase ( )
@@ -139,8 +139,8 @@ impl Ascii {
139
139
( self . chr - 0x20 ) < 0x5F
140
140
}
141
141
142
+ /// Deprecated: use `to_lowercase`
142
143
#[ inline]
143
- #[ allow( missing_doc) ]
144
144
#[ deprecated="renamed to `is_lowercase`" ]
145
145
pub fn is_lower ( & self ) -> bool {
146
146
self . is_lowercase ( )
@@ -319,12 +319,20 @@ pub trait AsciiStr {
319
319
/// Convert to a string.
320
320
fn as_str_ascii < ' a > ( & ' a self ) -> & ' a str ;
321
321
322
- /// Convert to vector representing a lower cased ascii string.
322
+ /// Deprecated: use `to_lowercase`
323
+ #[ deprecated="renamed `to_lowercase`" ]
323
324
fn to_lower ( & self ) -> Vec < Ascii > ;
324
325
325
- /// Convert to vector representing a upper cased ascii string.
326
+ /// Convert to vector representing a lower cased ascii string.
327
+ fn to_lowercase ( & self ) -> Vec < Ascii > ;
328
+
329
+ /// Deprecated: use `to_uppercase`
330
+ #[ deprecated="renamed `to_uppercase`" ]
326
331
fn to_upper ( & self ) -> Vec < Ascii > ;
327
332
333
+ /// Convert to vector representing a upper cased ascii string.
334
+ fn to_uppercase ( & self ) -> Vec < Ascii > ;
335
+
328
336
/// Compares two Ascii strings ignoring case.
329
337
fn eq_ignore_case ( self , other : & [ Ascii ] ) -> bool ;
330
338
}
@@ -337,11 +345,21 @@ impl<'a> AsciiStr for &'a [Ascii] {
337
345
338
346
#[ inline]
339
347
fn to_lower ( & self ) -> Vec < Ascii > {
348
+ self . to_lowercase ( )
349
+ }
350
+
351
+ #[ inline]
352
+ fn to_lowercase ( & self ) -> Vec < Ascii > {
340
353
self . iter ( ) . map ( |a| a. to_lowercase ( ) ) . collect ( )
341
354
}
342
355
343
356
#[ inline]
344
357
fn to_upper ( & self ) -> Vec < Ascii > {
358
+ self . to_uppercase ( )
359
+ }
360
+
361
+ #[ inline]
362
+ fn to_uppercase ( & self ) -> Vec < Ascii > {
345
363
self . iter ( ) . map ( |a| a. to_uppercase ( ) ) . collect ( )
346
364
}
347
365
@@ -615,12 +633,13 @@ mod tests {
615
633
assert_eq ! ( v. as_slice( ) . to_ascii( ) , b) ;
616
634
assert_eq ! ( "( ;" . to_string( ) . as_slice( ) . to_ascii( ) , b) ;
617
635
618
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_lower ( ) . into_string( ) , "abcdef&?#" . to_string( ) ) ;
619
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_upper ( ) . into_string( ) , "ABCDEF&?#" . to_string( ) ) ;
636
+ assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_lowercase ( ) . into_string( ) , "abcdef&?#" . to_string( ) ) ;
637
+ assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_uppercase ( ) . into_string( ) , "ABCDEF&?#" . to_string( ) ) ;
620
638
621
- assert_eq ! ( "" . to_ascii( ) . to_lower( ) . into_string( ) , "" . to_string( ) ) ;
622
- assert_eq ! ( "YMCA" . to_ascii( ) . to_lower( ) . into_string( ) , "ymca" . to_string( ) ) ;
623
- assert_eq ! ( "abcDEFxyz:.;" . to_ascii( ) . to_upper( ) . into_string( ) , "ABCDEFXYZ:.;" . to_string( ) ) ;
639
+ assert_eq ! ( "" . to_ascii( ) . to_lowercase( ) . into_string( ) , "" . to_string( ) ) ;
640
+ assert_eq ! ( "YMCA" . to_ascii( ) . to_lowercase( ) . into_string( ) , "ymca" . to_string( ) ) ;
641
+ let mixed = "abcDEFxyz:.;" . to_ascii ( ) ;
642
+ assert_eq ! ( mixed. to_uppercase( ) . into_string( ) , "ABCDEFXYZ:.;" . to_string( ) ) ;
624
643
625
644
assert ! ( "aBcDeF&?#" . to_ascii( ) . eq_ignore_case( "AbCdEf&?#" . to_ascii( ) ) ) ;
626
645
@@ -632,11 +651,12 @@ mod tests {
632
651
633
652
#[ test]
634
653
fn test_ascii_vec_ng ( ) {
635
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_lower( ) . into_string( ) , "abcdef&?#" . to_string( ) ) ;
636
- assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_upper( ) . into_string( ) , "ABCDEF&?#" . to_string( ) ) ;
637
- assert_eq ! ( "" . to_ascii( ) . to_lower( ) . into_string( ) , "" . to_string( ) ) ;
638
- assert_eq ! ( "YMCA" . to_ascii( ) . to_lower( ) . into_string( ) , "ymca" . to_string( ) ) ;
639
- assert_eq ! ( "abcDEFxyz:.;" . to_ascii( ) . to_upper( ) . into_string( ) , "ABCDEFXYZ:.;" . to_string( ) ) ;
654
+ assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_lowercase( ) . into_string( ) , "abcdef&?#" . to_string( ) ) ;
655
+ assert_eq ! ( "abCDef&?#" . to_ascii( ) . to_uppercase( ) . into_string( ) , "ABCDEF&?#" . to_string( ) ) ;
656
+ assert_eq ! ( "" . to_ascii( ) . to_lowercase( ) . into_string( ) , "" . to_string( ) ) ;
657
+ assert_eq ! ( "YMCA" . to_ascii( ) . to_lowercase( ) . into_string( ) , "ymca" . to_string( ) ) ;
658
+ let mixed = "abcDEFxyz:.;" . to_ascii ( ) ;
659
+ assert_eq ! ( mixed. to_uppercase( ) . into_string( ) , "ABCDEFXYZ:.;" . to_string( ) ) ;
640
660
}
641
661
642
662
#[ test]
0 commit comments