use std::sync::Arc; use anyhow::Result; use tuikit::error::TuikitError; use tuikit::event::Event; use tuikit::term::Term; /// Simple struct to read the events. pub struct EventReader { pub term: Arc, } impl EventReader { /// Creates a new instance with an Arc to a terminal. pub fn new(term: Arc) -> Self { Self { term } } /// Returns the events as they're received. Wait indefinitely for a new one. /// We should spend most of the application life here, doing nothing :) pub fn poll_event(&self) -> Result { self.term.poll_event() } }