diff --git a/Cargo.lock b/Cargo.lock index 708baa805..def110629 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -323,6 +323,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + [[package]] name = "codegen-macro" version = "0.0.0" @@ -337,6 +343,22 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "component_a" +version = "0.1.0" +dependencies = [ + "component_b", + "mesh", +] + +[[package]] +name = "component_b" +version = "0.1.0" +dependencies = [ + "once_cell", + "wasmtime 22.0.0", +] + [[package]] name = "core-foundation-sys" version = "0.8.6" @@ -367,7 +389,16 @@ version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79b27922a6879b5b5361d0a084cb0b1941bf109a98540addcb932da13b68bed4" dependencies = [ - "cranelift-entity", + "cranelift-entity 0.107.0", +] + +[[package]] +name = "cranelift-bforest" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b6b33d7e757a887989eb18b35712b2a67d96171ec3149d1bfb657b29b7b367c" +dependencies = [ + "cranelift-entity 0.109.0", ] [[package]] @@ -377,16 +408,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "304c455b28bf56372729acb356afbb55d622f2b0f2f7837aa5e57c138acaac4d" dependencies = [ "bumpalo", - "cranelift-bforest", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", + "cranelift-bforest 0.107.0", + "cranelift-codegen-meta 0.107.0", + "cranelift-codegen-shared 0.107.0", + "cranelift-control 0.107.0", + "cranelift-entity 0.107.0", + "cranelift-isle 0.107.0", + "gimli", + "hashbrown 0.14.3", + "log", + "regalloc2", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9acf15cb22be42d07c3b57d7856329cb228b7315d385346149df2566ad5e4aa" +dependencies = [ + "bumpalo", + "cranelift-bforest 0.109.0", + "cranelift-codegen-meta 0.109.0", + "cranelift-codegen-shared 0.109.0", + "cranelift-control 0.109.0", + "cranelift-entity 0.109.0", + "cranelift-isle 0.109.0", "gimli", "hashbrown 0.14.3", "log", "regalloc2", + "rustc-hash", "smallvec", "target-lexicon", ] @@ -397,7 +450,16 @@ version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1653c56b99591d07f67c5ca7f9f25888948af3f4b97186bff838d687d666f613" dependencies = [ - "cranelift-codegen-shared", + "cranelift-codegen-shared 0.107.0", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e934d301392b73b3f8b0540391fb82465a0f179a3cee7c726482ac4727efcc97" +dependencies = [ + "cranelift-codegen-shared 0.109.0", ] [[package]] @@ -406,6 +468,12 @@ version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f5b6a9cf6b6eb820ee3f973a0db313c05dc12d370f37b4fe9630286e1672573f" +[[package]] +name = "cranelift-codegen-shared" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb2a2566b3d54b854dfb288b3b187f6d3d17d6f762c92898207eba302931da" + [[package]] name = "cranelift-control" version = "0.107.0" @@ -415,6 +483,15 @@ dependencies = [ "arbitrary", ] +[[package]] +name = "cranelift-control" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0100f33b704cdacd01ad66ff41f8c5030d57cbff078e2a4e49ab1822591299fa" +dependencies = [ + "arbitrary", +] + [[package]] name = "cranelift-entity" version = "0.107.0" @@ -425,13 +502,35 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "cranelift-entity" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8cfdc315e5d18997093e040a8d234bea1ac1e118a716d3e30f40d449e78207b" +dependencies = [ + "serde", + "serde_derive", +] + [[package]] name = "cranelift-frontend" version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a07fd7393041d7faa2f37426f5dc7fc04003b70988810e8c063beefeff1cd8f9" dependencies = [ - "cranelift-codegen", + "cranelift-codegen 0.107.0", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-frontend" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f74b84f16af2e982b0c0c72233503d9d55cbfe3865dbe807ca28dc6642a28b5" +dependencies = [ + "cranelift-codegen 0.109.0", "log", "smallvec", "target-lexicon", @@ -443,13 +542,30 @@ version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f341d7938caa6dff8149dac05bb2b53fc680323826b83b4cf175ab9f5139a3c9" +[[package]] +name = "cranelift-isle" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adf306d3dde705fb94bd48082f01d38c4ededc74293a4c007805f610bf08bc6e" + [[package]] name = "cranelift-native" version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82af6066e6448d26eeabb7aa26a43f7ff79f8217b06bade4ee6ef230aecc8880" dependencies = [ - "cranelift-codegen", + "cranelift-codegen 0.107.0", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-native" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea0ebdef7aff4a79bcbc8b6495f31315f16b3bf311152f472eaa8d679352581" +dependencies = [ + "cranelift-codegen 0.109.0", "libc", "target-lexicon", ] @@ -460,14 +576,30 @@ version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2766fab7284a914a7f17f90ebe865c86453225fb8637ac31f123f5028fee69cd" dependencies = [ - "cranelift-codegen", - "cranelift-entity", - "cranelift-frontend", + "cranelift-codegen 0.107.0", + "cranelift-entity 0.107.0", + "cranelift-frontend 0.107.0", "itertools", "log", "smallvec", "wasmparser 0.202.0", - "wasmtime-types", + "wasmtime-types 20.0.0", +] + +[[package]] +name = "cranelift-wasm" +version = "0.109.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d549108a1942065cdbac3bb96c2952afa0e1b9a3beff4b08c4308ac72257576d" +dependencies = [ + "cranelift-codegen 0.109.0", + "cranelift-entity 0.109.0", + "cranelift-frontend 0.109.0", + "itertools", + "log", + "smallvec", + "wasmparser 0.209.1", + "wasmtime-types 22.0.0", ] [[package]] @@ -580,6 +712,12 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + [[package]] name = "encoding_rs" version = "0.8.33" @@ -931,6 +1069,12 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "libredox" version = "0.0.1" @@ -993,6 +1137,13 @@ dependencies = [ "autocfg", ] +[[package]] +name = "mesh" +version = "0.1.0" +dependencies = [ + "component_b", +] + [[package]] name = "miniz_oxide" version = "0.7.2" @@ -1044,6 +1195,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" +dependencies = [ + "crc32fast", + "hashbrown 0.14.3", + "indexmap", + "memchr", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -1080,6 +1243,17 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1324,6 +1498,9 @@ name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] [[package]] name = "socket2" @@ -1404,10 +1581,10 @@ name = "test-helpers" version = "0.0.0" dependencies = [ "codegen-macro", - "wasm-encoder 0.209.0", + "wasm-encoder 0.209.1", "wit-bindgen-core", "wit-component", - "wit-parser 0.209.0", + "wit-parser 0.209.1", ] [[package]] @@ -1682,9 +1859,18 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.209.0" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.211.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821112ccd35a6e25790ba5f4ed72ac5321707cf18a379bf071b76f8d0336603d" +checksum = "5e7d931a1120ef357f32b74547646b6fa68ea25e377772b72874b131a9ed70d4" dependencies = [ "leb128", ] @@ -1701,8 +1887,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.209.0", - "wasmparser 0.209.0", + "wasm-encoder 0.209.1", + "wasmparser 0.209.1", ] [[package]] @@ -1718,9 +1904,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.209.0" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233c757e98c11d092b757fd3ada885a446fdc002432bf7bf12c93f81ba96c7c9" +checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" dependencies = [ "ahash", "bitflags 2.5.0", @@ -1740,6 +1926,16 @@ dependencies = [ "wasmparser 0.202.0", ] +[[package]] +name = "wasmprinter" +version = "0.209.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceca8ae6eaa8c7c87b33c25c53bdf299f8c2a764aee1179402ff7652ef3a6859" +dependencies = [ + "anyhow", + "wasmparser 0.209.1", +] + [[package]] name = "wasmtime" version = "20.0.0" @@ -1771,17 +1967,73 @@ dependencies = [ "target-lexicon", "wasm-encoder 0.202.0", "wasmparser 0.202.0", - "wasmtime-cache", - "wasmtime-component-macro", - "wasmtime-component-util", - "wasmtime-cranelift", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-jit-icache-coherence", + "wasmtime-cache 20.0.0", + "wasmtime-component-macro 20.0.0", + "wasmtime-component-util 20.0.0", + "wasmtime-cranelift 20.0.0", + "wasmtime-environ 20.0.0", + "wasmtime-fiber 20.0.0", + "wasmtime-jit-debug 20.0.0", + "wasmtime-jit-icache-coherence 20.0.0", "wasmtime-runtime", - "wasmtime-slab", - "wasmtime-winch", + "wasmtime-slab 20.0.0", + "wasmtime-winch 20.0.0", + "wat", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786d8b5e7a4d54917c5ebe555b9667337e5f93383f49bddaaeec2eba68093b45" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown 0.14.3", + "indexmap", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset", + "object 0.36.0", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.209.1", + "wasmparser 0.209.1", + "wasmtime-asm-macros 22.0.0", + "wasmtime-cache 22.0.0", + "wasmtime-component-macro 22.0.0", + "wasmtime-component-util 22.0.0", + "wasmtime-cranelift 22.0.0", + "wasmtime-environ 22.0.0", + "wasmtime-fiber 22.0.0", + "wasmtime-jit-debug 22.0.0", + "wasmtime-jit-icache-coherence 22.0.0", + "wasmtime-slab 22.0.0", + "wasmtime-versioned-export-macros 22.0.0", + "wasmtime-winch 22.0.0", "wat", "windows-sys 0.52.0", ] @@ -1795,6 +2047,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "wasmtime-asm-macros" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d697d99c341d4a9ffb72f3af7a02124d233eeb59aee010f36d88e97cca553d5e" +dependencies = [ + "cfg-if", +] + [[package]] name = "wasmtime-cache" version = "20.0.0" @@ -1815,6 +2076,26 @@ dependencies = [ "zstd", ] +[[package]] +name = "wasmtime-cache" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916610f9ae9a6c22deb25bba2e6247ba9f00b093d30620875203b91328a1adfa" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys 0.52.0", + "zstd", +] + [[package]] name = "wasmtime-component-macro" version = "20.0.0" @@ -1825,17 +2106,38 @@ dependencies = [ "proc-macro2", "quote", "syn", - "wasmtime-component-util", - "wasmtime-wit-bindgen", + "wasmtime-component-util 20.0.0", + "wasmtime-wit-bindgen 20.0.0", "wit-parser 0.202.0", ] +[[package]] +name = "wasmtime-component-macro" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b29b462b068e73b5b27fae092a27f47e5937cabf6b26be2779c978698a52feca" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util 22.0.0", + "wasmtime-wit-bindgen 22.0.0", + "wit-parser 0.209.1", +] + [[package]] name = "wasmtime-component-util" version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78580bdb4e04c7da3bf98088559ca1d29382668536e4d5c7f2f966d79c390307" +[[package]] +name = "wasmtime-component-util" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d2912c53d9054984b380dfbd7579f9c3681b2a73b903a56bd71a1c4f175f1e" + [[package]] name = "wasmtime-cranelift" version = "20.0.0" @@ -1844,20 +2146,44 @@ checksum = "b60df0ee08c6a536c765f69e9e8205273435b66d02dd401e938769a2622a6c1a" dependencies = [ "anyhow", "cfg-if", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "cranelift-wasm", + "cranelift-codegen 0.107.0", + "cranelift-control 0.107.0", + "cranelift-entity 0.107.0", + "cranelift-frontend 0.107.0", + "cranelift-native 0.107.0", + "cranelift-wasm 0.107.0", "gimli", "log", "object 0.33.0", "target-lexicon", "thiserror", "wasmparser 0.202.0", - "wasmtime-environ", - "wasmtime-versioned-export-macros", + "wasmtime-environ 20.0.0", + "wasmtime-versioned-export-macros 20.0.0", +] + +[[package]] +name = "wasmtime-cranelift" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3975deafea000457ba84355c7c0fce0372937204f77026510b7b454f28a3a65" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen 0.109.0", + "cranelift-control 0.109.0", + "cranelift-entity 0.109.0", + "cranelift-frontend 0.109.0", + "cranelift-native 0.109.0", + "cranelift-wasm 0.109.0", + "gimli", + "log", + "object 0.36.0", + "target-lexicon", + "thiserror", + "wasmparser 0.209.1", + "wasmtime-environ 22.0.0", + "wasmtime-versioned-export-macros 22.0.0", ] [[package]] @@ -1869,7 +2195,7 @@ dependencies = [ "anyhow", "bincode", "cpp_demangle", - "cranelift-entity", + "cranelift-entity 0.107.0", "gimli", "indexmap", "log", @@ -1881,9 +2207,34 @@ dependencies = [ "thiserror", "wasm-encoder 0.202.0", "wasmparser 0.202.0", - "wasmprinter", - "wasmtime-component-util", - "wasmtime-types", + "wasmprinter 0.202.0", + "wasmtime-component-util 20.0.0", + "wasmtime-types 20.0.0", +] + +[[package]] +name = "wasmtime-environ" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f444e900e848b884d8a8a2949b6f5b92af642a3e663ff8fbe78731143a55be61" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-entity 0.109.0", + "gimli", + "indexmap", + "log", + "object 0.36.0", + "postcard", + "rustc-demangle", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder 0.209.1", + "wasmparser 0.209.1", + "wasmprinter 0.209.1", + "wasmtime-component-util 22.0.0", + "wasmtime-types 22.0.0", ] [[package]] @@ -1896,8 +2247,23 @@ dependencies = [ "cc", "cfg-if", "rustix", - "wasmtime-asm-macros", - "wasmtime-versioned-export-macros", + "wasmtime-asm-macros 20.0.0", + "wasmtime-versioned-export-macros 20.0.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-fiber" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ded58eb2d1bf0dcd2182d0ccd7055c4b10b50d711514f1d73f61515d0fa829d" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros 22.0.0", + "wasmtime-versioned-export-macros 22.0.0", "windows-sys 0.52.0", ] @@ -1910,7 +2276,19 @@ dependencies = [ "object 0.33.0", "once_cell", "rustix", - "wasmtime-versioned-export-macros", + "wasmtime-versioned-export-macros 20.0.0", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bc54198c6720f098210a85efb3ba8c078d1de4d373cdb6778850a66ae088d11" +dependencies = [ + "object 0.36.0", + "once_cell", + "rustix", + "wasmtime-versioned-export-macros 22.0.0", ] [[package]] @@ -1924,6 +2302,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5afe2f0499542f9a4bcfa1b55bfdda803b6ade4e7c93c6b99e0f39dba44b0a91" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "wasmtime-runtime" version = "20.0.0" @@ -1945,12 +2335,12 @@ dependencies = [ "rustix", "sptr", "wasm-encoder 0.202.0", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-fiber", - "wasmtime-jit-debug", - "wasmtime-slab", - "wasmtime-versioned-export-macros", + "wasmtime-asm-macros 20.0.0", + "wasmtime-environ 20.0.0", + "wasmtime-fiber 20.0.0", + "wasmtime-jit-debug 20.0.0", + "wasmtime-slab 20.0.0", + "wasmtime-versioned-export-macros 20.0.0", "windows-sys 0.52.0", ] @@ -1960,19 +2350,38 @@ version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b3655075824a374c536a2b2cc9283bb765fcdf3d58b58587862c48571ad81ef" +[[package]] +name = "wasmtime-slab" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a7de1f2bec5bbb35d532e61c85c049dc84ae671df60492f90b954ecf21169e7" + [[package]] name = "wasmtime-types" version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b98cf64a242b0b9257604181ca28b28a5fcaa4c9ea1d396f76d1d2d1c5b40eef" dependencies = [ - "cranelift-entity", + "cranelift-entity 0.107.0", "serde", "serde_derive", "thiserror", "wasmparser 0.202.0", ] +[[package]] +name = "wasmtime-types" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "412463e9000e14cf6856be48628d2213c20c153e29ffc22b036980c892ea6964" +dependencies = [ + "cranelift-entity 0.109.0", + "serde", + "serde_derive", + "smallvec", + "wasmparser 0.209.1", +] + [[package]] name = "wasmtime-versioned-export-macros" version = "20.0.0" @@ -1984,6 +2393,17 @@ dependencies = [ "syn", ] +[[package]] +name = "wasmtime-versioned-export-macros" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de5a9bc4f44ceeb168e9e8e3be4e0b4beb9095b468479663a9e24c667e36826f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "wasmtime-wasi" version = "20.0.0" @@ -2010,7 +2430,7 @@ dependencies = [ "tokio", "tracing", "url", - "wasmtime", + "wasmtime 20.0.0", "wiggle", "windows-sys 0.52.0", ] @@ -2022,14 +2442,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06b573d14ac846a0fb8c541d8fca6a64acf9a1d176176982472274ab1d2fa5d" dependencies = [ "anyhow", - "cranelift-codegen", + "cranelift-codegen 0.107.0", "gimli", "object 0.33.0", "target-lexicon", "wasmparser 0.202.0", - "wasmtime-cranelift", - "wasmtime-environ", - "winch-codegen", + "wasmtime-cranelift 20.0.0", + "wasmtime-environ 20.0.0", + "winch-codegen 0.18.0", +] + +[[package]] +name = "wasmtime-winch" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4db238a0241df2d15f79ad17b3a37a27f2ea6cb885894d81b42ae107544466" +dependencies = [ + "anyhow", + "cranelift-codegen 0.109.0", + "gimli", + "object 0.36.0", + "target-lexicon", + "wasmparser 0.209.1", + "wasmtime-cranelift 22.0.0", + "wasmtime-environ 22.0.0", + "winch-codegen 0.20.0", ] [[package]] @@ -2044,6 +2481,18 @@ dependencies = [ "wit-parser 0.202.0", ] +[[package]] +name = "wasmtime-wit-bindgen" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc077306b38288262e5ba01d4b21532a6987416cdc0aedf04bb06c22a68fdc" +dependencies = [ + "anyhow", + "heck 0.4.1", + "indexmap", + "wit-parser 0.209.1", +] + [[package]] name = "wast" version = "35.0.2" @@ -2055,24 +2504,24 @@ dependencies = [ [[package]] name = "wast" -version = "209.0.0" +version = "211.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "796916a29f4a8454655b7af3aa2d0e40532d07b4d3b8abdb78e4cb6b84c00586" +checksum = "b25506dd82d00da6b14a87436b3d52b1d264083fa79cdb72a0d1b04a8595ccaa" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.209.0", + "wasm-encoder 0.211.1", ] [[package]] name = "wat" -version = "1.209.0" +version = "1.211.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ecc135c1bdf98ef1c818b80996897ab23dff91391149e8c22d8278796b743e9" +checksum = "eb716ca6c86eecac2d82541ffc39860118fc0af9309c4f2670637bea2e1bdd7d" dependencies = [ - "wast 209.0.0", + "wast 211.0.1", ] [[package]] @@ -2086,7 +2535,7 @@ dependencies = [ "bitflags 2.5.0", "thiserror", "tracing", - "wasmtime", + "wasmtime 20.0.0", "wiggle-macro", ] @@ -2146,14 +2595,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb23450977f9d4a23c02439cf6899340b2d68887b19465c5682740d9cc37d52e" dependencies = [ "anyhow", - "cranelift-codegen", + "cranelift-codegen 0.107.0", "gimli", "regalloc2", "smallvec", "target-lexicon", "wasmparser 0.202.0", - "wasmtime-cranelift", - "wasmtime-environ", + "wasmtime-cranelift 20.0.0", + "wasmtime-environ 20.0.0", +] + +[[package]] +name = "winch-codegen" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c6915884e731b2db0d8cf08cb64474cb69221a161675fd3c135f91febc3daa" +dependencies = [ + "anyhow", + "cranelift-codegen 0.109.0", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser 0.209.1", + "wasmtime-cranelift 22.0.0", + "wasmtime-environ 22.0.0", ] [[package]] @@ -2343,11 +2809,11 @@ dependencies = [ "clap", "heck 0.5.0", "test-helpers", - "wasm-encoder 0.209.0", + "wasm-encoder 0.209.1", "wasm-metadata", "wit-bindgen-core", "wit-component", - "wit-parser 0.209.0", + "wit-parser 0.209.1", ] [[package]] @@ -2358,9 +2824,9 @@ dependencies = [ "clap", "heck 0.5.0", "test-artifacts", - "wasm-encoder 0.209.0", - "wasmparser 0.209.0", - "wasmtime", + "wasm-encoder 0.209.1", + "wasmparser 0.209.1", + "wasmtime 20.0.0", "wasmtime-wasi", "wit-bindgen-bridge", "wit-bindgen-c", @@ -2372,7 +2838,7 @@ dependencies = [ "wit-bindgen-rust", "wit-bindgen-teavm-java", "wit-component", - "wit-parser 0.209.0", + "wit-parser 0.209.1", ] [[package]] @@ -2381,7 +2847,7 @@ version = "0.26.0" dependencies = [ "anyhow", "heck 0.5.0", - "wit-parser 0.209.0", + "wit-parser 0.209.1", ] [[package]] @@ -2392,7 +2858,7 @@ dependencies = [ "clap", "heck 0.5.0", "test-helpers", - "wasm-encoder 0.209.0", + "wasm-encoder 0.209.1", "wasm-metadata", "wit-bindgen-c", "wit-bindgen-core", @@ -2408,9 +2874,9 @@ dependencies = [ "heck 0.5.0", "indexmap", "test-helpers", - "wasm-encoder 0.209.0", + "wasm-encoder 0.209.1", "wasm-metadata", - "wasmparser 0.209.0", + "wasmparser 0.209.1", "wit-bindgen-core", "wit-component", ] @@ -2501,11 +2967,11 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.209.0", + "wasm-encoder 0.209.1", "wasm-metadata", - "wasmparser 0.209.0", + "wasmparser 0.209.1", "wat", - "wit-parser 0.209.0", + "wit-parser 0.209.1", ] [[package]] @@ -2528,9 +2994,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.209.0" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9455f94dfa4817ec1cdd7f53bba662dcbaf10cd41152d03bd39c6cabe90491fa" +checksum = "3e79b9e3c0b6bb589dec46317e645851e0db2734c44e2be5e251b03ff4a51269" dependencies = [ "anyhow", "id-arena", @@ -2541,7 +3007,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.209.0", + "wasmparser 0.209.1", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 30b1121d7..565ccea0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,9 @@ CLI tool to generate bindings for WIT documents and the component model. [workspace] members = [ "crates/test-rust-wasm", + "crates/cpp/tests/native_mesh/rust/mesh", + "crates/cpp/tests/native_mesh/rust/component_a", + "crates/cpp/tests/native_mesh/rust/component_b", ] resolver = "2" diff --git a/crates/cpp/tests/native_mesh/Makefile b/crates/cpp/tests/native_mesh/Makefile index 497019c6d..65a5a0a67 100644 --- a/crates/cpp/tests/native_mesh/Makefile +++ b/crates/cpp/tests/native_mesh/Makefile @@ -1,16 +1,16 @@ all: - make -C component_b $@ - make -C mesh $@ - make -C component_a $@ + make -C cpp/component_b $@ + make -C cpp/mesh $@ + make -C cpp/component_a $@ bindgen: - make -C component_b $@ - make -C mesh $@ - make -C component_a $@ + make -C cpp/component_b $@ + make -C cpp/mesh $@ + make -C cpp/component_a $@ clean: - make -C component_b $@ - make -C mesh $@ - make -C component_a $@ + make -C cpp/component_b $@ + make -C cpp/mesh $@ + make -C cpp/component_a $@ \ No newline at end of file diff --git a/crates/cpp/tests/native_mesh/README.md b/crates/cpp/tests/native_mesh/README.md new file mode 100644 index 000000000..3b679c09d --- /dev/null +++ b/crates/cpp/tests/native_mesh/README.md @@ -0,0 +1,108 @@ +# Introduction + +The native-mesh example contains two components, `component_a` and `component_b`. +Both these components communicate to each other using `mesh`. + +This example has been implemented in C++ as well as Rust. + +# Building + +To build the C++ version, use the make file. + +Since the `wit-bindgen` does not create the complete code for `Rust`, the bindings are +generated, hand patched and stored with the code. + +To build each and every individual components, use `cargo build` inside that specific directory. +Or +Just do `cargo build component_a`, will build all the dependent components and the binary. + +Build the `component_b`, `mesh` and `component_a` in that order. + +The actual binary is `component_a` and will be present in `wit-bindgen/target/debug`. + +# Running + +To run the application use `caro run` inside the `component_a` +Or +once the build is successful, run the binary from `./wit-bindgen/target/debug/component_a` + +``` + +The code directory structure looks as below + +├── Makefile +├── cpp +│ ├── component_a +│ │ ├── Makefile +│ │ ├── a.cpp +│ │ ├── a_cpp.h +│ │ ├── component_a +│ │ ├── libcomponent_b.so -> ../component_b/libcomponent_b.so +│ │ ├── libmesh.so -> ../mesh/libmesh.so +│ │ └── main.cpp +│ ├── component_b +│ │ ├── Makefile +│ │ ├── b.cpp +│ │ ├── b_cpp.h +│ │ ├── exports-foo-foo-resources-R.h +│ │ ├── impl.cpp +│ │ └── libcomponent_b.so +│ └── mesh +│ ├── Makefile +│ ├── impl.cpp +│ ├── libcomponent_b.so -> ../component_b/libcomponent_b.so +│ ├── libmesh.so +│ ├── mesh-exports-foo-foo-resources-R.h +│ ├── mesh-exports-foo-foo-resources.h +│ ├── mesh_cpp_native.h +│ └── mesh_native.cpp +├── rust +│ ├── README.md +│ ├── component_a +│ │ ├── Cargo.lock +│ │ ├── Cargo.toml +│ │ └── src +│ │ ├── a.rs +│ │ ├── a_impl.rs +│ │ └── main.rs +│ ├── component_b +│ │ ├── Cargo.lock +│ │ ├── Cargo.toml +│ │ └── src +│ │ ├── b.rs +│ │ ├── b_impl.rs +│ │ ├── lib.rs +│ │ └── resource_table.rs +│ └── mesh +│ ├── Cargo.lock +│ ├── Cargo.toml +│ └── src +│ ├── impl_mesh.rs +│ ├── lib.rs +│ └── mesh.rs +└── wit + └── resources_simple.wit ( Contains the wit interface definitions for the components and the mesh) + +``` + +# Internal working + +`component_b` export three interfaces `create`, `add` and `consume`. `component_a` uses those `interfaces`. + +The `component_a` askes for creating a resource in `component_b` address space through the `mesh`. +So, `component_a` a receive the created object through `mesh`. +The `mesh` acts like a transport between the two components. +`mesh` stores the `resource` in its table and pass the `reference` to that object. + +The same functionality happens for all the three apis that are exported by the `component_b`. + + +Note: Rust does not build the .so objects for the libraries, it uses the `crates` mechanism to share the interfaces +with other components. + + + + + + + diff --git a/crates/cpp/tests/native_mesh/component_a/Makefile b/crates/cpp/tests/native_mesh/cpp/component_a/Makefile similarity index 80% rename from crates/cpp/tests/native_mesh/component_a/Makefile rename to crates/cpp/tests/native_mesh/cpp/component_a/Makefile index 829b6275e..f4db940d2 100644 --- a/crates/cpp/tests/native_mesh/component_a/Makefile +++ b/crates/cpp/tests/native_mesh/cpp/component_a/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS=-g -O0 -I../../../helper-types +CXXFLAGS=-g -O0 -I../../../../helper-types -std=c++1z all: component_a diff --git a/crates/cpp/tests/native_mesh/component_a/a.cpp b/crates/cpp/tests/native_mesh/cpp/component_a/a.cpp similarity index 100% rename from crates/cpp/tests/native_mesh/component_a/a.cpp rename to crates/cpp/tests/native_mesh/cpp/component_a/a.cpp diff --git a/crates/cpp/tests/native_mesh/component_a/a_cpp.h b/crates/cpp/tests/native_mesh/cpp/component_a/a_cpp.h similarity index 100% rename from crates/cpp/tests/native_mesh/component_a/a_cpp.h rename to crates/cpp/tests/native_mesh/cpp/component_a/a_cpp.h diff --git a/crates/cpp/tests/native_mesh/cpp/component_a/component_a b/crates/cpp/tests/native_mesh/cpp/component_a/component_a new file mode 100644 index 000000000..514e41cff Binary files /dev/null and b/crates/cpp/tests/native_mesh/cpp/component_a/component_a differ diff --git a/crates/cpp/tests/native_mesh/component_a/libcomponent_b.so b/crates/cpp/tests/native_mesh/cpp/component_a/libcomponent_b.so similarity index 100% rename from crates/cpp/tests/native_mesh/component_a/libcomponent_b.so rename to crates/cpp/tests/native_mesh/cpp/component_a/libcomponent_b.so diff --git a/crates/cpp/tests/native_mesh/component_a/libmesh.so b/crates/cpp/tests/native_mesh/cpp/component_a/libmesh.so similarity index 100% rename from crates/cpp/tests/native_mesh/component_a/libmesh.so rename to crates/cpp/tests/native_mesh/cpp/component_a/libmesh.so diff --git a/crates/cpp/tests/native_mesh/component_a/main.cpp b/crates/cpp/tests/native_mesh/cpp/component_a/main.cpp similarity index 100% rename from crates/cpp/tests/native_mesh/component_a/main.cpp rename to crates/cpp/tests/native_mesh/cpp/component_a/main.cpp diff --git a/crates/cpp/tests/native_mesh/component_b/Makefile b/crates/cpp/tests/native_mesh/cpp/component_b/Makefile similarity index 77% rename from crates/cpp/tests/native_mesh/component_b/Makefile rename to crates/cpp/tests/native_mesh/cpp/component_b/Makefile index 2fff54abd..75229f856 100644 --- a/crates/cpp/tests/native_mesh/component_b/Makefile +++ b/crates/cpp/tests/native_mesh/cpp/component_b/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS=-fPIC -g -O0 -I../../../helper-types +CXXFLAGS=-fPIC -g -O0 -I../../../../helper-types -std=c++1z all: libcomponent_b.so diff --git a/crates/cpp/tests/native_mesh/component_b/b.cpp b/crates/cpp/tests/native_mesh/cpp/component_b/b.cpp similarity index 100% rename from crates/cpp/tests/native_mesh/component_b/b.cpp rename to crates/cpp/tests/native_mesh/cpp/component_b/b.cpp diff --git a/crates/cpp/tests/native_mesh/component_b/b_cpp.h b/crates/cpp/tests/native_mesh/cpp/component_b/b_cpp.h similarity index 100% rename from crates/cpp/tests/native_mesh/component_b/b_cpp.h rename to crates/cpp/tests/native_mesh/cpp/component_b/b_cpp.h diff --git a/crates/cpp/tests/native_mesh/component_b/exports-foo-foo-resources-R.h b/crates/cpp/tests/native_mesh/cpp/component_b/exports-foo-foo-resources-R.h similarity index 100% rename from crates/cpp/tests/native_mesh/component_b/exports-foo-foo-resources-R.h rename to crates/cpp/tests/native_mesh/cpp/component_b/exports-foo-foo-resources-R.h diff --git a/crates/cpp/tests/native_mesh/component_b/impl.cpp b/crates/cpp/tests/native_mesh/cpp/component_b/impl.cpp similarity index 100% rename from crates/cpp/tests/native_mesh/component_b/impl.cpp rename to crates/cpp/tests/native_mesh/cpp/component_b/impl.cpp diff --git a/crates/cpp/tests/native_mesh/cpp/component_b/libcomponent_b.so b/crates/cpp/tests/native_mesh/cpp/component_b/libcomponent_b.so new file mode 100644 index 000000000..33b295151 Binary files /dev/null and b/crates/cpp/tests/native_mesh/cpp/component_b/libcomponent_b.so differ diff --git a/crates/cpp/tests/native_mesh/mesh/Makefile b/crates/cpp/tests/native_mesh/cpp/mesh/Makefile similarity index 82% rename from crates/cpp/tests/native_mesh/mesh/Makefile rename to crates/cpp/tests/native_mesh/cpp/mesh/Makefile index 523755e76..8dcc0d504 100644 --- a/crates/cpp/tests/native_mesh/mesh/Makefile +++ b/crates/cpp/tests/native_mesh/cpp/mesh/Makefile @@ -1,4 +1,4 @@ -CXXFLAGS=-fPIC -g -O0 -I../../../helper-types +CXXFLAGS=-fPIC -g -O0 -I../../../../helper-types -std=c++1z all: libmesh.so diff --git a/crates/cpp/tests/native_mesh/mesh/impl.cpp b/crates/cpp/tests/native_mesh/cpp/mesh/impl.cpp similarity index 100% rename from crates/cpp/tests/native_mesh/mesh/impl.cpp rename to crates/cpp/tests/native_mesh/cpp/mesh/impl.cpp diff --git a/crates/cpp/tests/native_mesh/mesh/libcomponent_b.so b/crates/cpp/tests/native_mesh/cpp/mesh/libcomponent_b.so similarity index 100% rename from crates/cpp/tests/native_mesh/mesh/libcomponent_b.so rename to crates/cpp/tests/native_mesh/cpp/mesh/libcomponent_b.so diff --git a/crates/cpp/tests/native_mesh/cpp/mesh/libmesh.so b/crates/cpp/tests/native_mesh/cpp/mesh/libmesh.so new file mode 100644 index 000000000..bbb1b6504 Binary files /dev/null and b/crates/cpp/tests/native_mesh/cpp/mesh/libmesh.so differ diff --git a/crates/cpp/tests/native_mesh/mesh/mesh-exports-foo-foo-resources-R.h b/crates/cpp/tests/native_mesh/cpp/mesh/mesh-exports-foo-foo-resources-R.h similarity index 100% rename from crates/cpp/tests/native_mesh/mesh/mesh-exports-foo-foo-resources-R.h rename to crates/cpp/tests/native_mesh/cpp/mesh/mesh-exports-foo-foo-resources-R.h diff --git a/crates/cpp/tests/native_mesh/mesh/mesh-exports-foo-foo-resources.h b/crates/cpp/tests/native_mesh/cpp/mesh/mesh-exports-foo-foo-resources.h similarity index 100% rename from crates/cpp/tests/native_mesh/mesh/mesh-exports-foo-foo-resources.h rename to crates/cpp/tests/native_mesh/cpp/mesh/mesh-exports-foo-foo-resources.h diff --git a/crates/cpp/tests/native_mesh/mesh/mesh_cpp_native.h b/crates/cpp/tests/native_mesh/cpp/mesh/mesh_cpp_native.h similarity index 100% rename from crates/cpp/tests/native_mesh/mesh/mesh_cpp_native.h rename to crates/cpp/tests/native_mesh/cpp/mesh/mesh_cpp_native.h diff --git a/crates/cpp/tests/native_mesh/mesh/mesh_native.cpp b/crates/cpp/tests/native_mesh/cpp/mesh/mesh_native.cpp similarity index 100% rename from crates/cpp/tests/native_mesh/mesh/mesh_native.cpp rename to crates/cpp/tests/native_mesh/cpp/mesh/mesh_native.cpp diff --git a/crates/cpp/tests/native_mesh/rust/component_a/Cargo.lock b/crates/cpp/tests/native_mesh/rust/component_a/Cargo.lock new file mode 100644 index 000000000..281f5bf08 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_a/Cargo.lock @@ -0,0 +1,1442 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "component_a" +version = "0.1.0" +dependencies = [ + "component_b", + "mesh", +] + +[[package]] +name = "component_b" +version = "0.1.0" +dependencies = [ + "once_cell", + "wasmtime", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29daf137addc15da6bab6eae2c4a11e274b1d270bf2759508e62f6145e863ef6" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de619867d5de4c644b7fd9904d6e3295269c93d8a71013df796ab338681222d4" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f5cf277490037d8dae9513d35e0ee8134670ae4a964a5ed5b198d4249d7c10" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3e22ecad1123343a3c09ac6ecc532bb5c184b6fcb7888df0ea953727f79924" + +[[package]] +name = "cranelift-control" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53ca3ec6d30bce84ccf59c81fead4d16381a3ef0ef75e8403bc1e7385980da09" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eabb8d36b0ca8906bec93c78ea516741cac2d7e6b266fa7b0ffddcc09004990" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b42630229e49a8cfcae90bdc43c8c4c08f7a7aa4618b67f79265cd2f996dd2" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d1e36361805dfe0b6cdfd5a5ffdb5d03fa796170c5717d2727cbe623b93a0" + +[[package]] +name = "cranelift-native" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aea85a0d7e1800b14ce9d3f53adf8ad4d1ee8a9e23b0269bdc50285e93b9b3" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac491fd3473944781f0cf9528c90cc899d18ad438da21961a839a3a44d57dfb" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mesh" +version = "0.1.0" +dependencies = [ + "component_b", +] + +[[package]] +name = "object" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-encoder" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.211.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e7d931a1120ef357f32b74547646b6fa68ea25e377772b72874b131a9ed70d4" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmparser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" +dependencies = [ + "anyhow", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92a1370c66a0022e6d92dcc277e2c84f5dece19569670b8ce7db8162560d8b6" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown 0.14.5", + "indexmap", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dee8679c974a7f258c03d60d3c747c426ed219945b6d08cbc77fd2eab15b2d1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00103ffaf7ee980f4e750fe272b6ada79d9901659892e457c7ca316b16df9ec" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cae30035f1cf97dcc6657c979cf39f99ce6be93583675eddf4aeaa5548509c" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ae611f08cea620c67330925be28a96115bf01f8f393a6cbdf4856a86087134" + +[[package]] +name = "wasmtime-cranelift" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2909406a6007e28be964067167890bca4574bd48a9ff18f1fa9f4856d89ea40" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e227f9ed2f5421473723d6c0352b5986e6e6044fde5410a274a394d726108f" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42edb392586d07038c1638e854382db916b6ca7845a2e6a7f8dc49e08907acdd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b26ef7914af0c0e3ca811bdc32f5f66fbba0fd21e1f8563350e8a7951e3598" +dependencies = [ + "object", + "once_cell", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe088f9b56bb353adaf837bf7e10f1c2e1676719dd5be4cac8e37f2ba1ee5bc" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys", +] + +[[package]] +name = "wasmtime-slab" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ff75cafffe47b04b036385ce3710f209153525b0ed19d57b0cf44a22d446460" + +[[package]] +name = "wasmtime-types" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f2fa462bfea3220711c84e2b549f147e4df89eeb49b8a2a3d89148f6cc4a8b1" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmtime-winch" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b27054fed6be4f3800aba5766f7ef435d4220ce290788f021a08d4fa573108" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "object", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936a52ce69c28de2aa3b5fb4f2dbbb2966df304f04cccb7aca4ba56d915fda0" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "wit-parser", +] + +[[package]] +name = "wast" +version = "211.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b25506dd82d00da6b14a87436b3d52b1d264083fa79cdb72a0d1b04a8595ccaa" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.211.1", +] + +[[package]] +name = "wat" +version = "1.211.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb716ca6c86eecac2d82541ffc39860118fc0af9309c4f2670637bea2e1bdd7d" +dependencies = [ + "wast", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dc69899ccb2da7daa4df31426dcfd284b104d1a85e1dae35806df0c46187f87" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-parser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.11+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/crates/cpp/tests/native_mesh/rust/component_a/Cargo.toml b/crates/cpp/tests/native_mesh/rust/component_a/Cargo.toml new file mode 100644 index 000000000..6563c1d95 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_a/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "component_a" +version = "0.1.0" +edition = "2021" + +[dependencies] +component_b = {path = "../component_b"} +mesh = {path = "../mesh"} \ No newline at end of file diff --git a/crates/cpp/tests/native_mesh/rust/component_a/src/a.rs b/crates/cpp/tests/native_mesh/rust/component_a/src/a.rs new file mode 100644 index 000000000..1572a4f89 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_a/src/a.rs @@ -0,0 +1,300 @@ +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! +// Options used: +#[allow(dead_code)] +pub mod foo { + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code, clippy::all)] + pub mod resources { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + + #[derive(Debug)] + #[repr(transparent)] + pub struct R { + handle: _rt::Resource, + } + + impl R { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for R { + #[inline] + unsafe fn drop(_handle: u32) { + { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-drop]r")] + fn fooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_: u32); + } + + crate::a_impl::fooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_handle); + } + } + } + + impl R { + #[allow(unused_unsafe, clippy::all)] + pub fn new(a: u32) -> Self { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[constructor]r")] + fn fooX3AfooX2FresourcesX00X5BconstructorX5Dr(_: i32) -> i32; + } + let ret = crate::a_impl::fooX3AfooX2FresourcesX00X5BconstructorX5Dr( + _rt::as_i32(&a), + ); + R::from_handle(ret as u32) + } + } + } + impl R { + #[allow(unused_unsafe, clippy::all)] + pub fn add(&self, b: u32) { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[method]r.add")] + fn fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd(_: i32, _: i32); + } + crate::a_impl::fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd( + (self).handle() as i32, + _rt::as_i32(&b), + ); + } + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn create() -> R { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "create")] + fn fooX3AfooX2FresourcesX00create() -> i32; + } + let ret = crate::a_impl::fooX3AfooX2FresourcesX00create(); + R::from_handle(ret as u32) + } + } + #[allow(unused_unsafe, clippy::all)] + /// borrows: func(o: borrow); + pub fn consume(o: R) { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "consume")] + fn fooX3AfooX2FresourcesX00consume(_: i32); + } + crate::a_impl::fooX3AfooX2FresourcesX00consume((&o).take_handle()); + } + } + } + } +} +mod _rt { + + use core::fmt; + use core::marker; + use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; + + /// A type which represents a component model resource, either imported or + /// exported into this component. + /// + /// This is a low-level wrapper which handles the lifetime of the resource + /// (namely this has a destructor). The `T` provided defines the component model + /// intrinsics that this wrapper uses. + /// + /// One of the chief purposes of this type is to provide `Deref` implementations + /// to access the underlying data when it is owned. + /// + /// This type is primarily used in generated code for exported and imported + /// resources. + #[repr(transparent)] + pub struct Resource { + // NB: This would ideally be `u32` but it is not. The fact that this has + // interior mutability is not exposed in the API of this type except for the + // `take_handle` method which is supposed to in theory be private. + // + // This represents, almost all the time, a valid handle value. When it's + // invalid it's stored as `u32::MAX`. + handle: AtomicU32, + _marker: marker::PhantomData, + } + + /// A trait which all wasm resources implement, namely providing the ability to + /// drop a resource. + /// + /// This generally is implemented by generated code, not user-facing code. + #[allow(clippy::missing_safety_doc)] + pub unsafe trait WasmResource { + /// Invokes the `[resource-drop]...` intrinsic. + unsafe fn drop(handle: u32); + } + + impl Resource { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + debug_assert!(handle != u32::MAX); + Self { + handle: AtomicU32::new(handle), + _marker: marker::PhantomData, + } + } + + /// Takes ownership of the handle owned by `resource`. + /// + /// Note that this ideally would be `into_handle` taking `Resource` by + /// ownership. The code generator does not enable that in all situations, + /// unfortunately, so this is provided instead. + /// + /// Also note that `take_handle` is in theory only ever called on values + /// owned by a generated function. For example a generated function might + /// take `Resource` as an argument but then call `take_handle` on a + /// reference to that argument. In that sense the dynamic nature of + /// `take_handle` should only be exposed internally to generated code, not + /// to user code. + #[doc(hidden)] + pub fn take_handle(resource: &Resource) -> u32 { + resource.handle.swap(u32::MAX, Relaxed) + } + + #[doc(hidden)] + pub fn handle(resource: &Resource) -> u32 { + resource.handle.load(Relaxed) + } + } + + impl fmt::Debug for Resource { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Resource") + .field("handle", &self.handle) + .finish() + } + } + + impl Drop for Resource { + fn drop(&mut self) { + unsafe { + match self.handle.load(Relaxed) { + // If this handle was "taken" then don't do anything in the + // destructor. + u32::MAX => {} + + // ... but otherwise do actually destroy it with the imported + // component model intrinsic as defined through `T`. + other => T::drop(other), + } + } + } + } + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } +} + +#[cfg(target_arch = "wasm32")] +#[link_section = "component-type:wit-bindgen:0.26.0:a:encoded world"] +#[doc(hidden)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 272] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x98\x01\x01A\x02\x01\ +A\x02\x01B\x0b\x04\0\x01r\x03\x01\x01i\0\x01@\x01\x01ay\0\x01\x04\0\x0e[construc\ +tor]r\x01\x02\x01h\0\x01@\x02\x04self\x03\x01by\x01\0\x04\0\x0d[method]r.add\x01\ +\x04\x01@\0\0\x01\x04\0\x06create\x01\x05\x01@\x01\x01o\x01\x01\0\x04\0\x07consu\ +me\x01\x06\x03\x01\x11foo:foo/resources\x05\0\x04\x01\x09foo:foo/a\x04\0\x0b\x07\ +\x01\0\x01a\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x07\ +0.209.0\x10wit-bindgen-rust\x060.26.0"; + +#[inline(never)] +#[doc(hidden)] +#[cfg(target_arch = "wasm32")] +pub fn __link_custom_section_describing_imports() { + wit_bindgen::rt::maybe_link_cabi_realloc(); +} diff --git a/crates/cpp/tests/native_mesh/rust/component_a/src/a_impl.rs b/crates/cpp/tests/native_mesh/rust/component_a/src/a_impl.rs new file mode 100644 index 000000000..8ad9ae785 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_a/src/a_impl.rs @@ -0,0 +1,31 @@ +use mesh::impl_mesh::fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd as add; +use mesh::impl_mesh::fooX3AfooX2FresourcesX00consume as consume; +use mesh::impl_mesh::fooX3AfooX2FresourcesX00create as create; + +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00create() -> i32 { + //component_b::b_impl::subtract(5, 6); + create() + //component_b::b_impl::fooX3AfooX2FresourcesX23create() +} + +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00consume(a: u32) { + consume(a); +} + +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_a: u32) { + dbg!("drop........"); +} + +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00X5BconstructorX5Dr(a: i32) -> i32 { + // Construct the resource here + a +} +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd(handle: i32, b: i32) { + //dbg!("handle:{}", handle); + add(handle as u32, b as u32); +} diff --git a/crates/cpp/tests/native_mesh/rust/component_a/src/main.rs b/crates/cpp/tests/native_mesh/rust/component_a/src/main.rs new file mode 100644 index 000000000..e8dd97616 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_a/src/main.rs @@ -0,0 +1,10 @@ +mod a; +mod a_impl; + +fn main() { + let obj = a::foo::foo::resources::create(); + //dbg!("created object {:?}", &obj); + // println!("{}", obj.handle()); + obj.add(5); + a::foo::foo::resources::consume(obj); +} diff --git a/crates/cpp/tests/native_mesh/rust/component_b/Cargo.lock b/crates/cpp/tests/native_mesh/rust/component_b/Cargo.lock new file mode 100644 index 000000000..47647fe5f --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_b/Cargo.lock @@ -0,0 +1,1427 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "component_b" +version = "0.1.0" +dependencies = [ + "once_cell", + "wasmtime", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29daf137addc15da6bab6eae2c4a11e274b1d270bf2759508e62f6145e863ef6" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de619867d5de4c644b7fd9904d6e3295269c93d8a71013df796ab338681222d4" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f5cf277490037d8dae9513d35e0ee8134670ae4a964a5ed5b198d4249d7c10" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3e22ecad1123343a3c09ac6ecc532bb5c184b6fcb7888df0ea953727f79924" + +[[package]] +name = "cranelift-control" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53ca3ec6d30bce84ccf59c81fead4d16381a3ef0ef75e8403bc1e7385980da09" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eabb8d36b0ca8906bec93c78ea516741cac2d7e6b266fa7b0ffddcc09004990" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b42630229e49a8cfcae90bdc43c8c4c08f7a7aa4618b67f79265cd2f996dd2" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d1e36361805dfe0b6cdfd5a5ffdb5d03fa796170c5717d2727cbe623b93a0" + +[[package]] +name = "cranelift-native" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aea85a0d7e1800b14ce9d3f53adf8ad4d1ee8a9e23b0269bdc50285e93b9b3" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac491fd3473944781f0cf9528c90cc899d18ad438da21961a839a3a44d57dfb" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-encoder" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.211.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e7d931a1120ef357f32b74547646b6fa68ea25e377772b72874b131a9ed70d4" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmparser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" +dependencies = [ + "anyhow", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92a1370c66a0022e6d92dcc277e2c84f5dece19569670b8ce7db8162560d8b6" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown 0.14.5", + "indexmap", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dee8679c974a7f258c03d60d3c747c426ed219945b6d08cbc77fd2eab15b2d1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00103ffaf7ee980f4e750fe272b6ada79d9901659892e457c7ca316b16df9ec" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cae30035f1cf97dcc6657c979cf39f99ce6be93583675eddf4aeaa5548509c" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ae611f08cea620c67330925be28a96115bf01f8f393a6cbdf4856a86087134" + +[[package]] +name = "wasmtime-cranelift" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2909406a6007e28be964067167890bca4574bd48a9ff18f1fa9f4856d89ea40" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e227f9ed2f5421473723d6c0352b5986e6e6044fde5410a274a394d726108f" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42edb392586d07038c1638e854382db916b6ca7845a2e6a7f8dc49e08907acdd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b26ef7914af0c0e3ca811bdc32f5f66fbba0fd21e1f8563350e8a7951e3598" +dependencies = [ + "object", + "once_cell", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe088f9b56bb353adaf837bf7e10f1c2e1676719dd5be4cac8e37f2ba1ee5bc" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys", +] + +[[package]] +name = "wasmtime-slab" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ff75cafffe47b04b036385ce3710f209153525b0ed19d57b0cf44a22d446460" + +[[package]] +name = "wasmtime-types" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f2fa462bfea3220711c84e2b549f147e4df89eeb49b8a2a3d89148f6cc4a8b1" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmtime-winch" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b27054fed6be4f3800aba5766f7ef435d4220ce290788f021a08d4fa573108" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "object", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936a52ce69c28de2aa3b5fb4f2dbbb2966df304f04cccb7aca4ba56d915fda0" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "wit-parser", +] + +[[package]] +name = "wast" +version = "211.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b25506dd82d00da6b14a87436b3d52b1d264083fa79cdb72a0d1b04a8595ccaa" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.211.1", +] + +[[package]] +name = "wat" +version = "1.211.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb716ca6c86eecac2d82541ffc39860118fc0af9309c4f2670637bea2e1bdd7d" +dependencies = [ + "wast", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dc69899ccb2da7daa4df31426dcfd284b104d1a85e1dae35806df0c46187f87" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-parser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.11+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/crates/cpp/tests/native_mesh/rust/component_b/Cargo.toml b/crates/cpp/tests/native_mesh/rust/component_b/Cargo.toml new file mode 100644 index 000000000..29e5ddae8 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "component_b" +version = "0.1.0" +edition = "2021" + +[dependencies] +once_cell = "1.19.0" +wasmtime = "22.0.0" diff --git a/crates/cpp/tests/native_mesh/rust/component_b/src/b.rs b/crates/cpp/tests/native_mesh/rust/component_b/src/b.rs new file mode 100644 index 000000000..fd1900e79 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_b/src/b.rs @@ -0,0 +1,441 @@ +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! +// Options used: +#[allow(dead_code)] +pub mod exports { + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code, clippy::all)] + #[macro_use] + pub mod resources { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use std::fmt::Debug; + + use super::super::super::super::_rt; + + #[derive(Debug)] + #[repr(transparent)] + pub struct R { + handle: _rt::Resource, + } + + type _RRep = Option; + + impl R { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `R`. + pub fn new(val: T) -> Self { + let val: _RRep = Some(val); + let ptr: *mut _RRep = _rt::Box::into_raw(_rt::Box::new(val)); + let v = unsafe { T::_resource_new(ptr.cast()) }; + let res = unsafe { Self::from_handle(v) }; + res + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + let res = Self { + handle: _rt::Resource::from_handle(handle), + }; + + res + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestR` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _RRep); + } + + fn as_ptr(&self) -> *mut _RRep { + R::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`R`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct RBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a R>, + } + + impl<'a> RBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + // let v = unsafe { Box::from_raw(self.rep) }; + // dbg!(*v); + let ptr = unsafe { &mut *self.as_ptr::() }; + + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _RRep { + R::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for R { + #[inline] + unsafe fn drop(_handle: u32) { + { + #[link(wasm_import_module = "[export]foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-drop]r")] + fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_: u32); + } + + crate::b_impl::X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_dropX5Dr( + _handle, + ); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_constructor_r_cabi(arg0: i32) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = R::new(T::new(arg0 as u32)); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_r_add_cabi(arg0: *mut u8, arg1: i32) { + // dbg!(arg0.clone()); + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + //let v = RBorrow::lift(arg0 as usize).get(); + T::add(RBorrow::lift(arg0 as usize).get(), arg1 as u32); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_create_cabi() -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::create(); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_consume_cabi(arg0: i32) { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + T::consume(R::from_handle(arg0 as u32)); + } + + pub trait Guest { + type R: GuestR; + fn create() -> R; + /// borrows: func(o: borrow); + fn consume(o: R); + } + + pub trait GuestR: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[link(wasm_import_module = "[export]foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-new]r")] + fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_newX5Dr( + _: *mut u8, + ) -> u32; + } + crate::b_impl::X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_newX5Dr(val) + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[link(wasm_import_module = "[export]foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-rep]r")] + fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_repX5Dr( + _: u32, + ) -> *mut u8; + } + + crate::b_impl::X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_repX5Dr( + handle as i32, + ) + } + + fn new(a: u32) -> Self; + fn add(&self, b: u32); + } + #[doc(hidden)] + #[macro_export] + + macro_rules! __export_foo_foo_resources_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => { + + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#[constructor]r")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + pub unsafe extern "C" fn fooX3AfooX2FresourcesX23X5BconstructorX5Dr(arg0: i32,) -> i32 { + $($path_to_types)*::_export_constructor_r_cabi::<<$ty as $($path_to_types)*::Guest>::R>(arg0) + } + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#[method]r.add")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + pub unsafe extern "C" fn fooX3AfooX2FresourcesX23X5BmethodX5DrX2Eadd(arg0: *mut u8,arg1: i32,) { + $($path_to_types)*::_export_method_r_add_cabi::<<$ty as $($path_to_types)*::Guest>::R>(arg0, arg1) + } + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#create")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + pub unsafe extern "C" fn fooX3AfooX2FresourcesX23create() -> i32 { + $($path_to_types)*::_export_create_cabi::<$ty>() + } + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#consume")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + pub unsafe extern "C" fn fooX3AfooX2FresourcesX23consume(arg0: i32,) { + $($path_to_types)*::_export_consume_cabi::<$ty>(arg0) + } + pub fn addr(a: i32, b: i32) -> i32 { + a + b + } + + const _: () = { + #[doc(hidden)] + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#[dtor]r")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + #[allow(non_snake_case)] + unsafe extern "C" fn fooX3AfooX2FresourcesX23X5BdtorX5Dr(rep: *mut u8) { + $($path_to_types)*::R::dtor::< + <$ty as $($path_to_types)*::Guest>::R + >(rep) + } + }; + + }; +} + //#[doc(hidden)] + // pub(crate) use __export_foo_foo_resources_cabi; + } + } + } +} +mod _rt { + + use core::fmt; + use core::marker; + use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; + + /// A type which represents a component model resource, either imported or + /// exported into this component. + /// + /// This is a low-level wrapper which handles the lifetime of the resource + /// (namely this has a destructor). The `T` provided defines the component model + /// intrinsics that this wrapper uses. + /// + /// One of the chief purposes of this type is to provide `Deref` implementations + /// to access the underlying data when it is owned. + /// + /// This type is primarily used in generated code for exported and imported + /// resources. + #[repr(transparent)] + pub struct Resource { + // NB: This would ideally be `u32` but it is not. The fact that this has + // interior mutability is not exposed in the API of this type except for the + // `take_handle` method which is supposed to in theory be private. + // + // This represents, almost all the time, a valid handle value. When it's + // invalid it's stored as `u32::MAX`. + handle: AtomicU32, + _marker: marker::PhantomData, + } + + /// A trait which all wasm resources implement, namely providing the ability to + /// drop a resource. + /// + /// This generally is implemented by generated code, not user-facing code. + #[allow(clippy::missing_safety_doc)] + pub unsafe trait WasmResource { + /// Invokes the `[resource-drop]...` intrinsic. + unsafe fn drop(handle: u32); + } + + impl Resource { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + debug_assert!(handle != u32::MAX); + Self { + handle: AtomicU32::new(handle), + _marker: marker::PhantomData, + } + } + + /// Takes ownership of the handle owned by `resource`. + /// + /// Note that this ideally would be `into_handle` taking `Resource` by + /// ownership. The code generator does not enable that in all situations, + /// unfortunately, so this is provided instead. + /// + /// Also note that `take_handle` is in theory only ever called on values + /// owned by a generated function. For example a generated function might + /// take `Resource` as an argument but then call `take_handle` on a + /// reference to that argument. In that sense the dynamic nature of + /// `take_handle` should only be exposed internally to generated code, not + /// to user code. + #[doc(hidden)] + pub fn take_handle(resource: &Resource) -> u32 { + resource.handle.swap(u32::MAX, Relaxed) + } + + #[doc(hidden)] + pub fn handle(resource: &Resource) -> u32 { + resource.handle.load(Relaxed) + } + } + + impl fmt::Debug for Resource { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Resource") + .field("handle", &self.handle) + .finish() + } + } + + impl Drop for Resource { + fn drop(&mut self) { + unsafe { + match self.handle.load(Relaxed) { + // If this handle was "taken" then don't do anything in the + // destructor. + u32::MAX => {} + + // ... but otherwise do actually destroy it with the imported + // component model intrinsic as defined through `T`. + other => T::drop(other), + } + } + } + } + pub use alloc_crate::boxed::Box; + + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen::rt::run_ctors_once(); + } + extern crate alloc as alloc_crate; +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_b_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::foo::foo::resources::__export_foo_foo_resources_cabi!($ty with_types_in $($path_to_types_root)*::exports::foo::foo::resources); + ) +} +#[doc(inline)] +//pub(crate) use __export_b_impl as export; +#[cfg(target_arch = "wasm32")] +#[link_section = "component-type:wit-bindgen:0.26.0:b:encoded world"] +#[doc(hidden)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 272] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x98\x01\x01A\x02\x01\ +A\x02\x01B\x0b\x04\0\x01r\x03\x01\x01i\0\x01@\x01\x01ay\0\x01\x04\0\x0e[construc\ +tor]r\x01\x02\x01h\0\x01@\x02\x04self\x03\x01by\x01\0\x04\0\x0d[method]r.add\x01\ +\x04\x01@\0\0\x01\x04\0\x06create\x01\x05\x01@\x01\x01o\x01\x01\0\x04\0\x07consu\ +me\x01\x06\x04\x01\x11foo:foo/resources\x05\0\x04\x01\x09foo:foo/b\x04\0\x0b\x07\ +\x01\0\x01b\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x07\ +0.209.0\x10wit-bindgen-rust\x060.26.0"; + +#[inline(never)] +#[doc(hidden)] +#[cfg(target_arch = "wasm32")] +pub fn __link_custom_section_describing_imports() { + wit_bindgen::rt::maybe_link_cabi_realloc(); +} diff --git a/crates/cpp/tests/native_mesh/rust/component_b/src/b_impl.rs b/crates/cpp/tests/native_mesh/rust/component_b/src/b_impl.rs new file mode 100644 index 000000000..a514ad78d --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_b/src/b_impl.rs @@ -0,0 +1,67 @@ +use crate::b::exports::foo::foo::resources::Guest; +use crate::b::exports::foo::foo::resources::GuestR; +use crate::b::exports::foo::foo::resources::R; +use std::cell::RefCell; + +#[derive(Debug)] +pub struct MyGuestR { + val: RefCell, +} + +impl GuestR for MyGuestR { + fn new(a: u32) -> Self { + MyGuestR { + val: RefCell::new(a), + } + } + + fn add(&self, b: u32) { + let mut val = self.val.borrow_mut(); + //dbg!(*val); + *val += b; + //println!("Note: add fails here because the variable in the trait is not mutable"); + } +} + +struct MyGuest {} +impl Guest for MyGuest { + type R = MyGuestR; + fn create() -> R { + let val = 18; + println!("Created a resource with value: {}", val); + let res = MyGuestR::new(val as u32); + let res = R::new(res); + // dbg!(&res); + return res; + } + fn consume(o: R) { + let p: &MyGuestR = o.get(); + println!("Consumed: {:?}", p.val.borrow()); + } +} + +crate::__export_foo_foo_resources_cabi!(MyGuest with_types_in crate::b::exports::foo::foo::resources); + +#[allow(non_snake_case)] +pub extern "C" fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(a: u32) { + crate::remove_resource(a as i32); +} + +type _RRep = Option; +#[allow(non_snake_case)] +pub extern "C" fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_newX5Dr(a: *mut u8) -> u32 { + //dbg!(a); + crate::store_resource(a) as u32 +} + +#[allow(non_snake_case)] +pub extern "C" fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_repX5Dr(id: i32) -> *mut u8 { + let v = crate::get_resource(id) + .unwrap() + .to_owned() + .lock() + .unwrap() + .ptr; + + v +} diff --git a/crates/cpp/tests/native_mesh/rust/component_b/src/lib.rs b/crates/cpp/tests/native_mesh/rust/component_b/src/lib.rs new file mode 100644 index 000000000..849dc460b --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_b/src/lib.rs @@ -0,0 +1,69 @@ +pub mod b; +pub mod b_impl; + +use once_cell::sync::Lazy; +use std::sync::{Arc, Mutex}; +use wasmtime::component::{Resource, ResourceTable}; + +#[derive(Debug)] +// Wrapper struct for the raw pointer +struct SafePtr { + pub ptr: *mut u8, +} + +// Implementing Send and Sync for SafePtr +unsafe impl Send for SafePtr {} +unsafe impl Sync for SafePtr {} + +// Using PhantomData to indicate that SafePtr owns a raw pointer +impl SafePtr { + fn new(ptr: *mut u8) -> Self { + SafePtr { ptr } + } +} + +static GLOBAL_MAP: Lazy>> = + Lazy::new(|| Arc::new(Mutex::new(ResourceTable::new()))); + +fn store_resource(value: *mut u8) -> i32 { + let mut map = GLOBAL_MAP.lock().unwrap(); + + let v = map.push(Arc::new(Mutex::new(SafePtr::new(value)))).unwrap(); + + v.rep() as i32 +} + +fn get_resource(key: i32) -> Option>> { + let map = GLOBAL_MAP.lock().unwrap(); + let key = Resource::new_own(key as u32); + let v: &Arc> = map.get(&key).unwrap(); + + Some(v.to_owned()) +} + +fn remove_resource(key: i32) { + let mut map = GLOBAL_MAP.lock().unwrap(); + let key: Resource>> = Resource::new_own(key as u32); + map.delete(key).unwrap(); +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn it_works() { + let value = 5; + let ptr = Box::into_raw(Box::new(value)); + let mut map = GLOBAL_MAP.lock().unwrap(); + let v = map + .push(Arc::new(Mutex::new(SafePtr::new(ptr.cast())))) + .unwrap(); + dbg!(&v.rep()); + + let key = v.rep(); + + let ret: &SafePtr = map.get(&Resource::new_own(key)).unwrap(); + dbg!(ret); + assert_eq!(Box::new(value), unsafe { Box::from_raw(ret.ptr) }); + } +} diff --git a/crates/cpp/tests/native_mesh/rust/component_b/src/resource_table.rs b/crates/cpp/tests/native_mesh/rust/component_b/src/resource_table.rs new file mode 100644 index 000000000..b7f72c8c7 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/component_b/src/resource_table.rs @@ -0,0 +1,15 @@ +use wasmtime::component::ResourceTable::{self, *}; + +struct RT { + rt: ResourceTable, +} + +impl RT { + fn create_rt() -> RT { + Self { + rt: ResourceTable::new(), + } + } + + fn insert_resource(&mut self, item: T) {} +} diff --git a/crates/cpp/tests/native_mesh/rust/mesh/Cargo.lock b/crates/cpp/tests/native_mesh/rust/mesh/Cargo.lock new file mode 100644 index 000000000..e149af0c2 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/mesh/Cargo.lock @@ -0,0 +1,1434 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + +[[package]] +name = "async-trait" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cc" +version = "1.0.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cobs" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" + +[[package]] +name = "component_b" +version = "0.1.0" +dependencies = [ + "once_cell", + "wasmtime", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8227005286ec39567949b33df9896bcadfa6051bccca2488129f108ca23119" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29daf137addc15da6bab6eae2c4a11e274b1d270bf2759508e62f6145e863ef6" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-codegen" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de619867d5de4c644b7fd9904d6e3295269c93d8a71013df796ab338681222d4" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f5cf277490037d8dae9513d35e0ee8134670ae4a964a5ed5b198d4249d7c10" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3e22ecad1123343a3c09ac6ecc532bb5c184b6fcb7888df0ea953727f79924" + +[[package]] +name = "cranelift-control" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53ca3ec6d30bce84ccf59c81fead4d16381a3ef0ef75e8403bc1e7385980da09" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eabb8d36b0ca8906bec93c78ea516741cac2d7e6b266fa7b0ffddcc09004990" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b42630229e49a8cfcae90bdc43c8c4c08f7a7aa4618b67f79265cd2f996dd2" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d1e36361805dfe0b6cdfd5a5ffdb5d03fa796170c5717d2727cbe623b93a0" + +[[package]] +name = "cranelift-native" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75aea85a0d7e1800b14ce9d3f53adf8ad4d1ee8a9e23b0269bdc50285e93b9b3" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.108.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac491fd3473944781f0cf9528c90cc899d18ad438da21961a839a3a44d57dfb" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "encoding_rs" +version = "0.8.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags", + "debugid", + "fxhash", + "serde", + "serde_json", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap", + "stable_deref_trait", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "ittapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" +dependencies = [ + "anyhow", + "ittapi-sys", + "log", +] + +[[package]] +name = "ittapi-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" +dependencies = [ + "cc", +] + +[[package]] +name = "jobserver" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +dependencies = [ + "libc", +] + +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + +[[package]] +name = "libc" +version = "0.2.155" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mesh" +version = "0.1.0" +dependencies = [ + "component_b", +] + +[[package]] +name = "object" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap", + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + +[[package]] +name = "postcard" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" +dependencies = [ + "cobs", + "embedded-io", + "serde", +] + +[[package]] +name = "proc-macro2" +version = "1.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "quote" +version = "1.0.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" + +[[package]] +name = "serde" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.203" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +dependencies = [ + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] + +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "syn" +version = "2.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "target-lexicon" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" + +[[package]] +name = "thiserror" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f49eb2ab21d2f26bd6db7bf383edc527a7ebaee412d17af4d40fdccd442f335" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f21c7aaf97f1bd9ca9d4f9e73b0a6c74bd5afef56f2bc931943a6e1c37e04e38" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-width" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-encoder" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d996306fb3aeaee0d9157adbe2f670df0236caf19f6728b221e92d0f27b3fe17" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasm-encoder" +version = "0.211.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e7d931a1120ef357f32b74547646b6fa68ea25e377772b72874b131a9ed70d4" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmparser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19bb9f8ab07616da582ef8adb24c54f1424c7ec876720b7da9db8ec0626c92c" +dependencies = [ + "ahash", + "bitflags", + "hashbrown 0.14.5", + "indexmap", + "semver", +] + +[[package]] +name = "wasmprinter" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c2d8a7b4dabb460208e6b4334d9db5766e84505038b2529e69c3d07ac619115" +dependencies = [ + "anyhow", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92a1370c66a0022e6d92dcc277e2c84f5dece19569670b8ce7db8162560d8b6" +dependencies = [ + "addr2line", + "anyhow", + "async-trait", + "bumpalo", + "cc", + "cfg-if", + "encoding_rs", + "fxprof-processed-profile", + "gimli", + "hashbrown 0.14.5", + "indexmap", + "ittapi", + "libc", + "libm", + "log", + "mach2", + "memfd", + "memoffset", + "object", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix", + "semver", + "serde", + "serde_derive", + "serde_json", + "smallvec", + "sptr", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-component-util", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-fiber", + "wasmtime-jit-debug", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "wasmtime-winch", + "wat", + "windows-sys", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dee8679c974a7f258c03d60d3c747c426ed219945b6d08cbc77fd2eab15b2d1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00103ffaf7ee980f4e750fe272b6ada79d9901659892e457c7ca316b16df9ec" +dependencies = [ + "anyhow", + "base64", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2", + "toml", + "windows-sys", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cae30035f1cf97dcc6657c979cf39f99ce6be93583675eddf4aeaa5548509c" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7ae611f08cea620c67330925be28a96115bf01f8f393a6cbdf4856a86087134" + +[[package]] +name = "wasmtime-cranelift" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2909406a6007e28be964067167890bca4574bd48a9ff18f1fa9f4856d89ea40" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40e227f9ed2f5421473723d6c0352b5986e6e6044fde5410a274a394d726108f" +dependencies = [ + "anyhow", + "cpp_demangle", + "cranelift-entity", + "gimli", + "indexmap", + "log", + "object", + "postcard", + "rustc-demangle", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder 0.207.0", + "wasmparser", + "wasmprinter", + "wasmtime-component-util", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-fiber" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42edb392586d07038c1638e854382db916b6ca7845a2e6a7f8dc49e08907acdd" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "rustix", + "wasmtime-asm-macros", + "wasmtime-versioned-export-macros", + "windows-sys", +] + +[[package]] +name = "wasmtime-jit-debug" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b26ef7914af0c0e3ca811bdc32f5f66fbba0fd21e1f8563350e8a7951e3598" +dependencies = [ + "object", + "once_cell", + "rustix", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe088f9b56bb353adaf837bf7e10f1c2e1676719dd5be4cac8e37f2ba1ee5bc" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys", +] + +[[package]] +name = "wasmtime-slab" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ff75cafffe47b04b036385ce3710f209153525b0ed19d57b0cf44a22d446460" + +[[package]] +name = "wasmtime-types" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f2fa462bfea3220711c84e2b549f147e4df89eeb49b8a2a3d89148f6cc4a8b1" +dependencies = [ + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasmtime-winch" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b27054fed6be4f3800aba5766f7ef435d4220ce290788f021a08d4fa573108" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "object", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", + "winch-codegen", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936a52ce69c28de2aa3b5fb4f2dbbb2966df304f04cccb7aca4ba56d915fda0" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "wit-parser", +] + +[[package]] +name = "wast" +version = "211.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b25506dd82d00da6b14a87436b3d52b1d264083fa79cdb72a0d1b04a8595ccaa" +dependencies = [ + "bumpalo", + "leb128", + "memchr", + "unicode-width", + "wasm-encoder 0.211.1", +] + +[[package]] +name = "wat" +version = "1.211.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb716ca6c86eecac2d82541ffc39860118fc0af9309c4f2670637bea2e1bdd7d" +dependencies = [ + "wast", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winch-codegen" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dc69899ccb2da7daa4df31426dcfd284b104d1a85e1dae35806df0c46187f87" +dependencies = [ + "anyhow", + "cranelift-codegen", + "gimli", + "regalloc2", + "smallvec", + "target-lexicon", + "wasmparser", + "wasmtime-cranelift", + "wasmtime-environ", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" + +[[package]] +name = "winnow" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b5e5f6c299a3c7890b876a2a587f3115162487e704907d9b6cd29473052ba1" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-parser" +version = "0.207.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c83dab33a9618d86cfe3563cc864deffd08c17efc5db31a3b7cd1edeffe6e1" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zstd" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.11+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/crates/cpp/tests/native_mesh/rust/mesh/Cargo.toml b/crates/cpp/tests/native_mesh/rust/mesh/Cargo.toml new file mode 100644 index 000000000..8dcf86705 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/mesh/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "mesh" +version = "0.1.0" +edition = "2021" + +[dependencies] +component_b = {path = "../component_b"} diff --git a/crates/cpp/tests/native_mesh/rust/mesh/src/impl_mesh.rs b/crates/cpp/tests/native_mesh/rust/mesh/src/impl_mesh.rs new file mode 100644 index 000000000..7d4f8e2d1 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/mesh/src/impl_mesh.rs @@ -0,0 +1,23 @@ +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00create() -> i32 { + unsafe { component_b::b_impl::fooX3AfooX2FresourcesX23create() } +} + +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00consume(a: u32) { + // let obj0 = mesh::foo::foo::resources::R::new(a); + unsafe { component_b::b_impl::fooX3AfooX2FresourcesX23consume(a as i32) } +} + +#[allow(non_snake_case)] +pub extern "C" fn fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd(a: u32, b: u32) { + // let obj0 = mesh::foo::foo::resources::R::new(a); + //dbg!(a); + //let handle = Box::into_raw(Box::new(a)); + //get the actual object + let handle = + component_b::b_impl::X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_repX5Dr(a as i32); + unsafe { + component_b::b_impl::fooX3AfooX2FresourcesX23X5BmethodX5DrX2Eadd(handle, b as i32); + } +} diff --git a/crates/cpp/tests/native_mesh/rust/mesh/src/lib.rs b/crates/cpp/tests/native_mesh/rust/mesh/src/lib.rs new file mode 100644 index 000000000..678f712a9 --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/mesh/src/lib.rs @@ -0,0 +1,2 @@ +pub mod impl_mesh; +pub mod mesh; diff --git a/crates/cpp/tests/native_mesh/rust/mesh/src/mesh.rs b/crates/cpp/tests/native_mesh/rust/mesh/src/mesh.rs new file mode 100644 index 000000000..7cfadb17e --- /dev/null +++ b/crates/cpp/tests/native_mesh/rust/mesh/src/mesh.rs @@ -0,0 +1,601 @@ +// Generated by `wit-bindgen` 0.26.0. DO NOT EDIT! +// Options used: +#[allow(dead_code)] +pub mod foo { + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code, clippy::all)] + pub mod resources { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + + #[derive(Debug)] + #[repr(transparent)] + pub struct R { + handle: _rt::Resource, + } + + impl R { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for R { + #[inline] + unsafe fn drop(_handle: u32) { + { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-drop]r")] + fn fooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_: u32); + } + + fooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_handle); + } + } + } + + impl R { + #[allow(unused_unsafe, clippy::all)] + pub fn new(a: u32) -> Self { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[constructor]r")] + fn fooX3AfooX2FresourcesX00X5BconstructorX5Dr(_: i32) -> i32; + } + let ret = fooX3AfooX2FresourcesX00X5BconstructorX5Dr(_rt::as_i32(&a)); + R::from_handle(ret as u32) + } + } + } + impl R { + #[allow(unused_unsafe, clippy::all)] + pub fn add(&self, b: u32) { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[method]r.add")] + fn fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd(_: i32, _: i32); + } + fooX3AfooX2FresourcesX00X5BmethodX5DrX2Eadd( + (self).handle() as i32, + _rt::as_i32(&b), + ); + } + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn create() -> R { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "create")] + fn fooX3AfooX2FresourcesX00create() -> i32; + } + + R::new(fooX3AfooX2FresourcesX00create() as u32) + } + } + #[allow(unused_unsafe, clippy::all)] + /// borrows: func(o: borrow); + pub fn consume(o: R) { + unsafe { + #[link(wasm_import_module = "foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "consume")] + fn fooX3AfooX2FresourcesX00consume(_: i32); + } + fooX3AfooX2FresourcesX00consume((&o).take_handle() as i32); + } + } + } + } +} +#[allow(dead_code)] +pub mod exports { + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code, clippy::all)] + pub mod resources { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + + use super::super::super::super::_rt; + + #[derive(Debug)] + // #[repr(transparent)] + pub struct R { + handle: _rt::Resource, + } + + type _RRep = Option; + + impl R { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `R`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _RRep = Some(val); + let ptr: *mut _RRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestR` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _RRep); + } + + fn as_ptr(&self) -> *mut _RRep { + R::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`R`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct RBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a R>, + } + + impl<'a> RBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _RRep { + R::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for R { + #[inline] + unsafe fn drop(_handle: u32) { + { + #[link(wasm_import_module = "[export]foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-drop]r")] + fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_: u32); + } + + X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_dropX5Dr(_handle); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_constructor_r_cabi(arg0: i32) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = R::new(T::new(arg0 as u32)); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_r_add_cabi(arg0: *mut u8, arg1: i32) { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + T::add(RBorrow::lift(arg0 as usize).get(), arg1 as u32); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_create_cabi() -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::create(); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_consume_cabi(arg0: i32) { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + T::consume(R::from_handle(arg0 as u32)); + } + pub trait Guest { + type R: GuestR; + fn create() -> R; + /// borrows: func(o: borrow); + fn consume(o: R); + } + pub trait GuestR: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[link(wasm_import_module = "[export]foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-new]r")] + fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_newX5Dr( + _: *mut u8, + ) -> u32; + } + X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_newX5Dr(val) + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[link(wasm_import_module = "[export]foo:foo/resources")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "[resource-rep]r")] + fn X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_repX5Dr( + _: u32, + ) -> *mut u8; + } + unsafe { X5BexportX5DfooX3AfooX2FresourcesX00X5Bresource_repX5Dr(handle) } + } + + fn new(a: u32) -> Self; + fn add(&self, b: u32); + } + #[doc(hidden)] + #[macro_export] + macro_rules! __export_foo_foo_resources_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#[constructor]r")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + unsafe extern "C" fn fooX3AfooX2FresourcesX23X5BconstructorX5Dr(arg0: i32,) -> i32 { + $($path_to_types)*::_export_constructor_r_cabi::<<$ty as $($path_to_types)*::Guest>::R>(arg0) + } + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#[method]r.add")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + unsafe extern "C" fn fooX3AfooX2FresourcesX23X5BmethodX5DrX2Eadd(arg0: *mut u8,arg1: i32,) { + $($path_to_types)*::_export_method_r_add_cabi::<<$ty as $($path_to_types)*::Guest>::R>(arg0, arg1) + } + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#create")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + unsafe extern "C" fn fooX3AfooX2FresourcesX23create() -> i32 { + $($path_to_types)*::_export_create_cabi::<$ty>() + } + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#consume")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + unsafe extern "C" fn fooX3AfooX2FresourcesX23consume(arg0: i32,) { + $($path_to_types)*::_export_consume_cabi::<$ty>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/resources#[dtor]r")] + #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] + #[allow(non_snake_case)] + unsafe extern "C" fn fooX3AfooX2FresourcesX23X5BdtorX5Dr(rep: *mut u8) { + $($path_to_types)*::R::dtor::< + <$ty as $($path_to_types)*::Guest>::R + >(rep) + } + }; + + };); +} + } + } + } +} +mod _rt { + + use core::fmt; + use core::marker; + use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; + + /// A type which represents a component model resource, either imported or + /// exported into this component. + /// + /// This is a low-level wrapper which handles the lifetime of the resource + /// (namely this has a destructor). The `T` provided defines the component model + /// intrinsics that this wrapper uses. + /// + /// One of the chief purposes of this type is to provide `Deref` implementations + /// to access the underlying data when it is owned. + /// + /// This type is primarily used in generated code for exported and imported + /// resources. + #[repr(transparent)] + pub struct Resource { + // NB: This would ideally be `u32` but it is not. The fact that this has + // interior mutability is not exposed in the API of this type except for the + // `take_handle` method which is supposed to in theory be private. + // + // This represents, almost all the time, a valid handle value. When it's + // invalid it's stored as `u32::MAX`. + handle: AtomicU32, + _marker: marker::PhantomData, + } + + /// A trait which all wasm resources implement, namely providing the ability to + /// drop a resource. + /// + /// This generally is implemented by generated code, not user-facing code. + #[allow(clippy::missing_safety_doc)] + pub unsafe trait WasmResource { + /// Invokes the `[resource-drop]...` intrinsic. + unsafe fn drop(handle: u32); + } + + impl Resource { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + debug_assert!(handle != u32::MAX); + Self { + handle: AtomicU32::new(handle), + _marker: marker::PhantomData, + } + } + + /// Takes ownership of the handle owned by `resource`. + /// + /// Note that this ideally would be `into_handle` taking `Resource` by + /// ownership. The code generator does not enable that in all situations, + /// unfortunately, so this is provided instead. + /// + /// Also note that `take_handle` is in theory only ever called on values + /// owned by a generated function. For example a generated function might + /// take `Resource` as an argument but then call `take_handle` on a + /// reference to that argument. In that sense the dynamic nature of + /// `take_handle` should only be exposed internally to generated code, not + /// to user code. + #[doc(hidden)] + pub fn take_handle(resource: &Resource) -> u32 { + resource.handle.swap(u32::MAX, Relaxed) + } + + #[doc(hidden)] + pub fn handle(resource: &Resource) -> u32 { + resource.handle.load(Relaxed) + } + } + + impl fmt::Debug for Resource { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Resource") + .field("handle", &self.handle) + .finish() + } + } + + impl Drop for Resource { + fn drop(&mut self) { + unsafe { + match self.handle.load(Relaxed) { + // If this handle was "taken" then don't do anything in the + // destructor. + u32::MAX => {} + + // ... but otherwise do actually destroy it with the imported + // component model intrinsic as defined through `T`. + other => T::drop(other), + } + } + } + } + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + pub use alloc_crate::boxed::Box; + + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen::rt::run_ctors_once(); + } + extern crate alloc as alloc_crate; +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_mesh_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::foo::foo::resources::__export_foo_foo_resources_cabi!($ty with_types_in $($path_to_types_root)*::exports::foo::foo::resources); + ) +} + +#[cfg(target_arch = "wasm32")] +#[link_section = "component-type:wit-bindgen:0.26.0:mesh:encoded world"] +#[doc(hidden)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 410] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x9f\x02\x01A\x02\x01\ +A\x04\x01B\x0b\x04\0\x01r\x03\x01\x01i\0\x01@\x01\x01ay\0\x01\x04\0\x0e[construc\ +tor]r\x01\x02\x01h\0\x01@\x02\x04self\x03\x01by\x01\0\x04\0\x0d[method]r.add\x01\ +\x04\x01@\0\0\x01\x04\0\x06create\x01\x05\x01@\x01\x01o\x01\x01\0\x04\0\x07consu\ +me\x01\x06\x03\x01\x11foo:foo/resources\x05\0\x01B\x0b\x04\0\x01r\x03\x01\x01i\0\ +\x01@\x01\x01ay\0\x01\x04\0\x0e[constructor]r\x01\x02\x01h\0\x01@\x02\x04self\x03\ +\x01by\x01\0\x04\0\x0d[method]r.add\x01\x04\x01@\0\0\x01\x04\0\x06create\x01\x05\ +\x01@\x01\x01o\x01\x01\0\x04\0\x07consume\x01\x06\x04\x01\x11foo:foo/resources\x05\ +\x01\x04\x01\x0cfoo:foo/mesh\x04\0\x0b\x0a\x01\0\x04mesh\x03\0\0\0G\x09producers\ +\x01\x0cprocessed-by\x02\x0dwit-component\x070.209.0\x10wit-bindgen-rust\x060.26\ +.0"; + +#[inline(never)] +#[doc(hidden)] +#[cfg(target_arch = "wasm32")] +pub fn __link_custom_section_describing_imports() { + wit_bindgen::rt::maybe_link_cabi_realloc(); +} diff --git a/crates/cpp/tests/native_strings/Makefile b/crates/cpp/tests/native_strings/Makefile index 54cdcdf09..0be82d7aa 100644 --- a/crates/cpp/tests/native_strings/Makefile +++ b/crates/cpp/tests/native_strings/Makefile @@ -1,26 +1,26 @@ -CXXFLAGS=-g -O0 -I../../helper-types +CXXFLAGS=-g -O0 -I../../helper-types --std=c++17 WIT_BINDGEN=../../../../target/debug/wit-bindgen all: libstrings.so app-strings -libstrings.so: the_world.pie.o guest.pie.o +libstrings.so: the_world.pie.o guest_exports.pie.o $(CXX) $(CXXFLAGS) -shared -o $@ $^ -Wl,--version-script=guest.lds %.pie.o: %.cpp $(CXX) $(CXXFLAGS) -fPIE -o $@ -c $^ -app-strings: the_world_native.o main.o - $(CXX) $(CXXFLAGS) -o $@ $^ -L. -lstrings +app-strings: the_world_native.o main.o guest_imports.o + $(CXX) $(CXXFLAGS) -o $@ $^ -g -L. -lstrings bindgen: wit/strings.wit $(WIT_BINDGEN) cpp wit --wasm64 --format $(WIT_BINDGEN) cpp wit --wasm64 --format --direct cd rust/src ; ../../$(WIT_BINDGEN) rust ../../wit --wasm64 -guest.wasm: the_world.cpp guest.cpp +guest.wasm: the_world.cpp guest_exports.cpp /opt/wasi-sdk/bin/clang++ -o $@ $^ $(CXXFLAGS) -guest_release.wasm: the_world.cpp guest.cpp +guest_release.wasm: the_world.cpp guest_exports.cpp /opt/wasi-sdk/bin/clang++ -o $@ $^ $(CXXFLAGS) -g0 -O3 clean: diff --git a/crates/cpp/tests/native_strings/guest.cpp b/crates/cpp/tests/native_strings/guest_exports.cpp similarity index 67% rename from crates/cpp/tests/native_strings/guest.cpp rename to crates/cpp/tests/native_strings/guest_exports.cpp index 90fa6258d..6d2938f1a 100644 --- a/crates/cpp/tests/native_strings/guest.cpp +++ b/crates/cpp/tests/native_strings/guest_exports.cpp @@ -1,13 +1,16 @@ #include "the_world_cpp.h" -void exports::foo::foo::strings::A(wit::string &&x) { +void exports::foo::foo::strings::A(wit::string &&x) +{ ::foo::foo::strings::A(x.get_view()); } -wit::string exports::foo::foo::strings::B() { +wit::string exports::foo::foo::strings::B() +{ return ::foo::foo::strings::B(); } -wit::string exports::foo::foo::strings::C(wit::string &&x, wit::string &&b) { +wit::string exports::foo::foo::strings::C(wit::string &&x, wit::string &&b) +{ return ::foo::foo::strings::C(x.get_view(), b.get_view()); } diff --git a/crates/cpp/tests/native_strings/guest_imports.cpp b/crates/cpp/tests/native_strings/guest_imports.cpp new file mode 100644 index 000000000..ce4cc515e --- /dev/null +++ b/crates/cpp/tests/native_strings/guest_imports.cpp @@ -0,0 +1,20 @@ +#include "the_world_cpp_native.h" +#include + +using namespace std; + +void foo::foo::strings::A(std::string_view x) +{ + std::cout << x << std::endl; +} +wit::string foo::foo::strings::B() +{ + wit::string b = wit::string::from_view(std::string_view("hello B")); + return b; +} +wit::string foo::foo::strings::C(std::string_view a, std::string_view b) +{ + std::cout << a << '|' << b << std::endl; + wit::string c = wit::string::from_view(std::string_view("hello C")); + return c; +} \ No newline at end of file diff --git a/crates/cpp/tests/native_strings/main.cpp b/crates/cpp/tests/native_strings/main.cpp index 0f86198e5..faef32df4 100644 --- a/crates/cpp/tests/native_strings/main.cpp +++ b/crates/cpp/tests/native_strings/main.cpp @@ -2,19 +2,6 @@ #include "the_world_cpp_native.h" #include -void foo::foo::strings::A(std::string_view x) { - std::cout << x << std::endl; -} -wit::string foo::foo::strings::B() { - wit::string b = wit::string::from_view(std::string_view("hello B")); - return b; -} -wit::string foo::foo::strings::C(std::string_view a, std::string_view b) { - std::cout << a << '|' << b << std::endl; - wit::string c = wit::string::from_view(std::string_view("hello C")); - return c; -} - int main() { wit::string a = wit::string::from_view(std::string_view("hello A")); exports::foo::foo::strings::A(a); diff --git a/crates/cpp/tests/native_strings/rust/src/lib.rs b/crates/cpp/tests/native_strings/rust/src/lib.rs index 0fb041a18..4ab10ffe0 100644 --- a/crates/cpp/tests/native_strings/rust/src/lib.rs +++ b/crates/cpp/tests/native_strings/rust/src/lib.rs @@ -3,6 +3,7 @@ use std::alloc::Layout; use the_world::exports::foo::foo::strings::Guest; mod the_world; +mod the_world_native; struct MyWorld; @@ -22,6 +23,7 @@ impl Guest for MyWorld { the_world::export!(MyWorld with_types_in the_world); + // the crate wit-bindgen-rt doesn't work on native #[no_mangle] pub unsafe extern "C" fn cabi_realloc( diff --git a/crates/cpp/tests/native_strings/rust/src/the_world.rs b/crates/cpp/tests/native_strings/rust/src/the_world.rs index 5c05d404b..9f53259ca 100644 --- a/crates/cpp/tests/native_strings/rust/src/the_world.rs +++ b/crates/cpp/tests/native_strings/rust/src/the_world.rs @@ -1,159 +1,180 @@ // Generated by `wit-bindgen` 0.24.0. DO NOT EDIT! // Options used: + #[allow(dead_code)] pub mod foo { - #[allow(dead_code)] - pub mod foo { - #[allow(dead_code, clippy::all)] - pub mod strings { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn a(x: &str,){ - unsafe { - let vec0 = x; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code, clippy::all)] + pub mod strings { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use crate::the_world_native; - #[link(wasm_import_module = "foo:foo/strings")] - extern "C" { - #[cfg_attr(target_arch = "wasm32", link_name = "a")] - fn fooX3AfooX2FstringsX00a(_: *mut u8, _: usize, ); - } - fooX3AfooX2FstringsX00a(ptr0.cast_mut(), len0); - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn b() -> _rt::String{ - unsafe { - #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit::; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[link(wasm_import_module = "foo:foo/strings")] - extern "C" { - #[cfg_attr(target_arch = "wasm32", link_name = "b")] - fn fooX3AfooX2FstringsX00b(_: *mut u8, ); - } - fooX3AfooX2FstringsX00b(ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(8).cast::(); - let len3 = l2; - let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn c(a: &str,b: &str,) -> _rt::String{ - unsafe { - #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit::; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); - let vec0 = a; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - let vec1 = b; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[link(wasm_import_module = "foo:foo/strings")] - extern "C" { - #[cfg_attr(target_arch = "wasm32", link_name = "c")] - fn fooX3AfooX2FstringsX00c(_: *mut u8, _: usize, _: *mut u8, _: usize, _: *mut u8, ); - } - fooX3AfooX2FstringsX00c(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1, ptr2); - let l3 = *ptr2.add(0).cast::<*mut u8>(); - let l4 = *ptr2.add(8).cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - _rt::string_lift(bytes5) - } - } + use super::super::super::_rt; + #[allow(unused_unsafe, clippy::all)] + pub fn a(x: &str) { + unsafe { + let vec0 = x; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + #[link(wasm_import_module = "foo:foo/strings")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "a")] + fn fooX3AfooX2FstringsX00a(_: *mut u8, _: usize); + } + the_world_native::fooX3AfooX2FstringsX00a(ptr0.cast_mut(), len0); + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn b() -> _rt::String { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[link(wasm_import_module = "foo:foo/strings")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "b")] + fn fooX3AfooX2FstringsX00b(_: *mut u8); + } + fooX3AfooX2FstringsX00b(ptr0); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(8).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + _rt::string_lift(bytes3) + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn c(a: &str, b: &str) -> _rt::String { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let vec0 = a; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = b; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let ptr2 = ret_area.0.as_mut_ptr().cast::(); + #[link(wasm_import_module = "foo:foo/strings")] + extern "C" { + #[cfg_attr(target_arch = "wasm32", link_name = "c")] + fn fooX3AfooX2FstringsX00c( + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + fooX3AfooX2FstringsX00c(ptr0.cast_mut(), len0, ptr1.cast_mut(), len1, ptr2); + let l3 = *ptr2.add(0).cast::<*mut u8>(); + let l4 = *ptr2.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + _rt::string_lift(bytes5) + } + } + } } - - } } #[allow(dead_code)] pub mod exports { - #[allow(dead_code)] - pub mod foo { #[allow(dead_code)] pub mod foo { - #[allow(dead_code, clippy::all)] - pub mod strings { - #[used] - #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; - use super::super::super::super::_rt; - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_a_cabi(arg0: *mut u8,arg1: usize,) {#[cfg(target_arch="wasm32")] - _rt::run_ctors_once();let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - T::a(_rt::string_lift(bytes0)); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_b_cabi() -> *mut u8 {#[cfg(target_arch="wasm32")] - _rt::run_ctors_once();let result0 = T::b(); - let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); - let vec2 = (result0.into_bytes()).into_boxed_slice(); - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - ::core::mem::forget(vec2); - *ptr1.add(8).cast::() = len2; - *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); - ptr1 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_b(arg0: *mut u8,) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0.add(8).cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn _export_c_cabi(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) -> *mut u8 {#[cfg(target_arch="wasm32")] - _rt::run_ctors_once();let len0 = arg1; - let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); - let len1 = arg3; - let bytes1 = _rt::Vec::from_raw_parts(arg2.cast(), len1, len1); - let result2 = T::c(_rt::string_lift(bytes0), _rt::string_lift(bytes1)); - let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); - let vec4 = (result2.into_bytes()).into_boxed_slice(); - let ptr4 = vec4.as_ptr().cast::(); - let len4 = vec4.len(); - ::core::mem::forget(vec4); - *ptr3.add(8).cast::() = len4; - *ptr3.add(0).cast::<*mut u8>() = ptr4.cast_mut(); - ptr3 - } - #[doc(hidden)] - #[allow(non_snake_case)] - pub unsafe fn __post_return_c(arg0: *mut u8,) { - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0.add(8).cast::(); - _rt::cabi_dealloc(l0, l1, 1); - } - pub trait Guest { - fn a(x: _rt::String,); - fn b() -> _rt::String; - fn c(a: _rt::String,b: _rt::String,) -> _rt::String; - } - #[doc(hidden)] - - macro_rules! __export_foo_foo_strings_cabi{ + #[allow(dead_code)] + pub mod foo { + #[allow(dead_code, clippy::all)] + pub mod strings { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_a_cabi(arg0: *mut u8, arg1: usize) { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + T::a(_rt::string_lift(bytes0)); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_b_cabi() -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::b(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + let vec2 = (result0.into_bytes()).into_boxed_slice(); + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + ::core::mem::forget(vec2); + *ptr1.add(8).cast::() = len2; + *ptr1.add(0).cast::<*mut u8>() = ptr2.cast_mut(); + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_b(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l0, l1, 1); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_c_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let len1 = arg3; + let bytes1 = _rt::Vec::from_raw_parts(arg2.cast(), len1, len1); + let result2 = T::c(_rt::string_lift(bytes0), _rt::string_lift(bytes1)); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + let vec4 = (result2.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr3.add(8).cast::() = len4; + *ptr3.add(0).cast::<*mut u8>() = ptr4.cast_mut(); + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_c(arg0: *mut u8) { + let l0 = *arg0.add(0).cast::<*mut u8>(); + let l1 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l0, l1, 1); + } + pub trait Guest { + fn a(x: _rt::String); + fn b() -> _rt::String; + fn c(a: _rt::String, b: _rt::String) -> _rt::String; + } + #[doc(hidden)] + #[macro_export] + macro_rules! __export_foo_foo_strings_cabi{ ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/strings#a")] #[cfg_attr(not(target_arch = "wasm32"), no_mangle)] - unsafe extern "C" fn fooX3AfooX2FstringsX23a(arg0: *mut u8,arg1: usize,) { + pub unsafe extern "C" fn fooX3AfooX2FstringsX23a(arg0: *mut u8,arg1: usize,) { + println!("fooX3AfooX2FstringsX23a"); $($path_to_types)*::_export_a_cabi::<$ty>(arg0, arg1) } #[cfg_attr(target_arch = "wasm32", export_name = "foo:foo/strings#b")] @@ -178,41 +199,39 @@ pub mod exports { } };); } - #[doc(hidden)] - pub(crate) use __export_foo_foo_strings_cabi; - #[repr(align(8))] - struct _RetArea([::core::mem::MaybeUninit::; 16]); - static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); - -} - -} -} + #[doc(hidden)] + pub(crate) use __export_foo_foo_strings_cabi; + #[repr(align(8))] + struct _RetArea([::core::mem::MaybeUninit; 16]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + } + } + } } mod _rt { - pub use alloc_crate::string::String; - pub use alloc_crate::vec::Vec; - pub unsafe fn string_lift(bytes: Vec) -> String { - if cfg!(debug_assertions) { - String::from_utf8(bytes).unwrap() - } else { - String::from_utf8_unchecked(bytes) + pub use alloc_crate::string::String; + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } } - } - - #[cfg(target_arch = "wasm32")] - pub fn run_ctors_once() { - wit_bindgen::rt::run_ctors_once(); - } - pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { - if size == 0 { - return; + + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen::rt::run_ctors_once(); } - let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr as *mut u8, layout); - } - extern crate alloc as alloc_crate; - pub use alloc_crate::alloc; + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + extern crate alloc as alloc_crate; + pub use alloc_crate::alloc; } /// Generates `#[no_mangle]` functions to export the specified type as the @@ -259,6 +278,5 @@ processed-by\x02\x0dwit-component\x070.207.0\x10wit-bindgen-rust\x060.24.0"; #[doc(hidden)] #[cfg(target_arch = "wasm32")] pub fn __link_custom_section_describing_imports() { - wit_bindgen::rt::maybe_link_cabi_realloc(); + wit_bindgen::rt::maybe_link_cabi_realloc(); } - diff --git a/crates/cpp/tests/native_strings/the_world.cpp b/crates/cpp/tests/native_strings/the_world.cpp index 9ab7b9c5c..d7538bb90 100644 --- a/crates/cpp/tests/native_strings/the_world.cpp +++ b/crates/cpp/tests/native_strings/the_world.cpp @@ -63,7 +63,7 @@ wit::string foo::foo::strings::C(std::string_view a, std::string_view b) { return wit::string((char const *)(*((uint8_t **)(ptr2 + 0))), len3); } extern "C" __attribute__((__export_name__("foo:foo/strings#a"))) void -fooX3AfooX2FstringsX23a(uint8_t *arg0, size_t arg1) { +fooX3AfooX2FstringsX23a(uint8_t *arg0, size_t arg1) { auto len0 = arg1; exports::foo::foo::strings::A(wit::string((char const *)(arg0), len0)); diff --git a/crates/cpp/tests/native_strings/the_world_native.cpp b/crates/cpp/tests/native_strings/the_world_native.cpp index 2ba8a4083..9284ff6ca 100644 --- a/crates/cpp/tests/native_strings/the_world_native.cpp +++ b/crates/cpp/tests/native_strings/the_world_native.cpp @@ -44,11 +44,12 @@ extern "C" void fooX3AfooX2FstringsX00c(uint8_t *arg0, size_t arg1, *((size_t *)(arg4 + 8)) = len3; *((uint8_t **)(arg4 + 0)) = ptr3; } -void exports::foo::foo::strings::A(wit::string x) { +void exports::foo::foo::strings::A(wit::string x) { auto const &vec0 = x; auto ptr0 = vec0.data(); auto len0 = vec0.size(); fooX3AfooX2FstringsX23a(ptr0, len0); + } wit::guest_owned exports::foo::foo::strings::B() { auto ret = fooX3AfooX2FstringsX23b();