pub trait Cased {
fn is_upper(&self) -> bool;
fn is_lower(&self) -> bool;
}
impl Cased for str {
fn is_upper(&self) -> bool {
self.chars().all(char::is_uppercase)
}
fn is_lower(&self) -> bool {
self.chars().all(char::is_lowercase)
}
}
impl Cased for char {
fn is_upper(&self) -> bool {
self.is_uppercase()
}
fn is_lower(&self) -> bool {
self.is_lowercase()
}
}
impl Cased for String {
fn is_upper(&self) -> bool {
self.chars().all(char::is_uppercase)
}
fn is_lower(&self) -> bool {
self.chars().all(char::is_lowercase)
}
}
impl<'a> Cased for &'a str {
fn is_upper(&self) -> bool {
self.chars().all(char::is_uppercase)
}
fn is_lower(&self) -> bool {
self.chars().all(char::is_lowercase)
}
}