Module persistence

Module persistence 

Source
Expand description

Persistence layer for saving and loading keybind profiles

§Storage Location

Keybind profiles are stored in projects/ricecoder/config/keybinds/ with the following structure:

projects/ricecoder/config/keybinds/
├── defaults.json          # Default keybinds (read-only)
├── active_profile.txt     # Name of the currently active profile
├── default.json           # Default profile (auto-created)
├── vim.json               # Example custom profile
└── emacs.json             # Example custom profile

§File Format

Each profile is stored as a JSON file with the following structure:

{
  "name": "default",
  "keybinds": [
    {
      "action_id": "editor.save",
      "key": "Ctrl+S",
      "category": "editing",
      "description": "Save current file",
      "is_default": true
    }
  ]
}

The active_profile.txt file contains just the name of the active profile:

default

§Usage

To use the default storage location:

use ricecoder_keybinds::{FileSystemPersistence, KeybindPersistence};

let persistence = FileSystemPersistence::with_default_location()?;
let profiles = persistence.list_profiles()?;

Structs§

FileSystemPersistence
File system based persistence

Traits§

KeybindPersistence
Trait for persisting keybind profiles