doc: make char::from_u32 example more brief
This commit is contained in:
parent
1671b9baec
commit
667a246442
1 changed files with 2 additions and 11 deletions
|
|
@ -74,17 +74,8 @@ pub const MAX: char = '\u{10ffff}';
|
|||
/// ```
|
||||
/// use std::char;
|
||||
///
|
||||
/// let c = char::from_u32(10084); // produces `Some(❤)`
|
||||
/// assert_eq!(c, Some('❤'));
|
||||
/// ```
|
||||
///
|
||||
/// An invalid character:
|
||||
///
|
||||
/// ```
|
||||
/// use std::char;
|
||||
///
|
||||
/// let none = char::from_u32(1114112);
|
||||
/// assert_eq!(none, None);
|
||||
/// assert_eq!(char::from_u32(0x2764), Some('❤'));
|
||||
/// assert_eq!(char::from_u32(0x110000), None); // invalid character
|
||||
/// ```
|
||||
#[inline]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue