crossterm_input crate is deprecated and no longer maintained. The GitHub repository will
be archived soon. All the code is being moved to the
crate. You can learn more in
the Merge sub-crates to the crossterm crate
crossterm_input crate provides a functionality to read the input events.
This documentation does not contain a lot of examples. The reason is that it's fairly obvious how to use this crate. Although, we do provide examples repository to demonstrate the capabilities.
Read the input synchronously from the user, the reads performed will be blocking calls. Using synchronous over asynchronous reading has the benefit that it is using fewer resources than the asynchronous because background thread and queues are left away.
SyncReader documentation for more details.
Read the input asynchronously, input events are gathered in the background and queued for you to read. Using asynchronous reading has the benefit that input events are queued until you read them. You can poll for occurred events, and the reads won't block your program.
AsyncReader documentation for more details.
On UNIX systems crossterm reads from the TTY, on Windows, it uses
For asynchronous reading, a background thread will be fired up to read input events,
occurred events will be queued on an MPSC-channel, and the user can iterate over those events.
The terminal has to be in the raw mode, raw mode prevents the input of the user to be displayed
on the terminal screen. See the
crossterm_screen crate documentation to learn more.
An asynchronous input reader (not blocking).
A synchronous input reader (blocking).
A terminal input.
Represents an input event.
Represents a key or a combination of keys.
Represents a mouse button/wheel.
Represents a mouse event.
Creates a new