You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typed map<K, V> support is limited to HashMap with the default hasher #14832
Today map<K, V> can only be used through the typed API and bindgen! as HashMap<K, V> with the default hasher (std's RandomState, or hashbrown's default hasher without std). A few consequences:
There's no support for BTreeMap, custom hashers, or getting at the raw entries. Vec<(K, V)> doesn't work since it only typechecks against list.
bindgen! has no way to choose the type (no map_type option, and with doesn't apply to map aliases).
additional_derives: [Hash] (or Ord) fails for any record containing a map.
Lowering iterates a randomly-seeded HashMap, so the order of entries the guest sees changes from run to run, which is surprising for embedders following the deterministic-execution guide.
For comparison, guest-side wit-bindgen has a map_type option plus a small WitMap trait, with BTreeMap as the no_std-friendly default and HashMap available behind std. Would something similar make sense here: impls for BTreeMap and HashMap<K, V, S>, an entries-preserving type for "just give me the list", and a bindgen! option to pick between them?
Activity