Skip to main content

Module registry

Module registry 

Source
Expand description

Plugin registry: the single source of truth for compiled .rhai scripts after discovery. Owns the parsed ASTs + resolved header data. Wrapping a CompiledPlugin in a Segment adapter is the consumer’s job (see linesmith-core’s RhaiSegment), not this module’s.

PluginRegistry::load walks the discovery order from super::discovery::scan_plugin_dirs, compiles each script, resolves its @data_deps header, and extracts the required const ID declaration. Non-fatal errors (compile failure, unknown dep, id collision) are returned alongside the registry so linesmith doctor can surface them; a single bad plugin does not abort the whole load.

Structs§

CompiledPlugin
A single compiled plugin ready to be wrapped by a consumer-side Segment adapter.
CompiledPluginParts
Owned-by-value view of a CompiledPlugin’s fields, returned by CompiledPlugin::into_parts. Pure transport DTO — the non-empty-id and status-first-dep invariants compile_plugin enforces are implicit on the values, but this struct doesn’t re-check them since callers can only obtain it by consuming a registry-built CompiledPlugin.
PluginRegistry
Keyed collection of compiled plugins. Lookup is by id; iteration preserves discovery order. Non-fatal load errors (compile failure, unknown dep, id collision) live alongside the compiled plugins so post-load consumers (e.g. linesmith doctor) can query them at any point without re-running discovery.