pub trait PluginRegistrar {
// Required methods
fn register_component(&mut self, name: &str, schema: ComponentSchema);
fn register_data_source(&mut self, name: &str, schema: DataSourceSchema);
fn register_transform(&mut self, name: &str, schema: TransformSchema);
fn register_action(&mut self, name: &str, schema: ActionSchema);
fn register_settings_page(&mut self, name: &str, page: PluginValue);
fn register_template(&mut self, name: &str, template: PluginValue);
fn context(&self) -> &dyn PluginContext;
fn context_arc(&self) -> Arc<dyn PluginContext>;
}Expand description
Re-export nemo-plugin-api for convenience Trait for plugin registration.
Passed to the plugin entry point function. Plugins use this to register their capabilities (components, data sources, transforms, actions, and templates) with the Nemo host.
The registrar is only valid during the plugin entry call and must not be stored or used after the entry function returns.
§Example
fn init(registrar: &mut dyn PluginRegistrar) {
registrar.register_component(
"widget",
ComponentSchema::new("widget")
.with_property("title", PropertySchema::string()),
);
registrar.register_action(
"refresh_widget",
ActionSchema::new("refresh_widget"),
);
}Required Methods§
Sourcefn register_component(&mut self, name: &str, schema: ComponentSchema)
fn register_component(&mut self, name: &str, schema: ComponentSchema)
Registers a component factory with the given name and schema.
Sourcefn register_data_source(&mut self, name: &str, schema: DataSourceSchema)
fn register_data_source(&mut self, name: &str, schema: DataSourceSchema)
Registers a data source factory with the given name and schema.
Sourcefn register_transform(&mut self, name: &str, schema: TransformSchema)
fn register_transform(&mut self, name: &str, schema: TransformSchema)
Registers a transform with the given name and schema.
Sourcefn register_action(&mut self, name: &str, schema: ActionSchema)
fn register_action(&mut self, name: &str, schema: ActionSchema)
Registers an action with the given name and schema.
Sourcefn register_settings_page(&mut self, name: &str, page: PluginValue)
fn register_settings_page(&mut self, name: &str, page: PluginValue)
Registers a settings page with the given display name and UI definition.
The page value is a PluginValue::Object describing the settings UI
using a declarative layout (e.g. stack, label, switch, input).
Sourcefn register_template(&mut self, name: &str, template: PluginValue)
fn register_template(&mut self, name: &str, template: PluginValue)
Registers a UI template that can be referenced in HCL layout configs.
Templates registered by plugins are merged with HCL-defined templates during layout expansion. HCL-defined templates take precedence if there is a name collision.
Sourcefn context(&self) -> &dyn PluginContext
fn context(&self) -> &dyn PluginContext
Gets the plugin context for API access during initialization.
Sourcefn context_arc(&self) -> Arc<dyn PluginContext>
fn context_arc(&self) -> Arc<dyn PluginContext>
Gets the plugin context as an Arc for use in background threads.
The returned Arc<dyn PluginContext> is Send + Sync and can safely
be moved to spawned tasks.