Skip to content

Commit

Permalink
core: Add from_u32 to the Char trait
Browse files Browse the repository at this point in the history
This is the only free function not part of the trait.
  • Loading branch information
brson committed Nov 21, 2014
1 parent f530aa0 commit 41fb8f7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libcore/char.rs
Expand Up @@ -270,6 +270,9 @@ pub trait Char {
/// Panics if given a radix > 36.
fn from_digit(num: uint, radix: uint) -> Option<Self>;

/// Converts from `u32` to a `char`
fn from_u32(i: u32) -> Option<char>;

/// Returns the hexadecimal Unicode escape of a character.
///
/// The rules are as follows:
Expand Down Expand Up @@ -319,6 +322,9 @@ impl Char for char {

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

#[inline]
fn from_u32(i: u32) -> Option<char> { from_u32(i) }

fn escape_unicode(&self, f: |char|) { escape_unicode(*self, f) }

fn escape_default(&self, f: |char|) { escape_default(*self, f) }
Expand Down

0 comments on commit 41fb8f7

Please sign in to comment.