Skip to content

Commit acb5fef

Browse files
committed
core: Rename Char::is_digit_radix to is_digit
This fits the naming of `to_digit` and `from_digit`. Leave the old name deprecated.
1 parent c2aff69 commit acb5fef

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/libcore/char.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,24 @@ pub trait Char {
245245
/// # Panics
246246
///
247247
/// Panics if given a radix > 36.
248+
#[deprecated = "use is_digit"]
248249
fn is_digit_radix(&self, radix: uint) -> bool;
249250

251+
/// Checks if a `char` parses as a numeric digit in the given radix.
252+
///
253+
/// Compared to `is_digit()`, this function only recognizes the characters
254+
/// `0-9`, `a-z` and `A-Z`.
255+
///
256+
/// # Return value
257+
///
258+
/// Returns `true` if `c` is a valid digit under `radix`, and `false`
259+
/// otherwise.
260+
///
261+
/// # Failure
262+
///
263+
/// Fails if given a radix > 36.
264+
fn is_digit(&self, radix: uint) -> bool;
265+
250266
/// Converts a character to the corresponding digit.
251267
///
252268
/// # Return value
@@ -319,8 +335,11 @@ pub trait Char {
319335

320336
#[experimental = "trait is experimental"]
321337
impl Char for char {
338+
#[deprecated = "use is_digit"]
322339
fn is_digit_radix(&self, radix: uint) -> bool { is_digit_radix(*self, radix) }
323340

341+
fn is_digit(&self, radix: uint) -> bool { is_digit_radix(*self, radix) }
342+
324343
fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) }
325344

326345
fn from_digit(num: uint, radix: uint) -> Option<char> { from_digit(num, radix) }

0 commit comments

Comments
 (0)