We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
is_ascii
const
1 parent 370d31b commit 1cfcf71Copy full SHA for 1cfcf71
library/core/src/array/ascii.rs
@@ -4,6 +4,19 @@ use crate::ascii;
4
impl<const N: usize> [u8; N] {
5
/// Converts this array of bytes into a array of ASCII characters,
6
/// or returns `None` if any of the characters is non-ASCII.
7
+ ///
8
+ /// # Examples
9
10
+ /// ```
11
+ /// #![feature(ascii_char)]
12
+ /// #![feature(const_option)]
13
14
+ /// const HEX_DIGITS: [std::ascii::Char; 16] =
15
+ /// *b"0123456789abcdef".as_ascii().unwrap();
16
17
+ /// assert_eq!(HEX_DIGITS[1].as_str(), "1");
18
+ /// assert_eq!(HEX_DIGITS[10].as_str(), "a");
19
20
#[unstable(feature = "ascii_char", issue = "110998")]
21
#[must_use]
22
#[inline]
0 commit comments