Skip to main content

export

Macro export 

Source
macro_rules! export {
    ($create:path) => { ... };
}
Expand description

Generate the plugin’s entire C ABI shell: the entry symbol, plus the name / family / command / free_* shims.

The usage is one line; create must be the path of a function returning Box<dyn PackageManager>, not a type name, because you may want to inject construction parameters in it:

ⓘ
pub fn create() -> Box<dyn pmpx_plugin::PackageManager> { Box::new(MyPlugin) }
pmpx_plugin::export!(create);

This shape is agreed with the wrapper project generated by crate-plugin-kit; the two sides must match.

Every call builds a new instance and deliberately caches nothing – in one process the host calls name / family / command once each.