pub struct Registry { /* private fields */ }Expand description
In-process registry mapping action name → plugin.
The v1 discovery path is explicit: callers construct a registry via
Registry::bootstrap (all 7 built-ins) or Registry::new (empty)
and optionally register further plugins with Registry::register.
External dylib / WASM loading is deferred to v2 per the feat-grex spec.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct an empty registry. Prefer Registry::bootstrap unless
you need a hand-picked plugin set (typical for tests).
Sourcepub fn register<P: ActionPlugin + 'static>(&mut self, plugin: P)
pub fn register<P: ActionPlugin + 'static>(&mut self, plugin: P)
Register plugin under its ActionPlugin::name. Later
registrations overwrite earlier ones with the same name — the
registry is last-writer-wins so higher-priority plugin collections
can shadow the built-ins after Registry::bootstrap.
Sourcepub fn get(&self, name: &str) -> Option<&dyn ActionPlugin>
pub fn get(&self, name: &str) -> Option<&dyn ActionPlugin>
Look up a plugin by name. Returns None if nothing is registered
under that name.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of registered plugins. Handy for tests and bootstrap assertions.
Sourcepub fn bootstrap() -> Self
pub fn bootstrap() -> Self
Build a registry pre-populated with every Tier-1 built-in
(symlink, env, mkdir, rmdir, require, when, exec) in
wet-run form.
The built-ins delegate to the existing execute::fs_executor free
functions — there is one struct per action rather than one struct
per executor so external callers can selectively shadow a single
built-in without re-deriving all seven.
Sourcepub fn register_from_inventory(&mut self)
pub fn register_from_inventory(&mut self)
Register every plugin submitted via inventory::submit! into the
PluginSubmission collector. Order is linker-defined; duplicate
names follow register’s last-writer-wins rule. Safe to call after
Registry::bootstrap — inventory entries shadow existing
registrations like any other register call (last-writer-wins).
Only available when the plugin-inventory feature is enabled.
Sourcepub fn bootstrap_from_inventory() -> Self
pub fn bootstrap_from_inventory() -> Self
Build a registry populated exclusively from
inventory::submit! entries. Equivalent to
let mut r = Registry::new(); r.register_from_inventory(); r.
Only available when the plugin-inventory feature is enabled.