diff --git a/crates/wasm-encoder/src/component/builder.rs b/crates/wasm-encoder/src/component/builder.rs index e7cf7baf8a..71603f8bd8 100644 --- a/crates/wasm-encoder/src/component/builder.rs +++ b/crates/wasm-encoder/src/component/builder.rs @@ -482,6 +482,19 @@ impl ComponentBuilder { base } + /// Creates a new component instance from the `exports` provided. + /// + /// Returns the index of the component instance created. + pub fn instantiate_exports<'a, E, N>(&mut self, debug_name: Option<&str>, exports: E) -> u32 + where + E: IntoIterator, + E::IntoIter: ExactSizeIterator, + N: Into>, + { + self.component_instances().export_items(exports); + self.instances.add(debug_name) + } + /// Declares a new `resource.drop` intrinsic. pub fn resource_drop(&mut self, ty: u32) -> u32 { self.canonical_functions().resource_drop(ty);