Skip to main content

PluginResolver

Trait PluginResolver 

Source
pub trait PluginResolver:
    Send
    + Sync
    + 'static {
    // Required method
    fn resolve(&self, name: &str) -> Result<PluginHandle>;
}
Expand description

Maps entry names to reusable plugin handles.

This is the Rust replacement for upstream Cordis’ dynamic import(name): resolution is static and injectable. The default implementation in cordis-loader is a registry populated at startup; tests and embedders can supply their own (plain closures implement the trait too).

The trait returns PluginHandle — not a bare plugin — because the handle’s stable PluginKey identity is what fibers, events, and “did this plugin dispose itself?” checks key off. Resolving the same name twice must yield distinct handles (wrap the plugin each time, as PluginHandle::new does), mirroring one plugin instance per entry.

Required Methods§

Source

fn resolve(&self, name: &str) -> Result<PluginHandle>

Resolve an entry’s plugin name to a fresh handle.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> PluginResolver for F
where F: Fn(&str) -> Result<PluginHandle> + Send + Sync + 'static,