promptuity/event.rs
1//! A module to read events.
2//!
3//! # Event
4//!
5//! The `event` module provides functionalities used in prompt handlers.
6//! The main offering is the direct re-export of [`crossterm::event`].
7//!
8//! ## Examples
9//!
10//! ```ignore
11//! use promptuity::event::{KeyCode, KeyModifiers};
12//!
13//! impl<W: std::io::Write> Prompt<W> for YourPrompt {
14//! // ...
15//! fn handle(&mut self, code: KeyCode, modifiers: KeyModifiers) -> PromptState {
16//! match (code, modifiers) {
17//! (KeyCode::Enter, KeyModifiers::NONE) => PromptState::Submit,
18//! _ => PromptState::Active,
19//! }
20//! }
21//! // ...
22//! }
23//! ```
24
25/// [`KeyCode`] re-exports from [`crossterm::event`].
26pub use crossterm::event::KeyCode;
27/// [`KeyModifiers`] re-exports from [`crossterm::event`].
28pub use crossterm::event::KeyModifiers;