Skip to main content

declare_plugin

Macro declare_plugin 

Source
macro_rules! declare_plugin {
    ($name:expr, $create:expr) => { ... };
}
Expand description

Declares the C ABI entry points for a cdylib plugin.

Generates three #[no_mangle] exports:

  • ROOM_PLUGIN_DECLARATION — a abi::PluginDeclaration static
  • room_plugin_create — calls the provided closure with a &str config and returns a double-boxed dyn Plugin
  • room_plugin_destroy — frees a plugin returned by room_plugin_create

§Arguments

  • $name — plugin name as a string literal (e.g. "taskboard")
  • $create — an expression that takes config: &str and returns impl Plugin (e.g. a closure or function call)

§Example

use room_protocol::declare_plugin;

declare_plugin!("my-plugin", |config: &str| {
    MyPlugin::from_config(config)
});