pub struct KeybindingsManager { /* private fields */ }Expand description
Manages a bidirectional mapping between action names and keys.
Actions are human-readable strings like "editor.cursorLeft". The manager
ensures that each key maps to at most one action.
Implementations§
Source§impl KeybindingsManager
impl KeybindingsManager
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a manager pre-populated with default_bindings.
Sourcepub fn set(&mut self, action: &str, key: Key) -> Result<(), KeybindingError>
pub fn set(&mut self, action: &str, key: Key) -> Result<(), KeybindingError>
Bind action to key, replacing any previous binding for that action.
Returns an error if key is already bound to a different action.
Sourcepub fn detect_conflicts(&self) -> Vec<(String, String)>
pub fn detect_conflicts(&self) -> Vec<(String, String)>
Detect any duplicate keys in the binding map.
Returns pairs of (action, other_action) that share the same key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeybindingsManager
impl RefUnwindSafe for KeybindingsManager
impl Send for KeybindingsManager
impl Sync for KeybindingsManager
impl Unpin for KeybindingsManager
impl UnsafeUnpin for KeybindingsManager
impl UnwindSafe for KeybindingsManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more