Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Add a `map_type` option to `bindgen!`, defaulting to `BTreeMap` (#14927)

Randolf J.87b9f6d98245
diff --git a/Cargo.lock b/Cargo.lock
index 43f2960e47..dc5a3d0797 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4573,6 +4573,7 @@ dependencies = [
"futures",
"fxprof-processed-profile",
"gimli 0.33.0",
+ "indexmap 2.14.0",
"ittapi",
"libc",
"libtest-mimic",
@@ -4683,6 +4684,7 @@ dependencies = [
"http",
"http-body-util",
"hyper",
+ "indexmap 2.14.0",
"libc",
"libtest-mimic",
"log",
diff --git a/Cargo.toml b/Cargo.toml
index aefb590324..1802f257ff 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -145,6 +145,7 @@ pulley-interpreter = { workspace = true, features = ["disas"] }
wasm-encoder = { workspace = true }
cranelift-native = { workspace = true }
futures = { workspace = true }
+indexmap = { workspace = true, features = ["std"] }
rand = { workspace = true }
# Should only be used for tests that are explicitly testing `anyhow::Error` and
diff --git a/crates/component-macro/src/bindgen.rs b/crates/component-macro/src/bindgen.rs
index 852521c3ac..2f997aebdd 100644
--- a/crates/component-macro/src/bindgen.rs
+++ b/crates/component-macro/src/bindgen.rs
@@ -148,6 +148,7 @@ impl Parse for Config {
Opt::WasmtimeCrate(f) => {
opts.wasmtime_crate = Some(f.into_token_stream().to_string())
}
+ Opt::MapType(p) => opts.map_type = Some(p.into_token_stream().to_string()),
Opt::Anyhow(val) => {
opts.anyhow = val;
}
@@ -262,6 +263,7 @@ mod kw {
syn::custom_keyword!(skip_mut_forwarding_impls);
syn::custom_keyword!(require_store_data_send);
syn::custom_keyword!(wasmtime_crate);
+ syn::custom_keyword!(map_type);
syn::custom_keyword!(anyhow);
syn::custom_keyword!(include_generated_code_from_file);
syn::custom_keyword!(include_component_type);
@@ -287,6 +289,7 @@ enum Opt {
SkipMutForwardingImpls(bool),
RequireStoreDataSend(bool),
WasmtimeCrate(syn::Path),
+ MapType(syn::Path),
Anyhow(bool),
IncludeGeneratedCodeFromFile(bool),
IncludeComponentType(bool),
@@ -423,6 +426,10 @@ impl Parse for Opt {
input.parse::<kw::wasmtime_crate>()?;
input.parse::<Token![:]>()?;
Ok(Opt::WasmtimeCrate(input.parse()?))
+ } else if l.peek(kw::map_type) {
+ input.parse::<kw::map_type>()?;
+ input.parse::<Token![:]>()?;
+ Ok(Opt::MapType(input.parse()?))
} else if l.peek(kw::anyhow) {
input.parse::<kw::anyhow>()?;
input.parse::<Token![:]>()?;
diff --git a/crates/component-macro/tests/codegen.rs b/crates/component-macro/tests/codegen.rs
index c244b6215c..11b4846853 100644
--- a/crates/component-macro/tests/codegen.rs
+++ b/crates/component-macro/tests/codegen.rs
@@ -1316,3 +1316,100 @@ mod include_component_type {
assert_eq!(world.exports.len(), 1);
}
}
+
+mod map_type {
+ mod default {
+ use std::collections::{BTreeMap, BTreeSet, HashSet};
+ use wasmtime::{Result, Store};
+
+ wasmtime::component::bindgen!({
+ inline: "
+ package my:inline;
+
+ interface maps {
+ type names-by-id = map<u32, string>;
+
+ record entry {
+ label: string,
+ values: map<string, u32>,
+ }
+
+ named: func(a: names-by-id) -> names-by-id;
+ anonymous: func(a: map<string, list<u8>>) -> map<string, u32>;
+ record-roundtrip: func(a: entry) -> entry;
+ }
+
+ world maps-world {
+ import maps;
+ export maps;
+ }
+ ",
+ // Maps are `BTreeMap`s by default, which implement these traits,
+ // so they can be derived for records containing maps.
+ additional_derives: [Hash, PartialEq, Eq, PartialOrd, Ord],
+ });
+
+ use my::inline::maps::{Entry, Host, NamesById};
+
+ struct X;
+
+ impl Host for X {
+ fn named(&mut self, a: NamesById) -> BTreeMap<u32, String> {
+ a
+ }
+
+ fn anonymous(&mut self, a: BTreeMap<String, Vec<u8>>) -> BTreeMap<String, u32> {
+ a.into_iter()
+ .map(|(k, v)| (k, u32::try_from(v.len()).unwrap()))
+ .collect()
+ }
+
+ fn record_roundtrip(&mut self, a: Entry) -> Entry {
+ let _ = BTreeSet::from([a.clone()]);
+ let _ = HashSet::from([a.clone()]);
+ a
+ }
+ }
+
+ fn call_exports(store: &mut Store<()>, bindings: &MapsWorld) -> Result<()> {
+ let maps = bindings.my_inline_maps();
+ let _: BTreeMap<u32, String> = maps.call_named(&mut *store, &BTreeMap::new())?;
+ let entry = exports::my::inline::maps::Entry {
+ label: String::new(),
+ values: BTreeMap::new(),
+ };
+ let _ = maps.call_record_roundtrip(&mut *store, &entry)?;
+ Ok(())
+ }
+ }
+
+ mod custom_hasher {
+ use std::collections::HashMap;
+ use std::hash::{BuildHasherDefault, DefaultHasher};
+
+ pub type CustomMap<K, V> = HashMap<K, V, BuildHasherDefault<DefaultHasher>>;
+
+ wasmtime::component::bindgen!({
+ inline: "
+ package my:inline;
+
+ interface maps {
+ named: func(a: map<u32, string>) -> map<string, u32>;
+ }
+
+ world maps-world {
+ import maps;
+ }
+ ",
+ map_type: crate::map_type::custom_hasher::CustomMap,
+ });
+
+ struct X;
+
+ impl my::inline::maps::Host for X {
+ fn named(&mut self, a: CustomMap<u32, String>) -> CustomMap<String, u32> {
+ a.into_iter().map(|(k, v)| (v, k)).collect()
+ }
+ }
+ }
+}
diff --git a/crates/component-macro/tests/expanded/map.rs b/crates/component-macro/tests/expanded/map.rs
index 07b46bce77..7d3a0ab0ce 100644
--- a/crates/component-macro/tests/expanded/map.rs
+++ b/crates/component-macro/tests/expanded/map.rs
@@ -209,7 +209,7 @@ pub mod foo {
HostThing::drop(*self, rep)
}
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -221,7 +221,7 @@ pub mod foo {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -242,7 +242,7 @@ pub mod foo {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -274,7 +274,7 @@ pub mod foo {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -316,24 +316,24 @@ pub mod foo {
fn named_roundtrip(&mut self, a: NamesById) -> IdsByName;
fn bytes_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
- ) -> std::collections::HashMap<
+ ) -> wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>;
fn option_roundtrip(
&mut self,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -341,14 +341,14 @@ pub mod foo {
fn result_roundtrip(
&mut self,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
wasmtime::component::__internal::String,
>,
) -> Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -357,14 +357,14 @@ pub mod foo {
fn tuple_roundtrip(
&mut self,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
u64,
),
) -> (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -372,16 +372,16 @@ pub mod foo {
);
fn nested_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
- ) -> std::collections::HashMap<
+ ) -> wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -389,13 +389,13 @@ pub mod foo {
fn list_of_maps(
&mut self,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -404,34 +404,34 @@ pub mod foo {
fn variant_roundtrip(&mut self, a: MapOrString) -> MapOrString;
fn all_key_types(
&mut self,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
) -> ();
fn own_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
- ) -> std::collections::HashMap<
+ ) -> wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>;
fn borrowed_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -443,11 +443,11 @@ pub mod foo {
}
fn bytes_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
- ) -> std::collections::HashMap<
+ ) -> wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
> {
@@ -456,13 +456,13 @@ pub mod foo {
fn option_roundtrip(
&mut self,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -472,14 +472,14 @@ pub mod foo {
fn result_roundtrip(
&mut self,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
wasmtime::component::__internal::String,
>,
) -> Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -490,14 +490,14 @@ pub mod foo {
fn tuple_roundtrip(
&mut self,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
u64,
),
) -> (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -507,16 +507,16 @@ pub mod foo {
}
fn nested_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
- ) -> std::collections::HashMap<
+ ) -> wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -526,13 +526,13 @@ pub mod foo {
fn list_of_maps(
&mut self,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -547,17 +547,17 @@ pub mod foo {
}
fn all_key_types(
&mut self,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -566,11 +566,11 @@ pub mod foo {
}
fn own_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
- ) -> std::collections::HashMap<
+ ) -> wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
> {
@@ -578,7 +578,7 @@ pub mod foo {
}
fn borrowed_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -623,7 +623,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -642,7 +642,7 @@ pub mod foo {
arg0,
): (
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -662,7 +662,7 @@ pub mod foo {
arg0,
): (
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -683,7 +683,7 @@ pub mod foo {
arg0,
): (
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -703,9 +703,9 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -725,7 +725,7 @@ pub mod foo {
arg0,
): (
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -776,17 +776,17 @@ pub mod foo {
arg9,
arg10,
): (
- std::collections::HashMap<bool, u32>,
- std::collections::HashMap<u8, u32>,
- std::collections::HashMap<i8, u32>,
- std::collections::HashMap<u16, u32>,
- std::collections::HashMap<i16, u32>,
- std::collections::HashMap<u32, u32>,
- std::collections::HashMap<i32, u32>,
- std::collections::HashMap<u64, u32>,
- std::collections::HashMap<i64, u32>,
- std::collections::HashMap<char, u32>,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<bool, u32>,
+ wasmtime::component::__internal::BTreeMap<u8, u32>,
+ wasmtime::component::__internal::BTreeMap<i8, u32>,
+ wasmtime::component::__internal::BTreeMap<u16, u32>,
+ wasmtime::component::__internal::BTreeMap<i16, u32>,
+ wasmtime::component::__internal::BTreeMap<u32, u32>,
+ wasmtime::component::__internal::BTreeMap<i32, u32>,
+ wasmtime::component::__internal::BTreeMap<u64, u32>,
+ wasmtime::component::__internal::BTreeMap<i64, u32>,
+ wasmtime::component::__internal::BTreeMap<char, u32>,
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -817,7 +817,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -835,7 +835,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -874,7 +874,7 @@ pub mod exports {
pub struct GuestThing<'a> {
funcs: &'a Guest,
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -886,7 +886,7 @@ pub mod exports {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -907,7 +907,7 @@ pub mod exports {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -941,7 +941,7 @@ pub mod exports {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1080,13 +1080,13 @@ pub mod exports {
let bytes_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1097,7 +1097,7 @@ pub mod exports {
.get_typed_func::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1105,7 +1105,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1117,7 +1117,7 @@ pub mod exports {
.get_typed_func::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1126,7 +1126,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1139,7 +1139,7 @@ pub mod exports {
.get_typed_func::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1148,7 +1148,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1160,18 +1160,18 @@ pub mod exports {
let nested_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1182,14 +1182,14 @@ pub mod exports {
let list_of_maps = *_instance
.get_typed_func::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1212,17 +1212,17 @@ pub mod exports {
let all_key_types = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1233,13 +1233,13 @@ pub mod exports {
let own_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1249,7 +1249,7 @@ pub mod exports {
let borrowed_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1297,13 +1297,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1312,13 +1312,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1329,12 +1329,12 @@ pub mod exports {
pub fn call_bytes_roundtrip<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1348,7 +1348,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1356,7 +1356,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1367,7 +1367,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1375,7 +1375,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1388,14 +1388,14 @@ pub mod exports {
&self,
mut store: S,
arg0: Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::Result<
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1410,7 +1410,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1419,7 +1419,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1431,7 +1431,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1440,7 +1440,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1454,7 +1454,7 @@ pub mod exports {
&self,
mut store: S,
arg0: Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1462,7 +1462,7 @@ pub mod exports {
>,
) -> wasmtime::Result<
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1478,7 +1478,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1487,7 +1487,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1499,7 +1499,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1508,7 +1508,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1522,7 +1522,7 @@ pub mod exports {
&self,
mut store: S,
arg0: (
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1530,7 +1530,7 @@ pub mod exports {
),
) -> wasmtime::Result<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1545,18 +1545,18 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1566,18 +1566,18 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1589,17 +1589,17 @@ pub mod exports {
pub fn call_nested_roundtrip<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1613,14 +1613,14 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1630,14 +1630,14 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1649,13 +1649,13 @@ pub mod exports {
pub fn call_list_of_maps<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &[std::collections::HashMap<
+ arg0: &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
) -> wasmtime::Result<
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1713,17 +1713,17 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1733,17 +1733,17 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1755,17 +1755,17 @@ pub mod exports {
pub fn call_all_key_types<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<bool, u32>,
- arg1: &std::collections::HashMap<u8, u32>,
- arg2: &std::collections::HashMap<i8, u32>,
- arg3: &std::collections::HashMap<u16, u32>,
- arg4: &std::collections::HashMap<i16, u32>,
- arg5: &std::collections::HashMap<u32, u32>,
- arg6: &std::collections::HashMap<i32, u32>,
- arg7: &std::collections::HashMap<u64, u32>,
- arg8: &std::collections::HashMap<i64, u32>,
- arg9: &std::collections::HashMap<char, u32>,
- arg10: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ arg1: &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ arg2: &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ arg3: &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ arg4: &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ arg5: &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ arg6: &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ arg7: &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ arg8: &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ arg9: &wasmtime::component::__internal::BTreeMap<char, u32>,
+ arg10: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1794,13 +1794,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1809,13 +1809,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1826,12 +1826,12 @@ pub mod exports {
pub fn call_own_values<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1844,7 +1844,7 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1854,7 +1854,7 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1866,7 +1866,7 @@ pub mod exports {
pub fn call_borrowed_values<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
diff --git a/crates/component-macro/tests/expanded/map_async.rs b/crates/component-macro/tests/expanded/map_async.rs
index 52ffe39919..bd4d48eae7 100644
--- a/crates/component-macro/tests/expanded/map_async.rs
+++ b/crates/component-macro/tests/expanded/map_async.rs
@@ -209,7 +209,7 @@ pub mod foo {
HostThing::drop(*self, rep).await
}
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -221,7 +221,7 @@ pub mod foo {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -242,7 +242,7 @@ pub mod foo {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -274,7 +274,7 @@ pub mod foo {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -319,12 +319,12 @@ pub mod foo {
) -> impl ::core::future::Future<Output = IdsByName> + Send;
fn bytes_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -332,14 +332,14 @@ pub mod foo {
fn option_roundtrip(
&mut self,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -348,7 +348,7 @@ pub mod foo {
fn result_roundtrip(
&mut self,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -356,7 +356,7 @@ pub mod foo {
>,
) -> impl ::core::future::Future<
Output = Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -366,7 +366,7 @@ pub mod foo {
fn tuple_roundtrip(
&mut self,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -374,7 +374,7 @@ pub mod foo {
),
) -> impl ::core::future::Future<
Output = (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -383,17 +383,17 @@ pub mod foo {
> + Send;
fn nested_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -402,14 +402,14 @@ pub mod foo {
fn list_of_maps(
&mut self,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -425,36 +425,36 @@ pub mod foo {
) -> impl ::core::future::Future<Output = MapOrString> + Send;
fn all_key_types(
&mut self,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
) -> impl ::core::future::Future<Output = ()> + Send;
fn own_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
> + Send;
fn borrowed_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -469,12 +469,12 @@ pub mod foo {
}
fn bytes_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -484,14 +484,14 @@ pub mod foo {
fn option_roundtrip(
&mut self,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -502,7 +502,7 @@ pub mod foo {
fn result_roundtrip(
&mut self,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -510,7 +510,7 @@ pub mod foo {
>,
) -> impl ::core::future::Future<
Output = Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -522,7 +522,7 @@ pub mod foo {
fn tuple_roundtrip(
&mut self,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -530,7 +530,7 @@ pub mod foo {
),
) -> impl ::core::future::Future<
Output = (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -541,17 +541,17 @@ pub mod foo {
}
fn nested_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -562,14 +562,14 @@ pub mod foo {
fn list_of_maps(
&mut self,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -591,17 +591,17 @@ pub mod foo {
}
fn all_key_types(
&mut self,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -612,12 +612,12 @@ pub mod foo {
}
fn own_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -626,7 +626,7 @@ pub mod foo {
}
fn borrowed_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -678,7 +678,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -699,7 +699,7 @@ pub mod foo {
arg0,
): (
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -721,7 +721,7 @@ pub mod foo {
arg0,
): (
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -744,7 +744,7 @@ pub mod foo {
arg0,
): (
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -766,9 +766,9 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -790,7 +790,7 @@ pub mod foo {
arg0,
): (
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -847,17 +847,17 @@ pub mod foo {
arg9,
arg10,
): (
- std::collections::HashMap<bool, u32>,
- std::collections::HashMap<u8, u32>,
- std::collections::HashMap<i8, u32>,
- std::collections::HashMap<u16, u32>,
- std::collections::HashMap<i16, u32>,
- std::collections::HashMap<u32, u32>,
- std::collections::HashMap<i32, u32>,
- std::collections::HashMap<u64, u32>,
- std::collections::HashMap<i64, u32>,
- std::collections::HashMap<char, u32>,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<bool, u32>,
+ wasmtime::component::__internal::BTreeMap<u8, u32>,
+ wasmtime::component::__internal::BTreeMap<i8, u32>,
+ wasmtime::component::__internal::BTreeMap<u16, u32>,
+ wasmtime::component::__internal::BTreeMap<i16, u32>,
+ wasmtime::component::__internal::BTreeMap<u32, u32>,
+ wasmtime::component::__internal::BTreeMap<i32, u32>,
+ wasmtime::component::__internal::BTreeMap<u64, u32>,
+ wasmtime::component::__internal::BTreeMap<i64, u32>,
+ wasmtime::component::__internal::BTreeMap<char, u32>,
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -891,7 +891,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -911,7 +911,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -952,7 +952,7 @@ pub mod exports {
pub struct GuestThing<'a> {
funcs: &'a Guest,
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -964,7 +964,7 @@ pub mod exports {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -985,7 +985,7 @@ pub mod exports {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1019,7 +1019,7 @@ pub mod exports {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1158,13 +1158,13 @@ pub mod exports {
let bytes_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1175,7 +1175,7 @@ pub mod exports {
.get_typed_func::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1183,7 +1183,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1195,7 +1195,7 @@ pub mod exports {
.get_typed_func::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1204,7 +1204,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1217,7 +1217,7 @@ pub mod exports {
.get_typed_func::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1226,7 +1226,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1238,18 +1238,18 @@ pub mod exports {
let nested_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1260,14 +1260,14 @@ pub mod exports {
let list_of_maps = *_instance
.get_typed_func::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1290,17 +1290,17 @@ pub mod exports {
let all_key_types = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1311,13 +1311,13 @@ pub mod exports {
let own_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1327,7 +1327,7 @@ pub mod exports {
let borrowed_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1380,13 +1380,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1395,13 +1395,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1412,12 +1412,12 @@ pub mod exports {
pub async fn call_bytes_roundtrip<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1436,7 +1436,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1444,7 +1444,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1455,7 +1455,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1463,7 +1463,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1476,14 +1476,14 @@ pub mod exports {
&self,
mut store: S,
arg0: Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::Result<
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1503,7 +1503,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1512,7 +1512,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1524,7 +1524,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1533,7 +1533,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1547,7 +1547,7 @@ pub mod exports {
&self,
mut store: S,
arg0: Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1555,7 +1555,7 @@ pub mod exports {
>,
) -> wasmtime::Result<
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1576,7 +1576,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1585,7 +1585,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1597,7 +1597,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1606,7 +1606,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1620,7 +1620,7 @@ pub mod exports {
&self,
mut store: S,
arg0: (
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1628,7 +1628,7 @@ pub mod exports {
),
) -> wasmtime::Result<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1648,18 +1648,18 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1669,18 +1669,18 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1692,17 +1692,17 @@ pub mod exports {
pub async fn call_nested_roundtrip<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1721,14 +1721,14 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1738,14 +1738,14 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1757,13 +1757,13 @@ pub mod exports {
pub async fn call_list_of_maps<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &[std::collections::HashMap<
+ arg0: &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
) -> wasmtime::Result<
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1836,17 +1836,17 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1856,17 +1856,17 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1878,17 +1878,17 @@ pub mod exports {
pub async fn call_all_key_types<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<bool, u32>,
- arg1: &std::collections::HashMap<u8, u32>,
- arg2: &std::collections::HashMap<i8, u32>,
- arg3: &std::collections::HashMap<u16, u32>,
- arg4: &std::collections::HashMap<i16, u32>,
- arg5: &std::collections::HashMap<u32, u32>,
- arg6: &std::collections::HashMap<i32, u32>,
- arg7: &std::collections::HashMap<u64, u32>,
- arg8: &std::collections::HashMap<i64, u32>,
- arg9: &std::collections::HashMap<char, u32>,
- arg10: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ arg1: &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ arg2: &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ arg3: &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ arg4: &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ arg5: &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ arg6: &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ arg7: &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ arg8: &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ arg9: &wasmtime::component::__internal::BTreeMap<char, u32>,
+ arg10: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1921,13 +1921,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1936,13 +1936,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1953,12 +1953,12 @@ pub mod exports {
pub async fn call_own_values<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1976,7 +1976,7 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1986,7 +1986,7 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1998,7 +1998,7 @@ pub mod exports {
pub async fn call_borrowed_values<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
diff --git a/crates/component-macro/tests/expanded/map_concurrent.rs b/crates/component-macro/tests/expanded/map_concurrent.rs
index ab9706955e..73de493a83 100644
--- a/crates/component-macro/tests/expanded/map_concurrent.rs
+++ b/crates/component-macro/tests/expanded/map_concurrent.rs
@@ -200,7 +200,7 @@ pub mod foo {
}
pub trait HostThing {}
impl<_T: HostThing + ?Sized + Send> HostThing for &mut _T {}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -212,7 +212,7 @@ pub mod foo {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -233,7 +233,7 @@ pub mod foo {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -265,7 +265,7 @@ pub mod foo {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -305,12 +305,12 @@ pub mod foo {
) -> impl ::core::future::Future<Output = IdsByName> + Send;
fn bytes_roundtrip(
host: wasmtime::component::Access<T, Self>,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -318,14 +318,14 @@ pub mod foo {
fn option_roundtrip(
host: wasmtime::component::Access<T, Self>,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -334,7 +334,7 @@ pub mod foo {
fn result_roundtrip(
host: wasmtime::component::Access<T, Self>,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -342,7 +342,7 @@ pub mod foo {
>,
) -> impl ::core::future::Future<
Output = Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -352,7 +352,7 @@ pub mod foo {
fn tuple_roundtrip(
host: wasmtime::component::Access<T, Self>,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -360,7 +360,7 @@ pub mod foo {
),
) -> impl ::core::future::Future<
Output = (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -369,17 +369,17 @@ pub mod foo {
> + Send;
fn nested_roundtrip(
host: wasmtime::component::Access<T, Self>,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -388,14 +388,14 @@ pub mod foo {
fn list_of_maps(
host: wasmtime::component::Access<T, Self>,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -411,36 +411,36 @@ pub mod foo {
) -> impl ::core::future::Future<Output = MapOrString> + Send;
fn all_key_types(
host: wasmtime::component::Access<T, Self>,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
) -> impl ::core::future::Future<Output = ()> + Send;
fn own_values(
host: wasmtime::component::Access<T, Self>,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
> + Send;
fn borrowed_values(
host: wasmtime::component::Access<T, Self>,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -502,7 +502,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -530,7 +530,7 @@ pub mod foo {
arg0,
): (
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -559,7 +559,7 @@ pub mod foo {
arg0,
): (
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -589,7 +589,7 @@ pub mod foo {
arg0,
): (
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -618,9 +618,9 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -649,7 +649,7 @@ pub mod foo {
arg0,
): (
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -729,17 +729,17 @@ pub mod foo {
arg9,
arg10,
): (
- std::collections::HashMap<bool, u32>,
- std::collections::HashMap<u8, u32>,
- std::collections::HashMap<i8, u32>,
- std::collections::HashMap<u16, u32>,
- std::collections::HashMap<i16, u32>,
- std::collections::HashMap<u32, u32>,
- std::collections::HashMap<i32, u32>,
- std::collections::HashMap<u64, u32>,
- std::collections::HashMap<i64, u32>,
- std::collections::HashMap<char, u32>,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<bool, u32>,
+ wasmtime::component::__internal::BTreeMap<u8, u32>,
+ wasmtime::component::__internal::BTreeMap<i8, u32>,
+ wasmtime::component::__internal::BTreeMap<u16, u32>,
+ wasmtime::component::__internal::BTreeMap<i16, u32>,
+ wasmtime::component::__internal::BTreeMap<u32, u32>,
+ wasmtime::component::__internal::BTreeMap<i32, u32>,
+ wasmtime::component::__internal::BTreeMap<u64, u32>,
+ wasmtime::component::__internal::BTreeMap<i64, u32>,
+ wasmtime::component::__internal::BTreeMap<char, u32>,
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -781,7 +781,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -808,7 +808,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -856,7 +856,7 @@ pub mod exports {
pub struct GuestThing<'a> {
funcs: &'a Guest,
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -868,7 +868,7 @@ pub mod exports {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -889,7 +889,7 @@ pub mod exports {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -923,7 +923,7 @@ pub mod exports {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1062,13 +1062,13 @@ pub mod exports {
let bytes_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1079,7 +1079,7 @@ pub mod exports {
.get_typed_func::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1087,7 +1087,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1099,7 +1099,7 @@ pub mod exports {
.get_typed_func::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1108,7 +1108,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1121,7 +1121,7 @@ pub mod exports {
.get_typed_func::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1130,7 +1130,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1142,18 +1142,18 @@ pub mod exports {
let nested_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1164,14 +1164,14 @@ pub mod exports {
let list_of_maps = *_instance
.get_typed_func::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1194,17 +1194,17 @@ pub mod exports {
let all_key_types = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1215,13 +1215,13 @@ pub mod exports {
let own_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1231,7 +1231,7 @@ pub mod exports {
let borrowed_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1283,13 +1283,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1298,13 +1298,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1315,12 +1315,12 @@ pub mod exports {
pub async fn call_bytes_roundtrip<_T, _D>(
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
- arg0: std::collections::HashMap<
+ arg0: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1338,7 +1338,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1346,7 +1346,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1357,7 +1357,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1365,7 +1365,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1378,14 +1378,14 @@ pub mod exports {
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
arg0: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::Result<
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1404,7 +1404,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1413,7 +1413,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1425,7 +1425,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1434,7 +1434,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1448,7 +1448,7 @@ pub mod exports {
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
arg0: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1456,7 +1456,7 @@ pub mod exports {
>,
) -> wasmtime::Result<
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1476,7 +1476,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1485,7 +1485,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1497,7 +1497,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1506,7 +1506,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1520,7 +1520,7 @@ pub mod exports {
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
arg0: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1528,7 +1528,7 @@ pub mod exports {
),
) -> wasmtime::Result<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1547,18 +1547,18 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1568,18 +1568,18 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1591,17 +1591,17 @@ pub mod exports {
pub async fn call_nested_roundtrip<_T, _D>(
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
- arg0: std::collections::HashMap<
+ arg0: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1620,7 +1620,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1628,7 +1628,7 @@ pub mod exports {
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1639,7 +1639,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1647,7 +1647,7 @@ pub mod exports {
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1660,14 +1660,14 @@ pub mod exports {
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
arg0: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::Result<
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1734,17 +1734,17 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- std::collections::HashMap<bool, u32>,
- std::collections::HashMap<u8, u32>,
- std::collections::HashMap<i8, u32>,
- std::collections::HashMap<u16, u32>,
- std::collections::HashMap<i16, u32>,
- std::collections::HashMap<u32, u32>,
- std::collections::HashMap<i32, u32>,
- std::collections::HashMap<u64, u32>,
- std::collections::HashMap<i64, u32>,
- std::collections::HashMap<char, u32>,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<bool, u32>,
+ wasmtime::component::__internal::BTreeMap<u8, u32>,
+ wasmtime::component::__internal::BTreeMap<i8, u32>,
+ wasmtime::component::__internal::BTreeMap<u16, u32>,
+ wasmtime::component::__internal::BTreeMap<i16, u32>,
+ wasmtime::component::__internal::BTreeMap<u32, u32>,
+ wasmtime::component::__internal::BTreeMap<i32, u32>,
+ wasmtime::component::__internal::BTreeMap<u64, u32>,
+ wasmtime::component::__internal::BTreeMap<i64, u32>,
+ wasmtime::component::__internal::BTreeMap<char, u32>,
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1754,17 +1754,17 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- std::collections::HashMap<bool, u32>,
- std::collections::HashMap<u8, u32>,
- std::collections::HashMap<i8, u32>,
- std::collections::HashMap<u16, u32>,
- std::collections::HashMap<i16, u32>,
- std::collections::HashMap<u32, u32>,
- std::collections::HashMap<i32, u32>,
- std::collections::HashMap<u64, u32>,
- std::collections::HashMap<i64, u32>,
- std::collections::HashMap<char, u32>,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<bool, u32>,
+ wasmtime::component::__internal::BTreeMap<u8, u32>,
+ wasmtime::component::__internal::BTreeMap<i8, u32>,
+ wasmtime::component::__internal::BTreeMap<u16, u32>,
+ wasmtime::component::__internal::BTreeMap<i16, u32>,
+ wasmtime::component::__internal::BTreeMap<u32, u32>,
+ wasmtime::component::__internal::BTreeMap<i32, u32>,
+ wasmtime::component::__internal::BTreeMap<u64, u32>,
+ wasmtime::component::__internal::BTreeMap<i64, u32>,
+ wasmtime::component::__internal::BTreeMap<char, u32>,
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1776,17 +1776,17 @@ pub mod exports {
pub async fn call_all_key_types<_T, _D>(
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
- arg0: std::collections::HashMap<bool, u32>,
- arg1: std::collections::HashMap<u8, u32>,
- arg2: std::collections::HashMap<i8, u32>,
- arg3: std::collections::HashMap<u16, u32>,
- arg4: std::collections::HashMap<i16, u32>,
- arg5: std::collections::HashMap<u32, u32>,
- arg6: std::collections::HashMap<i32, u32>,
- arg7: std::collections::HashMap<u64, u32>,
- arg8: std::collections::HashMap<i64, u32>,
- arg9: std::collections::HashMap<char, u32>,
- arg10: std::collections::HashMap<
+ arg0: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ arg1: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ arg2: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ arg3: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ arg4: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ arg5: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ arg6: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ arg7: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ arg8: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ arg9: wasmtime::component::__internal::BTreeMap<char, u32>,
+ arg10: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1820,13 +1820,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1835,13 +1835,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1852,12 +1852,12 @@ pub mod exports {
pub async fn call_own_values<_T, _D>(
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
- arg0: std::collections::HashMap<
+ arg0: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1874,7 +1874,7 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1884,7 +1884,7 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1896,7 +1896,7 @@ pub mod exports {
pub async fn call_borrowed_values<_T, _D>(
&self,
accessor: &wasmtime::component::Accessor<_T, _D>,
- arg0: std::collections::HashMap<
+ arg0: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
diff --git a/crates/component-macro/tests/expanded/map_tracing_async.rs b/crates/component-macro/tests/expanded/map_tracing_async.rs
index 194c78503d..79c4b35163 100644
--- a/crates/component-macro/tests/expanded/map_tracing_async.rs
+++ b/crates/component-macro/tests/expanded/map_tracing_async.rs
@@ -209,7 +209,7 @@ pub mod foo {
HostThing::drop(*self, rep).await
}
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -221,7 +221,7 @@ pub mod foo {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -242,7 +242,7 @@ pub mod foo {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -274,7 +274,7 @@ pub mod foo {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -319,12 +319,12 @@ pub mod foo {
) -> impl ::core::future::Future<Output = IdsByName> + Send;
fn bytes_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -332,14 +332,14 @@ pub mod foo {
fn option_roundtrip(
&mut self,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -348,7 +348,7 @@ pub mod foo {
fn result_roundtrip(
&mut self,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -356,7 +356,7 @@ pub mod foo {
>,
) -> impl ::core::future::Future<
Output = Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -366,7 +366,7 @@ pub mod foo {
fn tuple_roundtrip(
&mut self,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -374,7 +374,7 @@ pub mod foo {
),
) -> impl ::core::future::Future<
Output = (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -383,17 +383,17 @@ pub mod foo {
> + Send;
fn nested_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -402,14 +402,14 @@ pub mod foo {
fn list_of_maps(
&mut self,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -425,36 +425,36 @@ pub mod foo {
) -> impl ::core::future::Future<Output = MapOrString> + Send;
fn all_key_types(
&mut self,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
) -> impl ::core::future::Future<Output = ()> + Send;
fn own_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
> + Send;
fn borrowed_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -469,12 +469,12 @@ pub mod foo {
}
fn bytes_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -484,14 +484,14 @@ pub mod foo {
fn option_roundtrip(
&mut self,
a: Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -502,7 +502,7 @@ pub mod foo {
fn result_roundtrip(
&mut self,
a: Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -510,7 +510,7 @@ pub mod foo {
>,
) -> impl ::core::future::Future<
Output = Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -522,7 +522,7 @@ pub mod foo {
fn tuple_roundtrip(
&mut self,
a: (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -530,7 +530,7 @@ pub mod foo {
),
) -> impl ::core::future::Future<
Output = (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -541,17 +541,17 @@ pub mod foo {
}
fn nested_roundtrip(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -562,14 +562,14 @@ pub mod foo {
fn list_of_maps(
&mut self,
a: wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> impl ::core::future::Future<
Output = wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -591,17 +591,17 @@ pub mod foo {
}
fn all_key_types(
&mut self,
- a: std::collections::HashMap<bool, u32>,
- b: std::collections::HashMap<u8, u32>,
- c: std::collections::HashMap<i8, u32>,
- d: std::collections::HashMap<u16, u32>,
- e: std::collections::HashMap<i16, u32>,
- f: std::collections::HashMap<u32, u32>,
- g: std::collections::HashMap<i32, u32>,
- h: std::collections::HashMap<u64, u32>,
- i: std::collections::HashMap<i64, u32>,
- j: std::collections::HashMap<char, u32>,
- k: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<bool, u32>,
+ b: wasmtime::component::__internal::BTreeMap<u8, u32>,
+ c: wasmtime::component::__internal::BTreeMap<i8, u32>,
+ d: wasmtime::component::__internal::BTreeMap<u16, u32>,
+ e: wasmtime::component::__internal::BTreeMap<i16, u32>,
+ f: wasmtime::component::__internal::BTreeMap<u32, u32>,
+ g: wasmtime::component::__internal::BTreeMap<i32, u32>,
+ h: wasmtime::component::__internal::BTreeMap<u64, u32>,
+ i: wasmtime::component::__internal::BTreeMap<i64, u32>,
+ j: wasmtime::component::__internal::BTreeMap<char, u32>,
+ k: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -612,12 +612,12 @@ pub mod foo {
}
fn own_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
) -> impl ::core::future::Future<
- Output = std::collections::HashMap<
+ Output = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -626,7 +626,7 @@ pub mod foo {
}
fn borrowed_values(
&mut self,
- a: std::collections::HashMap<
+ a: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -694,7 +694,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -731,7 +731,7 @@ pub mod foo {
arg0,
): (
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -769,7 +769,7 @@ pub mod foo {
arg0,
): (
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -808,7 +808,7 @@ pub mod foo {
arg0,
): (
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -846,9 +846,9 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -886,7 +886,7 @@ pub mod foo {
arg0,
): (
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -991,17 +991,17 @@ pub mod foo {
arg9,
arg10,
): (
- std::collections::HashMap<bool, u32>,
- std::collections::HashMap<u8, u32>,
- std::collections::HashMap<i8, u32>,
- std::collections::HashMap<u16, u32>,
- std::collections::HashMap<i16, u32>,
- std::collections::HashMap<u32, u32>,
- std::collections::HashMap<i32, u32>,
- std::collections::HashMap<u64, u32>,
- std::collections::HashMap<i64, u32>,
- std::collections::HashMap<char, u32>,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<bool, u32>,
+ wasmtime::component::__internal::BTreeMap<u8, u32>,
+ wasmtime::component::__internal::BTreeMap<i8, u32>,
+ wasmtime::component::__internal::BTreeMap<u16, u32>,
+ wasmtime::component::__internal::BTreeMap<i16, u32>,
+ wasmtime::component::__internal::BTreeMap<u32, u32>,
+ wasmtime::component::__internal::BTreeMap<i32, u32>,
+ wasmtime::component::__internal::BTreeMap<u64, u32>,
+ wasmtime::component::__internal::BTreeMap<i64, u32>,
+ wasmtime::component::__internal::BTreeMap<char, u32>,
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1060,7 +1060,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -1096,7 +1096,7 @@ pub mod foo {
(
arg0,
): (
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::Resource<Thing>,
>,
@@ -1153,7 +1153,7 @@ pub mod exports {
pub struct GuestThing<'a> {
funcs: &'a Guest,
}
- pub type NamesById = std::collections::HashMap<
+ pub type NamesById = wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>;
@@ -1165,7 +1165,7 @@ pub mod exports {
4 == < NamesById as wasmtime::component::ComponentType >::ALIGN32
);
};
- pub type IdsByName = std::collections::HashMap<
+ pub type IdsByName = wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>;
@@ -1186,7 +1186,7 @@ pub mod exports {
#[component(name = "label")]
pub label: wasmtime::component::__internal::String,
#[component(name = "values")]
- pub values: std::collections::HashMap<
+ pub values: wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1220,7 +1220,7 @@ pub mod exports {
pub enum MapOrString {
#[component(name = "as-map")]
AsMap(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1359,13 +1359,13 @@ pub mod exports {
let bytes_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1376,7 +1376,7 @@ pub mod exports {
.get_typed_func::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1384,7 +1384,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1396,7 +1396,7 @@ pub mod exports {
.get_typed_func::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1405,7 +1405,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1418,7 +1418,7 @@ pub mod exports {
.get_typed_func::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1427,7 +1427,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1439,18 +1439,18 @@ pub mod exports {
let nested_roundtrip = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1461,14 +1461,14 @@ pub mod exports {
let list_of_maps = *_instance
.get_typed_func::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1491,17 +1491,17 @@ pub mod exports {
let all_key_types = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1512,13 +1512,13 @@ pub mod exports {
let own_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1528,7 +1528,7 @@ pub mod exports {
let borrowed_values = *_instance
.get_typed_func::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -1587,13 +1587,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1602,13 +1602,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1619,12 +1619,12 @@ pub mod exports {
pub async fn call_bytes_roundtrip<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::__internal::Vec<u8>,
>,
@@ -1649,7 +1649,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1657,7 +1657,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1668,7 +1668,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1676,7 +1676,7 @@ pub mod exports {
),
(
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1689,14 +1689,14 @@ pub mod exports {
&self,
mut store: S,
arg0: Option<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
>,
) -> wasmtime::Result<
Option<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1722,7 +1722,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1731,7 +1731,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1743,7 +1743,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1752,7 +1752,7 @@ pub mod exports {
),
(
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1766,7 +1766,7 @@ pub mod exports {
&self,
mut store: S,
arg0: Result<
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1774,7 +1774,7 @@ pub mod exports {
>,
) -> wasmtime::Result<
Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1801,7 +1801,7 @@ pub mod exports {
) -> wasmtime::component::TypedFunc<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1810,7 +1810,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1822,7 +1822,7 @@ pub mod exports {
wasmtime::component::TypedFunc::<
(
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1831,7 +1831,7 @@ pub mod exports {
),
(
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1845,7 +1845,7 @@ pub mod exports {
&self,
mut store: S,
arg0: (
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1853,7 +1853,7 @@ pub mod exports {
),
) -> wasmtime::Result<
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1879,18 +1879,18 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1900,18 +1900,18 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1923,17 +1923,17 @@ pub mod exports {
pub async fn call_nested_roundtrip<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
u32,
wasmtime::component::__internal::String,
>,
@@ -1958,14 +1958,14 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1975,14 +1975,14 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &[std::collections::HashMap<
+ &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
),
(
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -1994,13 +1994,13 @@ pub mod exports {
pub async fn call_list_of_maps<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &[std::collections::HashMap<
+ arg0: &[wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>],
) -> wasmtime::Result<
wasmtime::component::__internal::Vec<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -2091,17 +2091,17 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -2111,17 +2111,17 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<bool, u32>,
- &std::collections::HashMap<u8, u32>,
- &std::collections::HashMap<i8, u32>,
- &std::collections::HashMap<u16, u32>,
- &std::collections::HashMap<i16, u32>,
- &std::collections::HashMap<u32, u32>,
- &std::collections::HashMap<i32, u32>,
- &std::collections::HashMap<u64, u32>,
- &std::collections::HashMap<i64, u32>,
- &std::collections::HashMap<char, u32>,
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ &wasmtime::component::__internal::BTreeMap<char, u32>,
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -2133,17 +2133,17 @@ pub mod exports {
pub async fn call_all_key_types<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<bool, u32>,
- arg1: &std::collections::HashMap<u8, u32>,
- arg2: &std::collections::HashMap<i8, u32>,
- arg3: &std::collections::HashMap<u16, u32>,
- arg4: &std::collections::HashMap<i16, u32>,
- arg5: &std::collections::HashMap<u32, u32>,
- arg6: &std::collections::HashMap<i32, u32>,
- arg7: &std::collections::HashMap<u64, u32>,
- arg8: &std::collections::HashMap<i64, u32>,
- arg9: &std::collections::HashMap<char, u32>,
- arg10: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<bool, u32>,
+ arg1: &wasmtime::component::__internal::BTreeMap<u8, u32>,
+ arg2: &wasmtime::component::__internal::BTreeMap<i8, u32>,
+ arg3: &wasmtime::component::__internal::BTreeMap<u16, u32>,
+ arg4: &wasmtime::component::__internal::BTreeMap<i16, u32>,
+ arg5: &wasmtime::component::__internal::BTreeMap<u32, u32>,
+ arg6: &wasmtime::component::__internal::BTreeMap<i32, u32>,
+ arg7: &wasmtime::component::__internal::BTreeMap<u64, u32>,
+ arg8: &wasmtime::component::__internal::BTreeMap<i64, u32>,
+ arg9: &wasmtime::component::__internal::BTreeMap<char, u32>,
+ arg10: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
u32,
>,
@@ -2182,13 +2182,13 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -2197,13 +2197,13 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
),
(
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -2214,12 +2214,12 @@ pub mod exports {
pub async fn call_own_values<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
) -> wasmtime::Result<
- std::collections::HashMap<
+ wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -2243,7 +2243,7 @@ pub mod exports {
&self,
) -> wasmtime::component::TypedFunc<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -2253,7 +2253,7 @@ pub mod exports {
unsafe {
wasmtime::component::TypedFunc::<
(
- &std::collections::HashMap<
+ &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
@@ -2265,7 +2265,7 @@ pub mod exports {
pub async fn call_borrowed_values<S: wasmtime::AsContextMut>(
&self,
mut store: S,
- arg0: &std::collections::HashMap<
+ arg0: &wasmtime::component::__internal::BTreeMap<
wasmtime::component::__internal::String,
wasmtime::component::ResourceAny,
>,
diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml
index 5639b55088..d93b8809a4 100644
--- a/crates/wasmtime/Cargo.toml
+++ b/crates/wasmtime/Cargo.toml
@@ -53,6 +53,7 @@ bumpalo = { workspace = true }
fxprof-processed-profile = { version = "0.8.1", optional = true }
gimli = { workspace = true, optional = true }
addr2line = { workspace = true, optional = true }
+indexmap = { workspace = true, optional = true }
semver = { workspace = true, optional = true }
smallvec = { workspace = true, optional = true }
bitflags = { workspace = true }
@@ -233,6 +234,7 @@ component-model = [
"dep:wasmtime-component-util",
"dep:encoding_rs",
"dep:semver",
+ "dep:indexmap",
]
wmemcheck = [
diff --git a/crates/wasmtime/src/runtime/component/func/typed.rs b/crates/wasmtime/src/runtime/component/func/typed.rs
index e936d0f143..abbdfc9dae 100644
--- a/crates/wasmtime/src/runtime/component/func/typed.rs
+++ b/crates/wasmtime/src/runtime/component/func/typed.rs
@@ -6,12 +6,14 @@ use crate::hash_map::HashMap;
use crate::prelude::*;
use crate::{AsContextMut, StoreContext, StoreContextMut, ValRaw};
use alloc::borrow::Cow;
+use alloc::collections::BTreeMap;
use core::fmt;
-use core::hash::Hash;
+use core::hash::{BuildHasher, Hash};
use core::iter;
use core::marker;
use core::mem::{self, MaybeUninit};
use core::str;
+use indexmap::IndexMap;
use wasmtime_core::array::array_try_from_fn;
use wasmtime_environ::component::{
CanonicalAbiInfo, ComponentTypes, InterfaceType, MAX_FLAT_PARAMS, MAX_FLAT_RESULTS,
@@ -421,7 +423,7 @@ pub unsafe trait ComponentNamedList: ComponentType {}
/// | `result<T, E>` | `Result<T, E>` |
/// | `string` | `String`, `&str`, or [`WasmStr`] |
/// | `list<T>` | `Vec<T>`, `&[T]`, or [`WasmList`] |
-/// | `map<K, V>` | `HashMap<K, V>` |
+/// | `map<K, V>` | `HashMap<K, V, S>`, `BTreeMap<K, V>`, or `IndexMap<K, V, S>` |
/// | `own<T>`, `borrow<T>` | [`Resource<T>`] or [`ResourceAny`] |
/// | `record` | [`#[derive(ComponentType)]`][d-cm] |
/// | `variant` | [`#[derive(ComponentType)]`][d-cm] |
@@ -443,8 +445,8 @@ pub unsafe trait ComponentNamedList: ComponentType {}
/// those types are often generated by the
/// [`bindgen!`](crate::component::bindgen) macro from WIT definitions.
///
-/// Lifting a `map<K, V>` into a `HashMap<K, V>` keeps only the last value for
-/// each duplicate key. Use [`Val::Map`] to see every entry in order instead.
+/// Lifting a `map<K, V>` keeps only the last value for each duplicate key. Use
+/// [`Val::Map`] to see every entry in order instead.
///
/// Types that implement [`ComponentType`] are used for `Params` and `Return`
/// in [`TypedFunc`] and [`Func::typed`].
@@ -1953,7 +1955,7 @@ unsafe impl<T: Lift> Lift for WasmList<T> {
}
// =============================================================================
-// HashMap<K, V> support for component model `map<K, V>`
+// Support for component model `map<K, V>`
//
// Maps are represented as `list<tuple<K, V>>` in the canonical ABI, so the
// lowered form is a (pointer, length) pair just like lists.
@@ -1965,7 +1967,7 @@ fn map_abi<'a>(ty: InterfaceType, types: &'a ComponentTypes) -> &'a TypeMap {
}
}
-unsafe impl<K, V> ComponentType for HashMap<K, V>
+unsafe impl<K, V> ComponentType for BTreeMap<K, V>
where
K: ComponentType,
V: ComponentType,
@@ -1975,52 +1977,68 @@ where
const ABI: CanonicalAbiInfo = CanonicalAbiInfo::POINTER_PAIR;
fn typecheck(ty: &InterfaceType, types: &InstanceType<'_>) -> Result<()> {
- TryHashMap::<K, V>::typecheck(ty, types)
+ match ty {
+ InterfaceType::Map(t) => {
+ let map_ty = &types.types[*t];
+ K::typecheck(&map_ty.key, types)?;
+ V::typecheck(&map_ty.value, types)?;
+ Ok(())
+ }
+ other => bail!("expected `map` found `{}`", desc(other)),
+ }
}
}
-unsafe impl<K, V> Lower for HashMap<K, V>
-where
- K: Lower,
- V: Lower,
-{
- fn linear_lower_to_flat<U>(
- &self,
- cx: &mut LowerContext<'_, U>,
- ty: InterfaceType,
- dst: &mut MaybeUninit<[ValRaw; 2]>,
- ) -> Result<()> {
- let map = map_abi(ty, &cx.types);
- let (ptr, len) = lower_map_iter(cx, map, self.len(), self.iter())?;
- lower_pointer_pair_to_flat(cx, dst, ptr, len);
- Ok(())
- }
+// All map types have the same representation as `BTreeMap`.
+forward_type_impls! {
+ (K: ComponentType, V: ComponentType, S: Send + Sync) HashMap<K, V, S> => BTreeMap<K, V>,
+ (K: ComponentType, V: ComponentType, S: Send + Sync) TryHashMap<K, V, S> => BTreeMap<K, V>,
+ (K: ComponentType, V: ComponentType, S: Send + Sync) IndexMap<K, V, S> => BTreeMap<K, V>,
+}
- fn linear_lower_to_memory<U>(
- &self,
- cx: &mut LowerContext<'_, U>,
- ty: InterfaceType,
- offset: usize,
- ) -> Result<()> {
- let map = map_abi(ty, &cx.types);
- debug_assert!(offset % (CanonicalAbiInfo::POINTER_PAIR.align32 as usize) == 0);
- let (ptr, len) = lower_map_iter(cx, map, self.len(), self.iter())?;
- lower_pointer_pair_to_memory(cx, offset, ptr, len);
- Ok(())
- }
+macro_rules! map_lowers {
+ ($(($($generics:tt)*) $a:ty,)*) => ($(
+ unsafe impl <$($generics)*> Lower for $a {
+ fn linear_lower_to_flat<U>(
+ &self,
+ cx: &mut LowerContext<'_, U>,
+ ty: InterfaceType,
+ dst: &mut MaybeUninit<[ValRaw; 2]>,
+ ) -> Result<()> {
+ lower_map_to_flat(cx, ty, dst, self.iter())
+ }
+
+ fn linear_lower_to_memory<U>(
+ &self,
+ cx: &mut LowerContext<'_, U>,
+ ty: InterfaceType,
+ offset: usize,
+ ) -> Result<()> {
+ lower_map_to_memory(cx, ty, offset, self.iter())
+ }
+ }
+ )*)
}
-unsafe impl<K, V> Lift for HashMap<K, V>
+map_lowers! {
+ (K: Lower, V: Lower, S: Send + Sync) HashMap<K, V, S>,
+ (K: Lower, V: Lower, S: Send + Sync) TryHashMap<K, V, S>,
+ (K: Lower, V: Lower) BTreeMap<K, V>,
+ (K: Lower, V: Lower, S: Send + Sync) IndexMap<K, V, S>,
+}
+
+unsafe impl<K, V, S> Lift for HashMap<K, V, S>
where
K: Lift + Eq + Hash,
V: Lift,
+ S: BuildHasher + Default + Send + Sync,
{
fn linear_lift_from_flat(
cx: &mut LiftContext<'_>,
ty: InterfaceType,
src: &Self::Lower,
) -> Result<Self> {
- Ok(TryHashMap::<K, V>::linear_lift_from_flat(cx, ty, src)?.into())
+ Ok(TryHashMap::<K, V, S>::linear_lift_from_flat(cx, ty, src)?.into())
}
fn linear_lift_from_memory(
@@ -2028,27 +2046,91 @@ where
ty: InterfaceType,
bytes: &[u8],
) -> Result<Self> {
- Ok(TryHashMap::<K, V>::linear_lift_from_memory(cx, ty, bytes)?.into())
+ Ok(TryHashMap::<K, V, S>::linear_lift_from_memory(cx, ty, bytes)?.into())
}
}
+macro_rules! map_lifts {
+ ($(($($generics:tt)*) $a:ty,)*) => ($(
+ unsafe impl <$($generics)*> Lift for $a {
+ fn linear_lift_from_flat(
+ cx: &mut LiftContext<'_>,
+ ty: InterfaceType,
+ src: &Self::Lower,
+ ) -> Result<Self> {
+ let (ptr, len) = lift_pointer_pair_from_flat(cx, src)?;
+ lift_map(cx, ty, ptr, len)
+ }
+
+ fn linear_lift_from_memory(
+ cx: &mut LiftContext<'_>,
+ ty: InterfaceType,
+ bytes: &[u8],
+ ) -> Result<Self> {
+ debug_assert!((bytes.as_ptr() as usize) % (Self::ALIGN32 as usize) == 0);
+ let (ptr, len) = lift_pointer_pair_from_memory(cx, bytes)?;
+ lift_map(cx, ty, ptr, len)
+ }
+ }
+ )*)
+}
+
+map_lifts! {
+ (K: Lift + Eq + Hash, V: Lift, S: BuildHasher + Default + Send + Sync) TryHashMap<K, V, S>,
+ (K: Lift + Ord, V: Lift) BTreeMap<K, V>,
+ (K: Lift + Eq + Hash, V: Lift, S: BuildHasher + Default + Send + Sync) IndexMap<K, V, S>,
+}
+
+fn lower_map_to_flat<'a, K, V, U>(
+ cx: &mut LowerContext<'_, U>,
+ ty: InterfaceType,
+ dst: &mut MaybeUninit<[ValRaw; 2]>,
+ entries: impl ExactSizeIterator<Item = (&'a K, &'a V)>,
+) -> Result<()>
+where
+ K: Lower + 'a,
+ V: Lower + 'a,
+{
+ let map = map_abi(ty, &cx.types);
+ let (ptr, len) = lower_map_iter(cx, map, entries)?;
+ lower_pointer_pair_to_flat(cx, dst, ptr, len);
+ Ok(())
+}
+
+fn lower_map_to_memory<'a, K, V, U>(
+ cx: &mut LowerContext<'_, U>,
+ ty: InterfaceType,
+ offset: usize,
+ entries: impl ExactSizeIterator<Item = (&'a K, &'a V)>,
+) -> Result<()>
+where
+ K: Lower + 'a,
+ V: Lower + 'a,
+{
+ let map = map_abi(ty, &cx.types);
+ debug_assert!(offset % (CanonicalAbiInfo::POINTER_PAIR.align32 as usize) == 0);
+ let (ptr, len) = lower_map_iter(cx, map, entries)?;
+ lower_pointer_pair_to_memory(cx, offset, ptr, len);
+ Ok(())
+}
+
fn lower_map_iter<'a, K, V, U>(
cx: &mut LowerContext<'_, U>,
map: &TypeMap,
- len: usize,
- iter: impl Iterator<Item = (&'a K, &'a V)>,
+ entries: impl ExactSizeIterator<Item = (&'a K, &'a V)>,
) -> Result<(usize, usize)>
where
K: Lower + 'a,
V: Lower + 'a,
{
+ let len = entries.len();
let size = len
.checked_mul(usize::try_from(map.entry_abi.size32)?)
.ok_or_else(|| format_err!("size overflow copying a map"))?;
let ptr = cx.realloc(0, 0, map.entry_abi.align32, size)?;
let mut entry_offset = ptr;
- for (key, value) in iter {
+ for (key, value) in entries {
// Keys are the first field in each entry tuple.
<K as Lower>::linear_lower_to_memory(key, cx, map.key, entry_offset)?;
// Values start at the precomputed value offset within the tuple.
@@ -2064,96 +2146,75 @@ where
Ok((ptr, len))
}
-unsafe impl<K, V> ComponentType for TryHashMap<K, V>
+/// Helper trait for the Rust types that a `map<K, V>` can be lifted into.
+trait LiftMap<K, V>: Sized {
+ /// Creates an empty map with room for `len` entries.
+ fn with_capacity(len: usize) -> Result<Self>;
+
+ /// Adds an entry, replacing any previous value for `key`.
+ fn push(&mut self, key: K, value: V) -> Result<()>;
+}
+
+impl<K, V, S> LiftMap<K, V> for TryHashMap<K, V, S>
where
- K: ComponentType,
- V: ComponentType,
+ K: Eq + Hash,
+ S: BuildHasher + Default,
{
- type Lower = [ValRaw; 2];
-
- const ABI: CanonicalAbiInfo = CanonicalAbiInfo::POINTER_PAIR;
+ fn with_capacity(len: usize) -> Result<Self> {
+ Ok(TryHashMap::with_capacity_and_hasher(len, S::default())?)
+ }
- fn typecheck(ty: &InterfaceType, types: &InstanceType<'_>) -> Result<()> {
- match ty {
- InterfaceType::Map(t) => {
- let map_ty = &types.types[*t];
- K::typecheck(&map_ty.key, types)?;
- V::typecheck(&map_ty.value, types)?;
- Ok(())
- }
- other => bail!("expected `map` found `{}`", desc(other)),
- }
+ fn push(&mut self, key: K, value: V) -> Result<()> {
+ self.insert(key, value)?;
+ Ok(())
}
}
-unsafe impl<K, V> Lower for TryHashMap<K, V>
+impl<K, V> LiftMap<K, V> for BTreeMap<K, V>
where
- K: Lower,
- V: Lower,
+ K: Ord,
{
- fn linear_lower_to_flat<U>(
- &self,
- cx: &mut LowerContext<'_, U>,
- ty: InterfaceType,
- dst: &mut MaybeUninit<[ValRaw; 2]>,
- ) -> Result<()> {
- let map = map_abi(ty, &cx.types);
- let (ptr, len) = lower_map_iter(cx, map, self.len(), self.iter())?;
- lower_pointer_pair_to_flat(cx, dst, ptr, len);
- Ok(())
+ fn with_capacity(_len: usize) -> Result<Self> {
+ Ok(BTreeMap::new())
}
- fn linear_lower_to_memory<U>(
- &self,
- cx: &mut LowerContext<'_, U>,
- ty: InterfaceType,
- offset: usize,
- ) -> Result<()> {
- let map = map_abi(ty, &cx.types);
- debug_assert!(offset % (CanonicalAbiInfo::POINTER_PAIR.align32 as usize) == 0);
- let (ptr, len) = lower_map_iter(cx, map, self.len(), self.iter())?;
- lower_pointer_pair_to_memory(cx, offset, ptr, len);
+ fn push(&mut self, key: K, value: V) -> Result<()> {
+ self.insert(key, value);
Ok(())
}
}
-unsafe impl<K, V> Lift for TryHashMap<K, V>
+impl<K, V, S> LiftMap<K, V> for IndexMap<K, V, S>
where
- K: Lift + Eq + Hash,
- V: Lift,
+ K: Eq + Hash,
+ S: BuildHasher + Default,
{
- fn linear_lift_from_flat(
- cx: &mut LiftContext<'_>,
- ty: InterfaceType,
- src: &Self::Lower,
- ) -> Result<Self> {
- let map = map_abi(ty, &cx.types);
- let (ptr, len) = lift_pointer_pair_from_flat(cx, src)?;
- lift_try_map(cx, map, ptr, len)
+ fn with_capacity(len: usize) -> Result<Self> {
+ let mut map = IndexMap::with_hasher(S::default());
+ map.try_reserve(len)
+ .map_err(|_| OutOfMemory::new(len.saturating_mul(mem::size_of::<(K, V)>())))?;
+ Ok(map)
}
- fn linear_lift_from_memory(
- cx: &mut LiftContext<'_>,
- ty: InterfaceType,
- bytes: &[u8],
- ) -> Result<Self> {
- let map = map_abi(ty, &cx.types);
- debug_assert!((bytes.as_ptr() as usize) % (Self::ALIGN32 as usize) == 0);
- let (ptr, len) = lift_pointer_pair_from_memory(cx, bytes)?;
- lift_try_map(cx, map, ptr, len)
+ // A replaced value keeps the position of the key's first entry.
+ fn push(&mut self, key: K, value: V) -> Result<()> {
+ self.insert(key, value);
+ Ok(())
}
}
-fn lift_try_map<K, V>(
+fn lift_map<M, K, V>(
cx: &mut LiftContext<'_>,
- map: &TypeMap,
+ ty: InterfaceType,
ptr: usize,
len: usize,
-) -> Result<TryHashMap<K, V>>
+) -> Result<M>
where
- K: Lift + Eq + Hash,
+ M: LiftMap<K, V>,
+ K: Lift,
V: Lift,
{
+ let map = map_abi(ty, &cx.types);
match len
.checked_mul(usize::try_from(map.entry_abi.size32)?)
.and_then(|total| ptr.checked_add(total))
@@ -2165,7 +2226,7 @@ where
bail!("map pointer is not aligned");
}
- let mut result = TryHashMap::with_capacity(len)?;
+ let mut result = M::with_capacity(len)?;
for i in 0..len {
let entry_base = ptr + (i * usize::try_from(map.entry_abi.size32)?);
@@ -2176,7 +2237,7 @@ where
&cx.memory()[entry_base + usize::try_from(map.value_offset32)?..][..V::SIZE32];
let value = V::linear_lift_from_memory(cx, map.value, value_bytes)?;
- result.insert(key, value)?;
+ result.push(key, value)?;
}
Ok(result)
diff --git a/crates/wasmtime/src/runtime/component/mod.rs b/crates/wasmtime/src/runtime/component/mod.rs
index c0a0dfa20d..3834eb057d 100644
--- a/crates/wasmtime/src/runtime/component/mod.rs
+++ b/crates/wasmtime/src/runtime/component/mod.rs
@@ -166,6 +166,7 @@ pub mod __internal {
pub use crate::map_maybe_uninit;
pub use crate::store::StoreOpaque;
pub use alloc::boxed::Box;
+ pub use alloc::collections::BTreeMap;
pub use alloc::string::String;
pub use alloc::vec::Vec;
pub use core::cell::RefCell;
@@ -502,6 +503,12 @@ pub(crate) use self::store::ComponentStoreData;
/// serde::Serialize,
/// ],
///
+/// // The Rust type to use for WIT `map<K, V>` types: `BTreeMap`,
+/// // `std::collections::HashMap`, or `indexmap::IndexMap`.
+/// //
+/// // By default this is `BTreeMap`.
+/// map_type: std::collections::HashMap,
+///
/// // An niche configuration option to require that the `T` in `Store<T>`
/// // is always `Send` in the generated bindings. Typically not needed
/// // but if synchronous bindings depend on asynchronous bindings using
diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs
index 4be6ee0581..a8deb81642 100644
--- a/crates/wit-bindgen/src/lib.rs
+++ b/crates/wit-bindgen/src/lib.rs
@@ -158,6 +158,10 @@ pub struct Opts {
/// These derive attributes will be added to any generated structs or enums
pub additional_derive_attributes: Vec<String>,
+ /// Path to the Rust type used for WIT `map<K, V>` types, `BTreeMap` by
+ /// default.
+ pub map_type: Option<String>,
+
/// Evaluate to a string literal containing the generated code rather than the generated tokens
/// themselves. Mostly useful for Wasmtime internal debugging and development.
pub stringify: bool,
@@ -1348,6 +1352,13 @@ impl<_T: Send + 'static> {camel}Pre<_T> {{
.clone()
.unwrap_or("wasmtime".to_string())
}
+
+ fn map_type_path(&self) -> String {
+ match &self.opts.map_type {
+ Some(path) => path.clone(),
+ None => format!("{}::component::__internal::BTreeMap", self.wasmtime_path()),
+ }
+ }
}
enum LookupItem<'a> {
@@ -2518,9 +2529,10 @@ impl<'a> InterfaceGenerator<'a> {
self.push_str(&format!("pub type {name}"));
self.print_generics(lt);
self.push_str(" = ");
+ let map = self.map_type_path();
let key_ty = self.ty(key, mode);
let value_ty = self.ty(value, mode);
- self.push_str(&format!("std::collections::HashMap<{key_ty}, {value_ty}>"));
+ self.push_str(&format!("{map}<{key_ty}, {value_ty}>"));
self.push_str(";\n");
self.assert_type(id, &name);
}
@@ -3760,6 +3772,10 @@ impl<'a> RustGenerator<'a> for InterfaceGenerator<'a> {
fn wasmtime_path(&self) -> String {
self.generator.wasmtime_path()
}
+
+ fn map_type_path(&self) -> String {
+ self.generator.map_type_path()
+ }
}
#[derive(Default)]
diff --git a/crates/wit-bindgen/src/rust.rs b/crates/wit-bindgen/src/rust.rs
index 8e8b4d2234..f07d32239d 100644
--- a/crates/wit-bindgen/src/rust.rs
+++ b/crates/wit-bindgen/src/rust.rs
@@ -17,6 +17,9 @@ pub trait RustGenerator<'a> {
fn is_imported_interface(&self, interface: InterfaceId) -> bool;
fn wasmtime_path(&self) -> String;
+ /// Path to the Rust type used for WIT `map<K, V>` types.
+ fn map_type_path(&self) -> String;
+
/// This determines whether we generate owning types or (where appropriate)
/// borrowing types.
///
@@ -241,7 +244,7 @@ pub trait RustGenerator<'a> {
};
let key = self.ty(key, next_mode);
let value = self.ty(value, next_mode);
- let map = format!("std::collections::HashMap<{key}, {value}>");
+ let map = format!("{}<{key}, {value}>", self.map_type_path());
match mode {
TypeMode::AllBorrowed(lt) => {
if lt != "'_" {
diff --git a/tests/all/component_model.rs b/tests/all/component_model.rs
index 8a3303a08d..a73e33c281 100644
--- a/tests/all/component_model.rs
+++ b/tests/all/component_model.rs
@@ -20,6 +20,7 @@ mod import;
mod instance;
mod linker;
mod macros;
+mod map;
mod missing_async;
mod nested;
mod post_return;
diff --git a/tests/all/component_model/map.rs b/tests/all/component_model/map.rs
new file mode 100644
index 0000000000..3225bb2259
--- /dev/null
+++ b/tests/all/component_model/map.rs
@@ -0,0 +1,45 @@
+#![cfg(not(miri))]
+
+use super::{make_echo_component, map_engine};
+use indexmap::IndexMap;
+use std::collections::{BTreeMap, HashMap};
+use std::hash::{BuildHasherDefault, DefaultHasher};
+use wasmtime::component::{Component, Linker};
+use wasmtime::{Result, Store};
+
+/// A `HashMap` with a hasher other than the default `RandomState`.
+type CustomHashMap<K, V> = HashMap<K, V, BuildHasherDefault<DefaultHasher>>;
+
+#[test]
+fn map_types() -> Result<()> {
+ let engine = map_engine();
+ let mut store = Store::new(&engine, ());
+ let component = Component::new(&engine, make_echo_component("(map u32 string)", 8))?;
+ let instance = Linker::new(&engine).instantiate(&mut store, &component)?;
+ let entry = |k: u32, v: &str| (k, v.to_string());
+
+ // `IndexMap` keeps the order of its entries.
+ let input = IndexMap::<u32, String>::from([entry(3, "c"), entry(1, "a"), entry(2, "b")]);
+ let echo = instance.get_typed_func::<(&IndexMap<u32, String>,), (IndexMap<u32, String>,)>(
+ &mut store, "echo",
+ )?;
+ let output = echo.call(&mut store, (&input,))?.0;
+ assert!(output.iter().eq(input.iter()));
+
+ // `BTreeMap` is lowered in sorted order.
+ let input = BTreeMap::from([entry(2, "b"), entry(1, "a")]);
+ let echo = instance.get_typed_func::<(&BTreeMap<u32, String>,), (IndexMap<u32, String>,)>(
+ &mut store, "echo",
+ )?;
+ let output = echo.call(&mut store, (&input,))?.0;
+ assert!(output.iter().eq(input.iter()));
+
+ // `HashMap` works with any hasher.
+ let input = CustomHashMap::from_iter([entry(1, "a"), entry(2, "b")]);
+ let echo = instance
+ .get_typed_func::<(&CustomHashMap<u32, String>,), (CustomHashMap<u32, String>,)>(
+ &mut store, "echo",
+ )?;
+ assert_eq!(echo.call(&mut store, (&input,))?.0, input);
+ Ok(())
+}