@@ -19,7 +19,7 @@ use core::option::Option;
19
19
use tables:: { derived_property, property, general_category, conversions, charwidth} ;
20
20
21
21
/// Functionality for manipulating `char`.
22
- #[ experimental = "pending prelude organization" ]
22
+ #[ stable ]
23
23
pub trait CharExt {
24
24
/// Checks if a `char` parses as a numeric digit in the given radix.
25
25
///
@@ -103,6 +103,7 @@ pub trait CharExt {
103
103
104
104
/// Returns whether the specified character is considered a Unicode
105
105
/// alphabetic code point.
106
+ #[ stable]
106
107
fn is_alphabetic ( self ) -> bool ;
107
108
108
109
/// Returns whether the specified character satisfies the 'XID_Start'
@@ -111,6 +112,7 @@ pub trait CharExt {
111
112
/// 'XID_Start' is a Unicode Derived Property specified in
112
113
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
113
114
/// mostly similar to ID_Start but modified for closure under NFKx.
115
+ #[ experimental = "mainly needed for compiler internals" ]
114
116
fn is_xid_start ( self ) -> bool ;
115
117
116
118
/// Returns whether the specified `char` satisfies the 'XID_Continue'
@@ -119,38 +121,45 @@ pub trait CharExt {
119
121
/// 'XID_Continue' is a Unicode Derived Property specified in
120
122
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
121
123
/// mostly similar to 'ID_Continue' but modified for closure under NFKx.
124
+ #[ experimental = "mainly needed for compiler internals" ]
122
125
fn is_xid_continue ( self ) -> bool ;
123
126
124
127
/// Indicates whether a character is in lowercase.
125
128
///
126
129
/// This is defined according to the terms of the Unicode Derived Core
127
130
/// Property `Lowercase`.
131
+ #[ stable]
128
132
fn is_lowercase ( self ) -> bool ;
129
133
130
134
/// Indicates whether a character is in uppercase.
131
135
///
132
136
/// This is defined according to the terms of the Unicode Derived Core
133
137
/// Property `Uppercase`.
138
+ #[ stable]
134
139
fn is_uppercase ( self ) -> bool ;
135
140
136
141
/// Indicates whether a character is whitespace.
137
142
///
138
143
/// Whitespace is defined in terms of the Unicode Property `White_Space`.
144
+ #[ stable]
139
145
fn is_whitespace ( self ) -> bool ;
140
146
141
147
/// Indicates whether a character is alphanumeric.
142
148
///
143
149
/// Alphanumericness is defined in terms of the Unicode General Categories
144
150
/// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'.
151
+ #[ stable]
145
152
fn is_alphanumeric ( self ) -> bool ;
146
153
147
154
/// Indicates whether a character is a control code point.
148
155
///
149
156
/// Control code points are defined in terms of the Unicode General
150
157
/// Category `Cc`.
158
+ #[ stable]
151
159
fn is_control ( self ) -> bool ;
152
160
153
161
/// Indicates whether the character is numeric (Nd, Nl, or No).
162
+ #[ stable]
154
163
fn is_numeric ( self ) -> bool ;
155
164
156
165
/// Converts a character to its lowercase equivalent.
@@ -162,6 +171,7 @@ pub trait CharExt {
162
171
///
163
172
/// Returns the lowercase equivalent of the character, or the character
164
173
/// itself if no conversion is possible.
174
+ #[ experimental = "pending case transformation decisions" ]
165
175
fn to_lowercase ( self ) -> char ;
166
176
167
177
/// Converts a character to its uppercase equivalent.
@@ -184,6 +194,7 @@ pub trait CharExt {
184
194
/// [`SpecialCasing`.txt`]: ftp://ftp.unicode.org/Public/UNIDATA/SpecialCasing.txt
185
195
///
186
196
/// [2]: http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf#G33992
197
+ #[ experimental = "pending case transformation decisions" ]
187
198
fn to_uppercase ( self ) -> char ;
188
199
189
200
/// Returns this character's displayed width in columns, or `None` if it is a
@@ -199,7 +210,7 @@ pub trait CharExt {
199
210
fn width ( self , is_cjk : bool ) -> Option < uint > ;
200
211
}
201
212
202
- #[ experimental = "pending prelude organization" ]
213
+ #[ stable ]
203
214
impl CharExt for char {
204
215
#[ unstable = "pending integer conventions" ]
205
216
fn is_digit ( self , radix : uint ) -> bool { C :: is_digit ( self , radix) }
@@ -218,6 +229,7 @@ impl CharExt for char {
218
229
#[ unstable = "pending decision about Iterator/Writer/Reader" ]
219
230
fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < uint > { C :: encode_utf16 ( self , dst) }
220
231
232
+ #[ stable]
221
233
fn is_alphabetic ( self ) -> bool {
222
234
match self {
223
235
'a' ... 'z' | 'A' ... 'Z' => true ,
@@ -226,10 +238,13 @@ impl CharExt for char {
226
238
}
227
239
}
228
240
241
+ #[ experimental = "mainly needed for compiler internals" ]
229
242
fn is_xid_start ( self ) -> bool { derived_property:: XID_Start ( self ) }
230
243
244
+ #[ experimental = "mainly needed for compiler internals" ]
231
245
fn is_xid_continue ( self ) -> bool { derived_property:: XID_Continue ( self ) }
232
246
247
+ #[ stable]
233
248
fn is_lowercase ( self ) -> bool {
234
249
match self {
235
250
'a' ... 'z' => true ,
@@ -238,6 +253,7 @@ impl CharExt for char {
238
253
}
239
254
}
240
255
256
+ #[ stable]
241
257
fn is_uppercase ( self ) -> bool {
242
258
match self {
243
259
'A' ... 'Z' => true ,
@@ -246,6 +262,7 @@ impl CharExt for char {
246
262
}
247
263
}
248
264
265
+ #[ stable]
249
266
fn is_whitespace ( self ) -> bool {
250
267
match self {
251
268
' ' | '\x09' ... '\x0d' => true ,
@@ -254,12 +271,15 @@ impl CharExt for char {
254
271
}
255
272
}
256
273
274
+ #[ stable]
257
275
fn is_alphanumeric ( self ) -> bool {
258
276
self . is_alphabetic ( ) || self . is_numeric ( )
259
277
}
260
278
279
+ #[ stable]
261
280
fn is_control ( self ) -> bool { general_category:: Cc ( self ) }
262
281
282
+ #[ stable]
263
283
fn is_numeric ( self ) -> bool {
264
284
match self {
265
285
'0' ... '9' => true ,
@@ -268,8 +288,10 @@ impl CharExt for char {
268
288
}
269
289
}
270
290
291
+ #[ experimental = "pending case transformation decisions" ]
271
292
fn to_lowercase ( self ) -> char { conversions:: to_lower ( self ) }
272
293
294
+ #[ experimental = "pending case transformation decisions" ]
273
295
fn to_uppercase ( self ) -> char { conversions:: to_upper ( self ) }
274
296
275
297
#[ experimental = "needs expert opinion. is_cjk flag stands out as ugly" ]
0 commit comments