Type Definition kvarn::ctl::Plugin

source ·
pub type Plugin = Box<dyn for<'a> Fn(Arguments, &'a Vec<PortDescriptor>, &'a Manager, &'a Plugins) -> RetSyncFut<'a, PluginResponse> + Send + Sync>;
Available on crate feature handover only.
Expand description

A plugin, similar to the extensions. One can easily be constructed using the plugin! macro.


let mut config = RunConfig::new();
let plugin: ctl::Plugin = Box::new(|args, _port_descriptors, _shutdown_manager, _plugins| {
    Box::pin(async move {
        let mut s = args.name().to_owned();
        for arg in args.iter() {
            s.push(' ');
    }) as extensions::RetSyncFut<'_, _>
config = config.add_plugin("my-plugin", plugin);