Expand description
The chord grammar, shared by str::parse at run time and the chord! macro at compile time.
A chord is terms joined by +, with optional whitespace around each: any number of
modifiers, then exactly one key.
- Modifiers:
Shift,CtrlorControl,AltorOption,Meta,Super,LogoorCommand, andControlOrMeta. - A named key such as
Enter,ArrowLeftorF5, orKey(Shift)for a key whose name is also a modifier. - A physical key,
Code(KeyK). - A single letter or digit, such as
Kor1, meaning that character. - A quoted character such as
"é", with Rust’s escapes (\",\\,\n,\u{..}). Plusfor the+key.
Errors carry a byte range into the input, so a macro can point at the offending token.
Structs§
- Chord
Error - A chord or keystroke that does not parse, with the byte range of the offending input.
Enums§
- Chord
Error Kind - The ways a chord can fail to parse.
Constants§
- MODIFIER_
NAMES - Every modifier name the grammar accepts, aliases included.
Functions§
- bare_
key_ names - The named keys that can be written bare, which is every one whose name is not also a
modifier. The rest are written
Key(..). - modifier_
named - The modifier with this name, aliases included.
- parse_
chord - Parses a chord such as
Control+Shift+K. - parse_
keystroke - Parses one key with no modifiers, such as
K,EnterorKey(Shift).