eov-plugin-api
Shared API and ABI definitions for native plugins for eov, a cross-platform whole-slide image viewer.
This crate is intended for plugin authors and host integrations. It does not load or package plugin binaries itself. The eov application discovers plugin packages, validates their manifests, loads their native libraries, and passes host callbacks through the contracts defined here.
Add the dependency
Keep the crate version aligned with the eov host version that will load the plugin:
[]
= "0.4.5"
= "0.11"
Native plugins should build both a dynamic library for eov and an rlib when
they also contain Rust tests or reusable internal code:
[]
= ["cdylib", "rlib"]
What this crate provides
eov_plugin_api::fficontains theabi_stabletypes used across the native plugin boundary, includingPluginVTable,HostApiVTable, toolbar and HUD registrations, host snapshots, viewport overlays, and filter callbacks.PluginManifestandIconDescriptordescribe and validateplugin.toml.Plugin,HostContext, and the related registration types provide a Rust plugin abstraction for in-process integrations.ViewportFiltersupports CPU RGBA8 post-processing and GPU filter integrations. The FFI module exposes the corresponding ABI-safe types.PluginErrorandPluginResultprovide errors shared by the Rust-level API.
The dynamic-library path uses eov_plugin_api::ffi. The Rust-level traits and
the FFI types are related APIs, but they are not interchangeable at the ABI
boundary: exported callbacks must use the abi_stable types from ffi.
Plugin manifest
Each plugin package contains a plugin.toml at its root. The fields below are
the fields understood by PluginManifest:
= "example_plugin"
= "Example Plugin"
= "0.1.0"
= "ui/example-panel.slint"
= "ExamplePanel"
[]
= ">=0.4.1"
[]
= "svg"
= "<svg viewBox=\"0 0 24 24\">...</svg>"
[[]]
= "open_panel"
= "Open example panel"
= "open_panel"
entry_ui and entry_component are optional for plugins without a Slint
window. Icon files can be used instead of inline SVG data:
[]
= "file"
= "icons/example.svg"
UI and icon paths are relative to the plugin root. Absolute paths and ..
path traversal are rejected by manifest validation. A manifest can be parsed
from a string or file and its referenced files can then be checked:
use PluginManifest;
use Path;
Native plugin entry point
Native plugins are loaded through abi_stable. A plugin dynamic library
exports the following symbol and returns a fully populated PluginVTable:
use PluginVTable;
pub extern "C"
The vtable covers plugin initialization, toolbar and HUD actions, callbacks
from plugin UI, viewport context-menu actions, viewport overlays, annotation
events, undo/redo, and CPU/GPU viewport filters. HostApiVTable is supplied by
the host and lets a plugin query application state, read slide regions, open
files, move the active viewport, request rendering, update controls, and write
host log messages.
For example, a toolbar callback uses ABI-safe strings and vectors:
use ;
use ToolbarButtonFFI;
Do not pass ordinary Rust String, Vec, or other Rust-owned values across
the exported ABI. Use the stable types in eov_plugin_api::ffi and
abi_stable::std_types instead.
Runtime and packaging
The eov host normally discovers .eop plugin packages in ~/.eov/plugins/.
Use --plugin-dir to select another directory. A package contains the
manifest, the platform-specific plugin library, and any UI or icon files it
references. Packaging and installation are host-level concerns; see eov's
plugin documentation for the
current package layout and loading workflow.
The plugin system is experimental. Build a plugin against the same
eov-plugin-api release used by the target eov host, and treat changes to the
vtable or manifest contract as release compatibility changes.
Related projects
License
Licensed under MIT, Apache-2.0, or GPLv3, at your option.