Skip to main content

KeyReader

Trait KeyReader 

Source
pub trait KeyReader {
    // Required method
    fn read_key(&mut self, timeout: Duration) -> Option<Key>;
}
Expand description

Abstraction over the terminal so prompts can be driven by mock input.

Implementors return the next normalized Key, or None when timeout elapses without a key press (or at end of a mocked input queue).

Required Methods§

Source

fn read_key(&mut self, timeout: Duration) -> Option<Key>

Blocks up to timeout, returning the next key or None on timeout.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§