macro_rules! export_plugin {
    (
        $plugin_ty:ty,
        $name:expr,
        $desc:expr,
        $version:expr $(,)?
    ) => { ... };
}
Expand description

Defines the necessary exports for HexChat to load your plugin.

Do not define a main function; initialization should be performed in your plugin’s Plugin::init function.

The type passed to export_plugin must implement Plugin.

§Examples

use hexavalent::{Plugin, PluginHandle, export_plugin};

#[derive(Default)]
struct NoopPlugin;

impl Plugin for NoopPlugin {
    fn init(&self, ph: PluginHandle<'_, Self>) {
        ph.print("Hello world!");
    }
}

export_plugin!(NoopPlugin, "No-op", "Doesn't do anything", "1.0.0");

Cargo’s environment variables can also be used to copy name, description, and version from Cargo.toml.

use hexavalent::{Plugin, PluginHandle, export_plugin};

#[derive(Default)]
struct NoopPlugin;

impl Plugin for NoopPlugin {
    fn init(&self, ph: PluginHandle<'_, Self>) {
        ph.print("Hello world!");
    }
}

export_plugin!(
    NoopPlugin,
    env!("CARGO_PKG_NAME"),
    env!("CARGO_PKG_DESCRIPTION"),
    env!("CARGO_PKG_VERSION"),
);