Skip to main content

EventSource

Trait EventSource 

Source
pub trait EventSource {
    // Required methods
    fn wait_for_event(&mut self) -> impl Future<Output = ()>;
    fn try_read_event(&mut self) -> Result<Option<Event>>;
}
Expand description

Input half of a terminal: an async source of crossterm Events.

Required Methods§

Source

fn wait_for_event(&mut self) -> impl Future<Output = ()>

Wait until an event might be available from try_read_event, or until an implementation-defined animation tick elapses.

Must be cancel-safe: dropping the returned future must not lose events.

Source

fn try_read_event(&mut self) -> Result<Option<Event>>

Non-blocking read of the next pending event, if any.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§