Skip to content

Commit

Permalink
Add char::MIN
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Jul 31, 2023
1 parent b321edd commit f65fbe9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions library/core/src/char/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ use crate::unicode::{self, conversions};
use super::*;

impl char {
/// The lowest valid code point a `char` can have, `'\0'`.
///
/// # Examples
///
/// ```
/// # fn something_which_returns_char() -> char { 'a' }
/// let c: char = something_which_returns_char();
/// assert!(char::MIN <= c);
///
/// let value_at_min = char::MIN as u32;
/// assert_eq!(char::from_u32(value_at_min), Some('\0'));
/// ```
#[unstable(feature = "char_min", issue = "114298")]
pub const MIN: char = '\0';

/// The highest valid code point a `char` can have, `'\u{10FFFF}'`.
///
/// # Examples
Expand Down

0 comments on commit f65fbe9

Please sign in to comment.