Public declaration syntax from harness-sdk/src/keymap/binding.rs Original source SHA-256: 79d49bee63f1a186d7ea0ac618d4d78270597479a6cf2b820b482ef2b6dbb7ab Function bodies and constant values are omitted. This is not the complete implementation. Source line 13 #[derive(Debug, Error, PartialEq, Eq)] pub enum KeySpecError { /// The spec is empty or whitespace-only. #[error("empty key spec")] Empty, /// A modifier token was not one of `ctrl`, `alt`, `shift`, `meta`. #[error("unknown modifier: {0}")] UnknownModifier(String), /// The terminal token did not name a key we know. #[error("unknown key: {0}")] UnknownKey(String), /// The chord referenced more than the supported two segments. #[error("chord too long: {0}")] ChordTooLong(String), } Source line 36 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct KeyBinding { /// Optional first half of a chord (`Ctrl+X` in `Ctrl+X Ctrl+E`). /// `None` for non-chord bindings. pub prefix: Option, /// The terminal half (always set). pub terminal: KeyChordHalf } Source line 46 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct KeyChordHalf { /// The key code. pub code: KeyCode, /// Modifier mask. pub modifiers: KeyModifiers } Source line 56 #[must_use] pub fn single(code: KeyCode, modifiers: KeyModifiers) -> Self; Source line 65 #[must_use] pub fn chord(prefix: KeyChordHalf, terminal: KeyChordHalf) -> Self; Source line 74 #[must_use] pub fn is_chord(&self) -> bool; Source line 83 #[must_use] pub fn matches_event(&self, ev: &KeyEvent) -> bool; Source line 90 #[must_use] pub fn matches_prefix(&self, ev: &KeyEvent) -> bool; Source line 99 pub fn parse_key_spec(spec: &str) -> Result; Source line 114 pub fn parse_key_spec_chord(spec: &str) -> Result;