pub struct PluginLoader { /* private fields */ }Expand description
Plugin loader responsible for discovering and loading native plugins.
A trusted directory is an application-managed or explicitly user-approved installation location. Repository-controlled directories must not be added as trusted directories: loading a dynamic library executes its constructors before the plugin ABI can be inspected.
Implementations§
Source§impl PluginLoader
impl PluginLoader
Sourcepub fn add_trusted_dir(&mut self, path: PathBuf) -> &mut Self
pub fn add_trusted_dir(&mut self, path: PathBuf) -> &mut Self
Add an explicitly trusted plugin directory.
This method only enforces path containment after the directory is trusted; it does not verify provenance or obtain user consent. Callers must not pass paths selected from repository contents.
Sourcepub fn trusted_dirs(&self) -> &[PathBuf]
pub fn trusted_dirs(&self) -> &[PathBuf]
Get trusted plugin directories
Sourcepub fn load_plugin(
&self,
plugin_path: &Path,
) -> Result<Box<dyn NativePluginTrait>>
pub fn load_plugin( &self, plugin_path: &Path, ) -> Result<Box<dyn NativePluginTrait>>
Load a plugin from a specific path.
§Security
Library::new can execute arbitrary native initialization code before
this function returns. The caller must establish explicit user consent
and provenance before calling this method; plugin metadata is not an
authorization mechanism.
Sourcepub fn discover_plugins(&self) -> Result<Vec<Box<dyn NativePluginTrait>>>
pub fn discover_plugins(&self) -> Result<Vec<Box<dyn NativePluginTrait>>>
Discover and load all plugins in trusted directories.
Loading occurs during discovery, so callers must establish provenance and explicit user consent before invoking this method.
Sourcepub fn library_filename(&self, name: &str) -> String
pub fn library_filename(&self, name: &str) -> String
Convert a plugin name to a library filename for the current platform