@@ -17,7 +17,7 @@ use mem;
17
17
use ops:: Range ;
18
18
use iter:: FusedIterator ;
19
19
20
- /// Extension methods for ASCII-subset only operations on string slices .
20
+ /// Extension methods for ASCII-subset only operations.
21
21
///
22
22
/// Be aware that operations on seemingly non-ASCII characters can sometimes
23
23
/// have unexpected results. Consider this example:
@@ -54,19 +54,21 @@ pub trait AsciiExt {
54
54
///
55
55
/// let ascii = 'a';
56
56
/// let utf8 = '❤';
57
+ /// let int_ascii = 97;
57
58
///
58
59
/// assert!(ascii.is_ascii());
59
60
/// assert!(!utf8.is_ascii());
61
+ /// assert!(int_ascii.is_ascii());
60
62
/// ```
61
63
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
62
64
fn is_ascii ( & self ) -> bool ;
63
65
64
- /// Makes a copy of the string in ASCII upper case.
66
+ /// Makes a copy of the value in its ASCII upper case equivalent .
65
67
///
66
68
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
67
69
/// but non-ASCII letters are unchanged.
68
70
///
69
- /// To uppercase the string in-place, use [`make_ascii_uppercase`].
71
+ /// To uppercase the value in-place, use [`make_ascii_uppercase`].
70
72
///
71
73
/// To uppercase ASCII characters in addition to non-ASCII characters, use
72
74
/// [`str::to_uppercase`].
@@ -78,22 +80,24 @@ pub trait AsciiExt {
78
80
///
79
81
/// let ascii = 'a';
80
82
/// let utf8 = '❤';
83
+ /// let int_ascii = 97;
81
84
///
82
85
/// assert_eq!('A', ascii.to_ascii_uppercase());
83
86
/// assert_eq!('❤', utf8.to_ascii_uppercase());
87
+ /// assert_eq!(65, int_ascii.to_ascii_uppercase());
84
88
/// ```
85
89
///
86
90
/// [`make_ascii_uppercase`]: #tymethod.make_ascii_uppercase
87
91
/// [`str::to_uppercase`]: ../primitive.str.html#method.to_uppercase
88
92
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
89
93
fn to_ascii_uppercase ( & self ) -> Self :: Owned ;
90
94
91
- /// Makes a copy of the string in ASCII lower case.
95
+ /// Makes a copy of the value in its ASCII lower case equivalent .
92
96
///
93
97
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
94
98
/// but non-ASCII letters are unchanged.
95
99
///
96
- /// To lowercase the string in-place, use [`make_ascii_lowercase`].
100
+ /// To lowercase the value in-place, use [`make_ascii_lowercase`].
97
101
///
98
102
/// To lowercase ASCII characters in addition to non-ASCII characters, use
99
103
/// [`str::to_lowercase`].
@@ -105,20 +109,22 @@ pub trait AsciiExt {
105
109
///
106
110
/// let ascii = 'A';
107
111
/// let utf8 = '❤';
112
+ /// let int_ascii = 65;
108
113
///
109
114
/// assert_eq!('a', ascii.to_ascii_lowercase());
110
115
/// assert_eq!('❤', utf8.to_ascii_lowercase());
116
+ /// assert_eq!(97, int_ascii.to_ascii_lowercase());
111
117
/// ```
112
118
///
113
119
/// [`make_ascii_lowercase`]: #tymethod.make_ascii_lowercase
114
120
/// [`str::to_lowercase`]: ../primitive.str.html#method.to_lowercase
115
121
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
116
122
fn to_ascii_lowercase ( & self ) -> Self :: Owned ;
117
123
118
- /// Checks that two strings are an ASCII case-insensitive match.
124
+ /// Checks that two values are an ASCII case-insensitive match.
119
125
///
120
126
/// Same as `to_ascii_lowercase(a) == to_ascii_lowercase(b)`,
121
- /// but without allocating and copying temporary strings .
127
+ /// but without allocating and copying temporaries .
122
128
///
123
129
/// # Examples
124
130
///
@@ -142,7 +148,7 @@ pub trait AsciiExt {
142
148
/// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
143
149
/// but non-ASCII letters are unchanged.
144
150
///
145
- /// To return a new uppercased string without modifying the existing one, use
151
+ /// To return a new uppercased value without modifying the existing one, use
146
152
/// [`to_ascii_uppercase`].
147
153
///
148
154
/// # Examples
@@ -166,7 +172,7 @@ pub trait AsciiExt {
166
172
/// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
167
173
/// but non-ASCII letters are unchanged.
168
174
///
169
- /// To return a new lowercased string without modifying the existing one, use
175
+ /// To return a new lowercased value without modifying the existing one, use
170
176
/// [`to_ascii_lowercase`].
171
177
///
172
178
/// # Examples
0 commit comments