From 118a3461a7a6bfa7d4cba711479ba11100186d4c Mon Sep 17 00:00:00 2001 From: Mikayla Date: Sun, 21 Jan 2024 14:33:34 -0800 Subject: [PATCH] Restore erronously removed APIs --- crates/gpui/src/keymap/matcher.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/gpui/src/keymap/matcher.rs b/crates/gpui/src/keymap/matcher.rs index 9f8759b2a9..5bf2107321 100644 --- a/crates/gpui/src/keymap/matcher.rs +++ b/crates/gpui/src/keymap/matcher.rs @@ -96,6 +96,21 @@ pub enum KeyMatch { Some(Vec>), } +impl KeyMatch { + /// Returns true if the match is complete. + pub fn is_some(&self) -> bool { + matches!(self, KeyMatch::Some(_)) + } + + /// Get the matches if the match is complete. + pub fn matches(self) -> Option>> { + match self { + KeyMatch::Some(matches) => Some(matches), + _ => None, + } + } +} + impl PartialEq for KeyMatch { fn eq(&self, other: &Self) -> bool { match (self, other) {