Skip to main content

with_plugin

Function with_plugin 

Source
pub fn with_plugin<R>(
    component_type: &str,
    f: impl FnOnce(&dyn JsonUiPlugin) -> R,
) -> Option<R>
Expand description

Look up a plugin by component type name in the global registry.

Acquires a read lock on the global registry, checks if the plugin exists, and calls the provided closure with a reference to it. Returns None if no plugin is registered for the given type.

The closure pattern avoids lifetime issues with returning references through the RwLock guard.