(&mut self, event: InputEvent)
| 159 | |
| 160 | impl InputRingBuffer { |
| 161 | pub fn new(capacity: usize) -> Self { |
| 162 | Self { |
| 163 | events: VecDeque::with_capacity(capacity), |
| 164 | capacity, |
| 165 | dropped_events: 0, |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | pub fn push(&mut self, event: InputEvent) { |
| 170 | if self.capacity == 0 { |
| 171 | self.dropped_events = self.dropped_events.saturating_add(1); |
| 172 | return; |
| 173 | } |
| 174 | if self.events.len() == self.capacity { |