Module registry

Module registry 

Source
Expand description

Action registry for name→ID mapping and dispatch Action Registry - Maps action IDs to handlers

Provides hybrid type-safety with String names for UI triggers and numeric IDs for fast execution path.

§Architecture

  • UI Layer: Triggers actions by string name (“reset”, “randomize”)
  • Registry: Maps names → numeric IDs (HashMap)
  • Executor: Dispatches by numeric ID (Vec indexing)

§Standard Actions

Reserved IDs 0-99 for built-in actions:

  • 0: Reset - Return parameters to defaults
  • 1: Randomize - Randomize within widget ranges

§Custom Actions

IDs 100+ for plugin-defined actions, executed via WASM.

§Usage

use glitcher_api::registry::ActionRegistry;
use glitcher_api::actions::ActionContext;

let registry = ActionRegistry::from_manifest(manifest);

// UI trigger by name
let updates = registry.trigger("reset", &ctx, 0)?;

// Fast path by ID
let updates = registry.execute(standard_actions::RESET, &ctx, 0)?;

Modules§

standard_actions
Standard action ID constants (0-99 reserved)

Structs§

ActionRegistry
Action registry for a node

Enums§

ActionHandler
Action handler variants
StandardAction
Standard built-in actions

Type Aliases§

ActionId
Numeric action ID for fast dispatch