Skip to main content

Module abi

Module abi 

Source
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 an abi_stable prefix type. The host loads it with LibHeader::init_root_module, which checks the eov-plugin-api major 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 far PluginModule::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.
  • PluginFfi and HostFfi are #[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 on HostFfi::call and new crate::protocol::HostEvents, which older peers answer with Unsupported or receive as Unknown; pixel data keeps using the existing binary calls. The same holds for SlideSourceFfi and SlideFfi: new slide features go through SlideFfi::call, or through new root-module fields checked the same way.
  • ABI_VERSION is 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§

HostFfi_trait
This module is generated by the #[sabi_trait] attribute on HostFfi
PluginFfi_trait
This module is generated by the #[sabi_trait] attribute on PluginFfi
SlideFfi_trait
This module is generated by the #[sabi_trait] attribute on SlideFfi
SlideSourceFfi_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.
FilterFrame
A rendered frame handed to a CPU filter, to be modified in place.
FilterView
The pane a filter is being applied for.
HostFfi_TO
The trait object for HostFfi.
Pixels
An RGBA8 image: straight (non-premultiplied) alpha, row-major, no padding.
PluginFfi_TO
The trait object for PluginFfi.
PluginModule
The root module every plugin library exports (via crate::export_plugin!).
PluginModuleRef
This is the pointer to the prefix of PluginModule.
PluginModule_Prefix
This is the prefix fields of PluginModule, accessible through PluginModuleRef, with .0.prefix().
RasterUpload
A raster overlay object (e.g. a heat map) covering a level-0 rectangle.
RegionRequest
A request for slide pixels.
SlideFfi_TO
The trait object for SlideFfi.
SlideRegion
A region of one pyramid level, in pixels of that level (unlike RegionRequest, whose corner is in level-0 pixels).
SlideSourceFfi_TO
The trait object for SlideSourceFfi.

Enums§

FfiErrorKind
Classifies an FfiError.

Constants§

ABI_VERSION
Explicit ABI generation, checked by the host in addition to the abi_stable layout check.
API_VERSION
The version of eov-plugin-api this crate is.
MAX_RASTER_PIXELS
Largest raster, in pixels, a single HostFfi::put_raster may upload.
MAX_REGION_PIXELS
Largest region, in pixels, a single HostFfi::read_region may request.
MAX_SLIDE_READ_PIXELS
Largest region, in pixels, the host asks a SlideFfi::read_region for at once (larger reads arrive in parts).
SLIDE_SOURCE_FIELD
The index of PluginModule::slide_source among the root module’s fields (the first field added after plugin API 1.0).

Traits§

HostFfi
The host services available to one plugin.
PluginFfi
A live plugin instance.
SlideFfi
One open slide.
SlideSourceFfi
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.
HostFfi_CTO
A type alias for the const-constructible HostFfi_TO.
PluginBox
An owned plugin instance.
PluginFfi_CTO
A type alias for the const-constructible PluginFfi_TO.
SlideBox
An owned slide handle.
SlideFfi_CTO
A type alias for the const-constructible SlideFfi_TO.
SlideSourceBox
An owned slide source.
SlideSourceFfi_CTO
A type alias for the const-constructible SlideSourceFfi_TO.