Function construct_plugin

Source
pub fn construct_plugin(
    context: Arc<dyn PluginContext + Send + Sync>,
) -> Result<Arc<dyn Plugin + Send + Sync>, PluginLoadingError>
Expand description

Constructs the plugin and initializes the plugin context.

This method guarantees that the plugin context is set before initializing the dependency injection framework. After PLUGIN_CONTEXT.set has been called, it’s guaranteed that PLUGIN_CONTEXT has a value. See also the documentation of OnceLock::set.

Returns an error if the plugin construction failed, by either:

  • The dependency injection container failed to construct
  • The dependency injection container doesn’t contain a component of type Plugin
  • A component has unsatisfied dependencies.