pub trait EventSource: Send + 'static {
// Required method
fn next_event(&mut self) -> Option<AppEvent>;
}Expand description
Source of raw terminal events consumed by EventReader.
Implement this trait to provide a custom event source (e.g. a mock for testing or a replay driver).
§Examples
use zeph_tui::event::{AppEvent, EventSource};
use crossterm::event::KeyEvent;
struct OneTickSource;
impl EventSource for OneTickSource {
fn next_event(&mut self) -> Option<AppEvent> {
None // signal EOF
}
}Required Methods§
Sourcefn next_event(&mut self) -> Option<AppEvent>
fn next_event(&mut self) -> Option<AppEvent>
Return the next event, or None to signal that the source is exhausted
and the event loop should terminate.