[−][src]Macro hexavalent::export_plugin
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!\0"); } } 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!\0"); } } export_plugin!( NoopPlugin, env!("CARGO_PKG_NAME"), env!("CARGO_PKG_DESCRIPTION"), env!("CARGO_PKG_VERSION"), );