MCPcopy Create free account
hub / github.com/emberian/evdev / next

Method next

src/sync_stream.rs:590–613  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

588impl Iterator for FetchEventsSynced<'_> {
589 type Item = InputEvent;
590 fn next(&mut self) -> Option<InputEvent> {
591 // first: check if we need to emit compensatory events due to a SYN_DROPPED we found in the
592 // last batch of blocks
593 if let Some(ev) = compensate_events(&mut self.sync, self.dev) {
594 self.dev.prev_state.process_event(ev);
595 return Some(ev);
596 }
597 let state = &mut self.dev.state;
598 let (res, consumed_to) = sync_events(&mut self.range, &self.dev.raw.event_buf, |ev| {
599 state.process_event(ev)
600 });
601 if let Some(end) = consumed_to {
602 self.consumed_to = end
603 }
604 match res {
605 Ok(ev) => Some(InputEvent::from(ev)),
606 Err(requires_sync) => {
607 if requires_sync {
608 self.dev.block_dropped = true;
609 }
610 None
611 }
612 }
613 }
614}
615
616impl Drop for FetchEventsSynced<'_> {

Callers 1

sync_eventsFunction · 0.45

Calls 3

compensate_eventsFunction · 0.85
sync_eventsFunction · 0.85
process_eventMethod · 0.80

Tested by

no test coverage detected