1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! What a key press types: [`Keyboard::wait_for_inputs`] returns these.
//!
//! [`Keyboard::wait_for_inputs`]: crate::Keyboard::wait_for_inputs
/// What a key press types, with Shift and Fn applied.
///
/// Fn takes precedence: Fn + Shift + `;` is [`Arrow::Up`]. A key with
/// nothing on its Fn layer types as it would without Fn.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[non_exhaustive]
pub enum KeyInput {
/// A printable character (Shift gives the upper one on the key).
Char(char),
/// Enter.
Enter,
/// Backspace.
Backspace,
/// Delete: Fn + Backspace.
Delete,
/// Tab.
Tab,
/// Escape: Fn + `` ` ``.
Escape,
/// An arrow: Fn + `;` (up), `,` (left), `.` (down) or `/` (right).
Arrow(Arrow),
/// A modifier on its own: pressing Shift, say, before the key it shifts.
Modifier(Modifier),
}
/// The arrow keys' directions.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[expect(missing_docs, reason = "the directions are their names")]
#[non_exhaustive]
pub enum Arrow {
Up,
Down,
Left,
Right,
}
/// The modifier keys.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[expect(missing_docs, reason = "the keys are their labels")]
#[non_exhaustive]
pub enum Modifier {
Shift,
Fn,
Ctrl,
Opt,
Alt,
}