Skip to content

Commit 01417f2

Browse files
committed
Mark the contents of char stable.
1 parent 8018293 commit 01417f2

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

src/libcore/char.rs

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub const MAX: char = '\u{10ffff}';
6969

7070
/// Converts from `u32` to a `char`
7171
#[inline]
72-
#[unstable = "pending decisions about costructors for primitives"]
72+
#[stable]
7373
pub fn from_u32(i: u32) -> Option<char> {
7474
// catch out-of-bounds and surrogates
7575
if (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF) {
@@ -92,7 +92,7 @@ pub fn from_u32(i: u32) -> Option<char> {
9292
/// Panics if given an `radix` > 36.
9393
///
9494
#[inline]
95-
#[unstable = "pending decisions about costructors for primitives"]
95+
#[unstable = "pending integer conventions"]
9696
pub fn from_digit(num: uint, radix: uint) -> Option<char> {
9797
if radix > 36 {
9898
panic!("from_digit: radix is too high (maximum 36)");
@@ -111,7 +111,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
111111
}
112112

113113
/// Basic `char` manipulations.
114-
#[experimental = "trait organization may change"]
114+
#[stable]
115115
pub trait Char {
116116
/// Checks if a `char` parses as a numeric digit in the given radix.
117117
///
@@ -126,7 +126,7 @@ pub trait Char {
126126
/// # Panics
127127
///
128128
/// Panics if given a radix > 36.
129-
#[unstable = "pending error conventions"]
129+
#[unstable = "pending integer conventions"]
130130
fn is_digit(self, radix: uint) -> bool;
131131

132132
/// Converts a character to the corresponding digit.
@@ -140,7 +140,7 @@ pub trait Char {
140140
/// # Panics
141141
///
142142
/// Panics if given a radix outside the range [0..36].
143-
#[unstable = "pending error conventions, trait organization"]
143+
#[unstable = "pending integer conventions"]
144144
fn to_digit(self, radix: uint) -> Option<uint>;
145145

146146
/// Returns an iterator that yields the hexadecimal Unicode escape
@@ -149,7 +149,7 @@ pub trait Char {
149149
/// All characters are escaped with Rust syntax of the form `\\u{NNNN}`
150150
/// where `NNNN` is the shortest hexadecimal representation of the code
151151
/// point.
152-
#[unstable = "pending error conventions, trait organization"]
152+
#[stable]
153153
fn escape_unicode(self) -> EscapeUnicode;
154154

155155
/// Returns an iterator that yields the 'default' ASCII and
@@ -164,47 +164,47 @@ pub trait Char {
164164
/// escaped.
165165
/// * Any other chars in the range [0x20,0x7e] are not escaped.
166166
/// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
167-
#[unstable = "pending error conventions, trait organization"]
167+
#[stable]
168168
fn escape_default(self) -> EscapeDefault;
169169

170170
/// Returns the amount of bytes this character would need if encoded in
171171
/// UTF-8.
172-
#[unstable = "pending trait organization"]
172+
#[stable]
173173
fn len_utf8(self) -> uint;
174174

175175
/// Returns the amount of bytes this character would need if encoded in
176176
/// UTF-16.
177-
#[unstable = "pending trait organization"]
177+
#[stable]
178178
fn len_utf16(self) -> uint;
179179

180180
/// Encodes this character as UTF-8 into the provided byte buffer,
181181
/// and then returns the number of bytes written.
182182
///
183183
/// If the buffer is not large enough, nothing will be written into it
184184
/// and a `None` will be returned.
185-
#[unstable = "pending trait organization"]
185+
#[stable]
186186
fn encode_utf8(self, dst: &mut [u8]) -> Option<uint>;
187187

188188
/// Encodes this character as UTF-16 into the provided `u16` buffer,
189189
/// and then returns the number of `u16`s written.
190190
///
191191
/// If the buffer is not large enough, nothing will be written into it
192192
/// and a `None` will be returned.
193-
#[unstable = "pending trait organization"]
193+
#[stable]
194194
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint>;
195195
}
196196

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"]
200200
fn is_digit(self, radix: uint) -> bool {
201201
match self.to_digit(radix) {
202202
Some(_) => true,
203203
None => false,
204204
}
205205
}
206206

207-
#[unstable = "pending trait organization"]
207+
#[unstable = "pending integer conventions"]
208208
fn to_digit(self, radix: uint) -> Option<uint> {
209209
if radix > 36 {
210210
panic!("to_digit: radix is too high (maximum 36)");
@@ -219,12 +219,12 @@ impl Char for char {
219219
else { None }
220220
}
221221

222-
#[unstable = "pending error conventions, trait organization"]
222+
#[stable]
223223
fn escape_unicode(self) -> EscapeUnicode {
224224
EscapeUnicode { c: self, state: EscapeUnicodeState::Backslash }
225225
}
226226

227-
#[unstable = "pending error conventions, trait organization"]
227+
#[stable]
228228
fn escape_default(self) -> EscapeDefault {
229229
let init_state = match self {
230230
'\t' => EscapeDefaultState::Backslash('t'),
@@ -240,7 +240,7 @@ impl Char for char {
240240
}
241241

242242
#[inline]
243-
#[unstable = "pending trait organization"]
243+
#[stable]
244244
fn len_utf8(self) -> uint {
245245
let code = self as u32;
246246
match () {
@@ -252,14 +252,14 @@ impl Char for char {
252252
}
253253

254254
#[inline]
255-
#[unstable = "pending trait organization"]
255+
#[stable]
256256
fn len_utf16(self) -> uint {
257257
let ch = self as u32;
258258
if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
259259
}
260260

261261
#[inline]
262-
#[unstable = "pending error conventions, trait organization"]
262+
#[unstable = "pending decision about Iterator/Writer/Reader"]
263263
fn encode_utf8(self, dst: &mut [u8]) -> Option<uint> {
264264
// Marked #[inline] to allow llvm optimizing it away
265265
let code = self as u32;
@@ -287,7 +287,7 @@ impl Char for char {
287287
}
288288

289289
#[inline]
290-
#[unstable = "pending error conventions, trait organization"]
290+
#[unstable = "pending decision about Iterator/Writer/Reader"]
291291
fn encode_utf16(self, dst: &mut [u16]) -> Option<uint> {
292292
// Marked #[inline] to allow llvm optimizing it away
293293
let mut ch = self as u32;
@@ -310,6 +310,7 @@ impl Char for char {
310310
/// An iterator over the characters that represent a `char`, as escaped by
311311
/// Rust's unicode escaping rules.
312312
#[derive(Clone)]
313+
#[stable]
313314
pub struct EscapeUnicode {
314315
c: char,
315316
state: EscapeUnicodeState
@@ -325,6 +326,7 @@ enum EscapeUnicodeState {
325326
Done,
326327
}
327328

329+
#[stable]
328330
impl Iterator for EscapeUnicode {
329331
type Item = char;
330332

@@ -370,6 +372,7 @@ impl Iterator for EscapeUnicode {
370372
/// An iterator over the characters that represent a `char`, escaped
371373
/// for maximum portability.
372374
#[derive(Clone)]
375+
#[stable]
373376
pub struct EscapeDefault {
374377
state: EscapeDefaultState
375378
}
@@ -382,6 +385,7 @@ enum EscapeDefaultState {
382385
Unicode(EscapeUnicode),
383386
}
384387

388+
#[stable]
385389
impl Iterator for EscapeDefault {
386390
type Item = char;
387391

0 commit comments

Comments
 (0)