MCPcopy Create free account
hub / github.com/algoscienceacademy/RustUI / poll

Function poll

src/event.rs:5–14  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3use crossterm::event::{self as term_event, Event as TermEvent, KeyEvent};
4
5pub fn poll() -> Option<Event> {
6 static mut EVENT_RECEIVER: Option<Receiver<Event>> = None;
7
8 if let Ok(true) = term_event::poll(std::time::Duration::from_millis(100)) {
9 if let Ok(TermEvent::Key(key)) = term_event::read() {
10 return Some(Event::from_key_event(key));
11 }
12 }
13 None
14}
15
16#[derive(Clone, Debug)]
17pub enum Event {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected