kvarn

Macro plugin

source
macro_rules! plugin {
    (|$args:tt, $ports:tt, $shutdown:tt, $plugins:tt $(,)?|  $code:block ) => { ... };
}
Available on crate feature handover only.
Expand description

Create a Plugin.

ยงExamples

use ctl::*;
let mut config = RunConfig::new();
config.add_plugin(
    "wait",
    plugin!(|args, _, shutdown, _| {
        if let Err(r) = check_no_arguments(&args) {
            return r;
        }
        shutdown.wait().await;
        PluginResponse::ok_empty()
    })
);