reactive_graph_std_metadata/
plugin.rs1use reactive_graph_plugin_api::prelude::plugin::*;
2use reactive_graph_plugin_api::prelude::providers::*;
3
4export_plugin!({
5 "dependencies": [
6 { "name": "reactive-graph-std-base", "version": ">=0.10.0, <0.11.0" },
7 { "name": "reactive-graph-std-taxonomy", "version": ">=0.10.0, <0.11.0" }
8 ]
9});
10
11#[injectable]
12pub trait MetaDataPlugin: Plugin + Send + Sync {}
13
14#[derive(Component)]
15pub struct MetaDataPluginImpl {
16 component_provider: Arc<dyn TypeProvider<Components> + Send + Sync>,
17
18 #[component(default = "component_provider_registry")]
19 component_provider_registry: Arc<dyn ComponentProviderRegistry + Send + Sync>,
20}
21
22#[async_trait]
23#[component_alias]
24impl Plugin for MetaDataPluginImpl {
25 async fn activate(&self) -> Result<(), PluginActivationError> {
26 self.component_provider_registry.register_provider(self.component_provider.clone()).await;
27 Ok(())
28 }
29
30 async fn deactivate(&self) -> Result<(), PluginDeactivationError> {
31 self.component_provider_registry.unregister_provider(self.component_provider.id()).await;
32 Ok(())
33 }
34}