Macro rustyscript::module

source ·
macro_rules! module {
    ($filename:literal, $contents:literal) => { ... };
}
Expand description

Creates a static module

§Arguments

  • filename - A string representing the filename of the module.
  • contents - A string containing the contents of the module.

§Example

use rustyscript::{ module, StaticModule };

const MY_SCRIPT: StaticModule = module!(
    "filename.js",
    "export const myValue = 42;"
);

let module_instance = MY_SCRIPT.to_module();