Skip to main content

PluginMetaSink

Trait PluginMetaSink 

Source
pub trait PluginMetaSink: Send + Sync {
    // Required methods
    fn register_plugin(&self, id: u32, name: String, doc: String);
    fn unregister_plugin(&self, id: u32);

    // Provided method
    fn register_seam_ids(&self, primary: u32, seam_ids: &[u32]) { ... }
}
Expand description

The host-owned plugin-metadata store, viewed as a write seam. Implemented by the host’s PluginMetaRegistry; consumed by the plugin loader. All methods take &self (the store is interior-mutable behind a lock) so the shared Arc handle suffices — no &mut plumbing across the boundary.

Required Methods§

Source

fn register_plugin(&self, id: u32, name: String, doc: String)

Record a loaded plugin’s manifest name + doc against its host-issued numeric id, so SourceLayer::Plugin(id) provenance renders as the name and :list-plugins shows it. Called once per plugin at load.

Source

fn unregister_plugin(&self, id: u32)

Forget a plugin’s metadata (unload / reload). Idempotent — a never-registered or already-removed id is a no-op.

Provided Methods§

Source

fn register_seam_ids(&self, primary: u32, seam_ids: &[u32])

Record that seam_ids all belong to the plugin registered as primary.

A plugin is instantiated once per seam and each instance gets its own host id; primary (the first) is its identity, but a contribution is stamped with the id of the seam that made it. Without this, a binding the keymap seam registered renders as <plugin:29> while the same plugin’s grammar renders as its name. Aliases only — :list-plugins must still show the plugin once. unregister_plugin(primary) drops them.

Defaults to a no-op so a test sink need not care; the host’s registry is the one implementation that must.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§