Skip to main content

Crate eov_plugin_api

Crate eov_plugin_api 

Source
Expand description

The eov plugin API.

An eov plugin is a native library (cdylib) that implements sdk::Plugin and exports it with export_plugin!. The host talks to it through a small, layout-checked ABI (abi) carrying JSON messages defined in protocol; the SDK hides both behind safe Rust types.

use eov_plugin_api::prelude::*;

struct Counter {
    host: Host,
}

impl Plugin for Counter {
    fn create(host: Host, _init: PluginInit) -> Result<Self, String> {
        Ok(Self { host })
    }

    fn on_event(&self, event: HostEvent) -> Result<(), String> {
        if let HostEvent::FileOpened { file } = event {
            self.host.info(format!("{} opened", file.filename));
        }
        Ok(())
    }
}

eov_plugin_api::export_plugin!(Counter);

A plugin package (.eop) is a tar archive holding plugin.toml (see manifest), the library and any .slint files and assets. See the crate README and example-plugin/ for a complete walkthrough, and testing for unit-testing plugins without eov.

Re-exports§

pub use manifest::PluginManifest;

Modules§

abi
The binary interface between eov and plugin libraries.
manifest
Plugin manifest (plugin.toml) parsing and validation.
prelude
Everything a plugin usually needs: use eov_plugin_api::prelude::*;.
protocol
The message protocol spoken between the eov host and plugins.
sdk
The safe Rust SDK for writing eov plugins.
testing
Unit-test support for plugins: run a Plugin against an in-memory mock host.

Macros§

export_plugin
Exports a Plugin implementation as an eov plugin library.

Structs§

PluginDescriptor
A discovered plugin package: its extracted root and parsed manifest.

Enums§

IconDescriptor
How a plugin’s icon is provided in its manifest.
PluginError
Errors raised while reading plugin packages and manifests.

Type Aliases§

PluginResult