Macro falco_plugin::plugin

source ·
macro_rules! plugin {
    ($ty:ty) => { ... };
    ($maj:expr; $min:expr; $patch:expr => $ty:ty) => { ... };
}
Expand description

§Register a Falco plugin

This macro must be called at most once in a crate (it generates public functions) with a type implementing Plugin as the sole parameter:

use falco_plugin::base::Plugin;
use falco_plugin::plugin;

struct MyPlugin;
impl Plugin for MyPlugin {
    // ...
}

plugin!(MyPlugin);

It implements a form where you can override the required API version (for example, if you wish to advertise an older version for increased compatibility):

use falco_plugin::base::Plugin;
use falco_plugin::plugin;

struct MyPlugin;
impl Plugin for MyPlugin {
    // ...
}

// require version 3.3.0 of the API
plugin!(3;3;0 => MyPlugin);

Note: this does not affect the actual version supported in any way. If you use this form, it’s entirely your responsibility to ensure the advertised version is compatible with the actual version supported by this crate.