str_utils/
is_ascii_uppercased.rs

1/// To extend `[u8]` and `str` to have `is_ascii_uppercased` method.
2pub trait IsAsciiUppercased {
3    /// Returns `true` if all characters in the string are not lowercase according to Unicode.
4    fn is_ascii_uppercased(&self) -> bool;
5}
6
7impl IsAsciiUppercased for [u8] {
8    #[inline]
9    fn is_ascii_uppercased(&self) -> bool {
10        self.iter().all(|c| !c.is_ascii_lowercase())
11    }
12}
13
14impl IsAsciiUppercased for str {
15    #[inline]
16    fn is_ascii_uppercased(&self) -> bool {
17        self.as_bytes().is_ascii_uppercased()
18    }
19}