@@ -69,7 +69,7 @@ pub const MAX: char = '\u{10ffff}';
69
69
70
70
/// Converts from `u32` to a `char`
71
71
#[ inline]
72
- #[ unstable = "pending decisions about costructors for primitives" ]
72
+ #[ stable ]
73
73
pub fn from_u32 ( i : u32 ) -> Option < char > {
74
74
// catch out-of-bounds and surrogates
75
75
if ( i > MAX as u32 ) || ( i >= 0xD800 && i <= 0xDFFF ) {
@@ -92,7 +92,7 @@ pub fn from_u32(i: u32) -> Option<char> {
92
92
/// Panics if given an `radix` > 36.
93
93
///
94
94
#[ inline]
95
- #[ unstable = "pending decisions about costructors for primitives " ]
95
+ #[ unstable = "pending integer conventions " ]
96
96
pub fn from_digit ( num : uint , radix : uint ) -> Option < char > {
97
97
if radix > 36 {
98
98
panic ! ( "from_digit: radix is too high (maximum 36)" ) ;
@@ -111,7 +111,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
111
111
}
112
112
113
113
/// Basic `char` manipulations.
114
- #[ experimental = "trait organization may change" ]
114
+ #[ stable ]
115
115
pub trait Char {
116
116
/// Checks if a `char` parses as a numeric digit in the given radix.
117
117
///
@@ -126,7 +126,7 @@ pub trait Char {
126
126
/// # Panics
127
127
///
128
128
/// Panics if given a radix > 36.
129
- #[ unstable = "pending error conventions" ]
129
+ #[ unstable = "pending integer conventions" ]
130
130
fn is_digit ( self , radix : uint ) -> bool ;
131
131
132
132
/// Converts a character to the corresponding digit.
@@ -140,7 +140,7 @@ pub trait Char {
140
140
/// # Panics
141
141
///
142
142
/// Panics if given a radix outside the range [0..36].
143
- #[ unstable = "pending error conventions, trait organization " ]
143
+ #[ unstable = "pending integer conventions" ]
144
144
fn to_digit ( self , radix : uint ) -> Option < uint > ;
145
145
146
146
/// Returns an iterator that yields the hexadecimal Unicode escape
@@ -149,7 +149,7 @@ pub trait Char {
149
149
/// All characters are escaped with Rust syntax of the form `\\u{NNNN}`
150
150
/// where `NNNN` is the shortest hexadecimal representation of the code
151
151
/// point.
152
- #[ unstable = "pending error conventions, trait organization" ]
152
+ #[ stable ]
153
153
fn escape_unicode ( self ) -> EscapeUnicode ;
154
154
155
155
/// Returns an iterator that yields the 'default' ASCII and
@@ -164,47 +164,47 @@ pub trait Char {
164
164
/// escaped.
165
165
/// * Any other chars in the range [0x20,0x7e] are not escaped.
166
166
/// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
167
- #[ unstable = "pending error conventions, trait organization" ]
167
+ #[ stable ]
168
168
fn escape_default ( self ) -> EscapeDefault ;
169
169
170
170
/// Returns the amount of bytes this character would need if encoded in
171
171
/// UTF-8.
172
- #[ unstable = "pending trait organization" ]
172
+ #[ stable ]
173
173
fn len_utf8 ( self ) -> uint ;
174
174
175
175
/// Returns the amount of bytes this character would need if encoded in
176
176
/// UTF-16.
177
- #[ unstable = "pending trait organization" ]
177
+ #[ stable ]
178
178
fn len_utf16 ( self ) -> uint ;
179
179
180
180
/// Encodes this character as UTF-8 into the provided byte buffer,
181
181
/// and then returns the number of bytes written.
182
182
///
183
183
/// If the buffer is not large enough, nothing will be written into it
184
184
/// and a `None` will be returned.
185
- #[ unstable = "pending trait organization" ]
185
+ #[ stable ]
186
186
fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < uint > ;
187
187
188
188
/// Encodes this character as UTF-16 into the provided `u16` buffer,
189
189
/// and then returns the number of `u16`s written.
190
190
///
191
191
/// If the buffer is not large enough, nothing will be written into it
192
192
/// and a `None` will be returned.
193
- #[ unstable = "pending trait organization" ]
193
+ #[ stable ]
194
194
fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < uint > ;
195
195
}
196
196
197
- #[ experimental = "trait is experimental" ]
198
- impl Char for char {
199
- #[ unstable = "pending trait organization " ]
197
+ #[ stable ]
198
+ impl CharExt for char {
199
+ #[ unstable = "pending integer conventions " ]
200
200
fn is_digit ( self , radix : uint ) -> bool {
201
201
match self . to_digit ( radix) {
202
202
Some ( _) => true ,
203
203
None => false ,
204
204
}
205
205
}
206
206
207
- #[ unstable = "pending trait organization " ]
207
+ #[ unstable = "pending integer conventions " ]
208
208
fn to_digit ( self , radix : uint ) -> Option < uint > {
209
209
if radix > 36 {
210
210
panic ! ( "to_digit: radix is too high (maximum 36)" ) ;
@@ -219,12 +219,12 @@ impl Char for char {
219
219
else { None }
220
220
}
221
221
222
- #[ unstable = "pending error conventions, trait organization" ]
222
+ #[ stable ]
223
223
fn escape_unicode ( self ) -> EscapeUnicode {
224
224
EscapeUnicode { c : self , state : EscapeUnicodeState :: Backslash }
225
225
}
226
226
227
- #[ unstable = "pending error conventions, trait organization" ]
227
+ #[ stable ]
228
228
fn escape_default ( self ) -> EscapeDefault {
229
229
let init_state = match self {
230
230
'\t' => EscapeDefaultState :: Backslash ( 't' ) ,
@@ -240,7 +240,7 @@ impl Char for char {
240
240
}
241
241
242
242
#[ inline]
243
- #[ unstable = "pending trait organization" ]
243
+ #[ stable ]
244
244
fn len_utf8 ( self ) -> uint {
245
245
let code = self as u32 ;
246
246
match ( ) {
@@ -252,14 +252,14 @@ impl Char for char {
252
252
}
253
253
254
254
#[ inline]
255
- #[ unstable = "pending trait organization" ]
255
+ #[ stable ]
256
256
fn len_utf16 ( self ) -> uint {
257
257
let ch = self as u32 ;
258
258
if ( ch & 0xFFFF_u32 ) == ch { 1 } else { 2 }
259
259
}
260
260
261
261
#[ inline]
262
- #[ unstable = "pending error conventions, trait organization " ]
262
+ #[ unstable = "pending decision about Iterator/Writer/Reader " ]
263
263
fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < uint > {
264
264
// Marked #[inline] to allow llvm optimizing it away
265
265
let code = self as u32 ;
@@ -287,7 +287,7 @@ impl Char for char {
287
287
}
288
288
289
289
#[ inline]
290
- #[ unstable = "pending error conventions, trait organization " ]
290
+ #[ unstable = "pending decision about Iterator/Writer/Reader " ]
291
291
fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < uint > {
292
292
// Marked #[inline] to allow llvm optimizing it away
293
293
let mut ch = self as u32 ;
@@ -310,6 +310,7 @@ impl Char for char {
310
310
/// An iterator over the characters that represent a `char`, as escaped by
311
311
/// Rust's unicode escaping rules.
312
312
#[ derive( Clone ) ]
313
+ #[ stable]
313
314
pub struct EscapeUnicode {
314
315
c : char ,
315
316
state : EscapeUnicodeState
@@ -325,6 +326,7 @@ enum EscapeUnicodeState {
325
326
Done ,
326
327
}
327
328
329
+ #[ stable]
328
330
impl Iterator for EscapeUnicode {
329
331
type Item = char ;
330
332
@@ -370,6 +372,7 @@ impl Iterator for EscapeUnicode {
370
372
/// An iterator over the characters that represent a `char`, escaped
371
373
/// for maximum portability.
372
374
#[ derive( Clone ) ]
375
+ #[ stable]
373
376
pub struct EscapeDefault {
374
377
state : EscapeDefaultState
375
378
}
@@ -382,6 +385,7 @@ enum EscapeDefaultState {
382
385
Unicode ( EscapeUnicode ) ,
383
386
}
384
387
388
+ #[ stable]
385
389
impl Iterator for EscapeDefault {
386
390
type Item = char ;
387
391
0 commit comments