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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl !RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl !UnwindSafe for Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more