generate_wrapper_crate

Function generate_wrapper_crate 

Source
pub fn generate_wrapper_crate(
    wit: &Utf8Path,
    js_modules: &[JsModuleSpec],
    output: &Utf8Path,
    world: Option<&str>,
) -> Result<()>
Expand description

Generates a Rust wrapper crate for a combination of a WIT package and a JavaScript module.

The wit parameter should point to a WIT root (holding the WIT package of the component, with optionally a deps subdirectory with an arbitrary number of dependencies).

The js_modules parameter must point to at least one JavaScript module that implements the WIT package, and optionally additional modules that get imported during the initialization of the component. It is always the first in the list that is considered the one containing the implementation of the WIT exports.

The output parameter is the root directory where the generated Rust crate’s source code and Cargo manifest is placed.

If world is None, the default world is selected and used, otherwise the specified one.