Function std::char::from_u32Stable [-] [+] [src]

pub fn from_u32(i: u32) -> Option<char>

Converts a u32 to an Option<char>.

Examples

fn main() { use std::char; let c = char::from_u32(10084); // produces `Some(❤)` assert_eq!(c, Some('❤')); }
use std::char;

let c = char::from_u32(10084); // produces `Some(❤)`
assert_eq!(c, Some('❤'));

An invalid character:

fn main() { use std::char; let none = char::from_u32(1114112); assert_eq!(none, None); }
use std::char;

let none = char::from_u32(1114112);
assert_eq!(none, None);