Skip to content

Commit a78f9e9

Browse files
committed
core: Deprecated remaining free functions in char
Prefer the methods.
1 parent 8067a8c commit a78f9e9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libcore/char.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ pub fn from_u32(i: u32) -> Option<char> {
9898
/// This just wraps `to_digit()`.
9999
///
100100
#[inline]
101+
#[deprecated = "use the Char::is_digit method"]
101102
pub fn is_digit_radix(c: char, radix: uint) -> bool {
102103
match to_digit(c, radix) {
103104
Some(_) => true,
@@ -120,6 +121,7 @@ pub fn is_digit_radix(c: char, radix: uint) -> bool {
120121
/// Fails if given a `radix` outside the range `[0..36]`.
121122
///
122123
#[inline]
124+
#[deprecated = "use the Char::to_digit method"]
123125
pub fn to_digit(c: char, radix: uint) -> Option<uint> {
124126
if radix > 36 {
125127
panic!("to_digit: radix is too high (maximum 36)");
@@ -174,6 +176,7 @@ pub fn from_digit(num: uint, radix: uint) -> Option<char> {
174176
/// - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
175177
/// - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
176178
///
179+
#[deprecated = "use the Char::escape_unicode method"]
177180
pub fn escape_unicode(c: char, f: |char|) {
178181
// avoid calling str::to_str_radix because we don't really need to allocate
179182
// here.
@@ -206,6 +209,7 @@ pub fn escape_unicode(c: char, f: |char|) {
206209
/// - Any other chars in the range [0x20,0x7e] are not escaped.
207210
/// - Any other chars are given hex Unicode escapes; see `escape_unicode`.
208211
///
212+
#[deprecated = "use the Char::escape_default method"]
209213
pub fn escape_default(c: char, f: |char|) {
210214
match c {
211215
'\t' => { f('\\'); f('t'); }
@@ -221,6 +225,7 @@ pub fn escape_default(c: char, f: |char|) {
221225

222226
/// Returns the amount of bytes this `char` would need if encoded in UTF-8
223227
#[inline]
228+
#[deprecated = "use the Char::len_utf8 method"]
224229
pub fn len_utf8_bytes(c: char) -> uint {
225230
let code = c as u32;
226231
match () {

0 commit comments

Comments
 (0)