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