提交 41fb8f77 编写于 作者: B Brian Anderson

core: Add from_u32 to the Char trait

This is the only free function not part of the trait.
上级 f530aa08
......@@ -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:
......@@ -319,6 +322,9 @@ fn to_digit(&self, radix: uint) -> Option<uint> { to_digit(*self, radix) }
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) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册