KeybindEngine

Struct KeybindEngine 

Source
pub struct KeybindEngine { /* private fields */ }
Expand description

Main keybind engine combining registry and profile management

Implementations§

Source§

impl KeybindEngine

Source

pub fn new() -> Self

Create a new keybind engine

Source

pub fn load_defaults_from_file( &mut self, path: impl AsRef<Path>, ) -> Result<(), EngineError>

Load default keybinds from a JSON file

Source

pub fn apply_defaults(&mut self) -> Result<(), EngineError>

Apply default keybinds and create default profile if needed

Source

pub fn reset_to_defaults(&mut self) -> Result<(), EngineError>

Reset keybinds to defaults

Source

pub fn get_defaults(&self) -> &[Keybind]

Get the default keybinds

Source

pub fn set_defaults(&mut self, keybinds: Vec<Keybind>)

Set the default keybinds (for testing purposes)

Source

pub fn apply_keybinds( &mut self, keybinds: Vec<Keybind>, ) -> Result<(), EngineError>

Apply keybinds to the engine

Source

pub fn get_action(&self, key: &KeyCombo) -> Option<&str>

Get action for a key combination

Source

pub fn get_keybind(&self, action_id: &str) -> Option<&Keybind>

Get keybind for an action

Source

pub fn all_keybinds(&self) -> Vec<&Keybind>

Get all keybinds

Source

pub fn keybinds_by_category(&self, category: &str) -> Vec<&Keybind>

Get keybinds by category

Source

pub fn categories(&self) -> Vec<String>

Get all categories

Source

pub fn create_profile( &mut self, name: impl Into<String>, keybinds: Vec<Keybind>, ) -> Result<(), EngineError>

Create a new profile

Source

pub fn select_profile(&mut self, name: &str) -> Result<(), EngineError>

Select a profile and apply its keybinds immediately

Source

pub fn delete_profile(&mut self, name: &str) -> Result<(), EngineError>

Delete a profile

Source

pub fn active_profile_name(&self) -> Option<&str>

Get active profile name

Source

pub fn keybind_count(&self) -> usize

Get number of keybinds

Source

pub fn has_keybinds(&self) -> bool

Check if engine has keybinds

Source

pub fn validate_keybinds(&self, keybinds: &[Keybind]) -> ValidationResult

Validate keybinds for conflicts

Source

pub fn validate_and_apply_from_string( &mut self, content: &str, format: &str, ) -> Result<ValidationResult, EngineError>

Full validation pipeline: parse → validate → apply

Source

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

Source

pub fn get_help_all(&self) -> String

Get help for all keybinds

Source

pub fn get_help_by_category(&self, category: &str) -> String

Get help for keybinds by category

Source

pub fn search_keybinds(&self, query: &str) -> Vec<&Keybind>

Search keybinds

Source

pub fn get_keybinds_paginated( &self, page: usize, page_size: usize, ) -> Page<&Keybind>

Get paginated keybinds

Source

pub fn get_profile(&self, name: &str) -> Option<&Profile>

Get a profile by name

Trait Implementations§

Source§

impl Default for KeybindEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.