1 2 3 4 5 6 7 8 9 10 11 12 13
pub trait MaskExt { fn all(&self) -> bool; fn any(&self) -> bool; } impl<const N: usize> MaskExt for [bool; N] { fn all(&self) -> bool { self.iter().all(|&b| b) } fn any(&self) -> bool { self.iter().any(|&b| b) } }