tty_form/
device.rs

1/// An input device to use for controlling a form.
2pub trait InputDevice {
3    /// Blocks until an input event is received.
4    fn read(&mut self) -> crossterm::Result<crossterm::event::Event>;
5}
6
7/// The standard input device.
8pub struct StdinDevice;
9
10impl InputDevice for StdinDevice {
11    fn read(&mut self) -> crossterm::Result<crossterm::event::Event> {
12        crossterm::event::read()
13    }
14}