@@ -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 ]
7373pub 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 " ]
9696pub fn from_digit ( num : uint , radix : uint ) -> Option < char > {
9797 if radix > 36 {
9898 panic ! ( "from_digit: radix is too high (maximum 36)" ) ;
@@ -111,8 +111,8 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
111111}
112112
113113/// Basic `char` manipulations.
114- #[ experimental = "trait organization may change" ]
115- pub trait Char {
114+ #[ stable ]
115+ pub trait CharExt {
116116 /// Checks if a `char` parses as a numeric digit in the given radix.
117117 ///
118118 /// Compared to `is_numeric()`, this function only recognizes the characters
@@ -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,44 @@ 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" ]
186- fn encode_utf8 ( & self , dst : & mut [ u8 ] ) -> Option < uint > ;
185+ #[ stable ]
186+ 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" ]
194- fn encode_utf16 ( & self , dst : & mut [ u16 ] ) -> Option < uint > ;
193+ #[ stable ]
194+ 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 {
201- match self . to_digit ( radix) {
202- Some ( _) => true ,
203- None => false ,
204- }
201+ self . to_digit ( radix) . is_some ( )
205202 }
206203
207- #[ unstable = "pending trait organization " ]
204+ #[ unstable = "pending integer conventions " ]
208205 fn to_digit ( self , radix : uint ) -> Option < uint > {
209206 if radix > 36 {
210207 panic ! ( "to_digit: radix is too high (maximum 36)" ) ;
@@ -219,12 +216,12 @@ impl Char for char {
219216 else { None }
220217 }
221218
222- #[ unstable = "pending error conventions, trait organization" ]
219+ #[ stable ]
223220 fn escape_unicode ( self ) -> EscapeUnicode {
224221 EscapeUnicode { c : self , state : EscapeUnicodeState :: Backslash }
225222 }
226223
227- #[ unstable = "pending error conventions, trait organization" ]
224+ #[ stable ]
228225 fn escape_default ( self ) -> EscapeDefault {
229226 let init_state = match self {
230227 '\t' => EscapeDefaultState :: Backslash ( 't' ) ,
@@ -240,7 +237,7 @@ impl Char for char {
240237 }
241238
242239 #[ inline]
243- #[ unstable = "pending trait organization" ]
240+ #[ stable ]
244241 fn len_utf8 ( self ) -> uint {
245242 let code = self as u32 ;
246243 match ( ) {
@@ -252,17 +249,17 @@ impl Char for char {
252249 }
253250
254251 #[ inline]
255- #[ unstable = "pending trait organization" ]
252+ #[ stable ]
256253 fn len_utf16 ( self ) -> uint {
257254 let ch = self as u32 ;
258255 if ( ch & 0xFFFF_u32 ) == ch { 1 } else { 2 }
259256 }
260257
261258 #[ inline]
262- #[ unstable = "pending error conventions, trait organization " ]
263- fn encode_utf8 < ' a > ( & self , dst : & ' a mut [ u8 ] ) -> Option < uint > {
259+ #[ unstable = "pending decision about Iterator/Writer/Reader " ]
260+ fn encode_utf8 ( self , dst : & mut [ u8 ] ) -> Option < uint > {
264261 // Marked #[inline] to allow llvm optimizing it away
265- let code = * self as u32 ;
262+ let code = self as u32 ;
266263 if code < MAX_ONE_B && dst. len ( ) >= 1 {
267264 dst[ 0 ] = code as u8 ;
268265 Some ( 1 )
@@ -287,10 +284,10 @@ impl Char for char {
287284 }
288285
289286 #[ inline]
290- #[ unstable = "pending error conventions, trait organization " ]
291- fn encode_utf16 ( & self , dst : & mut [ u16 ] ) -> Option < uint > {
287+ #[ unstable = "pending decision about Iterator/Writer/Reader " ]
288+ fn encode_utf16 ( self , dst : & mut [ u16 ] ) -> Option < uint > {
292289 // Marked #[inline] to allow llvm optimizing it away
293- let mut ch = * self as u32 ;
290+ let mut ch = self as u32 ;
294291 if ( ch & 0xFFFF_u32 ) == ch && dst. len ( ) >= 1 {
295292 // The BMP falls through (assuming non-surrogate, as it should)
296293 dst[ 0 ] = ch as u16 ;
@@ -310,6 +307,7 @@ impl Char for char {
310307/// An iterator over the characters that represent a `char`, as escaped by
311308/// Rust's unicode escaping rules.
312309#[ derive( Clone ) ]
310+ #[ stable]
313311pub struct EscapeUnicode {
314312 c : char ,
315313 state : EscapeUnicodeState
@@ -325,6 +323,7 @@ enum EscapeUnicodeState {
325323 Done ,
326324}
327325
326+ #[ stable]
328327impl Iterator for EscapeUnicode {
329328 type Item = char ;
330329
@@ -370,6 +369,7 @@ impl Iterator for EscapeUnicode {
370369/// An iterator over the characters that represent a `char`, escaped
371370/// for maximum portability.
372371#[ derive( Clone ) ]
372+ #[ stable]
373373pub struct EscapeDefault {
374374 state : EscapeDefaultState
375375}
@@ -382,6 +382,7 @@ enum EscapeDefaultState {
382382 Unicode ( EscapeUnicode ) ,
383383}
384384
385+ #[ stable]
385386impl Iterator for EscapeDefault {
386387 type Item = char ;
387388
0 commit comments