Expand description
The binary interface between eov and plugin libraries.
Plugin authors do not use this module directly: implement
crate::sdk::Plugin and export it with crate::export_plugin!.
§Compatibility rules
The ABI is deliberately small. Almost everything travels as JSON messages
defined in crate::protocol; only pixel data crosses as binary.
- abi_stable 0.11’s load-time layout check accepts a library whose
prefix type (a module or a
#[sabi_trait]vtable) has more fields than the host’s copy, but rejects one with fewer (“too many fields”: a 1.0 library in a host whose copy has one more field). - The root module (
PluginModule) is anabi_stableprefix type. The host loads it withLibHeader::init_root_module, which checks theeov-plugin-apimajor version and the layout of every type reachable from the module before any plugin code runs. Because of the rule above it checks every library against the root module’s base layout (v1_0::PluginModule: the fields plugin API 1.0 was first built with, which every 1.x module has), and then the fields added since (so farPluginModule::slide_source) with the full layout, only when the library’s module has them. A library built before a field was added therefore loads unchanged, and a newer one loads into an older eov, without its additions. PluginFfiandHostFfiare#[sabi_trait]objects. Their vtables are frozen for 1.x: by the rule above, a method appended to one would make every older plugin fail the check. New capabilities are JSON methods onHostFfi::calland newcrate::protocol::HostEvents, which older peers answer withUnsupportedor receive asUnknown; pixel data keeps using the existing binary calls. The same holds forSlideSourceFfiandSlideFfi: new slide features go throughSlideFfi::call, or through new root-module fields checked the same way.ABI_VERSIONis an additional explicit handshake; it only changes together with the crate’s major version.
§Slide sources
A plugin can read slide formats eov does not read itself (Philips
iSyntax, Olympus VSI, Leica LIF, remote sources such as DICOMweb or
OMERO). It declares them in its manifest ([[slide_formats]], see
crate::manifest::SlideFormatSpec), so eov knows the extensions and URI
schemes without running plugin code, and the SDK exports the root
module’s PluginModule::slide_source, which hands the host the
instance’s SlideSourceFfi. Opening a slide returns a SlideFfi
handle: the metadata as JSON (crate::protocol::SlideInfo), region
reads into a host buffer and associated images.
Threading: a slide source and its slides are Send + Sync and are
called from worker threads (slide openers, render workers, exports,
batch runs), several at once and on the same handle. eov holds none of
its locks while it calls them. A call that panics fails (the SDK turns
the panic into FfiErrorKind::Panicked) and the plugin is stopped;
one that returns an error fails only that read.
Modules§
- Host
Ffi_ trait - This module is generated by the
#[sabi_trait]attribute on HostFfi - Plugin
Ffi_ trait - This module is generated by the
#[sabi_trait]attribute on PluginFfi - Slide
Ffi_ trait - This module is generated by the
#[sabi_trait]attribute on SlideFfi - Slide
Source Ffi_ trait - This module is generated by the
#[sabi_trait]attribute on SlideSourceFfi - v1_0
- The root module as plugin API 1.0 defined it, frozen: the layout the host checks every plugin library against first (see the compatibility rules). Plugins never use it.
Structs§
- FfiError
- An error crossing the plugin boundary.
- Filter
Frame - A rendered frame handed to a CPU filter, to be modified in place.
- Filter
View - The pane a filter is being applied for.
- Host
Ffi_ TO - The trait object for HostFfi.
- Pixels
- An RGBA8 image: straight (non-premultiplied) alpha, row-major, no padding.
- Plugin
Ffi_ TO - The trait object for PluginFfi.
- Plugin
Module - The root module every plugin library exports (via
crate::export_plugin!). - Plugin
Module Ref - This is the pointer to the prefix of
PluginModule. - Plugin
Module_ Prefix - This is the prefix fields of
PluginModule, accessible throughPluginModuleRef, with.0.prefix(). - Raster
Upload - A raster overlay object (e.g. a heat map) covering a level-0 rectangle.
- Region
Request - A request for slide pixels.
- Slide
Ffi_ TO - The trait object for SlideFfi.
- Slide
Region - A region of one pyramid level, in pixels of that level (unlike
RegionRequest, whose corner is in level-0 pixels). - Slide
Source Ffi_ TO - The trait object for SlideSourceFfi.
Enums§
- FfiError
Kind - Classifies an
FfiError.
Constants§
- ABI_
VERSION - Explicit ABI generation, checked by the host in addition to the
abi_stablelayout check. - API_
VERSION - The version of
eov-plugin-apithis crate is. - MAX_
RASTER_ PIXELS - Largest raster, in pixels, a single
HostFfi::put_rastermay upload. - MAX_
REGION_ PIXELS - Largest region, in pixels, a single
HostFfi::read_regionmay request. - MAX_
SLIDE_ READ_ PIXELS - Largest region, in pixels, the host asks a
SlideFfi::read_regionfor at once (larger reads arrive in parts). - SLIDE_
SOURCE_ FIELD - The index of
PluginModule::slide_sourceamong the root module’s fields (the first field added after plugin API 1.0).
Traits§
- HostFfi
- The host services available to one plugin.
- Plugin
Ffi - A live plugin instance.
- Slide
Ffi - One open slide.
- Slide
Source Ffi - The slide formats one plugin instance reads (see the module documentation).
Functions§
- plugin_
library_ filename - Returns the expected shared-library file name for a plugin id on the current platform.
Type Aliases§
- FfiResult
- HostBox
- An owned host API handle.
- Host
Ffi_ CTO - A type alias for the const-constructible
HostFfi_TO. - Plugin
Box - An owned plugin instance.
- Plugin
Ffi_ CTO - A type alias for the const-constructible
PluginFfi_TO. - Slide
Box - An owned slide handle.
- Slide
Ffi_ CTO - A type alias for the const-constructible
SlideFfi_TO. - Slide
Source Box - An owned slide source.
- Slide
Source Ffi_ CTO - A type alias for the const-constructible
SlideSourceFfi_TO.