Skip to main content

EventSource

Trait EventSource 

Source
pub trait EventSource {
    // Required method
    fn poll_event(&mut self, timeout: Duration) -> Result<Option<Event>>;
}
Expand description

Abstracts “give me the next input event, or None if the poll timeout elapses” (i.e. crossterm::event::poll + event::read), so a UI’s main loop can be driven by canned events in tests instead of blocking on a real terminal.

Required Methods§

Source

fn poll_event(&mut self, timeout: Duration) -> Result<Option<Event>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§