Skip to content

Commit f65fbe9

Browse files
committed
Add char::MIN
1 parent b321edd commit f65fbe9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

library/core/src/char/methods.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ use crate::unicode::{self, conversions};
99
use super::*;
1010

1111
impl char {
12+
/// The lowest valid code point a `char` can have, `'\0'`.
13+
///
14+
/// # Examples
15+
///
16+
/// ```
17+
/// # fn something_which_returns_char() -> char { 'a' }
18+
/// let c: char = something_which_returns_char();
19+
/// assert!(char::MIN <= c);
20+
///
21+
/// let value_at_min = char::MIN as u32;
22+
/// assert_eq!(char::from_u32(value_at_min), Some('\0'));
23+
/// ```
24+
#[unstable(feature = "char_min", issue = "114298")]
25+
pub const MIN: char = '\0';
26+
1227
/// The highest valid code point a `char` can have, `'\u{10FFFF}'`.
1328
///
1429
/// # Examples

0 commit comments

Comments
 (0)