plugins-rs 0.1.0

js plugins for a rust app
docs.rs failed to build plugins-rs-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

PluginSystem

PluginSystem build with deno-core


Cargo.toml

plugin-rs = { git = "https://github.com/blockz-dev/plugins-rs" }


Features

  • Embeded Plugins
  • Simple Standalone Plugins
  • Archived Plugins with .7z, .zip, .tar, .tar.gz, .tar.xz

Not Supported yet

  • npm, jsr packages (only local)

Example

use plugins_rs::bind_dir;
use plugins_rs::{ Source, PluginSystem };

fn main() {

    let mut plugins = match PluginSystem::builder()
        .add_source(Source::from_static(std::env::current_dir().unwrap().join("javascript").join("plugins")))
        .add_embed(Source::from_embed(bind_dir!("javascript/embed")))
        .run() {
            Ok(prt) => prt,
            Err(err) => panic!("{}", err),
        };

    loop {
        println!("exec() > {:?}", plugins.execute("namespace", "base", "exec()").unwrap());
        println!("do_action.audio_dir() > {:?}", plugins.execute("namespace", "base", "do_action.audio_dir()").unwrap());
        println!("demo.title > {:?}", plugins.execute("namespace", "base", "demo.title").unwrap());
        std::thread::sleep(std::time::Duration::from_millis(1000));
    }

}