Skip to content

Commit f635aa8

Browse files
committed
core: Mark remaining Char methods unstable
The `Char` trait itself may go away in favor of primitive inherent methods. Still some questions about whether the preconditions are following the final error handling conventions.
1 parent a78f9e9 commit f635aa8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/libcore/char.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ pub trait Char {
268268
/// # Failure
269269
///
270270
/// Fails if given a radix > 36.
271+
#[unstable = "pending error conventions"]
271272
fn is_digit(&self, radix: uint) -> bool;
272273

273274
/// Converts a character to the corresponding digit.
@@ -281,6 +282,7 @@ pub trait Char {
281282
/// # Failure
282283
///
283284
/// Fails if given a radix outside the range [0..36].
285+
#[unstable = "pending error conventions, trait organization"]
284286
fn to_digit(&self, radix: uint) -> Option<uint>;
285287

286288
/// Converts a number to the character representing it.
@@ -307,6 +309,7 @@ pub trait Char {
307309
/// * Characters in [0,0xff] get 2-digit escapes: `\\xNN`
308310
/// * Characters in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`.
309311
/// * Characters above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`.
312+
#[unstable = "pending error conventions, trait organization"]
310313
fn escape_unicode(&self, f: |char|);
311314

312315
/// Returns a 'default' ASCII and C++11-like literal escape of a
@@ -321,6 +324,7 @@ pub trait Char {
321324
/// escaped.
322325
/// * Any other chars in the range [0x20,0x7e] are not escaped.
323326
/// * Any other chars are given hex Unicode escapes; see `escape_unicode`.
327+
#[unstable = "pending error conventions, trait organization"]
324328
fn escape_default(&self, f: |char|);
325329

326330
/// Returns the amount of bytes this character would need if encoded in
@@ -330,24 +334,28 @@ pub trait Char {
330334

331335
/// Returns the amount of bytes this character would need if encoded in
332336
/// UTF-8.
337+
#[unstable = "pending trait organization"]
333338
fn len_utf8(&self) -> uint;
334339

335340
/// Returns the amount of bytes this character would need if encoded in
336341
/// UTF-16.
342+
#[unstable = "pending trait organization"]
337343
fn len_utf16(&self) -> uint;
338344

339345
/// Encodes this character as UTF-8 into the provided byte buffer,
340346
/// and then returns the number of bytes written.
341347
///
342348
/// If the buffer is not large enough, nothing will be written into it
343349
/// and a `None` will be returned.
350+
#[unstable = "pending trait organization"]
344351
fn encode_utf8(&self, dst: &mut [u8]) -> Option<uint>;
345352

346353
/// Encodes this character as UTF-16 into the provided `u16` buffer,
347354
/// and then returns the number of `u16`s written.
348355
///
349356
/// If the buffer is not large enough, nothing will be written into it
350357
/// and a `None` will be returned.
358+
#[unstable = "pending trait organization"]
351359
fn encode_utf16(&self, dst: &mut [u16]) -> Option<uint>;
352360
}
353361

@@ -356,8 +364,10 @@ impl Char for char {
356364
#[deprecated = "use is_digit"]
357365
fn is_digit_radix(&self, radix: uint) -> bool { is_digit_radix(*self, radix) }
358366

367+
#[unstable = "pending trait organization"]
359368
fn is_digit(&self, radix: uint) -> bool { is_digit_radix(*self, radix) }
360369

370+
#[unstable = "pending trait organization"]
361371
fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) }
362372

363373
#[deprecated = "use the char::from_digit free function"]
@@ -367,24 +377,29 @@ impl Char for char {
367377
#[deprecated = "use the char::from_u32 free function"]
368378
fn from_u32(i: u32) -> Option<char> { from_u32(i) }
369379

380+
#[unstable = "pending error conventions, trait organization"]
370381
fn escape_unicode(&self, f: |char|) { escape_unicode(*self, f) }
371382

383+
#[unstable = "pending error conventions, trait organization"]
372384
fn escape_default(&self, f: |char|) { escape_default(*self, f) }
373385

374386
#[inline]
375387
#[deprecated = "use len_utf8"]
376388
fn len_utf8_bytes(&self) -> uint { len_utf8_bytes(*self) }
377389

378390
#[inline]
391+
#[unstable = "pending trait organization"]
379392
fn len_utf8(&self) -> uint { len_utf8_bytes(*self) }
380393

381394
#[inline]
395+
#[unstable = "pending trait organization"]
382396
fn len_utf16(&self) -> uint {
383397
let ch = *self as u32;
384398
if (ch & 0xFFFF_u32) == ch { 1 } else { 2 }
385399
}
386400

387401
#[inline]
402+
#[unstable = "pending error conventions, trait organization"]
388403
fn encode_utf8<'a>(&self, dst: &'a mut [u8]) -> Option<uint> {
389404
// Marked #[inline] to allow llvm optimizing it away
390405
let code = *self as u32;
@@ -412,6 +427,7 @@ impl Char for char {
412427
}
413428

414429
#[inline]
430+
#[unstable = "pending error conventions, trait organization"]
415431
fn encode_utf16(&self, dst: &mut [u16]) -> Option<uint> {
416432
// Marked #[inline] to allow llvm optimizing it away
417433
let mut ch = *self as u32;

0 commit comments

Comments
 (0)