pub struct KeybindEngine { /* private fields */ }Expand description
Main keybind engine combining registry and profile management
Implementations§
Source§impl KeybindEngine
impl KeybindEngine
Sourcepub fn load_defaults_from_file(
&mut self,
path: impl AsRef<Path>,
) -> Result<(), EngineError>
pub fn load_defaults_from_file( &mut self, path: impl AsRef<Path>, ) -> Result<(), EngineError>
Load default keybinds from a JSON file
Sourcepub fn apply_defaults(&mut self) -> Result<(), EngineError>
pub fn apply_defaults(&mut self) -> Result<(), EngineError>
Apply default keybinds and create default profile if needed
Sourcepub fn reset_to_defaults(&mut self) -> Result<(), EngineError>
pub fn reset_to_defaults(&mut self) -> Result<(), EngineError>
Reset keybinds to defaults
Sourcepub fn get_defaults(&self) -> &[Keybind]
pub fn get_defaults(&self) -> &[Keybind]
Get the default keybinds
Sourcepub fn set_defaults(&mut self, keybinds: Vec<Keybind>)
pub fn set_defaults(&mut self, keybinds: Vec<Keybind>)
Set the default keybinds (for testing purposes)
Sourcepub fn apply_keybinds(
&mut self,
keybinds: Vec<Keybind>,
) -> Result<(), EngineError>
pub fn apply_keybinds( &mut self, keybinds: Vec<Keybind>, ) -> Result<(), EngineError>
Apply keybinds to the engine
Sourcepub fn get_action(&self, key: &KeyCombo) -> Option<&str>
pub fn get_action(&self, key: &KeyCombo) -> Option<&str>
Get action for a key combination
Sourcepub fn get_keybind(&self, action_id: &str) -> Option<&Keybind>
pub fn get_keybind(&self, action_id: &str) -> Option<&Keybind>
Get keybind for an action
Sourcepub fn all_keybinds(&self) -> Vec<&Keybind>
pub fn all_keybinds(&self) -> Vec<&Keybind>
Get all keybinds
Sourcepub fn keybinds_by_category(&self, category: &str) -> Vec<&Keybind>
pub fn keybinds_by_category(&self, category: &str) -> Vec<&Keybind>
Get keybinds by category
Sourcepub fn categories(&self) -> Vec<String>
pub fn categories(&self) -> Vec<String>
Get all categories
Sourcepub fn create_profile(
&mut self,
name: impl Into<String>,
keybinds: Vec<Keybind>,
) -> Result<(), EngineError>
pub fn create_profile( &mut self, name: impl Into<String>, keybinds: Vec<Keybind>, ) -> Result<(), EngineError>
Create a new profile
Sourcepub fn select_profile(&mut self, name: &str) -> Result<(), EngineError>
pub fn select_profile(&mut self, name: &str) -> Result<(), EngineError>
Select a profile and apply its keybinds immediately
Sourcepub fn delete_profile(&mut self, name: &str) -> Result<(), EngineError>
pub fn delete_profile(&mut self, name: &str) -> Result<(), EngineError>
Delete a profile
Sourcepub fn active_profile_name(&self) -> Option<&str>
pub fn active_profile_name(&self) -> Option<&str>
Get active profile name
Sourcepub fn keybind_count(&self) -> usize
pub fn keybind_count(&self) -> usize
Get number of keybinds
Sourcepub fn has_keybinds(&self) -> bool
pub fn has_keybinds(&self) -> bool
Check if engine has keybinds
Sourcepub fn validate_keybinds(&self, keybinds: &[Keybind]) -> ValidationResult
pub fn validate_keybinds(&self, keybinds: &[Keybind]) -> ValidationResult
Validate keybinds for conflicts
Sourcepub fn validate_and_apply_from_string(
&mut self,
content: &str,
format: &str,
) -> Result<ValidationResult, EngineError>
pub fn validate_and_apply_from_string( &mut self, content: &str, format: &str, ) -> Result<ValidationResult, EngineError>
Full validation pipeline: parse → validate → apply
Sourcepub fn validate_apply_and_persist_from_string(
&mut self,
content: &str,
format: &str,
profile_name: &str,
persistence: &dyn KeybindPersistence,
) -> Result<ValidationResult, EngineError>
pub fn validate_apply_and_persist_from_string( &mut self, content: &str, format: &str, profile_name: &str, persistence: &dyn KeybindPersistence, ) -> Result<ValidationResult, EngineError>
Full validation pipeline with persistence: parse → validate → apply → persist
Sourcepub fn get_help_all(&self) -> String
pub fn get_help_all(&self) -> String
Get help for all keybinds
Sourcepub fn get_help_by_category(&self, category: &str) -> String
pub fn get_help_by_category(&self, category: &str) -> String
Get help for keybinds by category
Sourcepub fn search_keybinds(&self, query: &str) -> Vec<&Keybind>
pub fn search_keybinds(&self, query: &str) -> Vec<&Keybind>
Search keybinds
Sourcepub fn get_keybinds_paginated(
&self,
page: usize,
page_size: usize,
) -> Page<&Keybind>
pub fn get_keybinds_paginated( &self, page: usize, page_size: usize, ) -> Page<&Keybind>
Get paginated keybinds
Sourcepub fn get_profile(&self, name: &str) -> Option<&Profile>
pub fn get_profile(&self, name: &str) -> Option<&Profile>
Get a profile by name