jrandolf opened issue #14831:
For an exported function taking an anonymous map, e.g.
f: func(m: map<string, list<string>>),bindgen!generates:pub fn call_f<S: AsContextMut>(&self, store: S, arg0: HashMap<&str, &[String]>) -> ...while for a named
type named = map<string, string>it generatescall_g(.., arg0: &Named).The anonymous form means a caller holding a
HashMap<String, Vec<String>>has to build (and hash) a second map of references just to make the call, and it's inconsistent with both named maps and lists (which are&[T]). Generating&HashMap<K, V>with owned keys and values, the way lists are handled, would fix both. Since this changes generated signatures it seems worth settling beforemapis enabled by default.
alexcrichton added the wasm-proposal:component-model-map label to Issue #14831.
alexcrichton closed issue #14831:
For an exported function taking an anonymous map, e.g.
f: func(m: map<string, list<string>>),bindgen!generates:pub fn call_f<S: AsContextMut>(&self, store: S, arg0: HashMap<&str, &[String]>) -> ...while for a named
type named = map<string, string>it generatescall_g(.., arg0: &Named).The anonymous form means a caller holding a
HashMap<String, Vec<String>>has to build (and hash) a second map of references just to make the call, and it's inconsistent with both named maps and lists (which are&[T]). Generating&HashMap<K, V>with owned keys and values, the way lists are handled, would fix both. Since this changes generated signatures it seems worth settling beforemapis enabled by default.
Last updated: Oct 31 2026 at 23:03 UTC