pub struct HelpRegistry { /* private fields */ }Expand description
Central registry mapping widget IDs to help content.
Supports:
- Direct registration via
register - Lazy/deferred registration via
register_lazy - Hierarchical parent chains via
set_parent - Resolution that walks parent chain via
resolve
Implementations§
Source§impl HelpRegistry
impl HelpRegistry
Sourcepub fn register(&mut self, id: HelpId, content: HelpContent)
pub fn register(&mut self, id: HelpId, content: HelpContent)
Register help content for a widget.
Overwrites any previous content (or lazy provider) for the same ID.
Sourcepub fn register_lazy(
&mut self,
id: HelpId,
provider: impl FnOnce() -> HelpContent + Send + 'static,
)
pub fn register_lazy( &mut self, id: HelpId, provider: impl FnOnce() -> HelpContent + Send + 'static, )
Register a lazy provider that will be called on first lookup.
The provider is invoked at most once; its result is cached.
Sourcepub fn unregister(&mut self, id: HelpId) -> bool
pub fn unregister(&mut self, id: HelpId) -> bool
Remove help content for a widget.
Returns true if content was present.
Sourcepub fn set_parent(&mut self, child: HelpId, parent: HelpId) -> bool
pub fn set_parent(&mut self, child: HelpId, parent: HelpId) -> bool
Set the parent of a widget in the help hierarchy.
When resolve is called for child and no content
is found, the lookup walks to parent (and its ancestors).
Returns false (and does nothing) if setting this parent would create
a cycle.
Sourcepub fn clear_parent(&mut self, child: HelpId)
pub fn clear_parent(&mut self, child: HelpId)
Remove the parent link for a widget.
Sourcepub fn get(&mut self, id: HelpId) -> Option<&HelpContent>
pub fn get(&mut self, id: HelpId) -> Option<&HelpContent>
Get help content for a specific widget (no hierarchy walk).
Forces lazy providers if present.
Sourcepub fn peek(&self, id: HelpId) -> Option<&HelpContent>
pub fn peek(&self, id: HelpId) -> Option<&HelpContent>
Peek at help content without forcing lazy providers.
Sourcepub fn resolve(&mut self, id: HelpId) -> Option<&HelpContent>
pub fn resolve(&mut self, id: HelpId) -> Option<&HelpContent>
Resolve help content by walking the parent hierarchy.
Returns the first content found starting from id and walking up
through parents. Returns None if no content exists in the chain.