Expand description
Central registry for contextual help content.
Maps widget IDs to structured help entries with hierarchical resolution
(widget → container → app). Widgets register their help content via
HelpRegistry::register, and consumers look up help for a given widget
via HelpRegistry::get or HelpRegistry::resolve (which walks the
hierarchy).
§Invariants
- Each
HelpIdmaps to at most oneHelpContentat any given time. resolvewalks parents until it finds content or reaches the root; it never cycles (parent chains are acyclic by construction—set_parentrejects cycles).- Lazy providers are called at most once per lookup; results are cached in the registry for subsequent lookups.
§Example
use ftui_widgets::help_registry::{HelpRegistry, HelpContent, HelpId, Keybinding};
let mut reg = HelpRegistry::new();
let widget_id = HelpId(42);
reg.register(widget_id, HelpContent {
short: "Save the current file".into(),
long: Some("Writes the buffer to disk, creating the file if needed.".into()),
keybindings: vec![Keybinding::new("Ctrl+S", "Save")],
see_also: vec![],
});
assert_eq!(reg.get(widget_id).unwrap().short, "Save the current file");Structs§
- Help
Content - Structured help content for a widget.
- HelpId
- Unique identifier for a help-registered widget.
- Help
Registry - Central registry mapping widget IDs to help content.
- Keybinding
- A keyboard shortcut associated with a widget.