Core and the app · crate
kinogaki-plugin-host
Studio's plugin loader.
- Repository
- Core and the app (kinogaki/studio-core)
- Folder
studio/core/plugin-host- Source
- 8 files, 1,208 lines
- Tests
- 0 files, 0 lines
What it is
Studio's plugin loader.
A plugin is a Rust dylib exporting its package (kinogaki_studio_api::export_package!), with a manifest beside it (Manifest: its id, kind, version and the packages it needs), in a kind folder (renders/, nodes/, formats/, kernels/) of the application's or the user's plugin folder (Folders).
Plugins::load finds them all (scan), chooses what to load before loading anything (resolve: one per id, the application's first; only those whose dependencies load too, dependencies first), then opens each library, checks it was compiled against this Studio's build of the shared libraries, calls its entry once and has the host admit the package it returns (load: Studio's registry checks it, and refuses one that clashes with what is installed). Libraries are never unloaded. What can't be loaded is Unavailable, with a line for the Console saying why.
The build. Studio and its plugins share one standard library and one build of the SDK and the other shared crates (kinogaki-shared, the kit). Nothing at link time notices a plugin compiled against another build (it loads, then misbehaves), so each plugin records the build it was compiled against (kinogaki_shared::link!) and the loader compares it with kinogaki_shared::BUILD, the build of the library Studio runs with, before it calls anything in the plugin. This crate is the only one in Studio allowed unsafe, in sys.rs alone.
Depends on
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-prism | lib-prism | normal | Prism documents for Kinogaki. |
kinogaki-shared | Core and the app | normal | The crates Studio and its plugins share, built once as a Rust dylib. |
kinogaki-studio-api | SDK | normal | Kinogaki Studio's headless plugin API. |
Third-party
None.
Used by
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-editor | Core and the app | normal | Kinogaki Studio's editor: the document and everything the window shows of it, as parts one frame borrows one by one. |
kinogaki-studio | Core and the app | tests | Kinogaki Studio: the editor in a window, after the plugins load. |
Modules
choiceWhich packages a run installs: those Settings ▸ Plugins leaves on, or, for one run, exactly those a--plugins poly,renderlist names and what they need.130 linesloadLoading the plugins resolution chose, in dependency order: open each library, check it was compiled against the build of the shared libraries this Studio runs with, call its entry once, and keep the package it returns once the host admits it.87 linesmanifestA plugin's manifest: a small Prism document next to its library (renders/pixel.prismabesiderenders/pixel.dylib), read without loading the library.151 linesresolveChoosing what to load, before anything is loaded: one plugin per id (the application's wins), only those not turned off, and only those whose dependencies load too, in dependency order.79 linesscanFinding plugins: each kind folder of the application's and the user's plugin folders, a manifest (*.prisma) beside each library.156 linessys(private)Opening a plugin library and reading its two symbols: the onlyunsafein Studio (the crate denies it everywhere else).95 lines
Public types and traits
At the crate root
Structs FoldersFoundLoadedManifestManifestErrorPluginsUnavailable
Enums InstallKindWhy
By module: 9 public types and traits in 4 modules
choice CandidateOnly
load Loaded
manifest KindManifestManifestError
scan FoldersFoundInstall
Besides these, 7 public functions at module level.
