Skip to main content

load_module

Function load_module 

Source
pub fn load_module(
    spec: &str,
    resolver: &dyn ModuleResolver,
    ctx: &Ctx,
    seen: &mut Instances,
) -> Result<Value, LoadError>
Expand description

Load the module spec names, with its whole import graph: resolve, compile and instantiate every module it reaches, leaves first, one instance per canonical name, and hand back the instance for spec itself.

seen deduplicates and may be reused across calls as a cache (see Instances); pass a fresh one for an independent load. Identities come from ctx, which reserves each module’s block of item ids as it is instantiated, so a host that hands values out between contexts should seed successors with Ctx::ids_used.