diff options
Diffstat (limited to 'src/structs.rs')
| -rw-r--r-- | src/structs.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/structs.rs b/src/structs.rs index dd2c0cfe9..060c2b060 100644 --- a/src/structs.rs +++ b/src/structs.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | use crate::events::Event; | ||
| 2 | |||
| 1 | macro_rules! impl_bytes { | 3 | macro_rules! impl_bytes { |
| 2 | ($t:ident) => { | 4 | ($t:ident) => { |
| 3 | impl $t { | 5 | impl $t { |
| @@ -157,3 +159,10 @@ pub struct EventMask { | |||
| 157 | pub events: [u8; 24], | 159 | pub events: [u8; 24], |
| 158 | } | 160 | } |
| 159 | impl_bytes!(EventMask); | 161 | impl_bytes!(EventMask); |
| 162 | |||
| 163 | impl EventMask { | ||
| 164 | pub fn unset(&mut self, evt: Event) { | ||
| 165 | let evt = evt as u8 as usize; | ||
| 166 | self.events[evt / 8] &= !(1 << (evt % 8)); | ||
| 167 | } | ||
| 168 | } | ||
