macro_rules! javy_plugin {
($namespace:literal, $component:ident, $config:expr, $modify_runtime:expr) => { ... };
}
Expand description
Provides default implementations for required methods a Javy plugin.
§Arguments
namespace
- The name of the module that will be used for function imports in dynamically linked modules generated with this plugin.component
- A struct.config
- A function that will return ajavy::Config
to configure thejavy::Runtime
.modify_runtime
- A function that can add modify thejavy::Runtime
. For example, by adding additional methods for use by JavaScript.
§Examples
ⓘ
use javy_plugin_api::{javy::{Config, Runtime}, javy_plugin};
struct Component;
javy_plugin!("my-import-namespace", Component, config, modify_runtime);
fn config() -> Config {
Config::default()
}
fn modify_runtime(runtime: Runtime) -> Runtime {
runtime
}