Crate ewwii_plugin_api

Crate ewwii_plugin_api 

Source
Expand description

§ewwii_plugin_api - A plugin interface for ewwii

ewwii_plguin_api is a shared list of traits that both ewwii and its plugins can use. This crate simplifies and provides a safe way for building plugins for ewwii.

§Example

The following example shows how this crate shall be used to build ewwii plugins:

use ewwii_plugin_api::{EwwiiAPI, Plugin, export_plugin};

pub struct DummyStructure;

impl Plugin for DummyStructure {
    // critical for ewwii to launch the plugin
    fn init(&self, host: &dyn EwwiiAPI) {
        // will be printed by the host
        host.log("Plugin says Hello!");
    }
}

// Critical for ewwii to load the plugin
export_plugin!(DummyStructure);

Re-exports§

pub use rhai;
pub use gtk4;

Modules§

example
A module providing example implementations of plugins
widget_backend
Module exposing structures and types from the Widget rendering and definition backend in ewwii.

Macros§

auto_plugin
Macro to implement and export a plugin in a single step. With this macro, users can write their plugin code directly without having to manually implement each trait.
export_plugin
Automatically implements create_plugin for a given fieldless structure
export_stateful_plugin
Automatically implements create_plugin for a given structure that has fields.

Traits§

EwwiiAPI
The shared trait defining the Ewwii plugin API
Plugin
The API format that the plugin should follow. This trait should be implemented for a structure and that structure should be exported via FFI.