From caf0070ab3b2ea79b0d66ea00a9df3cefb7a07b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 20 May 2025 22:50:16 +0000 Subject: [PATCH] Bug 1967206 - Update jobserver (and related crates to avoid duplication). r=glandium,supply-chain-reviewers Differential Revision: https://phabricator.services.mozilla.com/D250045 --- Cargo.lock | 37 +- Cargo.toml | 7 +- build/rust/r-efi/Cargo.toml | 8 + build/rust/r-efi/lib.rs | 3 + build/rust/wasi-0.10/Cargo.toml | 2 +- build/rust/wasi/Cargo.toml | 2 +- supply-chain/audits.toml | 21 +- supply-chain/imports.lock | 8 +- .../rust/getrandom/.cargo-checksum.json | 2 +- third_party/rust/getrandom/CHANGELOG.md | 67 +- third_party/rust/getrandom/Cargo.lock | 365 + third_party/rust/getrandom/Cargo.toml | 40 +- third_party/rust/getrandom/LICENSE-MIT | 2 +- third_party/rust/getrandom/README.md | 48 +- third_party/rust/getrandom/build.rs | 52 +- third_party/rust/getrandom/src/backends.rs | 62 +- .../getrandom/src/backends/apple_other.rs | 1 + .../rust/getrandom/src/backends/custom.rs | 1 + .../rust/getrandom/src/backends/efi_rng.rs | 124 + .../rust/getrandom/src/backends/esp_idf.rs | 1 + .../rust/getrandom/src/backends/fuchsia.rs | 1 + .../rust/getrandom/src/backends/getentropy.rs | 1 + .../rust/getrandom/src/backends/getrandom.rs | 5 +- .../rust/getrandom/src/backends/hermit.rs | 9 +- .../getrandom/src/backends/linux_android.rs | 17 - .../backends/linux_android_with_fallback.rs | 39 +- .../rust/getrandom/src/backends/linux_raw.rs | 136 + .../rust/getrandom/src/backends/netbsd.rs | 2 + .../rust/getrandom/src/backends/rdrand.rs | 3 + .../rust/getrandom/src/backends/rndr.rs | 3 + .../rust/getrandom/src/backends/solaris.rs | 1 + .../rust/getrandom/src/backends/solid.rs | 5 +- .../rust/getrandom/src/backends/use_file.rs | 4 +- .../rust/getrandom/src/backends/vxworks.rs | 29 +- .../rust/getrandom/src/backends/wasi_p1.rs | 14 +- .../rust/getrandom/src/backends/wasi_p2.rs | 3 + .../rust/getrandom/src/backends/wasm_js.rs | 1 + .../rust/getrandom/src/backends/windows.rs | 31 +- .../rust/getrandom/src/backends/windows7.rs | 1 + third_party/rust/getrandom/src/error.rs | 122 +- third_party/rust/getrandom/src/lib.rs | 1 + third_party/rust/getrandom/src/util.rs | 2 + third_party/rust/getrandom/src/util_libc.rs | 18 +- .../rust/jobserver/.cargo-checksum.json | 2 +- third_party/rust/jobserver/Cargo.lock | 198 + third_party/rust/jobserver/Cargo.toml | 30 +- third_party/rust/jobserver/src/unix.rs | 11 +- third_party/rust/jobserver/src/windows.rs | 27 +- third_party/rust/wasi/.cargo-checksum.json | 2 +- third_party/rust/wasi/Cargo.lock | 12 +- third_party/rust/wasi/Cargo.toml | 62 +- third_party/rust/wasi/README.md | 56 +- third_party/rust/wasi/ci/regenerate.sh | 82 +- .../rust/wasi/ci/rustfmt-bindings.toml | 2 - third_party/rust/wasi/ci/vendor-wit.sh | 28 + .../rust/wasi/examples/cli-command-no_std.rs | 11 + third_party/rust/wasi/examples/cli-command.rs | 7 +- .../rust/wasi/examples/hello-world-no_std.rs | 4 + third_party/rust/wasi/examples/hello-world.rs | 7 +- .../rust/wasi/examples/http-proxy-no_std.rs | 22 + third_party/rust/wasi/examples/http-proxy.rs | 7 +- third_party/rust/wasi/src/bindings.rs | 12148 ++++++++-------- third_party/rust/wasi/src/command.rs | 1029 +- third_party/rust/wasi/src/ext/mod.rs | 8 + third_party/rust/wasi/src/ext/std.rs | 69 + third_party/rust/wasi/src/lib.rs | 19 +- third_party/rust/wasi/src/proxy.rs | 617 +- .../rust/wasi/wit/deps/cli/command.wit | 5 +- .../rust/wasi/wit/deps/cli/environment.wit | 4 + third_party/rust/wasi/wit/deps/cli/exit.wit | 13 + .../rust/wasi/wit/deps/cli/imports.wit | 28 +- third_party/rust/wasi/wit/deps/cli/run.wit | 2 + third_party/rust/wasi/wit/deps/cli/stdio.wit | 15 +- .../rust/wasi/wit/deps/cli/terminal.wit | 13 + .../wasi/wit/deps/clocks/monotonic-clock.wit | 21 +- .../rust/wasi/wit/deps/clocks/timezone.wit | 55 + .../rust/wasi/wit/deps/clocks/wall-clock.wit | 6 +- .../rust/wasi/wit/deps/clocks/world.wit | 7 +- .../wasi/wit/deps/filesystem/preopens.wit | 7 +- .../rust/wasi/wit/deps/filesystem/types.wit | 66 +- .../rust/wasi/wit/deps/filesystem/world.wit | 5 +- .../rust/wasi/wit/deps/http/handler.wit | 6 + third_party/rust/wasi/wit/deps/http/proxy.wit | 40 +- third_party/rust/wasi/wit/deps/http/types.wit | 234 +- third_party/rust/wasi/wit/deps/io/error.wit | 18 +- third_party/rust/wasi/wit/deps/io/poll.wit | 34 +- third_party/rust/wasi/wit/deps/io/streams.wit | 34 +- third_party/rust/wasi/wit/deps/io/world.wit | 6 +- .../wasi/wit/deps/random/insecure-seed.wit | 4 +- .../rust/wasi/wit/deps/random/insecure.wit | 5 +- .../rust/wasi/wit/deps/random/random.wit | 5 +- .../rust/wasi/wit/deps/random/world.wit | 8 +- .../wit/deps/sockets/instance-network.wit | 4 +- .../wasi/wit/deps/sockets/ip-name-lookup.wit | 13 +- .../rust/wasi/wit/deps/sockets/network.wit | 28 +- .../wit/deps/sockets/tcp-create-socket.wit | 5 +- .../rust/wasi/wit/deps/sockets/tcp.wit | 56 +- .../wit/deps/sockets/udp-create-socket.wit | 5 +- .../rust/wasi/wit/deps/sockets/udp.wit | 36 +- .../rust/wasi/wit/deps/sockets/world.wit | 10 +- third_party/rust/wasi/wit/wasi-crate.wit | 4 +- .../rust/wit-bindgen-rt/.cargo-checksum.json | 2 +- third_party/rust/wit-bindgen-rt/Cargo.lock | 181 + third_party/rust/wit-bindgen-rt/Cargo.toml | 33 +- third_party/rust/wit-bindgen-rt/build.rs | 26 +- .../rust/wit-bindgen-rt/src/async_support.rs | 515 + .../src/async_support/future_support.rs | 362 + .../src/async_support/stream_support.rs | 431 + .../rust/wit-bindgen-rt/src/cabi_realloc.c | 4 +- .../rust/wit-bindgen-rt/src/cabi_realloc.o | Bin 261 -> 261 bytes .../rust/wit-bindgen-rt/src/cabi_realloc.rs | 4 +- third_party/rust/wit-bindgen-rt/src/lib.rs | 39 +- .../src/libwit_bindgen_cabi_realloc.a | Bin 412 -> 412 bytes 113 files changed, 10826 insertions(+), 7334 deletions(-) create mode 100644 build/rust/r-efi/Cargo.toml create mode 100644 build/rust/r-efi/lib.rs create mode 100644 third_party/rust/getrandom/Cargo.lock create mode 100644 third_party/rust/getrandom/src/backends/efi_rng.rs delete mode 100644 third_party/rust/getrandom/src/backends/linux_android.rs create mode 100644 third_party/rust/getrandom/src/backends/linux_raw.rs create mode 100644 third_party/rust/jobserver/Cargo.lock delete mode 100644 third_party/rust/wasi/ci/rustfmt-bindings.toml create mode 100755 third_party/rust/wasi/ci/vendor-wit.sh create mode 100644 third_party/rust/wasi/examples/cli-command-no_std.rs create mode 100644 third_party/rust/wasi/examples/hello-world-no_std.rs create mode 100644 third_party/rust/wasi/examples/http-proxy-no_std.rs create mode 100644 third_party/rust/wasi/src/ext/mod.rs create mode 100644 third_party/rust/wasi/src/ext/std.rs create mode 100644 third_party/rust/wasi/wit/deps/clocks/timezone.wit create mode 100644 third_party/rust/wit-bindgen-rt/Cargo.lock create mode 100644 third_party/rust/wit-bindgen-rt/src/async_support.rs create mode 100644 third_party/rust/wit-bindgen-rt/src/async_support/future_support.rs create mode 100644 third_party/rust/wit-bindgen-rt/src/async_support/stream_support.rs diff --git a/Cargo.lock b/Cargo.lock index acb93c9c8acd..cb26b6d9a8f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2482,21 +2482,21 @@ dependencies = [ name = "getrandom" version = "0.2.999" dependencies = [ - "getrandom 0.3.1", + "getrandom 0.3.3", ] [[package]] name = "getrandom" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.13.0+wasi-0.2.0", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", "wasm-bindgen", - "windows-targets", ] [[package]] @@ -3503,10 +3503,11 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" dependencies = [ + "getrandom 0.3.3", "libc", ] @@ -5489,6 +5490,10 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.999.999" + [[package]] name = "rand" version = "0.8.5" @@ -6567,7 +6572,7 @@ checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" dependencies = [ "cfg-if", "fastrand", - "getrandom 0.3.1", + "getrandom 0.3.3", "once_cell", "rustix", "windows-sys", @@ -7356,23 +7361,22 @@ dependencies = [ name = "wasi" version = "0.10.0+wasi-snapshot-preview999" dependencies = [ - "wasi 0.13.0+wasi-0.2.0", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] name = "wasi" version = "0.11.999" dependencies = [ - "wasi 0.13.0+wasi-0.2.0", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] name = "wasi" -version = "0.13.0+wasi-0.2.0" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "652cd73449d0b957a2743b70c72d79d34a5fa505696488f4ca90b46f6da94118" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ - "bitflags 2.9.0", "wit-bindgen-rt", ] @@ -7865,9 +7869,12 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.21.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "026d24a27f6712541fa534f2954bd9e0eb66172f033c2157c0f31d106255c497" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.9.0", +] [[package]] name = "wpf-gpu-raster" diff --git a/Cargo.toml b/Cargo.toml index 352c71a31c9f..172d6ba2b4d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,6 +131,9 @@ terminal_size = { path = "build/rust/terminal_size" } # Patch bitflags 1.0 to 2.0 bitflags = { path = "build/rust/bitflags" } +# Patch r-efi to an empty crate +r-efi = { path = "build/rust/r-efi" } + # Patch redox_users to an empty crate redox_users = { path = "build/rust/redox_users" } @@ -146,10 +149,10 @@ base64_13 = { package = "base64", path = "build/rust/base64_13" } # Patch base64 0.21 to 0.22 base64_21 = { package = "base64", path = "build/rust/base64" } -# Patch wasi 0.10 to 0.13 +# Patch wasi 0.10 to 0.14 wasi_0_10 = { package = "wasi", path = "build/rust/wasi-0.10" } -# Patch wasi 0.11 to 0.13 +# Patch wasi 0.11 to 0.14 wasi_0_11 = { package = "wasi", path = "build/rust/wasi" } # tokio 0.29.0 includes an experimental "tracing" feature which requires diff --git a/build/rust/r-efi/Cargo.toml b/build/rust/r-efi/Cargo.toml new file mode 100644 index 000000000000..2feabc4c6e73 --- /dev/null +++ b/build/rust/r-efi/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "r-efi" +version = "5.999.999" +edition = "2018" +license = "MPL-2.0" + +[lib] +path = "lib.rs" diff --git a/build/rust/r-efi/lib.rs b/build/rust/r-efi/lib.rs new file mode 100644 index 000000000000..e0032240a4d2 --- /dev/null +++ b/build/rust/r-efi/lib.rs @@ -0,0 +1,3 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/build/rust/wasi-0.10/Cargo.toml b/build/rust/wasi-0.10/Cargo.toml index 4a2fee86eeab..a73e1b6c7e8b 100644 --- a/build/rust/wasi-0.10/Cargo.toml +++ b/build/rust/wasi-0.10/Cargo.toml @@ -8,7 +8,7 @@ license = "MPL-2.0" path = "lib.rs" [dependencies.wasi] -version = "0.13.0" +version = "0.14.0" default-features = false [features] diff --git a/build/rust/wasi/Cargo.toml b/build/rust/wasi/Cargo.toml index 3cbeeab16086..bc3812f028a2 100644 --- a/build/rust/wasi/Cargo.toml +++ b/build/rust/wasi/Cargo.toml @@ -8,7 +8,7 @@ license = "MPL-2.0" path = "lib.rs" [dependencies.wasi] -version = "0.13.0" +version = "0.14.0" default-features = false [features] diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index 10165bd94c42..2298ce44d8c6 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -2563,6 +2563,19 @@ In addition, I've checked Linux, Windows, Mac, and Android more thoroughly again documentation. """ +[[audits.getrandom]] +who = "Emilio Cobos Álvarez " +criteria = "safe-to-deploy" +delta = "0.3.1 -> 0.3.3" +notes = """ +Biggest non-trivial change is a new UEFI back-end, which looks reasonable to +the best of my ability: There's some trickiness on initialization but doesn't +look unsafe, at worse it leaks, and it might not if the relevant pointers are +static/non-owning. Other changes also look reasonable too: some tweaks to +inlining and a syscall-based linux back-end, whose relevant unsafe code looks +reasonable. +""" + [[audits.gimli]] who = "Alex Franchuk " criteria = "safe-to-deploy" @@ -3130,6 +3143,12 @@ who = "Mike Hommey " criteria = "safe-to-deploy" delta = "0.1.24 -> 0.1.25" +[[audits.jobserver]] +who = "Emilio Cobos Álvarez " +criteria = "safe-to-deploy" +delta = "0.1.32 -> 0.1.33" +notes = "No unsafe added, only non-trivial change is switching to the getrandom crate on Windows." + [[audits.keccak]] who = "Simon Friedberger " criteria = "safe-to-deploy" @@ -6951,7 +6970,7 @@ end = "2024-05-08" criteria = "safe-to-deploy" user-id = 1 # Alex Crichton (alexcrichton) start = "2020-06-03" -end = "2024-05-05" +end = "2026-05-19" [[trusted.wasm-encoder]] criteria = "safe-to-deploy" diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index 449aeb79b52a..5e2642baeb2c 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -785,8 +785,8 @@ user-login = "seanmonstar" user-name = "Sean McArthur" [[publisher.wasi]] -version = "0.13.0+wasi-0.2.0" -when = "2024-03-12" +version = "0.14.2+wasi-0.2.4" +when = "2025-02-28" user-id = 1 user-login = "alexcrichton" user-name = "Alex Crichton" @@ -885,8 +885,8 @@ user-login = "epage" user-name = "Ed Page" [[publisher.wit-bindgen-rt]] -version = "0.21.0" -when = "2024-03-04" +version = "0.39.0" +when = "2025-02-05" user-id = 73222 user-login = "wasmtime-publish" diff --git a/third_party/rust/getrandom/.cargo-checksum.json b/third_party/rust/getrandom/.cargo-checksum.json index 4ddb4359034d..1da331a59bdd 100644 --- a/third_party/rust/getrandom/.cargo-checksum.json +++ b/third_party/rust/getrandom/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"3000732ebdbde090f0f971e87b1bffa89de25ae70fc282b58c6c4ed7f574eea7","Cargo.toml":"448e4ae3f4a71ebd55435f6de05ef03cb4ad8ad27cc586305c39f58491f075b8","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"42fa16951ce7f24b5a467a40e5b449a1d41e662f97ca779864f053f39e097737","README.md":"89acb2c8a9b37d50ee569ac163e3eac9d3c1b003631bd95bd3397daa34d4e2bf","SECURITY.md":"816ea79f8c7937888ab5a972a1efb270c4bada028b448953a195359fe11d526e","benches/buffer.rs":"20fb7dd9edafe0c182f1fe037b28d7542f8e0ae742d51e97aeebf418edde49aa","build.rs":"5b6a7fe4b07f17eab0cef06d80721ffbfa22527577b0d13bdb71306ae45cd96c","src/backends.rs":"00cdd73cc21c4e76ebd60cae2199c1b7de6fd24ca7a59d868a7c999244959c2e","src/backends/apple_other.rs":"7e1f893a6eb3da9238a5510d5b6d5c3db7c6aee77becd64b6707778ec4915cff","src/backends/custom.rs":"c921b05cbeb7f22bfe59d65cf9fd2f232874cfd7bb019ede80a2f7e97cfd63c8","src/backends/esp_idf.rs":"dc16e3669e4bb13cc0e9b8c4d6888a991de3c501a4527b649804450adb11a93d","src/backends/fuchsia.rs":"8b367069acf80094e3fb1a3044a6141e9ed5267667c0a2ed91ee83f0b620506b","src/backends/getentropy.rs":"035ec45cfed3efa4fcd3d5ff3453430c87e02d106578a22ba7e52c11d7494cdf","src/backends/getrandom.rs":"6bfeca07027237cc44b4591740f69813ab3f2f4bcd047b7fe495b94af11881ea","src/backends/hermit.rs":"9500f549c9a167b62169fb163617007f20f7adce0990f54d8a990b449504c8b7","src/backends/linux_android.rs":"78b2f2734422154b62541d3bb728d32bb09d30a704e69ca6a9b6faca44da2caa","src/backends/linux_android_with_fallback.rs":"a266494b23e194629893a1082ab7e942118d89d15311f1f6f519fbc4495687e9","src/backends/netbsd.rs":"5f3cf054961b3732aa177d0f354e4ee0fba31ac5384ac9245e15801237223db8","src/backends/rdrand.rs":"995f4532722aa90ea9228daa167ed63520715041ff6d73368bf2eb394dbe5c24","src/backends/rndr.rs":"4e1ce1e28dda72c8a3a29bfa62240f9d0fdb89ee1f7af2fb38dc570e79e2cbc1","src/backends/solaris.rs":"f9972e8748260567c90f209913045df312bfe39f6999e3b21617cb16446aedba","src/backends/solid.rs":"1d99a7299e309d5f0cc66efa68b31daa436a1dbf2fb8e1f9c1e99ca45c2943ca","src/backends/use_file.rs":"b835a4517e8c7f3bfa879b2395b65baafe69ee41d0bd922a2ffa9186f5feedfe","src/backends/vxworks.rs":"be8c29e6bb3cc8c60aaccd12a68e28612ee308e3023f9ede700433c0ecbf1d63","src/backends/wasi_p1.rs":"16771c1089a2b81f48e04f0e78e598106d525d0d5c1d4152230a1ef1c84c2b4f","src/backends/wasi_p2.rs":"84a69c83df27c2d028c975d89e27f402c1ef24e2c972f5f71fef947dc90f0cf2","src/backends/wasm_js.rs":"42dbddf2648f4b358d5246e294ec1a2c48ec245b2be00452772b26c5fb37cd82","src/backends/windows.rs":"6f2d2090980d53d5bca41bd5638af0106f9c804e9e696a545430862fdc631e63","src/backends/windows7.rs":"8c25d1d7d97b64a45186644bd8c41e9eb1b99ce622221f4cdfaa7d584afc1fcc","src/error.rs":"9c0db953fc3b54c7535e76068362168203e777d0d7ba81025744ae58702a78e1","src/error_std_impls.rs":"4c068e81d876237a7e0a0e91519896bd670c2f999ca729f7fb970caf888cab46","src/lazy.rs":"9c7e3efcc7b4cc2252751d29e42465bae8cbe49461a4a81a006d8d2c45003fd1","src/lib.rs":"4342b61e1564ea792791bcbc8bcd2403633016473e6c74e5f8bc92866e340cc8","src/util.rs":"1c5000cac8e43ddbc31a2f1b900c9ace6e3ccf32f362fa13fdee09d2c219136c","src/util_libc.rs":"0a6a6fcc5b32b78f02828fd2e76ff0642966935108dc90159ba40bdb9c1cf1ba","tests/mod.rs":"b8e88300a1ec0b2f6cbc03d40cc66eacae625d1fdc1163f4cf50fae7712d2bdc"},"package":"43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"} \ No newline at end of file +{"files":{"CHANGELOG.md":"fc99d55b89ff2dcca19d1d36f4e10b76e5adecc211afff67aac4d199f35e435c","Cargo.lock":"e55b09b283d1685505f5d15a2d79f0a7c1de35c79321eafd02074c815ef67597","Cargo.toml":"c11a6fef961eec45202c915ccde2aeec475c0950f31cb3c5a74e65fea2262bbc","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"29e9fe5074bd27e0e5d5d110394fbbcd841baee2651a3c4b4560a632702cede4","README.md":"5afb17166a328f69726ae52321b3c6f698adefbfc64898e93e45cd3d4ce3e1e5","SECURITY.md":"816ea79f8c7937888ab5a972a1efb270c4bada028b448953a195359fe11d526e","benches/buffer.rs":"20fb7dd9edafe0c182f1fe037b28d7542f8e0ae742d51e97aeebf418edde49aa","build.rs":"9280e324b69c0c80c65de8074046104ac561cbfe0b7856e02a939e491936aaac","src/backends.rs":"1c43868fdb6b1bfd0f6b6ac1e4f8195ad0045fa472e366821be2249ef5aa6da6","src/backends/apple_other.rs":"f8fa784588f347cfd7c2b5f37a96b23d446f95c3157668069d7146e281fa783b","src/backends/custom.rs":"c8776ff0dda65cef1373b8624043f8a42ce4fd6183fbeb8918f9df5d4a13d457","src/backends/efi_rng.rs":"873b7343a003a5f222753fbd50cba3f2beeacec4386ad3272ec98d654a4466d4","src/backends/esp_idf.rs":"b50d6c582b49488204151c2036a100aac7902b8215fb791f271e1b5fc772db9a","src/backends/fuchsia.rs":"d7c660a62f1da2c41c537ccea085bba6d3f83b82c34e6e63175130feca9dece8","src/backends/getentropy.rs":"a0fdf57546e20be8e76d21ec5f815f07a3a4dfb590d4d693cc2e78b494676304","src/backends/getrandom.rs":"1d165160ab4526534f0981d0cddee4075d6ddfc07d7a3086b0b30544ad755b17","src/backends/hermit.rs":"92e0cf4103b5ddc15ed48cad8d7165ba8e344fde0f07960385b36590466ee67c","src/backends/linux_android_with_fallback.rs":"ba4b820542aceee7b3b0b8b8be6460140cd0f601132b4e79f1abe0051a997af8","src/backends/linux_raw.rs":"eea0428ac3a803ae1c8463cdbaf385b73008ec67a02c7c634eb4ce01589a97f8","src/backends/netbsd.rs":"ca6a6c4c17c04ec987002296debdd7a03b10f5efd5bcb79f159b9a13c4b6821f","src/backends/rdrand.rs":"2a06eb62ad7e97c2486ab1b0159e4b9fe3a1c0a39d479a836d23051f89cb9aed","src/backends/rndr.rs":"bc06a88e3314a06494b6fe70bdae684fe45f9a6a63d28c61dbd90f66595424d0","src/backends/solaris.rs":"b263a3e8bc3c490a0c589d2a1a67d8fdb36119993df1f8d05f43975ff88f9c3e","src/backends/solid.rs":"1c92fc4c5a8ac67b64af560bb7843d6e447efe9785e557f064348fb84b83ceb8","src/backends/use_file.rs":"a2582912793ed985f7c092243405c8ee15fc2d6cb23ef4233a842325cec69492","src/backends/vxworks.rs":"64ee8619c5b5aa267761aabc99552ba8df71d14cda7cc66d6c1e4f4fb1ed8d00","src/backends/wasi_p1.rs":"77755c8fefb9f36509b2e6764edb9f8293dc1efa3d5a9bc85d28723ceeb7aec0","src/backends/wasi_p2.rs":"5821dff8eb2a145a49adcb751f9ec794e0fb8989ff625c70a98afcba48de0731","src/backends/wasm_js.rs":"5913b33ec9cb4076cef65d461ce82af98e9233f621eac8fab44b68fd37080927","src/backends/windows.rs":"60a5c9a87c8b35d3816c8909d051ce76741121806de6ea4f17a847c89b9cd4a2","src/backends/windows7.rs":"a5fac48672fa109eff2dc67f424fe99fabe4ec8af4802ce4ecc2f07706b2201c","src/error.rs":"6497fc88435c341e5547c35f259f9bebf1272b83b782794d8c6251a4c3159d28","src/error_std_impls.rs":"4c068e81d876237a7e0a0e91519896bd670c2f999ca729f7fb970caf888cab46","src/lazy.rs":"9c7e3efcc7b4cc2252751d29e42465bae8cbe49461a4a81a006d8d2c45003fd1","src/lib.rs":"54279c7e2ac54bf990c89c37f12754da7183cde6fb51d9e6900aaaed4e1f995f","src/util.rs":"207e21353f4e402daf84ff137c8d4aa4ffafa48141194ae7148252e06dcadd9f","src/util_libc.rs":"1d3f16d8996295822e6cbfc848e90912795f378913627c6b765f47b2185d9480","tests/mod.rs":"b8e88300a1ec0b2f6cbc03d40cc66eacae625d1fdc1163f4cf50fae7712d2bdc"},"package":"26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"} \ No newline at end of file diff --git a/third_party/rust/getrandom/CHANGELOG.md b/third_party/rust/getrandom/CHANGELOG.md index 96dba823612d..fbfe1d6db577 100644 --- a/third_party/rust/getrandom/CHANGELOG.md +++ b/third_party/rust/getrandom/CHANGELOG.md @@ -4,6 +4,61 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.3.3] - 2025-05-09 + +### Changed +- Doc improvements [#632] [#634] [#635] +- Add crate version to docs.rs links used in `compile_error!`s [#639] + +## Fixed +- Error handling in WASI p1 [#661] + +[#632]: https://github.com/rust-random/getrandom/pull/632 +[#634]: https://github.com/rust-random/getrandom/pull/634 +[#635]: https://github.com/rust-random/getrandom/pull/635 +[#639]: https://github.com/rust-random/getrandom/pull/639 +[#661]: https://github.com/rust-random/getrandom/pull/661 + +## [0.3.2] - 2025-03-17 + +### Added +- `efi_rng` opt-in backend [#570] +- `linux_raw` opt-in backend [#572] +- `.cargo/config.toml` example in the crate-level docs [#591] +- `getrandom_test_linux_without_fallback` configuration flag to test that file fallback + is not triggered in the `linux_android_with_fallback` backend [#605] +- Built-in support for `*-linux-none` targets [#618] +- Cygwin support [#626] + +### Changed +- Update `wasi` dependency to v0.14 [#594] +- Add `#[inline]` attribute to the inner functions [#596] +- Update WASI and Emscripten links in the crate-level docs [#597] +- Do not use `dlsym` on MUSL targets in the `linux_android_with_fallback` backend [#602] +- Remove `linux_android.rs` and use `getrandom.rs` instead [#603] +- Always use `RtlGenRandom` on Windows targets when compiling with pre-1.78 Rust [#610] +- Internal representation of the `Error` type [#614] +- Remove `windows-targets` dependency and use [`raw-dylib`] directly [#627] + +### Removed +- `Error::INTERNAL_START` and `Error::CUSTOM_START` associated constants [#614] + +[#570]: https://github.com/rust-random/getrandom/pull/570 +[#572]: https://github.com/rust-random/getrandom/pull/572 +[#591]: https://github.com/rust-random/getrandom/pull/591 +[#594]: https://github.com/rust-random/getrandom/pull/594 +[#596]: https://github.com/rust-random/getrandom/pull/596 +[#597]: https://github.com/rust-random/getrandom/pull/597 +[#602]: https://github.com/rust-random/getrandom/pull/602 +[#603]: https://github.com/rust-random/getrandom/pull/603 +[#605]: https://github.com/rust-random/getrandom/pull/605 +[#610]: https://github.com/rust-random/getrandom/pull/610 +[#614]: https://github.com/rust-random/getrandom/pull/614 +[#618]: https://github.com/rust-random/getrandom/pull/618 +[#626]: https://github.com/rust-random/getrandom/pull/626 +[#627]: https://github.com/rust-random/getrandom/pull/627 +[`raw-dylib`]: https://doc.rust-lang.org/reference/items/external-blocks.html?highlight=link#dylib-versus-raw-dylib + ## [0.3.1] - 2025-01-28 ### Fixed @@ -76,6 +131,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#571]: https://github.com/rust-random/getrandom/pull/571 [#574]: https://github.com/rust-random/getrandom/pull/574 +## [0.2.16] - 2025-04-22 +### Added +- Cygwin support (backport of [#626]) [#654] + +[#654]: https://github.com/rust-random/getrandom/pull/654 + ## [0.2.15] - 2024-05-06 ### Added - Apple visionOS support [#410] @@ -526,7 +587,11 @@ Publish initial implementation. ## [0.0.0] - 2019-01-19 Publish an empty template library. +[0.3.3]: https://github.com/rust-random/getrandom/compare/v0.3.2...v0.3.3 +[0.3.2]: https://github.com/rust-random/getrandom/compare/v0.3.1...v0.3.2 +[0.3.1]: https://github.com/rust-random/getrandom/compare/v0.3.0...v0.3.1 [0.3.0]: https://github.com/rust-random/getrandom/compare/v0.2.15...v0.3.0 +[0.2.16]: https://github.com/rust-random/getrandom/compare/v0.2.15...v0.2.16 [0.2.15]: https://github.com/rust-random/getrandom/compare/v0.2.14...v0.2.15 [0.2.14]: https://github.com/rust-random/getrandom/compare/v0.2.13...v0.2.14 [0.2.13]: https://github.com/rust-random/getrandom/compare/v0.2.12...v0.2.13 @@ -542,7 +607,7 @@ Publish an empty template library. [0.2.3]: https://github.com/rust-random/getrandom/compare/v0.2.2...v0.2.3 [0.2.2]: https://github.com/rust-random/getrandom/compare/v0.2.1...v0.2.2 [0.2.1]: https://github.com/rust-random/getrandom/compare/v0.2.0...v0.2.1 -[0.2.0]: https://github.com/rust-random/getrandom/compare/v0.1.15...v0.2.0 +[0.2.0]: https://github.com/rust-random/getrandom/compare/v0.1.16...v0.2.0 [0.1.16]: https://github.com/rust-random/getrandom/compare/v0.1.15...v0.1.16 [0.1.15]: https://github.com/rust-random/getrandom/compare/v0.1.14...v0.1.15 [0.1.14]: https://github.com/rust-random/getrandom/compare/v0.1.13...v0.1.14 diff --git a/third_party/rust/getrandom/Cargo.lock b/third_party/rust/getrandom/Cargo.lock new file mode 100644 index 000000000000..c27e9a5b841b --- /dev/null +++ b/third_party/rust/getrandom/Cargo.lock @@ -0,0 +1,365 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "bumpalo" +version = "3.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" + +[[package]] +name = "cc" +version = "1.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "compiler_builtins" +version = "0.1.157" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f103f5a97b25e3ed7134dee586e90bbb0496b33ba41816f0e7274e5bb73b50" + +[[package]] +name = "getrandom" +version = "0.3.3" +dependencies = [ + "cfg-if", + "compiler_builtins", + "js-sys", + "libc", + "r-efi", + "rustc-std-workspace-core", + "wasi", + "wasm-bindgen", + "wasm-bindgen-test", +] + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "minicov" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b" +dependencies = [ + "cc", + "walkdir", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "rustc-std-workspace-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9c45b374136f52f2d6311062c7146bff20fec063c3f5d46a410bd937746955" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66c8d5e33ca3b6d9fa3b4676d774c5778031d27a578c2b007f905acf816152c3" +dependencies = [ + "js-sys", + "minicov", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17d5042cc5fa009658f9a7333ef24291b1291a25b6382dd68862a7f3b969f69b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] diff --git a/third_party/rust/getrandom/Cargo.toml b/third_party/rust/getrandom/Cargo.toml index 39298522a8cf..f4f2f6c6689a 100644 --- a/third_party/rust/getrandom/Cargo.toml +++ b/third_party/rust/getrandom/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.63" name = "getrandom" -version = "0.3.1" +version = "0.3.3" authors = ["The Rand Project Developers"] build = "build.rs" exclude = [".*"] @@ -45,6 +45,17 @@ pre-build = [ [package.metadata.docs.rs] features = ["std"] +[features] +rustc-dep-of-std = [ + "dep:compiler_builtins", + "dep:core", +] +std = [] +wasm_js = [ + "dep:wasm-bindgen", + "dep:js-sys", +] + [lib] name = "getrandom" path = "src/lib.rs" @@ -69,18 +80,7 @@ version = "1.0" optional = true package = "rustc-std-workspace-core" -[features] -rustc-dep-of-std = [ - "dep:compiler_builtins", - "dep:core", -] -std = [] -wasm_js = [ - "dep:wasm-bindgen", - "dep:js-sys", -] - -[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(getrandom_backend = "custom", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))'.dependencies.libc] +[target.'cfg(all(any(target_os = "linux", target_os = "android"), not(any(all(target_os = "linux", target_env = ""), getrandom_backend = "custom", getrandom_backend = "linux_raw", getrandom_backend = "rdrand", getrandom_backend = "rndr"))))'.dependencies.libc] version = "0.2.154" default-features = false @@ -98,13 +98,14 @@ optional = true default-features = false [target.'cfg(all(target_arch = "wasm32", target_os = "wasi", target_env = "p2"))'.dependencies.wasi] -version = "0.13" +version = "0.14" default-features = false -[target.'cfg(all(windows, not(target_vendor = "win7")))'.dependencies.windows-targets] -version = "0.52" +[target.'cfg(all(target_os = "uefi", getrandom_backend = "efi_rng"))'.dependencies.r-efi] +version = "5.1" +default-features = false -[target.'cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "hurd", target_os = "illumos", all(target_os = "horizon", target_arch = "arm")))'.dependencies.libc] +[target.'cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "hurd", target_os = "illumos", target_os = "cygwin", all(target_os = "horizon", target_arch = "arm")))'.dependencies.libc] version = "0.2.154" default-features = false @@ -136,8 +137,11 @@ default-features = false level = "warn" priority = 0 check-cfg = [ - 'cfg(getrandom_backend, values("custom", "rdrand", "rndr", "linux_getrandom", "wasm_js"))', + 'cfg(getrandom_backend, values("custom", "efi_rng", "rdrand", "rndr", "linux_getrandom", "linux_raw", "wasm_js"))', "cfg(getrandom_msan)", + "cfg(getrandom_windows_legacy)", "cfg(getrandom_test_linux_fallback)", + "cfg(getrandom_test_linux_without_fallback)", "cfg(getrandom_test_netbsd_fallback)", + 'cfg(target_os, values("cygwin"))', ] diff --git a/third_party/rust/getrandom/LICENSE-MIT b/third_party/rust/getrandom/LICENSE-MIT index 8ca28a1a09ec..e54440a9e59a 100644 --- a/third_party/rust/getrandom/LICENSE-MIT +++ b/third_party/rust/getrandom/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2018-2024 The rust-random Project Developers +Copyright (c) 2018-2025 The rust-random Project Developers Copyright (c) 2014 The Rust Project Developers Permission is hereby granted, free of charge, to any diff --git a/third_party/rust/getrandom/README.md b/third_party/rust/getrandom/README.md index 0007634c9e19..b0e17d477199 100644 --- a/third_party/rust/getrandom/README.md +++ b/third_party/rust/getrandom/README.md @@ -43,7 +43,7 @@ fn get_random_u128() -> Result { | Target | Target Triple | Implementation | ------------------ | ------------------ | -------------- | Linux, Android | `*‑linux‑*` | [`getrandom`][1] system call if available, otherwise [`/dev/urandom`][2] after successfully polling `/dev/random` -| Windows 10+ | `*‑windows‑*` | [`ProcessPrng`] +| Windows 10+ | `*‑windows‑*` | [`ProcessPrng`] on Rust 1.78+, [`RtlGenRandom`] otherwise | Windows 7, 8 | `*-win7‑windows‑*` | [`RtlGenRandom`] | macOS | `*‑apple‑darwin` | [`getentropy`][3] | iOS, tvOS, watchOS | `*‑apple‑{ios,tvos,watchos}` | [`CCRandomGenerateBytes`] @@ -69,6 +69,7 @@ fn get_random_u128() -> Result { | PS Vita | `*-vita-*` | [`getentropy`][19] | QNX Neutrino | `*‑nto-qnx*` | [`/dev/urandom`][14] (identical to `/dev/random`) | AIX | `*-ibm-aix` | [`/dev/urandom`][15] +| Cygwin | `*-cygwin` | [`getrandom`][20] (based on [`RtlGenRandom`]) Pull Requests that add support for new targets to `getrandom` are always welcome. @@ -80,15 +81,22 @@ of randomness based on their specific needs: | Backend name | Target | Target Triple | Implementation | ----------------- | -------------------- | ------------------------ | -------------- | `linux_getrandom` | Linux, Android | `*‑linux‑*` | [`getrandom`][1] system call (without `/dev/urandom` fallback). Bumps minimum supported Linux kernel version to 3.17 and Android API level to 23 (Marshmallow). +| `linux_raw` | Linux, Android | `*‑linux‑*` | Same as `linux_getrandom`, but uses raw `asm!`-based syscalls instead of `libc`. | `rdrand` | x86, x86-64 | `x86_64-*`, `i686-*` | [`RDRAND`] instruction | `rndr` | AArch64 | `aarch64-*` | [`RNDR`] register | `wasm_js` | Web Browser, Node.js | `wasm32‑unknown‑unknown`, `wasm32v1-none` | [`Crypto.getRandomValues`]. Requires feature `wasm_js` ([see below](#webassembly-support)). +| `efi_rng` | UEFI | `*-unknown‑uefi` | [`EFI_RNG_PROTOCOL`] with `EFI_RNG_ALGORITHM_RAW` (requires `std` and Nigthly compiler) | `custom` | All targets | `*` | User-provided custom implementation (see [custom backend]) Opt-in backends can be enabled using the `getrandom_backend` configuration flag. -The flag can be set either by specifying the `rustflags` field in -[`.cargo/config.toml`] (note that it can be done on a per-target basis), or by using -the `RUSTFLAGS` environment variable: +The flag can be set either by specifying the `rustflags` field in [`.cargo/config.toml`]: +```toml +# It's recommended to set the flag on a per-target basis: +[target.wasm32-unknown-unknown] +rustflags = ['--cfg', 'getrandom_backend="wasm_js"'] +``` + +Or by using the `RUSTFLAGS` environment variable: ```sh RUSTFLAGS='--cfg getrandom_backend="linux_getrandom"' cargo build @@ -105,6 +113,15 @@ WILL NOT have any effect on its downstream users. [`.cargo/config.toml`]: https://doc.rust-lang.org/cargo/reference/config.html +### Raw Linux syscall support + +Currently the `linux_raw` backend supports only targets with stabilized `asm!` macro, +i.e. `arm`, `aarch64`, `loongarch64`, `riscv32`, `riscv64`, `s390x`, `x86`, and `x86_64`. + +Note that the raw syscall backend may be slower than backends based on `libc::getrandom`, +e.g. it does not implement vDSO optimizations and on `x86` it uses the infamously slow +`int 0x80` instruction to perform syscall. + ### WebAssembly support This crate fully supports the [WASI] and [Emscripten] targets. However, @@ -113,7 +130,7 @@ is not automatically supported since, from the target name alone, we cannot dedu which JavaScript interface should be used (or if JavaScript is available at all). To enable `getrandom`'s functionality on `wasm32-unknown-unknown` using the Web -Crypto methods [described above](#opt-in-backends) via [`wasm-bindgen`], do +Crypto methods [described above][opt-in] via [`wasm-bindgen`], do *both* of the following: - Use the `wasm_js` feature flag, i.e. @@ -121,18 +138,22 @@ Crypto methods [described above](#opt-in-backends) via [`wasm-bindgen`], do On its own, this only makes the backend available. (As a side effect this will make your `Cargo.lock` significantly larger if you are not already using [`wasm-bindgen`], but otherwise enabling this feature is harmless.) -- Set `RUSTFLAGS='--cfg getrandom_backend="wasm_js"'` ([see above](#opt-in-backends)). +- Set `RUSTFLAGS='--cfg getrandom_backend="wasm_js"'` ([see above][opt-in]). This backend supports both web browsers (main window and Web Workers) and Node.js (v19 or later) environments. +WARNING: It is highly recommended to enable the `wasm_js` feature only for +binary crates and tests, i.e. avoid unconditionally enabling it in library crates. + ### Custom backend If this crate does not support your target out of the box or you have to use a non-default entropy source, then you can provide a custom implementation. -You need to enable the custom backend as described in the [configuration flags] -section. Next, you need to define an `extern` function with the following -signature: +You need to enable the custom backend as described in the +[opt-in backends][opt-in] section. + +Next, you need to define an `extern` function with the following signature: ```rust use getrandom::Error; @@ -305,7 +326,7 @@ dual licensed as above, without any additional terms or conditions. [//]: # (badges) -[GitHub Actions]: https://github.com/rust-random/getrandom/actions?query=workflow:Tests+branch:master +[GitHub Actions]: https://github.com/rust-random/getrandom/actions?query=branch:master [Build Status]: https://github.com/rust-random/getrandom/actions/workflows/tests.yml/badge.svg?branch=master [crates.io]: https://crates.io/crates/getrandom [Crate]: https://img.shields.io/crates/v/getrandom @@ -335,6 +356,7 @@ dual licensed as above, without any additional terms or conditions. [17]: https://www.gnu.org/software/libc/manual/html_mono/libc.html#index-getrandom [18]: https://github.com/rust3ds/shim-3ds/commit/b01d2568836dea2a65d05d662f8e5f805c64389d [19]: https://github.com/vitasdk/newlib/blob/2d869fe47aaf02b8e52d04e9a2b79d5b210fd016/newlib/libc/sys/vita/getentropy.c +[20]: https://github.com/cygwin/cygwin/blob/main/winsup/cygwin/libc/getentropy.cc [`ProcessPrng`]: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng [`RtlGenRandom`]: https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom @@ -346,6 +368,7 @@ dual licensed as above, without any additional terms or conditions. [`esp_fill_random`]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/random.html#functions [esp-idf-rng]: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/random.html [esp-trng-docs]: https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf#rng +[`EFI_RNG_PROTOCOL`]: https://uefi.org/specs/UEFI/2.10/37_Secure_Technologies.html#efi-rng-protocol [`random_get`]: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-random_getbuf-pointeru8-buf_len-size---errno [`get-random-u64`]: https://github.com/WebAssembly/WASI/blob/v0.2.1/wasip2/random/random.wit#L23-L28 [configuration flags]: #configuration-flags @@ -354,8 +377,9 @@ dual licensed as above, without any additional terms or conditions. [`module`]: https://rustwasm.github.io/wasm-bindgen/reference/attributes/on-js-imports/module.html [`sys_read_entropy`]: https://github.com/hermit-os/kernel/blob/315f58ff5efc81d9bf0618af85a59963ff55f8b1/src/syscalls/entropy.rs#L47-L55 [platform-support]: https://doc.rust-lang.org/stable/rustc/platform-support.html -[WASI]: https://github.com/CraneStation/wasi -[Emscripten]: https://www.hellorust.com/setup/emscripten/ +[WASI]: https://github.com/WebAssembly/WASI +[Emscripten]: https://emscripten.org +[opt-in]: #opt-in-backends [//]: # (licenses) diff --git a/third_party/rust/getrandom/build.rs b/third_party/rust/getrandom/build.rs index 15d419191320..14aaf0c8051e 100644 --- a/third_party/rust/getrandom/build.rs +++ b/third_party/rust/getrandom/build.rs @@ -1,9 +1,57 @@ -// Automatically detect cfg(sanitize = "memory") even if cfg(sanitize) isn't -// supported. Build scripts get cfg() info, even if the cfg is unstable. +use std::{env, ffi::OsString, process::Command}; + +/// Tries to get the minor version of the Rust compiler in use. +/// If it fails for any reason, returns `None`. +/// +/// Based on the `rustc_version` crate. +fn rustc_minor_version() -> Option { + let rustc = env::var_os("RUSTC").unwrap_or_else(|| OsString::from("rustc")); + let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER").filter(|w| !w.is_empty()) { + let mut cmd = Command::new(wrapper); + cmd.arg(rustc); + cmd + } else { + Command::new(rustc) + }; + + let out = cmd.arg("-vV").output().ok()?; + + if !out.status.success() { + return None; + } + + let stdout = std::str::from_utf8(&out.stdout).ok()?; + + // Assumes that the first line contains "rustc 1.xx.0-channel (abcdef 2025-01-01)" + // where "xx" is the minor version which we want to extract + let mut lines = stdout.lines(); + let first_line = lines.next()?; + let minor_ver_str = first_line.split(".").nth(1)?; + minor_ver_str.parse().ok() +} + fn main() { + // Automatically detect cfg(sanitize = "memory") even if cfg(sanitize) isn't + // supported. Build scripts get cfg() info, even if the cfg is unstable. println!("cargo:rerun-if-changed=build.rs"); let santizers = std::env::var("CARGO_CFG_SANITIZE").unwrap_or_default(); if santizers.contains("memory") { println!("cargo:rustc-cfg=getrandom_msan"); } + + // Use `RtlGenRandom` on older compiler versions since win7 targets + // TODO(MSRV 1.78): Remove this check + let target_family = env::var_os("CARGO_CFG_TARGET_FAMILY").and_then(|f| f.into_string().ok()); + if target_family.as_deref() == Some("windows") { + /// Minor version of the Rust compiler in which win7 targets were inroduced + const WIN7_INTRODUCED_MINOR_VER: u64 = 78; + + match rustc_minor_version() { + Some(minor_ver) if minor_ver < WIN7_INTRODUCED_MINOR_VER => { + println!("cargo:rustc-cfg=getrandom_windows_legacy"); + } + None => println!("cargo:warning=Couldn't detect minor version of the Rust compiler"), + _ => {} + } + } } diff --git a/third_party/rust/getrandom/src/backends.rs b/third_party/rust/getrandom/src/backends.rs index 1509af115bb0..2c539df26161 100644 --- a/third_party/rust/getrandom/src/backends.rs +++ b/third_party/rust/getrandom/src/backends.rs @@ -11,27 +11,36 @@ cfg_if! { mod custom; pub use custom::*; } else if #[cfg(getrandom_backend = "linux_getrandom")] { - mod linux_android; - pub use linux_android::*; + mod getrandom; + pub use getrandom::*; + } else if #[cfg(getrandom_backend = "linux_raw")] { + mod linux_raw; + pub use linux_raw::*; } else if #[cfg(getrandom_backend = "rdrand")] { mod rdrand; pub use rdrand::*; } else if #[cfg(getrandom_backend = "rndr")] { mod rndr; pub use rndr::*; + } else if #[cfg(getrandom_backend = "efi_rng")] { + mod efi_rng; + pub use efi_rng::*; } else if #[cfg(all(getrandom_backend = "wasm_js"))] { cfg_if! { if #[cfg(feature = "wasm_js")] { mod wasm_js; pub use wasm_js::*; } else { - compile_error!( + compile_error!(concat!( "The \"wasm_js\" backend requires the `wasm_js` feature \ for `getrandom`. For more information see: \ - https://docs.rs/getrandom/#webassembly-support" - ); + https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#webassembly-support" + )); } } + } else if #[cfg(all(target_os = "linux", target_env = ""))] { + mod linux_raw; + pub use linux_raw::*; } else if #[cfg(target_os = "espidf")] { mod esp_idf; pub use esp_idf::*; @@ -51,17 +60,6 @@ cfg_if! { ))] { mod getentropy; pub use getentropy::*; - } else if #[cfg(any( - target_os = "dragonfly", - target_os = "freebsd", - target_os = "hurd", - target_os = "illumos", - // Check for target_arch = "arm" to only include the 3DS. Does not - // include the Nintendo Switch (which is target_arch = "aarch64"). - all(target_os = "horizon", target_arch = "arm"), - ))] { - mod getrandom; - pub use getrandom::*; } else if #[cfg(any( // Rust supports Android API level 19 (KitKat) [0] and the next upgrade targets // level 21 (Lollipop) [1], while `getrandom(2)` was added only in @@ -102,9 +100,20 @@ cfg_if! { mod use_file; mod linux_android_with_fallback; pub use linux_android_with_fallback::*; - } else if #[cfg(any(target_os = "android", target_os = "linux"))] { - mod linux_android; - pub use linux_android::*; + } else if #[cfg(any( + target_os = "android", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "hurd", + target_os = "illumos", + target_os = "cygwin", + // Check for target_arch = "arm" to only include the 3DS. Does not + // include the Nintendo Switch (which is target_arch = "aarch64"). + all(target_os = "horizon", target_arch = "arm"), + ))] { + mod getrandom; + pub use getrandom::*; } else if #[cfg(target_os = "solaris")] { mod solaris; pub use solaris::*; @@ -146,7 +155,7 @@ cfg_if! { } else if #[cfg(target_os = "solid_asp3")] { mod solid; pub use solid::*; - } else if #[cfg(all(windows, target_vendor = "win7"))] { + } else if #[cfg(all(windows, any(target_vendor = "win7", getrandom_windows_legacy)))] { mod windows7; pub use windows7::*; } else if #[cfg(windows)] { @@ -156,16 +165,17 @@ cfg_if! { mod rdrand; pub use rdrand::*; } else if #[cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))] { - compile_error!( + compile_error!(concat!( "The wasm32-unknown-unknown targets are not supported by default; \ you may need to enable the \"wasm_js\" configuration flag. Note \ that enabling the `wasm_js` feature flag alone is insufficient. \ For more information see: \ - https://docs.rs/getrandom/#webassembly-support" - ); + https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#webassembly-support" + )); } else { - compile_error!("target is not supported. You may need to define \ - a custom backend see: \ - https://docs.rs/getrandom/#custom-backends"); + compile_error!(concat!( + "target is not supported. You may need to define a custom backend see: \ + https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#custom-backend" + )); } } diff --git a/third_party/rust/getrandom/src/backends/apple_other.rs b/third_party/rust/getrandom/src/backends/apple_other.rs index a8c0a24d63db..c7b51c0e0134 100644 --- a/third_party/rust/getrandom/src/backends/apple_other.rs +++ b/third_party/rust/getrandom/src/backends/apple_other.rs @@ -4,6 +4,7 @@ use core::{ffi::c_void, mem::MaybeUninit}; pub use crate::util::{inner_u32, inner_u64}; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { let dst_ptr = dest.as_mut_ptr().cast::(); let ret = unsafe { libc::CCRandomGenerateBytes(dst_ptr, dest.len()) }; diff --git a/third_party/rust/getrandom/src/backends/custom.rs b/third_party/rust/getrandom/src/backends/custom.rs index 0c482946688f..c505481ad006 100644 --- a/third_party/rust/getrandom/src/backends/custom.rs +++ b/third_party/rust/getrandom/src/backends/custom.rs @@ -4,6 +4,7 @@ use core::mem::MaybeUninit; pub use crate::util::{inner_u32, inner_u64}; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { extern "Rust" { fn __getrandom_v03_custom(dest: *mut u8, len: usize) -> Result<(), Error>; diff --git a/third_party/rust/getrandom/src/backends/efi_rng.rs b/third_party/rust/getrandom/src/backends/efi_rng.rs new file mode 100644 index 000000000000..768c8cc8cab3 --- /dev/null +++ b/third_party/rust/getrandom/src/backends/efi_rng.rs @@ -0,0 +1,124 @@ +//! Implementation for UEFI using EFI_RNG_PROTOCOL +use crate::Error; +use core::{ + mem::MaybeUninit, + ptr::{self, null_mut, NonNull}, + sync::atomic::{AtomicPtr, Ordering::Relaxed}, +}; +use r_efi::{ + efi::{BootServices, Handle}, + protocols::rng, +}; + +extern crate std; + +pub use crate::util::{inner_u32, inner_u64}; + +#[cfg(not(target_os = "uefi"))] +compile_error!("`efi_rng` backend can be enabled only for UEFI targets!"); + +static RNG_PROTOCOL: AtomicPtr = AtomicPtr::new(null_mut()); + +#[cold] +#[inline(never)] +fn init() -> Result, Error> { + const HANDLE_SIZE: usize = size_of::(); + + let boot_services = std::os::uefi::env::boot_services() + .ok_or(Error::BOOT_SERVICES_UNAVAILABLE)? + .cast::(); + + let mut handles = [ptr::null_mut(); 16]; + // `locate_handle` operates with length in bytes + let mut buf_size = handles.len() * HANDLE_SIZE; + let mut guid = rng::PROTOCOL_GUID; + let ret = unsafe { + ((*boot_services.as_ptr()).locate_handle)( + r_efi::efi::BY_PROTOCOL, + &mut guid, + null_mut(), + &mut buf_size, + handles.as_mut_ptr(), + ) + }; + + if ret.is_error() { + return Err(Error::from_uefi_code(ret.as_usize())); + } + + let handles_len = buf_size / HANDLE_SIZE; + let handles = handles.get(..handles_len).ok_or(Error::UNEXPECTED)?; + + let system_handle = std::os::uefi::env::image_handle(); + for &handle in handles { + let mut protocol: MaybeUninit<*mut rng::Protocol> = MaybeUninit::uninit(); + + let mut protocol_guid = rng::PROTOCOL_GUID; + let ret = unsafe { + ((*boot_services.as_ptr()).open_protocol)( + handle, + &mut protocol_guid, + protocol.as_mut_ptr().cast(), + system_handle.as_ptr(), + ptr::null_mut(), + r_efi::system::OPEN_PROTOCOL_GET_PROTOCOL, + ) + }; + + let protocol = if ret.is_error() { + continue; + } else { + let protocol = unsafe { protocol.assume_init() }; + NonNull::new(protocol).ok_or(Error::UNEXPECTED)? + }; + + // Try to use the acquired protocol handle + let mut buf = [0u8; 8]; + let mut alg_guid = rng::ALGORITHM_RAW; + let ret = unsafe { + ((*protocol.as_ptr()).get_rng)( + protocol.as_ptr(), + &mut alg_guid, + buf.len(), + buf.as_mut_ptr(), + ) + }; + + if ret.is_error() { + continue; + } + + RNG_PROTOCOL.store(protocol.as_ptr(), Relaxed); + return Ok(protocol); + } + Err(Error::NO_RNG_HANDLE) +} + +#[inline] +pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { + let protocol = match NonNull::new(RNG_PROTOCOL.load(Relaxed)) { + Some(p) => p, + None => init()?, + }; + + let mut alg_guid = rng::ALGORITHM_RAW; + let ret = unsafe { + ((*protocol.as_ptr()).get_rng)( + protocol.as_ptr(), + &mut alg_guid, + dest.len(), + dest.as_mut_ptr().cast::(), + ) + }; + + if ret.is_error() { + Err(Error::from_uefi_code(ret.as_usize())) + } else { + Ok(()) + } +} + +impl Error { + pub(crate) const BOOT_SERVICES_UNAVAILABLE: Error = Self::new_internal(10); + pub(crate) const NO_RNG_HANDLE: Error = Self::new_internal(11); +} diff --git a/third_party/rust/getrandom/src/backends/esp_idf.rs b/third_party/rust/getrandom/src/backends/esp_idf.rs index 7ee391ab10b4..4d1689dc7273 100644 --- a/third_party/rust/getrandom/src/backends/esp_idf.rs +++ b/third_party/rust/getrandom/src/backends/esp_idf.rs @@ -8,6 +8,7 @@ extern "C" { fn esp_fill_random(buf: *mut c_void, len: usize) -> u32; } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // Not that NOT enabling WiFi, BT, or the voltage noise entropy source (via `bootloader_random_enable`) // will cause ESP-IDF to return pseudo-random numbers based on the voltage noise entropy, after the initial boot process: diff --git a/third_party/rust/getrandom/src/backends/fuchsia.rs b/third_party/rust/getrandom/src/backends/fuchsia.rs index 5edd210dc1cc..b5f1ade5412b 100644 --- a/third_party/rust/getrandom/src/backends/fuchsia.rs +++ b/third_party/rust/getrandom/src/backends/fuchsia.rs @@ -9,6 +9,7 @@ extern "C" { fn zx_cprng_draw(buffer: *mut u8, length: usize); } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { unsafe { zx_cprng_draw(dest.as_mut_ptr().cast::(), dest.len()) } Ok(()) diff --git a/third_party/rust/getrandom/src/backends/getentropy.rs b/third_party/rust/getrandom/src/backends/getentropy.rs index e0b2d34c1c8a..ed181f0197be 100644 --- a/third_party/rust/getrandom/src/backends/getentropy.rs +++ b/third_party/rust/getrandom/src/backends/getentropy.rs @@ -15,6 +15,7 @@ pub use crate::util::{inner_u32, inner_u64}; #[path = "../util_libc.rs"] mod util_libc; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { for chunk in dest.chunks_mut(256) { let ret = unsafe { libc::getentropy(chunk.as_mut_ptr().cast::(), chunk.len()) }; diff --git a/third_party/rust/getrandom/src/backends/getrandom.rs b/third_party/rust/getrandom/src/backends/getrandom.rs index a00829f7c0bd..27d5a1f5db6a 100644 --- a/third_party/rust/getrandom/src/backends/getrandom.rs +++ b/third_party/rust/getrandom/src/backends/getrandom.rs @@ -16,15 +16,16 @@ //! nothing. On illumos, the default pool is used to implement getentropy(2), //! so we assume it is acceptable here. use crate::Error; -use core::{ffi::c_void, mem::MaybeUninit}; +use core::mem::MaybeUninit; pub use crate::util::{inner_u32, inner_u64}; #[path = "../util_libc.rs"] mod util_libc; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { util_libc::sys_fill_exact(dest, |buf| unsafe { - libc::getrandom(buf.as_mut_ptr().cast::(), buf.len(), 0) + libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) }) } diff --git a/third_party/rust/getrandom/src/backends/hermit.rs b/third_party/rust/getrandom/src/backends/hermit.rs index 11bfbf271b44..34d7cdbb967b 100644 --- a/third_party/rust/getrandom/src/backends/hermit.rs +++ b/third_party/rust/getrandom/src/backends/hermit.rs @@ -12,6 +12,7 @@ extern "C" { fn sys_secure_rand64(value: *mut u64) -> i32; } +#[inline] pub fn inner_u32() -> Result { let mut res = MaybeUninit::uninit(); let ret = unsafe { sys_secure_rand32(res.as_mut_ptr()) }; @@ -22,6 +23,7 @@ pub fn inner_u32() -> Result { } } +#[inline] pub fn inner_u64() -> Result { let mut res = MaybeUninit::uninit(); let ret = unsafe { sys_secure_rand64(res.as_mut_ptr()) }; @@ -32,6 +34,7 @@ pub fn inner_u64() -> Result { } } +#[inline] pub fn fill_inner(mut dest: &mut [MaybeUninit]) -> Result<(), Error> { while !dest.is_empty() { let res = unsafe { sys_read_entropy(dest.as_mut_ptr().cast::(), dest.len(), 0) }; @@ -41,10 +44,8 @@ pub fn fill_inner(mut dest: &mut [MaybeUninit]) -> Result<(), Error> { dest = dest.get_mut(len..).ok_or(Error::UNEXPECTED)?; } code => { - let err = u32::try_from(code.unsigned_abs()) - .ok() - .map_or(Error::UNEXPECTED, Error::from_os_error); - return Err(err); + let code = i32::try_from(code).map_err(|_| Error::UNEXPECTED)?; + return Err(Error::from_neg_error_code(code)); } } } diff --git a/third_party/rust/getrandom/src/backends/linux_android.rs b/third_party/rust/getrandom/src/backends/linux_android.rs deleted file mode 100644 index 6c0b66ae8224..000000000000 --- a/third_party/rust/getrandom/src/backends/linux_android.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! Implementation for Linux / Android without `/dev/urandom` fallback -use crate::Error; -use core::mem::MaybeUninit; - -pub use crate::util::{inner_u32, inner_u64}; - -#[path = "../util_libc.rs"] -mod util_libc; - -#[cfg(not(any(target_os = "android", target_os = "linux")))] -compile_error!("`linux_getrandom` backend can be enabled only for Linux/Android targets!"); - -pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { - util_libc::sys_fill_exact(dest, |buf| unsafe { - libc::getrandom(buf.as_mut_ptr().cast(), buf.len(), 0) - }) -} diff --git a/third_party/rust/getrandom/src/backends/linux_android_with_fallback.rs b/third_party/rust/getrandom/src/backends/linux_android_with_fallback.rs index cdfff9809556..2ad8f0a46f77 100644 --- a/third_party/rust/getrandom/src/backends/linux_android_with_fallback.rs +++ b/third_party/rust/getrandom/src/backends/linux_android_with_fallback.rs @@ -3,8 +3,8 @@ use super::use_file; use crate::Error; use core::{ ffi::c_void, - mem::{self, MaybeUninit}, - ptr::{self, NonNull}, + mem::{transmute, MaybeUninit}, + ptr::NonNull, sync::atomic::{AtomicPtr, Ordering}, }; use use_file::util_libc; @@ -17,17 +17,28 @@ type GetRandomFn = unsafe extern "C" fn(*mut c_void, libc::size_t, libc::c_uint) /// or not supported by kernel. const NOT_AVAILABLE: NonNull = unsafe { NonNull::new_unchecked(usize::MAX as *mut c_void) }; -static GETRANDOM_FN: AtomicPtr = AtomicPtr::new(ptr::null_mut()); +static GETRANDOM_FN: AtomicPtr = AtomicPtr::new(core::ptr::null_mut()); #[cold] +#[inline(never)] fn init() -> NonNull { - static NAME: &[u8] = b"getrandom\0"; - let name_ptr = NAME.as_ptr().cast::(); - let raw_ptr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, name_ptr) }; + // Use static linking to `libc::getrandom` on MUSL targets and `dlsym` everywhere else + #[cfg(not(target_env = "musl"))] + let raw_ptr = { + static NAME: &[u8] = b"getrandom\0"; + let name_ptr = NAME.as_ptr().cast::(); + unsafe { libc::dlsym(libc::RTLD_DEFAULT, name_ptr) } + }; + #[cfg(target_env = "musl")] + let raw_ptr = { + let fptr: GetRandomFn = libc::getrandom; + unsafe { transmute::(fptr) } + }; + let res_ptr = match NonNull::new(raw_ptr) { Some(fptr) => { - let getrandom_fn = unsafe { mem::transmute::, GetRandomFn>(fptr) }; - let dangling_ptr = ptr::NonNull::dangling().as_ptr(); + let getrandom_fn = unsafe { transmute::, GetRandomFn>(fptr) }; + let dangling_ptr = NonNull::dangling().as_ptr(); // Check that `getrandom` syscall is supported by kernel let res = unsafe { getrandom_fn(dangling_ptr, 0, 0) }; if cfg!(getrandom_test_linux_fallback) { @@ -49,16 +60,22 @@ fn init() -> NonNull { None => NOT_AVAILABLE, }; + #[cfg(getrandom_test_linux_without_fallback)] + if res_ptr == NOT_AVAILABLE { + panic!("Fallback is triggered with enabled `getrandom_test_linux_without_fallback`") + } + GETRANDOM_FN.store(res_ptr.as_ptr(), Ordering::Release); res_ptr } -// prevent inlining of the fallback implementation +// Prevent inlining of the fallback implementation #[inline(never)] fn use_file_fallback(dest: &mut [MaybeUninit]) -> Result<(), Error> { use_file::fill_inner(dest) } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // Despite being only a single atomic variable, we still cannot always use // Ordering::Relaxed, as we need to make sure a successful call to `init` @@ -75,8 +92,8 @@ pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { if fptr == NOT_AVAILABLE { use_file_fallback(dest) } else { - // note: `transume` is currently the only way to convert pointer into function reference - let getrandom_fn = unsafe { mem::transmute::, GetRandomFn>(fptr) }; + // note: `transmute` is currently the only way to convert a pointer into a function reference + let getrandom_fn = unsafe { transmute::, GetRandomFn>(fptr) }; util_libc::sys_fill_exact(dest, |buf| unsafe { getrandom_fn(buf.as_mut_ptr().cast(), buf.len(), 0) }) diff --git a/third_party/rust/getrandom/src/backends/linux_raw.rs b/third_party/rust/getrandom/src/backends/linux_raw.rs new file mode 100644 index 000000000000..4a59eef00cf9 --- /dev/null +++ b/third_party/rust/getrandom/src/backends/linux_raw.rs @@ -0,0 +1,136 @@ +//! Implementation for Linux / Android using `asm!`-based syscalls. +use crate::{Error, MaybeUninit}; + +pub use crate::util::{inner_u32, inner_u64}; + +#[cfg(not(any(target_os = "android", target_os = "linux")))] +compile_error!("`linux_raw` backend can be enabled only for Linux/Android targets!"); + +#[allow(non_upper_case_globals)] +unsafe fn getrandom_syscall(buf: *mut u8, buflen: usize, flags: u32) -> isize { + let r0; + + // Based on `rustix` and `linux-raw-sys` code. + cfg_if! { + if #[cfg(target_arch = "arm")] { + const __NR_getrandom: u32 = 384; + // In thumb-mode, r7 is the frame pointer and is not permitted to be used in + // an inline asm operand, so we have to use a different register and copy it + // into r7 inside the inline asm. + // Theoretically, we could detect thumb mode in the build script, but several + // register moves are cheap enough compared to the syscall cost, so we do not + // bother with it. + core::arch::asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = const __NR_getrandom, + tmp = out(reg) _, + inlateout("r0") buf => r0, + in("r1") buflen, + in("r2") flags, + options(nostack, preserves_flags) + ); + } else if #[cfg(target_arch = "aarch64")] { + const __NR_getrandom: u32 = 278; + core::arch::asm!( + "svc 0", + in("x8") __NR_getrandom, + inlateout("x0") buf => r0, + in("x1") buflen, + in("x2") flags, + options(nostack, preserves_flags) + ); + } else if #[cfg(target_arch = "loongarch64")] { + const __NR_getrandom: u32 = 278; + core::arch::asm!( + "syscall 0", + in("$a7") __NR_getrandom, + inlateout("$a0") buf => r0, + in("$a1") buflen, + in("$a2") flags, + options(nostack, preserves_flags) + ); + } else if #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] { + const __NR_getrandom: u32 = 278; + core::arch::asm!( + "ecall", + in("a7") __NR_getrandom, + inlateout("a0") buf => r0, + in("a1") buflen, + in("a2") flags, + options(nostack, preserves_flags) + ); + } else if #[cfg(target_arch = "s390x")] { + const __NR_getrandom: u32 = 349; + core::arch::asm!( + "svc 0", + in("r1") __NR_getrandom, + inlateout("r2") buf => r0, + in("r3") buflen, + in("r4") flags, + options(nostack, preserves_flags) + ); + } else if #[cfg(target_arch = "x86")] { + const __NR_getrandom: u32 = 355; + // `int 0x80` is famously slow, but implementing vDSO is too complex + // and `sysenter`/`syscall` have their own portability issues, + // so we use the simple "legacy" way of doing syscalls. + core::arch::asm!( + "int $$0x80", + in("eax") __NR_getrandom, + in("ebx") buf, + in("ecx") buflen, + in("edx") flags, + lateout("eax") r0, + options(nostack, preserves_flags) + ); + } else if #[cfg(target_arch = "x86_64")] { + #[cfg(target_pointer_width = "64")] + const __NR_getrandom: u32 = 318; + #[cfg(target_pointer_width = "32")] + const __NR_getrandom: u32 = (1 << 30) + 318; + + core::arch::asm!( + "syscall", + in("rax") __NR_getrandom, + in("rdi") buf, + in("rsi") buflen, + in("rdx") flags, + lateout("rax") r0, + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + } else { + compile_error!("`linux_raw` backend does not support this target arch"); + } + } + + r0 +} + +#[inline] +pub fn fill_inner(mut dest: &mut [MaybeUninit]) -> Result<(), Error> { + // Value of this error code is stable across all target arches. + const EINTR: isize = -4; + + loop { + let ret = unsafe { getrandom_syscall(dest.as_mut_ptr().cast(), dest.len(), 0) }; + match usize::try_from(ret) { + Ok(0) => return Err(Error::UNEXPECTED), + Ok(len) => { + dest = dest.get_mut(len..).ok_or(Error::UNEXPECTED)?; + if dest.is_empty() { + return Ok(()); + } + } + Err(_) if ret == EINTR => continue, + Err(_) => { + let code = i32::try_from(ret).map_err(|_| Error::UNEXPECTED)?; + return Err(Error::from_neg_error_code(code)); + } + } + } +} diff --git a/third_party/rust/getrandom/src/backends/netbsd.rs b/third_party/rust/getrandom/src/backends/netbsd.rs index 57fa91a006f2..f228a8b138e1 100644 --- a/third_party/rust/getrandom/src/backends/netbsd.rs +++ b/third_party/rust/getrandom/src/backends/netbsd.rs @@ -45,6 +45,7 @@ type GetRandomFn = unsafe extern "C" fn(*mut c_void, libc::size_t, libc::c_uint) static GETRANDOM: AtomicPtr = AtomicPtr::new(ptr::null_mut()); #[cold] +#[inline(never)] fn init() -> *mut c_void { static NAME: &[u8] = b"getrandom\0"; let name_ptr = NAME.as_ptr().cast::(); @@ -58,6 +59,7 @@ fn init() -> *mut c_void { ptr } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // Despite being only a single atomic variable, we still cannot always use // Ordering::Relaxed, as we need to make sure a successful call to `init` diff --git a/third_party/rust/getrandom/src/backends/rdrand.rs b/third_party/rust/getrandom/src/backends/rdrand.rs index 347786a559a5..609fcc386fc6 100644 --- a/third_party/rust/getrandom/src/backends/rdrand.rs +++ b/third_party/rust/getrandom/src/backends/rdrand.rs @@ -147,6 +147,7 @@ unsafe fn rdrand_u64() -> Option { Some((u64::from(a) << 32) | u64::from(b)) } +#[inline] pub fn inner_u32() -> Result { if !RDRAND_GOOD.unsync_init(is_rdrand_good) { return Err(Error::NO_RDRAND); @@ -155,6 +156,7 @@ pub fn inner_u32() -> Result { unsafe { rdrand_u32() }.ok_or(Error::FAILED_RDRAND) } +#[inline] pub fn inner_u64() -> Result { if !RDRAND_GOOD.unsync_init(is_rdrand_good) { return Err(Error::NO_RDRAND); @@ -163,6 +165,7 @@ pub fn inner_u64() -> Result { unsafe { rdrand_u64() }.ok_or(Error::FAILED_RDRAND) } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { if !RDRAND_GOOD.unsync_init(is_rdrand_good) { return Err(Error::NO_RDRAND); diff --git a/third_party/rust/getrandom/src/backends/rndr.rs b/third_party/rust/getrandom/src/backends/rndr.rs index fa24a0972dca..eea741a2dc34 100644 --- a/third_party/rust/getrandom/src/backends/rndr.rs +++ b/third_party/rust/getrandom/src/backends/rndr.rs @@ -108,6 +108,7 @@ fn is_rndr_available() -> bool { } } +#[inline] pub fn inner_u32() -> Result { if !is_rndr_available() { return Err(Error::RNDR_NOT_AVAILABLE); @@ -117,6 +118,7 @@ pub fn inner_u32() -> Result { res.map(truncate).ok_or(Error::RNDR_FAILURE) } +#[inline] pub fn inner_u64() -> Result { if !is_rndr_available() { return Err(Error::RNDR_NOT_AVAILABLE); @@ -126,6 +128,7 @@ pub fn inner_u64() -> Result { res.ok_or(Error::RNDR_FAILURE) } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { if !is_rndr_available() { return Err(Error::RNDR_NOT_AVAILABLE); diff --git a/third_party/rust/getrandom/src/backends/solaris.rs b/third_party/rust/getrandom/src/backends/solaris.rs index ea5344fcf5b0..c27f91a5ffb5 100644 --- a/third_party/rust/getrandom/src/backends/solaris.rs +++ b/third_party/rust/getrandom/src/backends/solaris.rs @@ -22,6 +22,7 @@ mod util_libc; const MAX_BYTES: usize = 1024; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { for chunk in dest.chunks_mut(MAX_BYTES) { let ptr = chunk.as_mut_ptr().cast::(); diff --git a/third_party/rust/getrandom/src/backends/solid.rs b/third_party/rust/getrandom/src/backends/solid.rs index 6699e686983f..caa773f81798 100644 --- a/third_party/rust/getrandom/src/backends/solid.rs +++ b/third_party/rust/getrandom/src/backends/solid.rs @@ -8,13 +8,12 @@ extern "C" { pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> i32; } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { let ret = unsafe { SOLID_RNG_SampleRandomBytes(dest.as_mut_ptr().cast::(), dest.len()) }; if ret >= 0 { Ok(()) } else { - // ITRON error numbers are always negative, so we negate it so that it - // falls in the dedicated OS error range (1..INTERNAL_START). - Err(Error::from_os_error(ret.unsigned_abs())) + Err(Error::from_neg_error_code(ret)) } } diff --git a/third_party/rust/getrandom/src/backends/use_file.rs b/third_party/rust/getrandom/src/backends/use_file.rs index ef12fca1bdd6..7b48d43388ff 100644 --- a/third_party/rust/getrandom/src/backends/use_file.rs +++ b/third_party/rust/getrandom/src/backends/use_file.rs @@ -40,6 +40,7 @@ const FD_ONGOING_INIT: libc::c_int = -2; // `Ordering::Acquire` to synchronize with it. static FD: AtomicI32 = AtomicI32::new(FD_UNINIT); +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { let mut fd = FD.load(Ordering::Acquire); if fd == FD_UNINIT || fd == FD_ONGOING_INIT { @@ -57,7 +58,7 @@ pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // TODO: Move `path` to `CStr` and use `CStr::from_bytes_until_nul` (MSRV 1.69) // or C-string literals (MSRV 1.77) for statics fn open_readonly(path: &[u8]) -> Result { - assert!(path.iter().any(|&b| b == 0)); + assert!(path.contains(&0)); loop { let fd = unsafe { libc::open( @@ -77,6 +78,7 @@ fn open_readonly(path: &[u8]) -> Result { } #[cold] +#[inline(never)] fn open_or_wait() -> Result { loop { match FD.load(Ordering::Acquire) { diff --git a/third_party/rust/getrandom/src/backends/vxworks.rs b/third_party/rust/getrandom/src/backends/vxworks.rs index f03ab1844e44..5f5e6773b3f7 100644 --- a/third_party/rust/getrandom/src/backends/vxworks.rs +++ b/third_party/rust/getrandom/src/backends/vxworks.rs @@ -11,20 +11,25 @@ mod util_libc; pub use crate::util::{inner_u32, inner_u64}; +static RNG_INIT: AtomicBool = AtomicBool::new(false); + +#[cold] +fn init() -> Result<(), Error> { + let ret = unsafe { libc::randSecure() }; + match ret.cmp(&0) { + Greater => RNG_INIT.store(true, Relaxed), + Equal => unsafe { + libc::usleep(10); + }, + Less => return Err(Error::VXWORKS_RAND_SECURE), + } + Ok(()) +} + +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { - static RNG_INIT: AtomicBool = AtomicBool::new(false); while !RNG_INIT.load(Relaxed) { - let ret = unsafe { libc::randSecure() }; - match ret.cmp(&0) { - Greater => { - RNG_INIT.store(true, Relaxed); - break; - } - Equal => unsafe { - libc::usleep(10); - }, - Less => return Err(Error::VXWORKS_RAND_SECURE), - } + init()?; } // Prevent overflow of i32 diff --git a/third_party/rust/getrandom/src/backends/wasi_p1.rs b/third_party/rust/getrandom/src/backends/wasi_p1.rs index 6eefdee61a6d..25b5ca3b7466 100644 --- a/third_party/rust/getrandom/src/backends/wasi_p1.rs +++ b/third_party/rust/getrandom/src/backends/wasi_p1.rs @@ -11,6 +11,11 @@ extern "C" { fn random_get(arg0: i32, arg1: i32) -> i32; } +/// WASI p1 uses `u16` for error codes in its witx definitions: +/// https://github.com/WebAssembly/WASI/blob/38454e9e/legacy/preview1/witx/typenames.witx#L34-L39 +const MAX_ERROR_CODE: i32 = u16::MAX as i32; + +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // Based on the wasi code: // https://docs.rs/wasi/0.11.0+wasi-snapshot-preview1/src/wasi/lib_generated.rs.html#2046-2062 @@ -20,11 +25,8 @@ pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { let ret = unsafe { random_get(dest.as_mut_ptr() as i32, dest.len() as i32) }; match ret { 0 => Ok(()), - code => { - let err = u32::try_from(code) - .map(Error::from_os_error) - .unwrap_or(Error::UNEXPECTED); - Err(err) - } + // WASI functions should return positive error codes which are smaller than `MAX_ERROR_CODE` + code if code <= MAX_ERROR_CODE => Err(Error::from_neg_error_code(-code)), + _ => Err(Error::UNEXPECTED), } } diff --git a/third_party/rust/getrandom/src/backends/wasi_p2.rs b/third_party/rust/getrandom/src/backends/wasi_p2.rs index 9d5d601d780c..63bd2d7cb7a0 100644 --- a/third_party/rust/getrandom/src/backends/wasi_p2.rs +++ b/third_party/rust/getrandom/src/backends/wasi_p2.rs @@ -3,15 +3,18 @@ use crate::Error; use core::mem::MaybeUninit; use wasi::random::random::get_random_u64; +#[inline] pub fn inner_u32() -> Result { let val = get_random_u64(); Ok(crate::util::truncate(val)) } +#[inline] pub fn inner_u64() -> Result { Ok(get_random_u64()) } +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { use core::ptr::copy_nonoverlapping; use wasi::random::random::get_random_u64; diff --git a/third_party/rust/getrandom/src/backends/wasm_js.rs b/third_party/rust/getrandom/src/backends/wasm_js.rs index fe8f1a6ede49..1320d9fc4493 100644 --- a/third_party/rust/getrandom/src/backends/wasm_js.rs +++ b/third_party/rust/getrandom/src/backends/wasm_js.rs @@ -14,6 +14,7 @@ use wasm_bindgen::{prelude::wasm_bindgen, JsValue}; const MAX_BUFFER_SIZE: usize = 65536; #[cfg(not(target_feature = "atomics"))] +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { for chunk in dest.chunks_mut(MAX_BUFFER_SIZE) { if get_random_values(chunk).is_err() { diff --git a/third_party/rust/getrandom/src/backends/windows.rs b/third_party/rust/getrandom/src/backends/windows.rs index e6e12e185219..b5cd504fe36c 100644 --- a/third_party/rust/getrandom/src/backends/windows.rs +++ b/third_party/rust/getrandom/src/backends/windows.rs @@ -26,14 +26,29 @@ use core::mem::MaybeUninit; pub use crate::util::{inner_u32, inner_u64}; // Binding to the Windows.Win32.Security.Cryptography.ProcessPrng API. As -// bcryptprimitives.dll lacks an import library, we use the windows-targets -// crate to link to it. -// -// TODO(MSRV 1.71): Migrate to linking as raw-dylib directly. -// https://github.com/joboet/rust/blob/5c1c72572479afe98734d5f78fa862abe662c41a/library/std/src/sys/pal/windows/c.rs#L119 -// https://github.com/microsoft/windows-rs/blob/0.60.0/crates/libs/targets/src/lib.rs -windows_targets::link!("bcryptprimitives.dll" "system" fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> i32); +// bcryptprimitives.dll lacks an import library, we use "raw-dylib". This +// was added in Rust 1.65 for x86_64/aarch64 and in Rust 1.71 for x86. +// We don't need MSRV 1.71, as we only use this backend on Rust 1.78 and later. +#[cfg_attr( + target_arch = "x86", + link( + name = "bcryptprimitives", + kind = "raw-dylib", + import_name_type = "undecorated" + ) +)] +#[cfg_attr( + not(target_arch = "x86"), + link(name = "bcryptprimitives", kind = "raw-dylib") +)] +extern "system" { + fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; +} +#[allow(clippy::upper_case_acronyms)] +type BOOL = core::ffi::c_int; // MSRV 1.64, similarly OK for this backend. +const TRUE: BOOL = 1; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { let result = unsafe { ProcessPrng(dest.as_mut_ptr().cast::(), dest.len()) }; // Since Windows 10, calls to the user-mode RNG are guaranteed to never @@ -41,6 +56,6 @@ pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // return 1 (which is how windows represents TRUE). // See the bottom of page 6 of the aforementioned Windows RNG // whitepaper for more information. - debug_assert!(result == 1); + debug_assert!(result == TRUE); Ok(()) } diff --git a/third_party/rust/getrandom/src/backends/windows7.rs b/third_party/rust/getrandom/src/backends/windows7.rs index 5b3c86c9c95a..8a353a9f889f 100644 --- a/third_party/rust/getrandom/src/backends/windows7.rs +++ b/third_party/rust/getrandom/src/backends/windows7.rs @@ -25,6 +25,7 @@ extern "system" { type BOOLEAN = u8; const TRUE: BOOLEAN = 1u8; +#[inline] pub fn fill_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { // Prevent overflow of u32 let chunk_size = usize::try_from(i32::MAX).expect("Windows does not support 16-bit targets"); diff --git a/third_party/rust/getrandom/src/error.rs b/third_party/rust/getrandom/src/error.rs index ccbe78373324..13f3121f6f8f 100644 --- a/third_party/rust/getrandom/src/error.rs +++ b/third_party/rust/getrandom/src/error.rs @@ -1,15 +1,20 @@ #[cfg(feature = "std")] extern crate std; -use core::{fmt, num::NonZeroU32}; +use core::fmt; // This private alias mirrors `std::io::RawOsError`: // https://doc.rust-lang.org/std/io/type.RawOsError.html) cfg_if::cfg_if!( if #[cfg(target_os = "uefi")] { + // See the UEFI spec for more information: + // https://uefi.org/specs/UEFI/2.10/Apx_D_Status_Codes.html type RawOsError = usize; + type NonZeroRawOsError = core::num::NonZeroUsize; + const UEFI_ERROR_FLAG: RawOsError = 1 << (RawOsError::BITS - 1); } else { type RawOsError = i32; + type NonZeroRawOsError = core::num::NonZeroI32; } ); @@ -19,16 +24,16 @@ cfg_if::cfg_if!( /// if so, which error code the OS gave the application. If such an error is /// encountered, please consult with your system documentation. /// -/// Internally this type is a NonZeroU32, with certain values reserved for -/// certain purposes, see [`Error::INTERNAL_START`] and [`Error::CUSTOM_START`]. -/// /// *If this crate's `"std"` Cargo feature is enabled*, then: /// - [`getrandom::Error`][Error] implements /// [`std::error::Error`](https://doc.rust-lang.org/std/error/trait.Error.html) /// - [`std::io::Error`](https://doc.rust-lang.org/std/io/struct.Error.html) implements /// [`From`](https://doc.rust-lang.org/std/convert/trait.From.html). + +// note: on non-UEFI targets OS errors are represented as negative integers, +// while on UEFI targets OS errors have the highest bit set to 1. #[derive(Copy, Clone, Eq, PartialEq)] -pub struct Error(NonZeroU32); +pub struct Error(NonZeroRawOsError); impl Error { /// This target/platform is not supported by `getrandom`. @@ -38,29 +43,32 @@ impl Error { /// Encountered an unexpected situation which should not happen in practice. pub const UNEXPECTED: Error = Self::new_internal(2); - /// Codes below this point represent OS Errors (i.e. positive i32 values). - /// Codes at or above this point, but below [`Error::CUSTOM_START`] are - /// reserved for use by the `rand` and `getrandom` crates. - pub const INTERNAL_START: u32 = 1 << 31; + /// Internal errors can be in the range of 2^16..2^17 + const INTERNAL_START: RawOsError = 1 << 16; + /// Custom errors can be in the range of 2^17..(2^17 + 2^16) + const CUSTOM_START: RawOsError = 1 << 17; - /// Codes at or above this point can be used by users to define their own - /// custom errors. - pub const CUSTOM_START: u32 = (1 << 31) + (1 << 30); - - /// Creates a new instance of an `Error` from a particular OS error code. - /// - /// This method is analogous to [`std::io::Error::from_raw_os_error()`][1], - /// except that it works in `no_std` contexts and `code` will be - /// replaced with `Error::UNEXPECTED` if it isn't in the range - /// `1..Error::INTERNAL_START`. Thus, for the result `r`, - /// `r == Self::UNEXPECTED || r.raw_os_error().unsigned_abs() == code`. - /// - /// [1]: https://doc.rust-lang.org/std/io/struct.Error.html#method.from_raw_os_error + /// Creates a new instance of an `Error` from a negative error code. + #[cfg(not(target_os = "uefi"))] #[allow(dead_code)] - pub(super) fn from_os_error(code: u32) -> Self { - match NonZeroU32::new(code) { - Some(code) if code.get() < Self::INTERNAL_START => Self(code), - _ => Self::UNEXPECTED, + pub(super) fn from_neg_error_code(code: RawOsError) -> Self { + if code < 0 { + let code = NonZeroRawOsError::new(code).expect("`code` is negative"); + Self(code) + } else { + Error::UNEXPECTED + } + } + + /// Creates a new instance of an `Error` from an UEFI error code. + #[cfg(target_os = "uefi")] + #[allow(dead_code)] + pub(super) fn from_uefi_code(code: RawOsError) -> Self { + if code & UEFI_ERROR_FLAG != 0 { + let code = NonZeroRawOsError::new(code).expect("The highest bit of `code` is set to 1"); + Self(code) + } else { + Self::UNEXPECTED } } @@ -79,27 +87,53 @@ impl Error { #[inline] pub fn raw_os_error(self) -> Option { let code = self.0.get(); - if code >= Self::INTERNAL_START { - return None; + + // note: in this method we need to cover only backends which rely on + // `Error::{from_error_code, from_errno, from_uefi_code}` methods, + // on all other backends this method always returns `None`. + + #[cfg(target_os = "uefi")] + { + if code & UEFI_ERROR_FLAG != 0 { + Some(code) + } else { + None + } + } + + #[cfg(not(target_os = "uefi"))] + { + // On most targets `std` expects positive error codes while retrieving error strings: + // - `libc`-based targets use `strerror_r` which expects positive error codes. + // - Hermit relies on the `hermit-abi` crate, which expects positive error codes: + // https://docs.rs/hermit-abi/0.4.0/src/hermit_abi/errno.rs.html#400-532 + // - WASIp1 uses the same conventions as `libc`: + // https://github.com/rust-lang/rust/blob/1.85.0/library/std/src/sys/pal/wasi/os.rs#L57-L67 + // + // The only exception is Solid, `std` expects negative system error codes, see: + // https://github.com/rust-lang/rust/blob/1.85.0/library/std/src/sys/pal/solid/error.rs#L5-L31 + if code >= 0 { + None + } else if cfg!(not(target_os = "solid_asp3")) { + code.checked_neg() + } else { + Some(code) + } } - let errno = RawOsError::try_from(code).ok()?; - #[cfg(target_os = "solid_asp3")] - let errno = -errno; - Some(errno) } /// Creates a new instance of an `Error` from a particular custom error code. pub const fn new_custom(n: u16) -> Error { - // SAFETY: code > 0 as CUSTOM_START > 0 and adding n won't overflow a u32. - let code = Error::CUSTOM_START + (n as u32); - Error(unsafe { NonZeroU32::new_unchecked(code) }) + // SAFETY: code > 0 as CUSTOM_START > 0 and adding `n` won't overflow `RawOsError`. + let code = Error::CUSTOM_START + (n as RawOsError); + Error(unsafe { NonZeroRawOsError::new_unchecked(code) }) } /// Creates a new instance of an `Error` from a particular internal error code. pub(crate) const fn new_internal(n: u16) -> Error { - // SAFETY: code > 0 as INTERNAL_START > 0 and adding n won't overflow a u32. - let code = Error::INTERNAL_START + (n as u32); - Error(unsafe { NonZeroU32::new_unchecked(code) }) + // SAFETY: code > 0 as INTERNAL_START > 0 and adding `n` won't overflow `RawOsError`. + let code = Error::INTERNAL_START + (n as RawOsError); + Error(unsafe { NonZeroRawOsError::new_unchecked(code) }) } fn internal_desc(&self) -> Option<&'static str> { @@ -176,15 +210,3 @@ impl fmt::Display for Error { } } } - -#[cfg(test)] -mod tests { - use super::Error; - use core::mem::size_of; - - #[test] - fn test_size() { - assert_eq!(size_of::(), 4); - assert_eq!(size_of::>(), 4); - } -} diff --git a/third_party/rust/getrandom/src/lib.rs b/third_party/rust/getrandom/src/lib.rs index 2ac0ad0ba660..51c494e173a9 100644 --- a/third_party/rust/getrandom/src/lib.rs +++ b/third_party/rust/getrandom/src/lib.rs @@ -10,6 +10,7 @@ #![doc = include_str!("../README.md")] #![warn(rust_2018_idioms, unused_lifetimes, missing_docs)] #![cfg_attr(docsrs, feature(doc_auto_cfg))] +#![cfg_attr(getrandom_backend = "efi_rng", feature(uefi_std))] #![deny( clippy::cast_lossless, clippy::cast_possible_truncation, diff --git a/third_party/rust/getrandom/src/util.rs b/third_party/rust/getrandom/src/util.rs index 4a55b0a50f70..d42c26e75e19 100644 --- a/third_party/rust/getrandom/src/util.rs +++ b/third_party/rust/getrandom/src/util.rs @@ -49,6 +49,7 @@ fn ptr_from_ref(r: &T) -> *const T { } /// Default implementation of `inner_u32` on top of `fill_uninit` +#[inline] pub fn inner_u32() -> Result { let mut res = MaybeUninit::::uninit(); // SAFETY: the created slice has the same size as `res` @@ -63,6 +64,7 @@ pub fn inner_u32() -> Result { } /// Default implementation of `inner_u64` on top of `fill_uninit` +#[inline] pub fn inner_u64() -> Result { let mut res = MaybeUninit::::uninit(); // SAFETY: the created slice has the same size as `res` diff --git a/third_party/rust/getrandom/src/util_libc.rs b/third_party/rust/getrandom/src/util_libc.rs index 2f6185958a82..24c53c0c9071 100644 --- a/third_party/rust/getrandom/src/util_libc.rs +++ b/third_party/rust/getrandom/src/util_libc.rs @@ -2,7 +2,7 @@ use crate::Error; use core::mem::MaybeUninit; cfg_if! { - if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] { + if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android", target_os = "cygwin"))] { use libc::__errno as errno_location; } else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox", target_os = "dragonfly"))] { use libc::__errno_location as errno_location; @@ -34,14 +34,16 @@ cfg_if! { } pub(crate) fn last_os_error() -> Error { - let errno: libc::c_int = unsafe { get_errno() }; + // We assume that on all targets which use the `util_libc` module `c_int` is equal to `i32` + let errno: i32 = unsafe { get_errno() }; - // c_int-to-u32 conversion is lossless for nonnegative values if they are the same size. - const _: () = assert!(core::mem::size_of::() == core::mem::size_of::()); - - match u32::try_from(errno) { - Ok(code) if code != 0 => Error::from_os_error(code), - _ => Error::ERRNO_NOT_POSITIVE, + if errno > 0 { + let code = errno + .checked_neg() + .expect("Positive number can be always negated"); + Error::from_neg_error_code(code) + } else { + Error::ERRNO_NOT_POSITIVE } } diff --git a/third_party/rust/jobserver/.cargo-checksum.json b/third_party/rust/jobserver/.cargo-checksum.json index d3431dfe659c..548d00ab1965 100644 --- a/third_party/rust/jobserver/.cargo-checksum.json +++ b/third_party/rust/jobserver/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"9eb074df6c05dd3b88b3bd5b68312da8552b116e148d9270ce474840408cf93f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"de412b60535de63bd312ab0df197f72b89d6aaeab166ed090f58a26dcda72bcf","src/error.rs":"f947d858ba95a9a08d16325d163b61fdf0ce40ec95b7fb08cc47c9876de9c8dc","src/lib.rs":"9b82f32a87deae5bd5a0ed36cdab3a195f9419c6befa9f77a682f262b9158722","src/unix.rs":"92c2afb1307e50339817a9d5dd70a2457ab15b87699297b889b4d8652a3a1778","src/wasm.rs":"74db7bd1441b7b4d1b53cd83e23097a2b976faf4d18d3f42f583048d27611d4d","src/windows.rs":"a636019813f2ca2236706e6fe4c88166dddf8aa050555941167ff8e55c848cf1","tests/client-of-myself.rs":"ca09bf398f69df4bac1730999e954dbbc3faf3c6512678c136e0938e7e9cd0ab","tests/client.rs":"5d9b3606356c0fed0c9f5bf372f0fa09f922f93ffe910a1a9a474898d5ec9fa2","tests/helper.rs":"7b8d9eb8484ccf1e656ed235a23f62c2756045e3a6604121aee5493d8a5b1ede","tests/make-as-a-client.rs":"8be1f3fef1e9e65c7904dbaa04364bf0f44e9deab84a2a247a5a94b5cf0df9bc","tests/server.rs":"da15bf12e1df1883f660892b996c9e0d92485aace3f7b50ee70c4a8e6deae8da"},"package":"48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"} \ No newline at end of file +{"files":{"Cargo.lock":"c4b876198c51462999d8485d55c13b9adbb8ec8d3139ee22a0b3b779ae848d1d","Cargo.toml":"d6392932a8989572704e9f1214fde950b436987afee156bb3c1710ecc37be518","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"de412b60535de63bd312ab0df197f72b89d6aaeab166ed090f58a26dcda72bcf","src/error.rs":"f947d858ba95a9a08d16325d163b61fdf0ce40ec95b7fb08cc47c9876de9c8dc","src/lib.rs":"9b82f32a87deae5bd5a0ed36cdab3a195f9419c6befa9f77a682f262b9158722","src/unix.rs":"e76e4073040f7576d54f1eaa9beb4a10e1c0ca4602f794de7204491b161676cc","src/wasm.rs":"74db7bd1441b7b4d1b53cd83e23097a2b976faf4d18d3f42f583048d27611d4d","src/windows.rs":"d939574ff187be4fa6bfba4cb9f2cb95541dc8752d0e2915c8b9de90bd833755","tests/client-of-myself.rs":"ca09bf398f69df4bac1730999e954dbbc3faf3c6512678c136e0938e7e9cd0ab","tests/client.rs":"5d9b3606356c0fed0c9f5bf372f0fa09f922f93ffe910a1a9a474898d5ec9fa2","tests/helper.rs":"7b8d9eb8484ccf1e656ed235a23f62c2756045e3a6604121aee5493d8a5b1ede","tests/make-as-a-client.rs":"8be1f3fef1e9e65c7904dbaa04364bf0f44e9deab84a2a247a5a94b5cf0df9bc","tests/server.rs":"da15bf12e1df1883f660892b996c9e0d92485aace3f7b50ee70c4a8e6deae8da"},"package":"38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a"} \ No newline at end of file diff --git a/third_party/rust/jobserver/Cargo.lock b/third_party/rust/jobserver/Cargo.lock new file mode 100644 index 000000000000..dd7c4f32db5f --- /dev/null +++ b/third_party/rust/jobserver/Cargo.lock @@ -0,0 +1,198 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi", +] + +[[package]] +name = "jobserver" +version = "0.1.33" +dependencies = [ + "getrandom", + "libc", + "nix", + "tempfile", +] + +[[package]] +name = "libc" +version = "0.2.171" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" + +[[package]] +name = "linux-raw-sys" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" + +[[package]] +name = "nix" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "rustix" +version = "0.38.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] diff --git a/third_party/rust/jobserver/Cargo.toml b/third_party/rust/jobserver/Cargo.toml index 9c688a0f697e..972c0b2d25a8 100644 --- a/third_party/rust/jobserver/Cargo.toml +++ b/third_party/rust/jobserver/Cargo.toml @@ -13,8 +13,14 @@ edition = "2021" rust-version = "1.63" name = "jobserver" -version = "0.1.32" +version = "0.1.33" authors = ["Alex Crichton "] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = """ An implementation of the GNU Make jobserver for Rust. """ @@ -24,35 +30,43 @@ readme = "README.md" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/jobserver-rs" +[lib] +name = "jobserver" +path = "src/lib.rs" + [[test]] name = "client" path = "tests/client.rs" harness = false -[[test]] -name = "server" -path = "tests/server.rs" - [[test]] name = "client-of-myself" path = "tests/client-of-myself.rs" harness = false +[[test]] +name = "helper" +path = "tests/helper.rs" + [[test]] name = "make-as-a-client" path = "tests/make-as-a-client.rs" harness = false [[test]] -name = "helper" -path = "tests/helper.rs" +name = "server" +path = "tests/server.rs" [dev-dependencies.tempfile] version = "3.10.1" [target."cfg(unix)".dependencies.libc] -version = "0.2.87" +version = "0.2.171" [target."cfg(unix)".dev-dependencies.nix] version = "0.28.0" features = ["fs"] + +[target."cfg(windows)".dependencies.getrandom] +version = "0.3.2" +features = ["std"] diff --git a/third_party/rust/jobserver/src/unix.rs b/third_party/rust/jobserver/src/unix.rs index cd05edd1eae1..2b310c2578ef 100644 --- a/third_party/rust/jobserver/src/unix.rs +++ b/third_party/rust/jobserver/src/unix.rs @@ -394,14 +394,7 @@ pub(crate) fn spawn_helper( let mut err = None; USR1_INIT.call_once(|| unsafe { let mut new: libc::sigaction = mem::zeroed(); - #[cfg(target_os = "aix")] - { - new.sa_union.__su_sigaction = sigusr1_handler; - } - #[cfg(not(target_os = "aix"))] - { - new.sa_sigaction = sigusr1_handler as usize; - } + new.sa_sigaction = sigusr1_handler as usize; new.sa_flags = libc::SA_SIGINFO as _; if libc::sigaction(libc::SIGUSR1, &new, ptr::null_mut()) != 0 { err = Some(io::Error::last_os_error()); @@ -516,7 +509,7 @@ unsafe fn fd_check(fd: c_int, check_pipe: bool) -> Result<(), FromEnvErrorInner> } fn clone_fd_and_set_cloexec(fd: c_int) -> Result { - // Safety: fd is a valid fd dand it remains open until returns + // Safety: fd is a valid fd and it remains open until returns unsafe { BorrowedFd::borrow_raw(fd) } .try_clone_to_owned() .map(File::from) diff --git a/third_party/rust/jobserver/src/windows.rs b/third_party/rust/jobserver/src/windows.rs index 7e6e6d4a78fe..550f658a13a3 100644 --- a/third_party/rust/jobserver/src/windows.rs +++ b/third_party/rust/jobserver/src/windows.rs @@ -36,6 +36,7 @@ const WAIT_FAILED: DWORD = 4294967295u32; const WAIT_OBJECT_0: DWORD = 0u32; const WAIT_TIMEOUT: DWORD = 258u32; +#[link(name = "kernel32")] extern "system" { fn CloseHandle(handle: HANDLE) -> BOOL; fn SetEvent(hEvent: HANDLE) -> BOOL; @@ -64,27 +65,6 @@ extern "system" { ) -> HANDLE; fn OpenSemaphoreA(dwDesiredAccess: DWORD, bInheritHandle: BOOL, lpName: *const i8) -> HANDLE; fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD; - #[link_name = "SystemFunction036"] - fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: u32) -> u8; -} - -// Note that we ideally would use the `getrandom` crate, but unfortunately -// that causes build issues when this crate is used in rust-lang/rust (see -// rust-lang/rust#65014 for more information). As a result we just inline -// the pretty simple Windows-specific implementation of generating -// randomness. -fn getrandom(dest: &mut [u8]) -> io::Result<()> { - // Prevent overflow of u32 - for chunk in dest.chunks_mut(u32::MAX as usize) { - let ret = unsafe { RtlGenRandom(chunk.as_mut_ptr(), chunk.len() as u32) }; - if ret == 0 { - return Err(io::Error::new( - io::ErrorKind::Other, - "failed to generate random bytes", - )); - } - } - Ok(()) } impl Client { @@ -98,9 +78,8 @@ impl Client { // slot and then immediately acquire it (without ever releaseing it // back). for _ in 0..100 { - let mut bytes = [0; 4]; - getrandom(&mut bytes)?; - let mut name = format!("__rust_jobserver_semaphore_{}\0", u32::from_ne_bytes(bytes)); + let bytes = getrandom::u32()?; + let mut name = format!("__rust_jobserver_semaphore_{}\0", bytes); unsafe { let create_limit = if limit == 0 { 1 } else { limit }; let r = CreateSemaphoreA( diff --git a/third_party/rust/wasi/.cargo-checksum.json b/third_party/rust/wasi/.cargo-checksum.json index 8ea84dfb10d9..dc814f0bfb6b 100644 --- a/third_party/rust/wasi/.cargo-checksum.json +++ b/third_party/rust/wasi/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CODE_OF_CONDUCT.md":"a13aaaf393818bd91207c618724d3fb74944ca5161201822a84af951bcf655ef","CONTRIBUTING.md":"2c908a3e263dc35dfed131c02ff907cd72fafb2c2096e4ba9b1e0cbb7a1b76df","Cargo.lock":"b9d654baafafdea655bebd209b210b7929bd72c93c3b73881cea6318d5d068d8","Cargo.toml":"cb74eea1b4da7e0ae85a9d88027b5310a6ae91b8c4bd1fb1867ec064eff41760","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"1a22f69b3d410be333651b7c98e68720e98da62bcbc03b4e74a689c33ba8c690","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","ci/regenerate.sh":"63e0826f651188eba51ac54abe3aa5ff44f0d887a1194b4e2a7dc2fa8fb1dfc9","ci/rustfmt-bindings.toml":"b1f37bcf2a7baa91220f0706b1d9f439721f1d026df9d9f97f513d76d8ff2669","examples/cli-command.rs":"f03689380e305e5fe32e2582cb10af43d03244c1b343b90ec03936108d67f084","examples/hello-world.rs":"48251e32311e7bda9bc852bf48b8925912ae11d2534f4f7401e0d7dd3c5aeb16","examples/http-proxy.rs":"4ec8e31010526ffb68d2b18fd7c31a32de4d58229604efd391d4a296fee22da0","src/bindings.rs":"5a8266e42aa070bb2b4e8703c010fa04393ccd1301c601153ba7b2dc5ac6460b","src/command.rs":"ec5c9f7797c017def18c13ceeb19793000c0417228cbf6bb83f15b93f8800c92","src/lib.rs":"4fa1fdbaa973d077b8d58130304ce4279b457312c6daab0b497cc9cd5380a962","src/proxy.rs":"19e5d6c0276456659af127f1b8d938b716cb919deb86b501eb17bb43d06f5ed1","wit/deps/cli/command.wit":"da467a3a1b7a1bf6d9ec10b5bc5cbb90ddbc912b34495e19c1d5fe6c5b130349","wit/deps/cli/environment.wit":"8d4f13e628d2e8f029f6d668d8075db5e6c8867238c0436cc966dd9a535148e1","wit/deps/cli/exit.wit":"337522eb41c89e660b1dabc1bae362acc462f9cbfdcb9546e790e371580175a2","wit/deps/cli/imports.wit":"8cb6df9f4860399cac4640df6e9cb5eeea35ce70920a2f3fb631911311870bc0","wit/deps/cli/run.wit":"50815a16aaebae4b99d2e2f9de69ddf30fc27249f41ad3cf477c4e796edf5792","wit/deps/cli/stdio.wit":"6311ad8251ff4e0452c5be30ee70d9d6c41971c31e566dc1029d653182cd69fe","wit/deps/cli/terminal.wit":"57b139fed58792c8dcac6cd74caf4baadda64f49b53181a999b5d6080694925c","wit/deps/clocks/monotonic-clock.wit":"2e974279ccee050c5ea32117f83cff50d1b3146763db2a60c3e8afeb774dad47","wit/deps/clocks/wall-clock.wit":"55b7978bad3fcf9b0886be4644834e8bf9e3553bba018d8fd9201482369cb6b8","wit/deps/clocks/world.wit":"015589355de95f274258599abf01290405b316d806bf2d97df0609077d970edf","wit/deps/filesystem/preopens.wit":"872e66229d4d44c0ac97751720f396729c9464f1b628fc6bda3ed2079a82e6f1","wit/deps/filesystem/types.wit":"f26dadcbcc7b231893c5f0094b729eabeb0643dca182697433fa8ab6ab786d20","wit/deps/filesystem/world.wit":"9e1ffb6f850441124c4fe07bcede8cb3c4b6186f1dc020cb9189020b8a853c2b","wit/deps/http/handler.wit":"96882590ae9934ca52f031eccc91704d0caf80c6b3227b6e1177e947ce135b24","wit/deps/http/proxy.wit":"57aa4c16de7ad4677046682959dd998abdf22bded708b57cee071a84c30fba3f","wit/deps/http/types.wit":"54565a9b1d701d43db8cd919924bdf6a9ba01b31113985043866881807a2d839","wit/deps/io/error.wit":"5c0cb7d20bca9d98233f13076132081e5aa12bc825a823066ff27d4cea834a0c","wit/deps/io/poll.wit":"88e2b5c3f04e6f59a93136823403389f1df37f92df7fc32ebcc36af8b1b78bfe","wit/deps/io/streams.wit":"41204f72fd3568897f9f217fc4840cd8ccf117bd53cc4f53ea6eacc7712bf76f","wit/deps/io/world.wit":"358617cc366d0c4528571fc983acb9431a4516b7c8582d93930b54c80125bc1a","wit/deps/random/insecure-seed.wit":"9ebba944fef13d4db4a124519349ebf03febaff40f78f818d2c77c926281eb12","wit/deps/random/insecure.wit":"28880bdfebda2f39f36f5fe5a1d20f6f1e76f1793ff6e973e34ff8cb4cdc633d","wit/deps/random/random.wit":"b36eb876e39d3a0d63d6ca0c6fc4e84278ddc22c48173906645ed3dae3ef0c79","wit/deps/random/world.wit":"7db07eadfefe2d2f042b5b7a283d5c5b8ab2a25276c352cfcc6cc9fd1a7b5fc7","wit/deps/sockets/instance-network.wit":"ad100127c74b967064cf5d8e1770f6f0d787ef55f07ba9f6b334bc4c98c82282","wit/deps/sockets/ip-name-lookup.wit":"fdfd3f54f7b82457c3b08b7c941c0a50a1fc15cdf23d692ccc5680eeb29313cd","wit/deps/sockets/network.wit":"db6583f0e2425abbb7621a26716371983e9753ec1c44c580a888a603e74a8840","wit/deps/sockets/tcp-create-socket.wit":"6a9175598eb628ee8a14989efa0ef4e3244aae1d339f1c882467c5c8226e02ef","wit/deps/sockets/tcp.wit":"aa7a316ce0cfb8b42c0f592b5096d218da8ad75e7878f06329954e22040c3ee5","wit/deps/sockets/udp-create-socket.wit":"058da3ade225a22ae9f7329453a51cf55174f3253b7a4163d10bc46bc7c53b85","wit/deps/sockets/udp.wit":"411998b320d08fce10400c840f0ca0ebef49c5a4fb13f94011bbce2bbd5972fc","wit/deps/sockets/world.wit":"9281c12b9611117e98674eb3f00bd9c4eb2e49f1386f0d6173b9c88181180d12","wit/wasi-crate.wit":"6cd5e54a427d2de5661ef10fe6d04ed5a446c27b805b51c0a90dc60f4b5d794f"},"package":"652cd73449d0b957a2743b70c72d79d34a5fa505696488f4ca90b46f6da94118"} \ No newline at end of file +{"files":{"CODE_OF_CONDUCT.md":"a13aaaf393818bd91207c618724d3fb74944ca5161201822a84af951bcf655ef","CONTRIBUTING.md":"2c908a3e263dc35dfed131c02ff907cd72fafb2c2096e4ba9b1e0cbb7a1b76df","Cargo.lock":"8cc81d2623344bdc9223c5e4a0530ae94dfa0930d465193719e6d300e2243225","Cargo.toml":"f43ee004589d9330d76d998fe7d9dd88ffd2a3daf5872b60fcaa495f47b02583","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"aab21c6fad2ca7e2b487764f49018ac8f6f0bf0236dabf5aa947e134952a1c69","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","ci/regenerate.sh":"2af2cc4f41022d09ce3132013b6a0de7d5ed6fecdb44ad98b1bbd7125643cec8","ci/vendor-wit.sh":"6ea63164316554fa60fc32243595dc79629953cfb63d973678dc715b3b3cd61e","examples/cli-command-no_std.rs":"f03689380e305e5fe32e2582cb10af43d03244c1b343b90ec03936108d67f084","examples/cli-command.rs":"ac21e564ac6fe77c10ebaae774a7ebedeb8b6779826ae86834546cbe28eb8140","examples/hello-world-no_std.rs":"48251e32311e7bda9bc852bf48b8925912ae11d2534f4f7401e0d7dd3c5aeb16","examples/hello-world.rs":"4f9e5cdd74914fb82c6a20dd2544260b8d7dac921f1e0d933ca272c1ffca5163","examples/http-proxy-no_std.rs":"4ec8e31010526ffb68d2b18fd7c31a32de4d58229604efd391d4a296fee22da0","examples/http-proxy.rs":"c52c07f36d3e856bbe4e72bdd484c4129d55f26436cf0631003e451f5322d678","src/bindings.rs":"9db6b925a72119137dbc306687aa6dc61f402ed0b726db7fdb1d7fe9bf893909","src/command.rs":"8e5475c6d4a41ea3b3ec98a918a61bce9dd58cf50a2a27c764bf9796b9cbf299","src/ext/mod.rs":"4bc79c71442ac6c55dc4f8a0632b6d6805c0c9c74b22b56791a483ae447dac0c","src/ext/std.rs":"c35fd8bdafd24a6adef4f5a27e8e4bb421b0e50cebfe350868ded43980b1a06e","src/lib.rs":"044e0df592d1159ce711f17bc27edc87f876951bd3ec1ce72ebabf20e011e84a","src/proxy.rs":"3a05d33e98936642a84c755e8f4db7c5b8de27ed0416614cf4fad8b48c519cdf","wit/deps/cli/command.wit":"f729a20e99a4601f90677e31a16e63f24ee32eef062b9305e94419428c8ff70b","wit/deps/cli/environment.wit":"5e58cd47b162e9f004bc9224a29c2ec3cf9e1a3d4c910154ce53742f828af91f","wit/deps/cli/exit.wit":"a0fae6014751dc95f45b1dbe530b7f4db99d5bd607ed8bbf879b22a906f4514c","wit/deps/cli/imports.wit":"a576c17e15ece40fe29eaeb73f416d6f46ac639f512d51ad20bb915b4686a4dd","wit/deps/cli/run.wit":"a7df5376da8230e0509fffbb8355641af0765cc5cff8064bbe58fef1cbbe63c1","wit/deps/cli/stdio.wit":"bc6e5e55963d9c49b91d9880d8e50e44a718c5a7b7211bb8cb5d4fcd552b13a8","wit/deps/cli/terminal.wit":"fc87cd0bc3f76ff7181d3666617a38ee10239f8e0344db2a52cb79f46c6b2d31","wit/deps/clocks/monotonic-clock.wit":"ab12521f4522c7bae48fb272fc90f7bf21f83bc3e6b86e400075826628fdcf23","wit/deps/clocks/timezone.wit":"aaabf8145758aa75222a5e18de29a912d5ebb5babc348884fd81b1fa90225adc","wit/deps/clocks/wall-clock.wit":"b7b63d7bbb6631bcc8ce7d25910d47308e6345104dc146513b76ff1d82e1d7a0","wit/deps/clocks/world.wit":"5f066526b320973195e083bc946874b36fc488f8ae5004119c9b5dcd83430660","wit/deps/filesystem/preopens.wit":"1c53bbc639e87efc67440332e186bcc617f1ab0f2a9789c339a69ed0da424358","wit/deps/filesystem/types.wit":"24413900954e7ca1438f3c9b326a6f799b748beab51a297ab687003578f66765","wit/deps/filesystem/world.wit":"70f31a63ada7aeb6be29380aae712406baf91dad72e73de39025e38f41a32cae","wit/deps/http/handler.wit":"1f66174b4058b102367e69ce8aa657b3e9dbc767f6ade960108faaa1731f0945","wit/deps/http/proxy.wit":"c8756768c033db884734f98858b0d448a3a2cb98d9e4584c705f1fc0418422f1","wit/deps/http/types.wit":"82ac209d799643a39309c40d108a9594bebb79312f383ffcf284f23011041e7e","wit/deps/io/error.wit":"ea8a48ed6aa970947f65e378a2e72b878b421d0594b5425349d1c033a138533f","wit/deps/io/poll.wit":"d6eafcf78f220dfc07c4f055019732cc30c526d6d0d0b24150325c5eeef5d041","wit/deps/io/streams.wit":"d4b8980637de85e47459a0144dc1a9b999bfcbfb6ab344f0eceadc5face6135b","wit/deps/io/world.wit":"5572ef45d90cd766282c171a6cc403b3b9567b73e63a413c4eba1b4ad05caf25","wit/deps/random/insecure-seed.wit":"466da73f3aa1065083dd15ffd1d55c8e69b6ec4dfc6c9c149e651a126f60f33c","wit/deps/random/insecure.wit":"0a132cde99268a502973ca112db9da45c0c32870c67d6b92bd3110636c1cd871","wit/deps/random/random.wit":"cebb42f292bada460ab424bb56caf392ad14d4d7dfae1b85dfbc55253c1b751f","wit/deps/random/world.wit":"7d825a7a1624f4a165f6c7abc9aaa77e25618a9fed0c56461df8826965920dc2","wit/deps/sockets/instance-network.wit":"1e4a5d97df44421503a169e1d514eca2cf160f545c44d320ce8a82f726a40cf8","wit/deps/sockets/ip-name-lookup.wit":"c87cc003ff2b92a0d74294418e0d62d12f42f913b94617f73cc09738a46e8fac","wit/deps/sockets/network.wit":"077f76c2f266b3211b0e3fbddf4fbfd9060be050954d44aad9b331419fbe3caf","wit/deps/sockets/tcp-create-socket.wit":"96a6a1a93b859127ee60273f0a77cda8d60930f7952174fb22469293b5da6a3a","wit/deps/sockets/tcp.wit":"ad16e21cae8b67e09f6541fafaf57c88242722871aced8e53aaf018ee63be086","wit/deps/sockets/udp-create-socket.wit":"c52b9bf91ef4e30e7ec08ad1fc9e77ef005a0a87648c5d2e416dd6e35369f08c","wit/deps/sockets/udp.wit":"b8cd7720349cf11278dd30c77799b0255bfc8cbfb2dc2a8dd333f658a88d147e","wit/deps/sockets/world.wit":"84e8071d91f63484a326b5a745728e1964edc55cc90796df7ba042b508325103","wit/wasi-crate.wit":"87b72c92cc7561d7fbedc1c268f310b476f36803890c76257ebe13c0a1c06a5d"},"package":"9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"} \ No newline at end of file diff --git a/third_party/rust/wasi/Cargo.lock b/third_party/rust/wasi/Cargo.lock index 0607ab34a43c..3f46f0388a11 100644 --- a/third_party/rust/wasi/Cargo.lock +++ b/third_party/rust/wasi/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "bitflags" @@ -28,9 +28,8 @@ checksum = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c" [[package]] name = "wasi" -version = "0.13.0+wasi-0.2.0" +version = "0.14.2+wasi-0.2.4" dependencies = [ - "bitflags", "compiler_builtins", "rustc-std-workspace-alloc", "rustc-std-workspace-core", @@ -39,6 +38,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.21.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "026d24a27f6712541fa534f2954bd9e0eb66172f033c2157c0f31d106255c497" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] diff --git a/third_party/rust/wasi/Cargo.toml b/third_party/rust/wasi/Cargo.toml index bea7a99cbde8..3b05b05c6eea 100644 --- a/third_party/rust/wasi/Cargo.toml +++ b/third_party/rust/wasi/Cargo.toml @@ -12,8 +12,14 @@ [package] edition = "2021" name = "wasi" -version = "0.13.0+wasi-0.2.0" +version = "0.14.2+wasi-0.2.4" authors = ["The Cranelift Project Developers"] +build = false +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = "WASI API bindings for Rust" documentation = "https://docs.rs/wasi" readme = "README.md" @@ -26,18 +32,51 @@ categories = [ "wasm", ] license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" -repository = "https://github.com/bytecodealliance/wasi" +repository = "https://github.com/bytecodealliance/wasi-rs" + +[features] +default = ["std"] +rustc-dep-of-std = [ + "compiler_builtins", + "core", + "rustc-std-workspace-alloc", +] +std = [] + +[lib] +name = "wasi" +path = "src/lib.rs" [[example]] name = "cli-command" crate-type = ["cdylib"] +path = "examples/cli-command.rs" +required-features = ["std"] + +[[example]] +name = "cli-command-no_std" +crate-type = ["cdylib"] +path = "examples/cli-command-no_std.rs" + +[[example]] +name = "hello-world" +path = "examples/hello-world.rs" +required-features = ["std"] + +[[example]] +name = "hello-world-no_std" +path = "examples/hello-world-no_std.rs" [[example]] name = "http-proxy" crate-type = ["cdylib"] +path = "examples/http-proxy.rs" +required-features = ["std"] -[dependencies.bitflags] -version = "2.4.2" +[[example]] +name = "http-proxy-no_std" +crate-type = ["cdylib"] +path = "examples/http-proxy-no_std.rs" [dependencies.compiler_builtins] version = "0.1" @@ -53,16 +92,5 @@ version = "1.0" optional = true [dependencies.wit-bindgen-rt] -version = "0.21.0" - -[features] -default = ["std"] -rustc-dep-of-std = [ - "compiler_builtins", - "core", - "rustc-std-workspace-alloc", -] -std = [] - -[badges.maintenance] -status = "experimental" +version = "0.39.0" +features = ["bitflags"] diff --git a/third_party/rust/wasi/README.md b/third_party/rust/wasi/README.md index 7d891ad0cfda..45956435b36a 100644 --- a/third_party/rust/wasi/README.md +++ b/third_party/rust/wasi/README.md @@ -31,11 +31,10 @@ This crate is procedurally generated from [WIT] files using [`wit-bindgen`]. # Usage -First you can depend on this crate via `Cargo.toml`: +Depending on this crate can be done by adding it to your dependencies: -```toml -[dependencies] -wasi = "0.12.0" +```sh +$ cargo add wasi ``` Next you can use the APIs in the root of the module like so: @@ -47,12 +46,33 @@ fn main() { } ``` -This crate is intended to target [components] but today you need to go through -the intermediate build step of a core WebAssembly module using the `wasm32-wasi` -target: +This crate can currently be used in three main ways. + +- One is to use it and compile for the [`wasm32-wasip2` target] in Rust 1.82 and later. + This is the simplest approach, as all the tools needed are included in the + Rust tooling, however it doesn't yet support some of the features of the + other approaches. + +- Another is to use it and compile using [`cargo component`]. This is essentially + the same as the next option, except that `cargo component` handles most of the + steps for you. `cargo component` also has a number of additional features for + working with dependencies and custom WIT interfaces. + +- And the third is to compile for the `wasm32-wasip1` target, and then adapt + the resulting modules into component using `wasm-tools component new`; see + the next section here for details. + +[`wasm32-wasip2` target]: https://blog.rust-lang.org/2024/11/26/wasip2-tier-2.html +[`cargo component`]: https://github.com/bytecodealliance/cargo-component + +## Building with wasm32-wasip1 and `cargo component new`. + +The `wasm32-wasip2` target works with a simple `cargo build --target=wasm32-wasip2` +and doesn't need a lot of documentation here, and `cargo component` has its own +documentation, so here we have some documentation for the `wasm32-wasip1` way. ``` -$ cargo build --target wasm32-wasi +$ cargo build --target wasm32-wasip1 ``` Next you'll want an "adapter" to convert the Rust standard library's usage of @@ -68,7 +88,7 @@ component: ``` $ cargo install wasm-tools -$ wasm-tools component new target/wasm32-wasi/debug/foo.wasm \ +$ wasm-tools component new target/wasm32-wasip1/debug/foo.wasm \ --adapt ./wasi_snapshot_preview1.command.wasm \ -o component.wasm ``` @@ -110,19 +130,17 @@ want to support. Rust WebAssembly targets include: * `wasm32-unknown-unknown` - do not use this crate because this target indicates that WASI is not desired. -* `wasm32-wasi` or `wasm32-wasip1` - this target has been present in Rust for - quite some time and is recently being renamed from `wasm32-wasi` to - `wasm32-wasip1`. The two targets have the same definition, it's just the name - that's changing. For this target you probably want the 0.11.0 track of this - crate. +* `wasm32-wasip1` - this target has been present in Rust for quite some time and + was previously known as `wasm32-wasi`. For this target you probably want the + 0.11.0 track of this crate. * `wasm32-wasip2` - this target is a recent addition to rustc (as of the time of this writing it's not merged yet into rustc). This is what the 0.12.0 version of the crate is intended for. -Note that if you use `wasm32-wasi` or `wasm32-wasip1` it's not necessarily -guaranteed you want 0.11.0 of this crate. If your users are producing components -then you probably want 0.12.0 instead. If you don't know what your users are -producing then you should probably stick with 0.11.0. +Note that if you use `wasm32-wasip1` it's not necessarily guaranteed you want +0.11.0 of this crate. If your users are producing components then you probably +want 0.12.0 instead. If you don't know what your users are producing then you +should probably stick with 0.11.0. Long story short, it's a bit complicated. We're in a transition period from WASIp1 to WASIp2 and things aren't going to be perfect every step of the way, so @@ -148,7 +166,7 @@ This project is triple licenced under the Apache 2/ Apache 2 with LLVM exception - Apache 2/ MIT is used in the rust standard library, and some of this code may be migrated there. - Some of this code may be used in compiler output, and the Apache 2 with LLVM exceptions licence is useful for this. -For more details see +For more details see - [Apache 2 Licence](LICENSE-APACHE) - [Apache 2 Licence with LLVM exceptions](LICENSE-Apache-2.0_WITH_LLVM-exception) - [MIT Licence](LICENSE-MIT) diff --git a/third_party/rust/wasi/ci/regenerate.sh b/third_party/rust/wasi/ci/regenerate.sh index aafc55c561cf..d7b6fe58dc4c 100755 --- a/third_party/rust/wasi/ci/regenerate.sh +++ b/third_party/rust/wasi/ci/regenerate.sh @@ -5,46 +5,46 @@ set -ex generate() { file="$1" shift - wit-bindgen rust wit --out-dir src --std-feature "$@" --rustfmt \ - --bitflags-path bitflags \ + wit-bindgen rust wit --async none --out-dir src --std-feature "$@" --format \ --runtime-path wit_bindgen_rt } # Generate the main body of the bindings which includes all imports from the two # worlds below. -generate src/bindings.rs --type-section-suffix rust-wasi-from-crates-io +generate src/bindings.rs --type-section-suffix rust-wasi-from-crates-io \ + --generate-all # Generate bindings for the `wasi:cli/command` world specifically, namely the # macro `export_command`. # # Note that `--with` is used to point at the previously generated bindings. -with="wasi:cli/environment@0.2.0=crate::cli::environment" -with="$with,wasi:cli/exit@0.2.0=crate::cli::exit" -with="$with,wasi:cli/stdin@0.2.0=crate::cli::stdin" -with="$with,wasi:cli/stdout@0.2.0=crate::cli::stdout" -with="$with,wasi:cli/stderr@0.2.0=crate::cli::stderr" -with="$with,wasi:cli/terminal-input@0.2.0=crate::cli::terminal_input" -with="$with,wasi:cli/terminal-output@0.2.0=crate::cli::terminal_output" -with="$with,wasi:cli/terminal-stdin@0.2.0=crate::cli::terminal_stdin" -with="$with,wasi:cli/terminal-stdout@0.2.0=crate::cli::terminal_stdout" -with="$with,wasi:cli/terminal-stderr@0.2.0=crate::cli::terminal_stderr" -with="$with,wasi:clocks/monotonic-clock@0.2.0=crate::clocks::monotonic_clock" -with="$with,wasi:clocks/wall-clock@0.2.0=crate::clocks::wall_clock" -with="$with,wasi:filesystem/types@0.2.0=crate::filesystem::types" -with="$with,wasi:filesystem/preopens@0.2.0=crate::filesystem::preopens" -with="$with,wasi:io/error@0.2.0=crate::io::error" -with="$with,wasi:io/poll@0.2.0=crate::io::poll" -with="$with,wasi:io/streams@0.2.0=crate::io::streams" -with="$with,wasi:random/random@0.2.0=crate::random::random" -with="$with,wasi:random/insecure@0.2.0=crate::random::insecure" -with="$with,wasi:random/insecure-seed@0.2.0=crate::random::insecure_seed" -with="$with,wasi:sockets/network@0.2.0=crate::sockets::network" -with="$with,wasi:sockets/instance-network@0.2.0=crate::sockets::instance_network" -with="$with,wasi:sockets/tcp@0.2.0=crate::sockets::tcp" -with="$with,wasi:sockets/tcp-create-socket@0.2.0=crate::sockets::tcp_create_socket" -with="$with,wasi:sockets/udp@0.2.0=crate::sockets::udp" -with="$with,wasi:sockets/udp-create-socket@0.2.0=crate::sockets::udp_create_socket" -with="$with,wasi:sockets/ip-name-lookup@0.2.0=crate::sockets::ip_name_lookup" +with="wasi:cli/environment@0.2.4=crate::cli::environment" +with="$with,wasi:cli/exit@0.2.4=crate::cli::exit" +with="$with,wasi:cli/stdin@0.2.4=crate::cli::stdin" +with="$with,wasi:cli/stdout@0.2.4=crate::cli::stdout" +with="$with,wasi:cli/stderr@0.2.4=crate::cli::stderr" +with="$with,wasi:cli/terminal-input@0.2.4=crate::cli::terminal_input" +with="$with,wasi:cli/terminal-output@0.2.4=crate::cli::terminal_output" +with="$with,wasi:cli/terminal-stdin@0.2.4=crate::cli::terminal_stdin" +with="$with,wasi:cli/terminal-stdout@0.2.4=crate::cli::terminal_stdout" +with="$with,wasi:cli/terminal-stderr@0.2.4=crate::cli::terminal_stderr" +with="$with,wasi:clocks/monotonic-clock@0.2.4=crate::clocks::monotonic_clock" +with="$with,wasi:clocks/wall-clock@0.2.4=crate::clocks::wall_clock" +with="$with,wasi:filesystem/types@0.2.4=crate::filesystem::types" +with="$with,wasi:filesystem/preopens@0.2.4=crate::filesystem::preopens" +with="$with,wasi:io/error@0.2.4=crate::io::error" +with="$with,wasi:io/poll@0.2.4=crate::io::poll" +with="$with,wasi:io/streams@0.2.4=crate::io::streams" +with="$with,wasi:random/random@0.2.4=crate::random::random" +with="$with,wasi:random/insecure@0.2.4=crate::random::insecure" +with="$with,wasi:random/insecure-seed@0.2.4=crate::random::insecure_seed" +with="$with,wasi:sockets/network@0.2.4=crate::sockets::network" +with="$with,wasi:sockets/instance-network@0.2.4=crate::sockets::instance_network" +with="$with,wasi:sockets/tcp@0.2.4=crate::sockets::tcp" +with="$with,wasi:sockets/tcp-create-socket@0.2.4=crate::sockets::tcp_create_socket" +with="$with,wasi:sockets/udp@0.2.4=crate::sockets::udp" +with="$with,wasi:sockets/udp-create-socket@0.2.4=crate::sockets::udp_create_socket" +with="$with,wasi:sockets/ip-name-lookup@0.2.4=crate::sockets::ip_name_lookup" generate src/command.rs \ --world wasi:cli/command \ --with "$with" \ @@ -54,17 +54,17 @@ generate src/command.rs \ --export-macro-name _export_command # Same as the `command` world, but for the proxy world. -with="wasi:cli/stdin@0.2.0=crate::cli::stdin" -with="$with,wasi:cli/stdout@0.2.0=crate::cli::stdout" -with="$with,wasi:cli/stderr@0.2.0=crate::cli::stderr" -with="$with,wasi:clocks/monotonic-clock@0.2.0=crate::clocks::monotonic_clock" -with="$with,wasi:clocks/wall-clock@0.2.0=crate::clocks::wall_clock" -with="$with,wasi:io/error@0.2.0=crate::io::error" -with="$with,wasi:io/poll@0.2.0=crate::io::poll" -with="$with,wasi:io/streams@0.2.0=crate::io::streams" -with="$with,wasi:random/random@0.2.0=crate::random::random" -with="$with,wasi:http/types@0.2.0=crate::http::types" -with="$with,wasi:http/outgoing-handler@0.2.0=crate::http::outgoing_handler" +with="wasi:cli/stdin@0.2.4=crate::cli::stdin" +with="$with,wasi:cli/stdout@0.2.4=crate::cli::stdout" +with="$with,wasi:cli/stderr@0.2.4=crate::cli::stderr" +with="$with,wasi:clocks/monotonic-clock@0.2.4=crate::clocks::monotonic_clock" +with="$with,wasi:clocks/wall-clock@0.2.4=crate::clocks::wall_clock" +with="$with,wasi:io/error@0.2.4=crate::io::error" +with="$with,wasi:io/poll@0.2.4=crate::io::poll" +with="$with,wasi:io/streams@0.2.4=crate::io::streams" +with="$with,wasi:random/random@0.2.4=crate::random::random" +with="$with,wasi:http/types@0.2.4=crate::http::types" +with="$with,wasi:http/outgoing-handler@0.2.4=crate::http::outgoing_handler" generate src/proxy.rs \ --world wasi:http/proxy \ --with "$with" \ diff --git a/third_party/rust/wasi/ci/rustfmt-bindings.toml b/third_party/rust/wasi/ci/rustfmt-bindings.toml deleted file mode 100644 index 0ee04dda58ac..000000000000 --- a/third_party/rust/wasi/ci/rustfmt-bindings.toml +++ /dev/null @@ -1,2 +0,0 @@ -max_width = 100 -tab_spaces = 2 diff --git a/third_party/rust/wasi/ci/vendor-wit.sh b/third_party/rust/wasi/ci/vendor-wit.sh new file mode 100755 index 000000000000..83d282e13294 --- /dev/null +++ b/third_party/rust/wasi/ci/vendor-wit.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Script to re-vendor the WIT files that wasi-rs uses as defined by a +# particular tag in upstream repositories. +# +# This script is executed on CI to ensure that everything is up-to-date. +set -ex + +# Space-separated list of wasi proposals that are vendored here along with the +# tag that they're all vendored at. +# +# This assumes that the repositories all have the pattern: +# https://github.com/WebAssembly/wasi-$repo +# and every repository has a tag `v$tag` here. That is currently done as part +# of the WASI release process. +repos="cli clocks filesystem http io random sockets" +tag=0.2.4 +dst=wit/deps + +rm -rf $dst +mkdir -p $dst + +for repo in $repos; do + mkdir $dst/$repo + curl -L https://github.com/WebAssembly/wasi-$repo/archive/refs/tags/v$tag.tar.gz | \ + tar xzf - --strip-components=2 -C $dst/$repo wasi-$repo-$tag/wit + rm -rf $dst/$repo/deps* +done diff --git a/third_party/rust/wasi/examples/cli-command-no_std.rs b/third_party/rust/wasi/examples/cli-command-no_std.rs new file mode 100644 index 000000000000..809d15a264c4 --- /dev/null +++ b/third_party/rust/wasi/examples/cli-command-no_std.rs @@ -0,0 +1,11 @@ +wasi::cli::command::export!(Example); + +struct Example; + +impl wasi::exports::cli::run::Guest for Example { + fn run() -> Result<(), ()> { + let stdout = wasi::cli::stdout::get_stdout(); + stdout.blocking_write_and_flush(b"Hello, WASI!").unwrap(); + Ok(()) + } +} diff --git a/third_party/rust/wasi/examples/cli-command.rs b/third_party/rust/wasi/examples/cli-command.rs index 809d15a264c4..e3932ab2fb9c 100644 --- a/third_party/rust/wasi/examples/cli-command.rs +++ b/third_party/rust/wasi/examples/cli-command.rs @@ -1,11 +1,14 @@ +use std::io::Write as _; + wasi::cli::command::export!(Example); struct Example; impl wasi::exports::cli::run::Guest for Example { fn run() -> Result<(), ()> { - let stdout = wasi::cli::stdout::get_stdout(); - stdout.blocking_write_and_flush(b"Hello, WASI!").unwrap(); + let mut stdout = wasi::cli::stdout::get_stdout(); + stdout.write_all(b"Hello, WASI!").unwrap(); + stdout.flush().unwrap(); Ok(()) } } diff --git a/third_party/rust/wasi/examples/hello-world-no_std.rs b/third_party/rust/wasi/examples/hello-world-no_std.rs new file mode 100644 index 000000000000..026e1bc13a08 --- /dev/null +++ b/third_party/rust/wasi/examples/hello-world-no_std.rs @@ -0,0 +1,4 @@ +fn main() { + let stdout = wasi::cli::stdout::get_stdout(); + stdout.blocking_write_and_flush(b"Hello, world!\n").unwrap(); +} diff --git a/third_party/rust/wasi/examples/hello-world.rs b/third_party/rust/wasi/examples/hello-world.rs index 026e1bc13a08..62d1210c97bc 100644 --- a/third_party/rust/wasi/examples/hello-world.rs +++ b/third_party/rust/wasi/examples/hello-world.rs @@ -1,4 +1,7 @@ +use std::io::Write as _; + fn main() { - let stdout = wasi::cli::stdout::get_stdout(); - stdout.blocking_write_and_flush(b"Hello, world!\n").unwrap(); + let mut stdout = wasi::cli::stdout::get_stdout(); + stdout.write_all(b"Hello, world!\n").unwrap(); + stdout.flush().unwrap(); } diff --git a/third_party/rust/wasi/examples/http-proxy-no_std.rs b/third_party/rust/wasi/examples/http-proxy-no_std.rs new file mode 100644 index 000000000000..9a2e54ab5040 --- /dev/null +++ b/third_party/rust/wasi/examples/http-proxy-no_std.rs @@ -0,0 +1,22 @@ +use wasi::http::types::{ + Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam, +}; + +wasi::http::proxy::export!(Example); + +struct Example; + +impl wasi::exports::http::incoming_handler::Guest for Example { + fn handle(_request: IncomingRequest, response_out: ResponseOutparam) { + let resp = OutgoingResponse::new(Fields::new()); + let body = resp.body().unwrap(); + + ResponseOutparam::set(response_out, Ok(resp)); + + let out = body.write().unwrap(); + out.blocking_write_and_flush(b"Hello, WASI!").unwrap(); + drop(out); + + OutgoingBody::finish(body, None).unwrap(); + } +} diff --git a/third_party/rust/wasi/examples/http-proxy.rs b/third_party/rust/wasi/examples/http-proxy.rs index 9a2e54ab5040..8226e8bc4ecf 100644 --- a/third_party/rust/wasi/examples/http-proxy.rs +++ b/third_party/rust/wasi/examples/http-proxy.rs @@ -1,3 +1,5 @@ +use std::io::Write as _; + use wasi::http::types::{ Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam, }; @@ -13,8 +15,9 @@ impl wasi::exports::http::incoming_handler::Guest for Example { ResponseOutparam::set(response_out, Ok(resp)); - let out = body.write().unwrap(); - out.blocking_write_and_flush(b"Hello, WASI!").unwrap(); + let mut out = body.write().unwrap(); + out.write_all(b"Hello, WASI!").unwrap(); + out.flush().unwrap(); drop(out); OutgoingBody::finish(body, None).unwrap(); diff --git a/third_party/rust/wasi/src/bindings.rs b/third_party/rust/wasi/src/bindings.rs index 8a73504b16ea..7862471b546d 100644 --- a/third_party/rust/wasi/src/bindings.rs +++ b/third_party/rust/wasi/src/bindings.rs @@ -1,15 +1,17 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.39.0. DO NOT EDIT! // Options used: // * std_feature +// * runtime_path: "wit_bindgen_rt" +// * type_section_suffix: "rust-wasi-from-crates-io" +#[rustfmt::skip] +#[allow(dead_code, clippy::all)] pub mod wasi { pub mod cli { - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod environment { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; #[allow(unused_unsafe, clippy::all)] /// Get the POSIX-style environment variables. @@ -27,40 +29,39 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] + #[link(wasm_import_module = "wasi:cli/environment@0.2.4")] extern "C" { #[link_name = "get-environment"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let base9 = l1; - let len9 = l2; - let mut result9 = _rt::Vec::with_capacity(len9); - for i in 0..len9 { - let base = base9.add(i * 16); - let e9 = { - let l3 = *base.add(0).cast::<*mut u8>(); - let l4 = *base.add(4).cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - let l6 = *base.add(8).cast::<*mut u8>(); - let l7 = *base.add(12).cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); - - (_rt::string_lift(bytes5), _rt::string_lift(bytes8)) + wit_import1(ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let base10 = l2; + let len10 = l3; + let mut result10 = _rt::Vec::with_capacity(len10); + for i in 0..len10 { + let base = base10.add(i * 16); + let e10 = { + let l4 = *base.add(0).cast::<*mut u8>(); + let l5 = *base.add(4).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); + let l7 = *base.add(8).cast::<*mut u8>(); + let l8 = *base.add(12).cast::(); + let len9 = l8; + let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); + (_rt::string_lift(bytes6), _rt::string_lift(bytes9)) }; - result9.push(e9); + result10.push(e10); } - _rt::cabi_dealloc(base9, len9 * 16, 4); - result9 + _rt::cabi_dealloc(base10, len10 * 16, 4); + let result11 = result10; + result11 } } #[allow(unused_unsafe, clippy::all)] @@ -72,36 +73,35 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] + #[link(wasm_import_module = "wasi:cli/environment@0.2.4")] extern "C" { #[link_name = "get-arguments"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let base6 = l1; - let len6 = l2; - let mut result6 = _rt::Vec::with_capacity(len6); - for i in 0..len6 { - let base = base6.add(i * 8); - let e6 = { - let l3 = *base.add(0).cast::<*mut u8>(); - let l4 = *base.add(4).cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - - _rt::string_lift(bytes5) + wit_import1(ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let base7 = l2; + let len7 = l3; + let mut result7 = _rt::Vec::with_capacity(len7); + for i in 0..len7 { + let base = base7.add(i * 8); + let e7 = { + let l4 = *base.add(0).cast::<*mut u8>(); + let l5 = *base.add(4).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); + _rt::string_lift(bytes6) }; - result6.push(e6); + result7.push(e7); } - _rt::cabi_dealloc(base6, len6 * 8, 4); - result6 + _rt::cabi_dealloc(base7, len7 * 8, 4); + let result8 = result7; + result8 } } #[allow(unused_unsafe, clippy::all)] @@ -114,168 +114,161 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] + #[link(wasm_import_module = "wasi:cli/environment@0.2.4")] extern "C" { #[link_name = "initial-cwd"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1(ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod exit { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; #[allow(unused_unsafe, clippy::all)] /// Exit the current instance and any linked instances. - pub fn exit(status: Result<(), ()>) { + pub fn exit(status: Result<(), ()>) -> () { unsafe { let result0 = match status { Ok(_) => 0i32, Err(_) => 1i32, }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/exit@0.2.0")] + #[link(wasm_import_module = "wasi:cli/exit@0.2.4")] extern "C" { #[link_name = "exit"] - fn wit_import(_: i32); + fn wit_import1(_: i32); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + extern "C" fn wit_import1(_: i32) { unreachable!() } - wit_import(result0); + wit_import1(result0); } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod stdin { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type InputStream = super::super::super::wasi::io::streams::InputStream; #[allow(unused_unsafe, clippy::all)] pub fn get_stdin() -> InputStream { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stdin@0.2.0")] + #[link(wasm_import_module = "wasi:cli/stdin@0.2.4")] extern "C" { #[link_name = "get-stdin"] - fn wit_import() -> i32; + fn wit_import0() -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { + extern "C" fn wit_import0() -> i32 { unreachable!() } - let ret = wit_import(); - super::super::super::wasi::io::streams::InputStream::from_handle(ret as u32) + let ret = wit_import0(); + super::super::super::wasi::io::streams::InputStream::from_handle( + ret as u32, + ) } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod stdout { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; #[allow(unused_unsafe, clippy::all)] pub fn get_stdout() -> OutputStream { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stdout@0.2.0")] + #[link(wasm_import_module = "wasi:cli/stdout@0.2.4")] extern "C" { #[link_name = "get-stdout"] - fn wit_import() -> i32; + fn wit_import0() -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { + extern "C" fn wit_import0() -> i32 { unreachable!() } - let ret = wit_import(); - super::super::super::wasi::io::streams::OutputStream::from_handle(ret as u32) + let ret = wit_import0(); + super::super::super::wasi::io::streams::OutputStream::from_handle( + ret as u32, + ) } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod stderr { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; #[allow(unused_unsafe, clippy::all)] pub fn get_stderr() -> OutputStream { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stderr@0.2.0")] + #[link(wasm_import_module = "wasi:cli/stderr@0.2.4")] extern "C" { #[link_name = "get-stderr"] - fn wit_import() -> i32; + fn wit_import0() -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { + extern "C" fn wit_import0() -> i32 { unreachable!() } - let ret = wit_import(); - super::super::super::wasi::io::streams::OutputStream::from_handle(ret as u32) + let ret = wit_import0(); + super::super::super::wasi::io::streams::OutputStream::from_handle( + ret as u32, + ) } } } - - #[allow(clippy::all)] + /// Terminal input. + /// + /// In the future, this may include functions for disabling echoing, + /// disabling input buffering so that keyboard events are sent through + /// immediately, querying supported features, and so on. + #[allow(dead_code, unused_imports, clippy::all)] pub mod terminal_input { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; /// The input side of a terminal. - #[derive(Debug)] #[repr(transparent)] pub struct TerminalInput { handle: _rt::Resource, } - impl TerminalInput { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -283,54 +276,49 @@ pub mod wasi { 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 TerminalInput { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:cli/terminal-input@0.2.0")] + #[link(wasm_import_module = "wasi:cli/terminal-input@0.2.4")] extern "C" { #[link_name = "[resource-drop]terminal-input"] fn drop(_: u32); } - drop(_handle); } } } } - - #[allow(clippy::all)] + /// Terminal output. + /// + /// In the future, this may include functions for querying the terminal + /// size, being notified of terminal size changes, querying supported + /// features, and so on. + #[allow(dead_code, unused_imports, clippy::all)] pub mod terminal_output { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; /// The output side of a terminal. - #[derive(Debug)] #[repr(transparent)] pub struct TerminalOutput { handle: _rt::Resource, } - impl TerminalOutput { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -338,45 +326,39 @@ pub mod wasi { 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 TerminalOutput { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:cli/terminal-output@0.2.0")] + #[link(wasm_import_module = "wasi:cli/terminal-output@0.2.4")] extern "C" { #[link_name = "[resource-drop]terminal-output"] fn drop(_: u32); } - drop(_handle); } } } } - - #[allow(clippy::all)] + /// An interface providing an optional `terminal-input` for stdin as a + /// link-time authority. + #[allow(dead_code, unused_imports, clippy::all)] pub mod terminal_stdin { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type TerminalInput = super::super::super::wasi::cli::terminal_input::TerminalInput; #[allow(unused_unsafe, clippy::all)] @@ -389,44 +371,43 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/terminal-stdin@0.2.0")] + #[link(wasm_import_module = "wasi:cli/terminal-stdin@0.2.4")] extern "C" { #[link_name = "get-terminal-stdin"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1(ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::cli::terminal_input::TerminalInput::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + super::super::super::wasi::cli::terminal_input::TerminalInput::from_handle( + l3 as u32, + ) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } - - #[allow(clippy::all)] + /// An interface providing an optional `terminal-output` for stdout as a + /// link-time authority. + #[allow(dead_code, unused_imports, clippy::all)] pub mod terminal_stdout { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; - pub type TerminalOutput = - super::super::super::wasi::cli::terminal_output::TerminalOutput; + pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput; #[allow(unused_unsafe, clippy::all)] /// If stdout is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. @@ -437,44 +418,43 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/terminal-stdout@0.2.0")] + #[link(wasm_import_module = "wasi:cli/terminal-stdout@0.2.4")] extern "C" { #[link_name = "get-terminal-stdout"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1(ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( + l3 as u32, + ) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } - - #[allow(clippy::all)] + /// An interface providing an optional `terminal-output` for stderr as a + /// link-time authority. + #[allow(dead_code, unused_imports, clippy::all)] pub mod terminal_stderr { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; - pub type TerminalOutput = - super::super::super::wasi::cli::terminal_output::TerminalOutput; + pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput; #[allow(unused_unsafe, clippy::all)] /// If stderr is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. @@ -485,42 +465,49 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/terminal-stderr@0.2.0")] + #[link(wasm_import_module = "wasi:cli/terminal-stderr@0.2.4")] extern "C" { #[link_name = "get-terminal-stderr"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1(ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( + l3 as u32, + ) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } } pub mod clocks { - #[allow(clippy::all)] + /// WASI Monotonic Clock is a clock API intended to let users measure elapsed + /// time. + /// + /// It is intended to be portable at least between Unix-family platforms and + /// Windows. + /// + /// A monotonic clock is a clock which has an unspecified initial value, and + /// successive reads of the clock will produce non-decreasing values. + #[allow(dead_code, unused_imports, clippy::all)] pub mod monotonic_clock { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Pollable = super::super::super::wasi::io::poll::Pollable; /// An instant in time, in nanoseconds. An instant is relative to an @@ -537,17 +524,16 @@ pub mod wasi { pub fn now() -> Instant { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] extern "C" { #[link_name = "now"] - fn wit_import() -> i64; + fn wit_import0() -> i64; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i64 { + extern "C" fn wit_import0() -> i64 { unreachable!() } - let ret = wit_import(); + let ret = wit_import0(); ret as u64 } } @@ -557,70 +543,81 @@ pub mod wasi { pub fn resolution() -> Duration { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] extern "C" { #[link_name = "resolution"] - fn wit_import() -> i64; + fn wit_import0() -> i64; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i64 { + extern "C" fn wit_import0() -> i64 { unreachable!() } - let ret = wit_import(); + let ret = wit_import0(); ret as u64 } } #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the specified instant - /// occured. + /// has occurred. pub fn subscribe_instant(when: Instant) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] extern "C" { #[link_name = "subscribe-instant"] - fn wit_import(_: i64) -> i32; + fn wit_import0(_: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i64) -> i32 { + extern "C" fn wit_import0(_: i64) -> i32 { unreachable!() } - let ret = wit_import(_rt::as_i64(when)); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0(_rt::as_i64(when)); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } #[allow(unused_unsafe, clippy::all)] - /// Create a `pollable` which will resolve once the given duration has - /// elapsed, starting at the time at which this function was called. - /// occured. + /// Create a `pollable` that will resolve after the specified duration has + /// elapsed from the time this function is invoked. pub fn subscribe_duration(when: Duration) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.4")] extern "C" { #[link_name = "subscribe-duration"] - fn wit_import(_: i64) -> i32; + fn wit_import0(_: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i64) -> i32 { + extern "C" fn wit_import0(_: i64) -> i32 { unreachable!() } - let ret = wit_import(_rt::as_i64(when)); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0(_rt::as_i64(when)); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } - - #[allow(clippy::all)] + /// WASI Wall Clock is a clock API intended to let users query the current + /// time. The name "wall" makes an analogy to a "clock on the wall", which + /// is not necessarily monotonic as it may be reset. + /// + /// It is intended to be portable at least between Unix-family platforms and + /// Windows. + /// + /// A wall clock is a clock which measures the date and time according to + /// some external reference. + /// + /// External references may be reset, so this clock is not necessarily + /// monotonic, making it unsuitable for measuring elapsed time. + /// + /// It is intended for reporting the current date and time for humans. + #[allow(dead_code, unused_imports, clippy::all)] pub mod wall_clock { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; /// A time and date in seconds plus nanoseconds. #[repr(C)] #[derive(Clone, Copy)] @@ -629,7 +626,10 @@ pub mod wasi { pub nanoseconds: u32, } impl ::core::fmt::Debug for Datetime { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Datetime") .field("seconds", &self.seconds) .field("nanoseconds", &self.nanoseconds) @@ -657,23 +657,23 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")] + #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.4")] extern "C" { #[link_name = "now"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::(); - let l2 = *ptr0.add(8).cast::(); - Datetime { - seconds: l1 as u64, - nanoseconds: l2 as u32, - } + wit_import1(ptr0); + let l2 = *ptr0.add(0).cast::(); + let l3 = *ptr0.add(8).cast::(); + let result4 = Datetime { + seconds: l2 as u64, + nanoseconds: l3 as u32, + }; + result4 } } #[allow(unused_unsafe, clippy::all)] @@ -687,35 +687,57 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")] + #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.4")] extern "C" { #[link_name = "resolution"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::(); - let l2 = *ptr0.add(8).cast::(); - Datetime { - seconds: l1 as u64, - nanoseconds: l2 as u32, - } + wit_import1(ptr0); + let l2 = *ptr0.add(0).cast::(); + let l3 = *ptr0.add(8).cast::(); + let result4 = Datetime { + seconds: l2 as u64, + nanoseconds: l3 as u32, + }; + result4 } } } } pub mod filesystem { - #[allow(clippy::all)] + /// WASI filesystem is a filesystem API primarily intended to let users run WASI + /// programs that access their files on their existing filesystems, without + /// significant overhead. + /// + /// It is intended to be roughly portable between Unix-family platforms and + /// Windows, though it does not hide many of the major differences. + /// + /// Paths are passed as interface-type `string`s, meaning they must consist of + /// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain + /// paths which are not accessible by this API. + /// + /// The directory separator in WASI is always the forward-slash (`/`). + /// + /// All paths in WASI are relative paths, and are interpreted relative to a + /// `descriptor` referring to a base directory. If a `path` argument to any WASI + /// function starts with `/`, or if any step of resolving a `path`, including + /// `..` and symbolic link steps, reaches a directory outside of the base + /// directory, or reaches a symlink to an absolute or rooted path in the + /// underlying filesystem, the function fails with `error-code::not-permitted`. + /// + /// For more information about WASI path resolution and sandboxing, see + /// [WASI filesystem path resolution]. + /// + /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md + #[allow(dead_code, unused_imports, clippy::all)] pub mod types { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type InputStream = super::super::super::wasi::io::streams::InputStream; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; @@ -727,7 +749,7 @@ pub mod wasi { /// /// Note: This was called `filetype` in earlier versions of WASI. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum DescriptorType { /// The type of the descriptor or file is unknown or is different from /// any of the other types specified. @@ -748,7 +770,10 @@ pub mod wasi { Socket, } impl ::core::fmt::Debug for DescriptorType { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { DescriptorType::Unknown => { f.debug_tuple("DescriptorType::Unknown").finish() @@ -762,24 +787,27 @@ pub mod wasi { DescriptorType::Directory => { f.debug_tuple("DescriptorType::Directory").finish() } - DescriptorType::Fifo => f.debug_tuple("DescriptorType::Fifo").finish(), + DescriptorType::Fifo => { + f.debug_tuple("DescriptorType::Fifo").finish() + } DescriptorType::SymbolicLink => { f.debug_tuple("DescriptorType::SymbolicLink").finish() } DescriptorType::RegularFile => { f.debug_tuple("DescriptorType::RegularFile").finish() } - DescriptorType::Socket => f.debug_tuple("DescriptorType::Socket").finish(), + DescriptorType::Socket => { + f.debug_tuple("DescriptorType::Socket").finish() + } } } } - impl DescriptorType { - pub(crate) unsafe fn _lift(val: u8) -> DescriptorType { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> DescriptorType { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => DescriptorType::Unknown, 1 => DescriptorType::BlockDevice, @@ -789,79 +817,73 @@ pub mod wasi { 5 => DescriptorType::SymbolicLink, 6 => DescriptorType::RegularFile, 7 => DescriptorType::Socket, - _ => panic!("invalid enum discriminant"), } } } - - bitflags::bitflags! { - /// Descriptor flags. - /// - /// Note: This was called `fdflags` in earlier versions of WASI. - #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] - pub struct DescriptorFlags: u8 { - /// Read mode: Data can be read. - const READ = 1 << 0; - /// Write mode: Data can be written to. - const WRITE = 1 << 1; - /// Request that writes be performed according to synchronized I/O file - /// integrity completion. The data stored in the file and the file's - /// metadata are synchronized. This is similar to `O_SYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - const FILE_INTEGRITY_SYNC = 1 << 2; - /// Request that writes be performed according to synchronized I/O data - /// integrity completion. Only the data stored in the file is - /// synchronized. This is similar to `O_DSYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - const DATA_INTEGRITY_SYNC = 1 << 3; - /// Requests that reads be performed at the same level of integrety - /// requested for writes. This is similar to `O_RSYNC` in POSIX. - /// - /// The precise semantics of this operation have not yet been defined for - /// WASI. At this time, it should be interpreted as a request, and not a - /// requirement. - const REQUESTED_WRITE_SYNC = 1 << 4; - /// Mutating directories mode: Directory contents may be mutated. - /// - /// When this flag is unset on a descriptor, operations using the - /// descriptor which would create, rename, delete, modify the data or - /// metadata of filesystem objects, or obtain another handle which - /// would permit any of those, shall fail with `error-code::read-only` if - /// they would otherwise succeed. - /// - /// This may only be set on directories. - const MUTATE_DIRECTORY = 1 << 5; - } + wit_bindgen_rt::bitflags::bitflags! { + #[doc = " Descriptor flags."] #[doc = ""] #[doc = + " Note: This was called `fdflags` in earlier versions of WASI."] + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub + struct DescriptorFlags : u8 { #[doc = " Read mode: Data can be read."] + const READ = 1 << 0; #[doc = " Write mode: Data can be written to."] + const WRITE = 1 << 1; #[doc = + " Request that writes be performed according to synchronized I/O file"] + #[doc = + " integrity completion. The data stored in the file and the file's"] + #[doc = + " metadata are synchronized. This is similar to `O_SYNC` in POSIX."] + #[doc = ""] #[doc = + " The precise semantics of this operation have not yet been defined for"] + #[doc = + " WASI. At this time, it should be interpreted as a request, and not a"] + #[doc = " requirement."] const FILE_INTEGRITY_SYNC = 1 << 2; #[doc = + " Request that writes be performed according to synchronized I/O data"] + #[doc = " integrity completion. Only the data stored in the file is"] + #[doc = " synchronized. This is similar to `O_DSYNC` in POSIX."] #[doc = + ""] #[doc = + " The precise semantics of this operation have not yet been defined for"] + #[doc = + " WASI. At this time, it should be interpreted as a request, and not a"] + #[doc = " requirement."] const DATA_INTEGRITY_SYNC = 1 << 3; #[doc = + " Requests that reads be performed at the same level of integrity"] #[doc + = " requested for writes. This is similar to `O_RSYNC` in POSIX."] #[doc + = ""] #[doc = + " The precise semantics of this operation have not yet been defined for"] + #[doc = + " WASI. At this time, it should be interpreted as a request, and not a"] + #[doc = " requirement."] const REQUESTED_WRITE_SYNC = 1 << 4; #[doc = + " Mutating directories mode: Directory contents may be mutated."] #[doc = + ""] #[doc = + " When this flag is unset on a descriptor, operations using the"] #[doc = + " descriptor which would create, rename, delete, modify the data or"] + #[doc = + " metadata of filesystem objects, or obtain another handle which"] #[doc + = + " would permit any of those, shall fail with `error-code::read-only` if"] + #[doc = " they would otherwise succeed."] #[doc = ""] #[doc = + " This may only be set on directories."] const MUTATE_DIRECTORY = 1 << 5; + } } - bitflags::bitflags! { - /// Flags determining the method of how paths are resolved. - #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] - pub struct PathFlags: u8 { - /// As long as the resolved path corresponds to a symbolic link, it is - /// expanded. - const SYMLINK_FOLLOW = 1 << 0; - } + wit_bindgen_rt::bitflags::bitflags! { + #[doc = " Flags determining the method of how paths are resolved."] + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub + struct PathFlags : u8 { #[doc = + " As long as the resolved path corresponds to a symbolic link, it is"] + #[doc = " expanded."] const SYMLINK_FOLLOW = 1 << 0; } } - bitflags::bitflags! { - /// Open flags used by `open-at`. - #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] - pub struct OpenFlags: u8 { - /// Create file if it does not exist, similar to `O_CREAT` in POSIX. - const CREATE = 1 << 0; - /// Fail if not a directory, similar to `O_DIRECTORY` in POSIX. - const DIRECTORY = 1 << 1; - /// Fail if file already exists, similar to `O_EXCL` in POSIX. - const EXCLUSIVE = 1 << 2; - /// Truncate file to size 0, similar to `O_TRUNC` in POSIX. - const TRUNCATE = 1 << 3; - } + wit_bindgen_rt::bitflags::bitflags! { + #[doc = " Open flags used by `open-at`."] #[derive(PartialEq, Eq, + PartialOrd, Ord, Hash, Debug, Clone, Copy)] pub struct OpenFlags : u8 { + #[doc = + " Create file if it does not exist, similar to `O_CREAT` in POSIX."] + const CREATE = 1 << 0; #[doc = + " Fail if not a directory, similar to `O_DIRECTORY` in POSIX."] const + DIRECTORY = 1 << 1; #[doc = + " Fail if file already exists, similar to `O_EXCL` in POSIX."] const + EXCLUSIVE = 1 << 2; #[doc = + " Truncate file to size 0, similar to `O_TRUNC` in POSIX."] const + TRUNCATE = 1 << 3; } } /// Number of hard links to an inode. pub type LinkCount = u64; @@ -895,7 +917,10 @@ pub mod wasi { pub status_change_timestamp: Option, } impl ::core::fmt::Debug for DescriptorStat { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("DescriptorStat") .field("type", &self.type_) .field("link-count", &self.link_count) @@ -921,9 +946,14 @@ pub mod wasi { Timestamp(Datetime), } impl ::core::fmt::Debug for NewTimestamp { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - NewTimestamp::NoChange => f.debug_tuple("NewTimestamp::NoChange").finish(), + NewTimestamp::NoChange => { + f.debug_tuple("NewTimestamp::NoChange").finish() + } NewTimestamp::Now => f.debug_tuple("NewTimestamp::Now").finish(), NewTimestamp::Timestamp(e) => { f.debug_tuple("NewTimestamp::Timestamp").field(e).finish() @@ -940,7 +970,10 @@ pub mod wasi { pub name: _rt::String, } impl ::core::fmt::Debug for DirectoryEntry { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("DirectoryEntry") .field("type", &self.type_) .field("name", &self.name) @@ -952,7 +985,7 @@ pub mod wasi { /// API; some are used in higher-level library layers, and others are provided /// merely for alignment with POSIX. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum ErrorCode { /// Permission denied, similar to `EACCES` in POSIX. Access, @@ -1073,48 +1106,119 @@ pub mod wasi { } pub fn message(&self) -> &'static str { match self { - ErrorCode::Access => "Permission denied, similar to `EACCES` in POSIX.", - ErrorCode::WouldBlock => "Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX.", - ErrorCode::Already => "Connection already in progress, similar to `EALREADY` in POSIX.", - ErrorCode::BadDescriptor => "Bad descriptor, similar to `EBADF` in POSIX.", - ErrorCode::Busy => "Device or resource busy, similar to `EBUSY` in POSIX.", - ErrorCode::Deadlock => "Resource deadlock would occur, similar to `EDEADLK` in POSIX.", - ErrorCode::Quota => "Storage quota exceeded, similar to `EDQUOT` in POSIX.", - ErrorCode::Exist => "File exists, similar to `EEXIST` in POSIX.", - ErrorCode::FileTooLarge => "File too large, similar to `EFBIG` in POSIX.", - ErrorCode::IllegalByteSequence => "Illegal byte sequence, similar to `EILSEQ` in POSIX.", - ErrorCode::InProgress => "Operation in progress, similar to `EINPROGRESS` in POSIX.", - ErrorCode::Interrupted => "Interrupted function, similar to `EINTR` in POSIX.", - ErrorCode::Invalid => "Invalid argument, similar to `EINVAL` in POSIX.", - ErrorCode::Io => "I/O error, similar to `EIO` in POSIX.", - ErrorCode::IsDirectory => "Is a directory, similar to `EISDIR` in POSIX.", - ErrorCode::Loop => "Too many levels of symbolic links, similar to `ELOOP` in POSIX.", - ErrorCode::TooManyLinks => "Too many links, similar to `EMLINK` in POSIX.", - ErrorCode::MessageSize => "Message too large, similar to `EMSGSIZE` in POSIX.", - ErrorCode::NameTooLong => "Filename too long, similar to `ENAMETOOLONG` in POSIX.", - ErrorCode::NoDevice => "No such device, similar to `ENODEV` in POSIX.", - ErrorCode::NoEntry => "No such file or directory, similar to `ENOENT` in POSIX.", - ErrorCode::NoLock => "No locks available, similar to `ENOLCK` in POSIX.", - ErrorCode::InsufficientMemory => "Not enough space, similar to `ENOMEM` in POSIX.", - ErrorCode::InsufficientSpace => "No space left on device, similar to `ENOSPC` in POSIX.", - ErrorCode::NotDirectory => "Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX.", - ErrorCode::NotEmpty => "Directory not empty, similar to `ENOTEMPTY` in POSIX.", - ErrorCode::NotRecoverable => "State not recoverable, similar to `ENOTRECOVERABLE` in POSIX.", - ErrorCode::Unsupported => "Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX.", - ErrorCode::NoTty => "Inappropriate I/O control operation, similar to `ENOTTY` in POSIX.", - ErrorCode::NoSuchDevice => "No such device or address, similar to `ENXIO` in POSIX.", - ErrorCode::Overflow => "Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX.", - ErrorCode::NotPermitted => "Operation not permitted, similar to `EPERM` in POSIX.", - ErrorCode::Pipe => "Broken pipe, similar to `EPIPE` in POSIX.", - ErrorCode::ReadOnly => "Read-only file system, similar to `EROFS` in POSIX.", - ErrorCode::InvalidSeek => "Invalid seek, similar to `ESPIPE` in POSIX.", - ErrorCode::TextFileBusy => "Text file busy, similar to `ETXTBSY` in POSIX.", - ErrorCode::CrossDevice => "Cross-device link, similar to `EXDEV` in POSIX.", - } + ErrorCode::Access => { + "Permission denied, similar to `EACCES` in POSIX." + } + ErrorCode::WouldBlock => { + "Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX." + } + ErrorCode::Already => { + "Connection already in progress, similar to `EALREADY` in POSIX." + } + ErrorCode::BadDescriptor => { + "Bad descriptor, similar to `EBADF` in POSIX." + } + ErrorCode::Busy => { + "Device or resource busy, similar to `EBUSY` in POSIX." + } + ErrorCode::Deadlock => { + "Resource deadlock would occur, similar to `EDEADLK` in POSIX." + } + ErrorCode::Quota => { + "Storage quota exceeded, similar to `EDQUOT` in POSIX." + } + ErrorCode::Exist => "File exists, similar to `EEXIST` in POSIX.", + ErrorCode::FileTooLarge => { + "File too large, similar to `EFBIG` in POSIX." + } + ErrorCode::IllegalByteSequence => { + "Illegal byte sequence, similar to `EILSEQ` in POSIX." + } + ErrorCode::InProgress => { + "Operation in progress, similar to `EINPROGRESS` in POSIX." + } + ErrorCode::Interrupted => { + "Interrupted function, similar to `EINTR` in POSIX." + } + ErrorCode::Invalid => { + "Invalid argument, similar to `EINVAL` in POSIX." + } + ErrorCode::Io => "I/O error, similar to `EIO` in POSIX.", + ErrorCode::IsDirectory => { + "Is a directory, similar to `EISDIR` in POSIX." + } + ErrorCode::Loop => { + "Too many levels of symbolic links, similar to `ELOOP` in POSIX." + } + ErrorCode::TooManyLinks => { + "Too many links, similar to `EMLINK` in POSIX." + } + ErrorCode::MessageSize => { + "Message too large, similar to `EMSGSIZE` in POSIX." + } + ErrorCode::NameTooLong => { + "Filename too long, similar to `ENAMETOOLONG` in POSIX." + } + ErrorCode::NoDevice => { + "No such device, similar to `ENODEV` in POSIX." + } + ErrorCode::NoEntry => { + "No such file or directory, similar to `ENOENT` in POSIX." + } + ErrorCode::NoLock => { + "No locks available, similar to `ENOLCK` in POSIX." + } + ErrorCode::InsufficientMemory => { + "Not enough space, similar to `ENOMEM` in POSIX." + } + ErrorCode::InsufficientSpace => { + "No space left on device, similar to `ENOSPC` in POSIX." + } + ErrorCode::NotDirectory => { + "Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX." + } + ErrorCode::NotEmpty => { + "Directory not empty, similar to `ENOTEMPTY` in POSIX." + } + ErrorCode::NotRecoverable => { + "State not recoverable, similar to `ENOTRECOVERABLE` in POSIX." + } + ErrorCode::Unsupported => { + "Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX." + } + ErrorCode::NoTty => { + "Inappropriate I/O control operation, similar to `ENOTTY` in POSIX." + } + ErrorCode::NoSuchDevice => { + "No such device or address, similar to `ENXIO` in POSIX." + } + ErrorCode::Overflow => { + "Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX." + } + ErrorCode::NotPermitted => { + "Operation not permitted, similar to `EPERM` in POSIX." + } + ErrorCode::Pipe => "Broken pipe, similar to `EPIPE` in POSIX.", + ErrorCode::ReadOnly => { + "Read-only file system, similar to `EROFS` in POSIX." + } + ErrorCode::InvalidSeek => { + "Invalid seek, similar to `ESPIPE` in POSIX." + } + ErrorCode::TextFileBusy => { + "Text file busy, similar to `ETXTBSY` in POSIX." + } + ErrorCode::CrossDevice => { + "Cross-device link, similar to `EXDEV` in POSIX." + } + } } } impl ::core::fmt::Debug for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("ErrorCode") .field("code", &(*self as i32)) .field("name", &self.name()) @@ -1123,20 +1227,21 @@ pub mod wasi { } } impl ::core::fmt::Display for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - write!(f, "{} (error {})", self.name(), *self as i32) + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { + write!(f, "{} (error {})", self.name(), * self as i32) } } - #[cfg(feature = "std")] impl std::error::Error for ErrorCode {} - impl ErrorCode { - pub(crate) unsafe fn _lift(val: u8) -> ErrorCode { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> ErrorCode { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => ErrorCode::Access, 1 => ErrorCode::WouldBlock, @@ -1175,15 +1280,13 @@ pub mod wasi { 34 => ErrorCode::InvalidSeek, 35 => ErrorCode::TextFileBusy, 36 => ErrorCode::CrossDevice, - _ => panic!("invalid enum discriminant"), } } } - /// File or memory access pattern advisory information. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum Advice { /// The application has no advice to give on its behavior with respect /// to the specified data. @@ -1205,10 +1308,15 @@ pub mod wasi { NoReuse, } impl ::core::fmt::Debug for Advice { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Advice::Normal => f.debug_tuple("Advice::Normal").finish(), - Advice::Sequential => f.debug_tuple("Advice::Sequential").finish(), + Advice::Sequential => { + f.debug_tuple("Advice::Sequential").finish() + } Advice::Random => f.debug_tuple("Advice::Random").finish(), Advice::WillNeed => f.debug_tuple("Advice::WillNeed").finish(), Advice::DontNeed => f.debug_tuple("Advice::DontNeed").finish(), @@ -1216,13 +1324,12 @@ pub mod wasi { } } } - impl Advice { - pub(crate) unsafe fn _lift(val: u8) -> Advice { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> Advice { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => Advice::Normal, 1 => Advice::Sequential, @@ -1230,12 +1337,10 @@ pub mod wasi { 3 => Advice::WillNeed, 4 => Advice::DontNeed, 5 => Advice::NoReuse, - _ => panic!("invalid enum discriminant"), } } } - /// A 128-bit hash value, split into parts because wasm doesn't have a /// 128-bit integer type. #[repr(C)] @@ -1247,7 +1352,10 @@ pub mod wasi { pub upper: u64, } impl ::core::fmt::Debug for MetadataHashValue { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("MetadataHashValue") .field("lower", &self.lower) .field("upper", &self.upper) @@ -1257,13 +1365,11 @@ pub mod wasi { /// A descriptor is a reference to a filesystem object, which may be a file, /// directory, named pipe, special file, or other object on which filesystem /// calls may be made. - #[derive(Debug)] #[repr(transparent)] pub struct Descriptor { handle: _rt::Resource, } - impl Descriptor { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -1271,45 +1377,37 @@ pub mod wasi { 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 Descriptor { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]descriptor"] fn drop(_: u32); } - drop(_handle); } } } - /// A stream of directory entries. - #[derive(Debug)] #[repr(transparent)] pub struct DirectoryEntryStream { handle: _rt::Resource, } - impl DirectoryEntryStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -1317,37 +1415,31 @@ pub mod wasi { 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 DirectoryEntryStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]directory-entry-stream"] fn drop(_: u32); } - drop(_handle); } } } - impl Descriptor { #[allow(unused_unsafe, clippy::all)] /// Return a stream for reading from a file, if available. @@ -1358,46 +1450,49 @@ pub mod wasi { /// file and they do not interfere with each other. /// /// Note: This allows using `read-stream`, which is similar to `read` in POSIX. - pub fn read_via_stream(&self, offset: Filesize) -> Result { + pub fn read_via_stream( + &self, + offset: Filesize, + ) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.read-via-stream"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(offset), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - + let l3 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::InputStream::from_handle( - l2 as u32, + l3 as u32, ) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr0.add(4).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -1416,40 +1511,42 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.write-via-stream"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(offset), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io::streams::OutputStream::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + super::super::super::wasi::io::streams::OutputStream::from_handle( + l3 as u32, + ) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr0.add(4).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -1460,45 +1557,47 @@ pub mod wasi { /// May fail with an error-code describing why the file cannot be appended. /// /// Note: This allows using `write-stream`, which is similar to `write` with - /// `O_APPEND` in in POSIX. + /// `O_APPEND` in POSIX. pub fn append_via_stream(&self) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.append-via-stream"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io::streams::OutputStream::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + super::super::super::wasi::io::streams::OutputStream::from_handle( + l3 as u32, + ) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr0.add(4).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -1516,42 +1615,49 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.advise"] - fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: i64, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8) { + extern "C" fn wit_import1( + _: i32, + _: i64, + _: i64, + _: i32, + _: *mut u8, + ) { unreachable!() } - wit_import( + wit_import1( (self).handle() as i32, _rt::as_i64(offset), _rt::as_i64(length), advice.clone() as i32, ptr0, ); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l3 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -1567,36 +1673,37 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.sync-data"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l3 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -1612,41 +1719,41 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.get-flags"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); DescriptorFlags::empty() - | DescriptorFlags::from_bits_retain(((l2 as u8) << 0) as _) + | DescriptorFlags::from_bits_retain(((l3 as u8) << 0) as _) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -1666,40 +1773,40 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.get-type"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - DescriptorType::_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + DescriptorType::_lift(l3 as u8) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -1713,36 +1820,37 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.set-size"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(size), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(size), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l3 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -1761,7 +1869,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let (result1_0, result1_1, result1_2) = match data_access_timestamp { NewTimestamp::NoChange => (0i32, 0i64, 0i32), NewTimestamp::Now => (1i32, 0i64, 0i32), @@ -1770,7 +1880,6 @@ pub mod wasi { seconds: seconds0, nanoseconds: nanoseconds0, } = e; - (2i32, _rt::as_i64(seconds0), _rt::as_i32(nanoseconds0)) } }; @@ -1782,16 +1891,15 @@ pub mod wasi { seconds: seconds2, nanoseconds: nanoseconds2, } = e; - (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) } }; let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.set-times"] - fn wit_import( + fn wit_import5( _: i32, _: i32, _: i64, @@ -1802,9 +1910,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import5( _: i32, _: i32, _: i64, @@ -1816,7 +1923,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import5( (self).handle() as i32, result1_0, result1_1, @@ -1826,22 +1933,22 @@ pub mod wasi { result3_2, ptr4, ); - let l5 = i32::from(*ptr4.add(0).cast::()); - match l5 { + let l6 = i32::from(*ptr4.add(0).cast::()); + let result8 = match l6 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l6 = i32::from(*ptr4.add(1).cast::()); - - ErrorCode::_lift(l6 as u8) + let l7 = i32::from(*ptr4.add(1).cast::()); + ErrorCode::_lift(l7 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result8 } } } @@ -1866,51 +1973,51 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.read"] - fn wit_import(_: i32, _: i64, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: i64, _: *mut u8) { unreachable!() } - wit_import( + wit_import1( (self).handle() as i32, _rt::as_i64(length), _rt::as_i64(offset), ptr0, ); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + let l2 = i32::from(*ptr0.add(0).cast::()); + let result8 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let l5 = i32::from(*ptr0.add(12).cast::()); - + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let l6 = i32::from(*ptr0.add(12).cast::()); ( - _rt::Vec::from_raw_parts(l2.cast(), len4, len4), - _rt::bool_lift(l5 as u8), + _rt::Vec::from_raw_parts(l3.cast(), len5, len5), + _rt::bool_lift(l6 as u8), ) }; Ok(e) } 1 => { let e = { - let l6 = i32::from(*ptr0.add(4).cast::()); - - ErrorCode::_lift(l6 as u8) + let l7 = i32::from(*ptr0.add(4).cast::()); + ErrorCode::_lift(l7 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result8 } } } @@ -1933,49 +2040,61 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let vec0 = buffer; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.write"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8); + fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: i64, + _: *mut u8, + ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: i64, + _: *mut u8, + ) { unreachable!() } - wit_import( + wit_import2( (self).handle() as i32, ptr0.cast_mut(), len0, _rt::as_i64(offset), ptr1, ); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + let l3 = i32::from(*ptr1.add(0).cast::()); + let result6 = match l3 { 0 => { let e = { - let l3 = *ptr1.add(8).cast::(); - - l3 as u64 + let l4 = *ptr1.add(8).cast::(); + l4 as u64 }; Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr1.add(8).cast::()); - - ErrorCode::_lift(l4 as u8) + let l5 = i32::from(*ptr1.add(8).cast::()); + ErrorCode::_lift(l5 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -1994,40 +2113,40 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.read-directory"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - DirectoryEntryStream::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + DirectoryEntryStream::from_handle(l3 as u32) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr0.add(4).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -2043,36 +2162,37 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.sync"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l3 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -2085,39 +2205,45 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.create-directory-at"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result5 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr1.add(1).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr1.add(1).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -2136,78 +2262,75 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 104]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 104]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 104], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.stat"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result16 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(8).cast::()); - let l3 = *ptr0.add(16).cast::(); - let l4 = *ptr0.add(24).cast::(); - let l5 = i32::from(*ptr0.add(32).cast::()); - let l8 = i32::from(*ptr0.add(56).cast::()); - let l11 = i32::from(*ptr0.add(80).cast::()); - + let l3 = i32::from(*ptr0.add(8).cast::()); + let l4 = *ptr0.add(16).cast::(); + let l5 = *ptr0.add(24).cast::(); + let l6 = i32::from(*ptr0.add(32).cast::()); + let l9 = i32::from(*ptr0.add(56).cast::()); + let l12 = i32::from(*ptr0.add(80).cast::()); DescriptorStat { - type_: DescriptorType::_lift(l2 as u8), - link_count: l3 as u64, - size: l4 as u64, - data_access_timestamp: match l5 { + type_: DescriptorType::_lift(l3 as u8), + link_count: l4 as u64, + size: l5 as u64, + data_access_timestamp: match l6 { 0 => None, 1 => { let e = { - let l6 = *ptr0.add(40).cast::(); - let l7 = *ptr0.add(48).cast::(); - - super::super::super::wasi::clocks::wall_clock::Datetime{ - seconds: l6 as u64, - nanoseconds: l7 as u32, - } + let l7 = *ptr0.add(40).cast::(); + let l8 = *ptr0.add(48).cast::(); + super::super::super::wasi::clocks::wall_clock::Datetime { + seconds: l7 as u64, + nanoseconds: l8 as u32, + } }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - data_modification_timestamp: match l8 { + data_modification_timestamp: match l9 { 0 => None, 1 => { let e = { - let l9 = *ptr0.add(64).cast::(); - let l10 = *ptr0.add(72).cast::(); - - super::super::super::wasi::clocks::wall_clock::Datetime{ - seconds: l9 as u64, - nanoseconds: l10 as u32, - } + let l10 = *ptr0.add(64).cast::(); + let l11 = *ptr0.add(72).cast::(); + super::super::super::wasi::clocks::wall_clock::Datetime { + seconds: l10 as u64, + nanoseconds: l11 as u32, + } }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - status_change_timestamp: match l11 { + status_change_timestamp: match l12 { 0 => None, 1 => { let e = { - let l12 = *ptr0.add(88).cast::(); - let l13 = *ptr0.add(96).cast::(); - - super::super::super::wasi::clocks::wall_clock::Datetime{ - seconds: l12 as u64, - nanoseconds: l13 as u32, - } + let l13 = *ptr0.add(88).cast::(); + let l14 = *ptr0.add(96).cast::(); + super::super::super::wasi::clocks::wall_clock::Datetime { + seconds: l13 as u64, + nanoseconds: l14 as u32, + } }; Some(e) } @@ -2219,14 +2342,14 @@ pub mod wasi { } 1 => { let e = { - let l14 = i32::from(*ptr0.add(8).cast::()); - - ErrorCode::_lift(l14 as u8) + let l15 = i32::from(*ptr0.add(8).cast::()); + ErrorCode::_lift(l15 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result16 } } } @@ -2247,88 +2370,97 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 104]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 104]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 104], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.stat-at"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import3( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import3( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import( + wit_import3( (self).handle() as i32, (flags0.bits() >> 0) as i32, ptr1.cast_mut(), len1, ptr2, ); - let l3 = i32::from(*ptr2.add(0).cast::()); - match l3 { + let l4 = i32::from(*ptr2.add(0).cast::()); + let result18 = match l4 { 0 => { let e = { - let l4 = i32::from(*ptr2.add(8).cast::()); - let l5 = *ptr2.add(16).cast::(); - let l6 = *ptr2.add(24).cast::(); - let l7 = i32::from(*ptr2.add(32).cast::()); - let l10 = i32::from(*ptr2.add(56).cast::()); - let l13 = i32::from(*ptr2.add(80).cast::()); - + let l5 = i32::from(*ptr2.add(8).cast::()); + let l6 = *ptr2.add(16).cast::(); + let l7 = *ptr2.add(24).cast::(); + let l8 = i32::from(*ptr2.add(32).cast::()); + let l11 = i32::from(*ptr2.add(56).cast::()); + let l14 = i32::from(*ptr2.add(80).cast::()); DescriptorStat { - type_: DescriptorType::_lift(l4 as u8), - link_count: l5 as u64, - size: l6 as u64, - data_access_timestamp: match l7 { + type_: DescriptorType::_lift(l5 as u8), + link_count: l6 as u64, + size: l7 as u64, + data_access_timestamp: match l8 { 0 => None, 1 => { let e = { - let l8 = *ptr2.add(40).cast::(); - let l9 = *ptr2.add(48).cast::(); - - super::super::super::wasi::clocks::wall_clock::Datetime{ - seconds: l8 as u64, - nanoseconds: l9 as u32, - } + let l9 = *ptr2.add(40).cast::(); + let l10 = *ptr2.add(48).cast::(); + super::super::super::wasi::clocks::wall_clock::Datetime { + seconds: l9 as u64, + nanoseconds: l10 as u32, + } }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - data_modification_timestamp: match l10 { + data_modification_timestamp: match l11 { 0 => None, 1 => { let e = { - let l11 = *ptr2.add(64).cast::(); - let l12 = *ptr2.add(72).cast::(); - - super::super::super::wasi::clocks::wall_clock::Datetime{ - seconds: l11 as u64, - nanoseconds: l12 as u32, - } + let l12 = *ptr2.add(64).cast::(); + let l13 = *ptr2.add(72).cast::(); + super::super::super::wasi::clocks::wall_clock::Datetime { + seconds: l12 as u64, + nanoseconds: l13 as u32, + } }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - status_change_timestamp: match l13 { + status_change_timestamp: match l14 { 0 => None, 1 => { let e = { - let l14 = *ptr2.add(88).cast::(); - let l15 = *ptr2.add(96).cast::(); - - super::super::super::wasi::clocks::wall_clock::Datetime{ - seconds: l14 as u64, - nanoseconds: l15 as u32, - } + let l15 = *ptr2.add(88).cast::(); + let l16 = *ptr2.add(96).cast::(); + super::super::super::wasi::clocks::wall_clock::Datetime { + seconds: l15 as u64, + nanoseconds: l16 as u32, + } }; Some(e) } @@ -2340,14 +2472,14 @@ pub mod wasi { } 1 => { let e = { - let l16 = i32::from(*ptr2.add(8).cast::()); - - ErrorCode::_lift(l16 as u8) + let l17 = i32::from(*ptr2.add(8).cast::()); + ErrorCode::_lift(l17 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result18 } } } @@ -2369,7 +2501,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); @@ -2382,7 +2516,6 @@ pub mod wasi { seconds: seconds2, nanoseconds: nanoseconds2, } = e; - (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) } }; @@ -2394,16 +2527,15 @@ pub mod wasi { seconds: seconds4, nanoseconds: nanoseconds4, } = e; - (2i32, _rt::as_i64(seconds4), _rt::as_i32(nanoseconds4)) } }; let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.set-times-at"] - fn wit_import( + fn wit_import7( _: i32, _: i32, _: *mut u8, @@ -2417,9 +2549,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import7( _: i32, _: i32, _: *mut u8, @@ -2434,7 +2565,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import7( (self).handle() as i32, (flags0.bits() >> 0) as i32, ptr1.cast_mut(), @@ -2447,22 +2578,22 @@ pub mod wasi { result5_2, ptr6, ); - let l7 = i32::from(*ptr6.add(0).cast::()); - match l7 { + let l8 = i32::from(*ptr6.add(0).cast::()); + let result10 = match l8 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l8 = i32::from(*ptr6.add(1).cast::()); - - ErrorCode::_lift(l8 as u8) + let l9 = i32::from(*ptr6.add(1).cast::()); + ErrorCode::_lift(l9 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result10 } } } @@ -2470,6 +2601,10 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a hard link. /// + /// Fails with `error-code::no-entry` if the old path does not exist, + /// with `error-code::exist` if the new path already exists, and + /// `error-code::not-permitted` if the old path is not a file. + /// /// Note: This is similar to `linkat` in POSIX. pub fn link_at( &self, @@ -2481,7 +2616,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let flags0 = old_path_flags; let vec1 = old_path; let ptr1 = vec1.as_ptr().cast::(); @@ -2491,10 +2628,10 @@ pub mod wasi { let len2 = vec2.len(); let ptr3 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.link-at"] - fn wit_import( + fn wit_import4( _: i32, _: i32, _: *mut u8, @@ -2505,9 +2642,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import4( _: i32, _: i32, _: *mut u8, @@ -2519,7 +2655,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import4( (self).handle() as i32, (flags0.bits() >> 0) as i32, ptr1.cast_mut(), @@ -2529,22 +2665,22 @@ pub mod wasi { len2, ptr3, ); - let l4 = i32::from(*ptr3.add(0).cast::()); - match l4 { + let l5 = i32::from(*ptr3.add(0).cast::()); + let result7 = match l5 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l5 = i32::from(*ptr3.add(1).cast::()); - - ErrorCode::_lift(l5 as u8) + let l6 = i32::from(*ptr3.add(1).cast::()); + ErrorCode::_lift(l6 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -2552,12 +2688,6 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Open a file or directory. /// - /// The returned descriptor is not guaranteed to be the lowest-numbered - /// descriptor not currently open/ it is randomized to prevent applications - /// from depending on making assumptions about indexes, since this is - /// error-prone in multi-threaded contexts. The returned descriptor is - /// guaranteed to be less than 2**31. - /// /// If `flags` contains `descriptor-flags::mutate-directory`, and the base /// descriptor doesn't have `descriptor-flags::mutate-directory` set, /// `open-at` fails with `error-code::read-only`. @@ -2578,7 +2708,9 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); @@ -2587,10 +2719,10 @@ pub mod wasi { let flags3 = flags; let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.open-at"] - fn wit_import( + fn wit_import5( _: i32, _: i32, _: *mut u8, @@ -2600,9 +2732,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import5( _: i32, _: i32, _: *mut u8, @@ -2613,7 +2744,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import5( (self).handle() as i32, (flags0.bits() >> 0) as i32, ptr1.cast_mut(), @@ -2622,26 +2753,25 @@ pub mod wasi { (flags3.bits() >> 0) as i32, ptr4, ); - let l5 = i32::from(*ptr4.add(0).cast::()); - match l5 { + let l6 = i32::from(*ptr4.add(0).cast::()); + let result9 = match l6 { 0 => { let e = { - let l6 = *ptr4.add(4).cast::(); - - Descriptor::from_handle(l6 as u32) + let l7 = *ptr4.add(4).cast::(); + Descriptor::from_handle(l7 as u32) }; Ok(e) } 1 => { let e = { - let l7 = i32::from(*ptr4.add(4).cast::()); - - ErrorCode::_lift(l7 as u8) + let l8 = i32::from(*ptr4.add(4).cast::()); + ErrorCode::_lift(l8 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result9 } } } @@ -2657,46 +2787,55 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.readlink-at"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result8 = match l3 { 0 => { let e = { - let l3 = *ptr1.add(4).cast::<*mut u8>(); - let l4 = *ptr1.add(8).cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - - _rt::string_lift(bytes5) + let l4 = *ptr1.add(4).cast::<*mut u8>(); + let l5 = *ptr1.add(8).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ); + _rt::string_lift(bytes6) }; Ok(e) } 1 => { let e = { - let l6 = i32::from(*ptr1.add(4).cast::()); - - ErrorCode::_lift(l6 as u8) + let l7 = i32::from(*ptr1.add(4).cast::()); + ErrorCode::_lift(l7 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result8 } } } @@ -2711,39 +2850,45 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.remove-directory-at"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result5 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr1.add(1).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr1.add(1).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -2761,7 +2906,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = old_path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -2770,10 +2917,10 @@ pub mod wasi { let len1 = vec1.len(); let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.rename-at"] - fn wit_import( + fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -2783,9 +2930,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -2796,7 +2942,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import3( (self).handle() as i32, ptr0.cast_mut(), len0, @@ -2805,22 +2951,22 @@ pub mod wasi { len1, ptr2, ); - let l3 = i32::from(*ptr2.add(0).cast::()); - match l3 { + let l4 = i32::from(*ptr2.add(0).cast::()); + let result6 = match l4 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr2.add(1).cast::()); - - ErrorCode::_lift(l4 as u8) + let l5 = i32::from(*ptr2.add(1).cast::()); + ErrorCode::_lift(l5 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -2832,11 +2978,17 @@ pub mod wasi { /// `error-code::not-permitted`. /// /// Note: This is similar to `symlinkat` in POSIX. - pub fn symlink_at(&self, old_path: &str, new_path: &str) -> Result<(), ErrorCode> { + pub fn symlink_at( + &self, + old_path: &str, + new_path: &str, + ) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = old_path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); @@ -2845,10 +2997,10 @@ pub mod wasi { let len1 = vec1.len(); let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.symlink-at"] - fn wit_import( + fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -2857,9 +3009,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import3( _: i32, _: *mut u8, _: usize, @@ -2869,7 +3020,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import3( (self).handle() as i32, ptr0.cast_mut(), len0, @@ -2877,22 +3028,22 @@ pub mod wasi { len1, ptr2, ); - let l3 = i32::from(*ptr2.add(0).cast::()); - match l3 { + let l4 = i32::from(*ptr2.add(0).cast::()); + let result6 = match l4 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr2.add(1).cast::()); - - ErrorCode::_lift(l4 as u8) + let l5 = i32::from(*ptr2.add(1).cast::()); + ErrorCode::_lift(l5 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -2906,39 +3057,45 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = path; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.unlink-file-at"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result5 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr1.add(1).cast::()); - - ErrorCode::_lift(l3 as u8) + let l4 = i32::from(*ptr1.add(1).cast::()); + ErrorCode::_lift(l4 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -2953,17 +3110,19 @@ pub mod wasi { pub fn is_same_object(&self, other: &Descriptor) -> bool { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.is-same-object"] - fn wit_import(_: i32, _: i32) -> i32; + fn wit_import0(_: i32, _: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) -> i32 { + extern "C" fn wit_import0(_: i32, _: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, (other).handle() as i32); + let ret = wit_import0( + (self).handle() as i32, + (other).handle() as i32, + ); _rt::bool_lift(ret as u8) } } @@ -2979,58 +3138,58 @@ pub mod wasi { /// replaced. It may also include a secret value chosen by the /// implementation and not otherwise exposed. /// - /// Implementations are encourated to provide the following properties: + /// Implementations are encouraged to provide the following properties: /// - /// - If the file is not modified or replaced, the computed hash value should - /// usually not change. - /// - If the object is modified or replaced, the computed hash value should - /// usually change. - /// - The inputs to the hash should not be easily computable from the - /// computed hash. + /// - If the file is not modified or replaced, the computed hash value should + /// usually not change. + /// - If the object is modified or replaced, the computed hash value should + /// usually change. + /// - The inputs to the hash should not be easily computable from the + /// computed hash. /// /// However, none of these is required. pub fn metadata_hash(&self) -> Result { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 24]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 24], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.metadata-hash"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - let l3 = *ptr0.add(16).cast::(); - + let l3 = *ptr0.add(8).cast::(); + let l4 = *ptr0.add(16).cast::(); MetadataHashValue { - lower: l2 as u64, - upper: l3 as u64, + lower: l3 as u64, + upper: l4 as u64, } }; Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - - ErrorCode::_lift(l4 as u8) + let l5 = i32::from(*ptr0.add(8).cast::()); + ErrorCode::_lift(l5 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -3048,98 +3207,114 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 24]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 24], + ); let flags0 = path_flags; let vec1 = path; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); let ptr2 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]descriptor.metadata-hash-at"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import3( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import3( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import( + wit_import3( (self).handle() as i32, (flags0.bits() >> 0) as i32, ptr1.cast_mut(), len1, ptr2, ); - let l3 = i32::from(*ptr2.add(0).cast::()); - match l3 { + let l4 = i32::from(*ptr2.add(0).cast::()); + let result8 = match l4 { 0 => { let e = { - let l4 = *ptr2.add(8).cast::(); - let l5 = *ptr2.add(16).cast::(); - + let l5 = *ptr2.add(8).cast::(); + let l6 = *ptr2.add(16).cast::(); MetadataHashValue { - lower: l4 as u64, - upper: l5 as u64, + lower: l5 as u64, + upper: l6 as u64, } }; Ok(e) } 1 => { let e = { - let l6 = i32::from(*ptr2.add(8).cast::()); - - ErrorCode::_lift(l6 as u8) + let l7 = i32::from(*ptr2.add(8).cast::()); + ErrorCode::_lift(l7 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result8 } } } impl DirectoryEntryStream { #[allow(unused_unsafe, clippy::all)] /// Read a single directory entry from a `directory-entry-stream`. - pub fn read_directory_entry(&self) -> Result, ErrorCode> { + pub fn read_directory_entry( + &self, + ) -> Result, ErrorCode> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 20]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 20]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 20], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "[method]directory-entry-stream.read-directory-entry"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result9 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - - match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + match l3 { 0 => None, 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = *ptr0.add(12).cast::<*mut u8>(); - let l5 = *ptr0.add(16).cast::(); - let len6 = l5; - let bytes6 = - _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - + let l4 = i32::from(*ptr0.add(8).cast::()); + let l5 = *ptr0.add(12).cast::<*mut u8>(); + let l6 = *ptr0.add(16).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts( + l5.cast(), + len7, + len7, + ); DirectoryEntry { - type_: DescriptorType::_lift(l3 as u8), - name: _rt::string_lift(bytes6), + type_: DescriptorType::_lift(l4 as u8), + name: _rt::string_lift(bytes7), } }; Some(e) @@ -3151,14 +3326,14 @@ pub mod wasi { } 1 => { let e = { - let l7 = i32::from(*ptr0.add(4).cast::()); - - ErrorCode::_lift(l7 as u8) + let l8 = i32::from(*ptr0.add(4).cast::()); + ErrorCode::_lift(l8 as u8) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result9 } } } @@ -3180,45 +3355,41 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.4")] extern "C" { #[link_name = "filesystem-error-code"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((err).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((err).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - ErrorCode::_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + ErrorCode::_lift(l3 as u8) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod preopens { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Descriptor = super::super::super::wasi::filesystem::types::Descriptor; #[allow(unused_unsafe, clippy::all)] - /// Return the set of preopened directories, and their path. + /// Return the set of preopened directories, and their paths. pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> { unsafe { #[repr(align(4))] @@ -3226,49 +3397,54 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.0")] + #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.4")] extern "C" { #[link_name = "get-directories"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let base7 = l1; - let len7 = l2; - let mut result7 = _rt::Vec::with_capacity(len7); - for i in 0..len7 { - let base = base7.add(i * 12); - let e7 = { - let l3 = *base.add(0).cast::(); - let l4 = *base.add(4).cast::<*mut u8>(); - let l5 = *base.add(8).cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - - (super::super::super::wasi::filesystem::types::Descriptor::from_handle(l3 as u32), _rt::string_lift(bytes6)) + wit_import1(ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let base8 = l2; + let len8 = l3; + let mut result8 = _rt::Vec::with_capacity(len8); + for i in 0..len8 { + let base = base8.add(i * 12); + let e8 = { + let l4 = *base.add(0).cast::(); + let l5 = *base.add(4).cast::<*mut u8>(); + let l6 = *base.add(8).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); + ( + super::super::super::wasi::filesystem::types::Descriptor::from_handle( + l4 as u32, + ), + _rt::string_lift(bytes7), + ) }; - result7.push(e7); + result8.push(e8); } - _rt::cabi_dealloc(base7, len7 * 12, 4); - result7 + _rt::cabi_dealloc(base8, len8 * 12, 4); + let result9 = result8; + result9 } } } } pub mod http { - #[allow(clippy::all)] + /// This interface defines all of the types and methods for implementing + /// HTTP Requests and Responses, both incoming and outgoing, as well as + /// their headers, trailers, and bodies. + #[allow(dead_code, unused_imports, clippy::all)] pub mod types { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration; pub type InputStream = super::super::super::wasi::io::streams::InputStream; @@ -3290,7 +3466,10 @@ pub mod wasi { Other(_rt::String), } impl ::core::fmt::Debug for Method { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Method::Get => f.debug_tuple("Method::Get").finish(), Method::Head => f.debug_tuple("Method::Head").finish(), @@ -3301,7 +3480,9 @@ pub mod wasi { Method::Options => f.debug_tuple("Method::Options").finish(), Method::Trace => f.debug_tuple("Method::Trace").finish(), Method::Patch => f.debug_tuple("Method::Patch").finish(), - Method::Other(e) => f.debug_tuple("Method::Other").field(e).finish(), + Method::Other(e) => { + f.debug_tuple("Method::Other").field(e).finish() + } } } } @@ -3313,11 +3494,16 @@ pub mod wasi { Other(_rt::String), } impl ::core::fmt::Debug for Scheme { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { Scheme::Http => f.debug_tuple("Scheme::Http").finish(), Scheme::Https => f.debug_tuple("Scheme::Https").finish(), - Scheme::Other(e) => f.debug_tuple("Scheme::Other").field(e).finish(), + Scheme::Other(e) => { + f.debug_tuple("Scheme::Other").field(e).finish() + } } } } @@ -3328,7 +3514,10 @@ pub mod wasi { pub info_code: Option, } impl ::core::fmt::Debug for DnsErrorPayload { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("DnsErrorPayload") .field("rcode", &self.rcode) .field("info-code", &self.info_code) @@ -3342,7 +3531,10 @@ pub mod wasi { pub alert_message: Option<_rt::String>, } impl ::core::fmt::Debug for TlsAlertReceivedPayload { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("TlsAlertReceivedPayload") .field("alert-id", &self.alert_id) .field("alert-message", &self.alert_message) @@ -3356,7 +3548,10 @@ pub mod wasi { pub field_size: Option, } impl ::core::fmt::Debug for FieldSizePayload { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("FieldSizePayload") .field("field-name", &self.field_name) .field("field-size", &self.field_size) @@ -3364,7 +3559,7 @@ pub mod wasi { } } /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types + /// #[derive(Clone)] pub enum ErrorCode { DnsTimeout, @@ -3413,9 +3608,14 @@ pub mod wasi { InternalError(Option<_rt::String>), } impl ::core::fmt::Debug for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - ErrorCode::DnsTimeout => f.debug_tuple("ErrorCode::DnsTimeout").finish(), + ErrorCode::DnsTimeout => { + f.debug_tuple("ErrorCode::DnsTimeout").finish() + } ErrorCode::DnsError(e) => { f.debug_tuple("ErrorCode::DnsError").field(e).finish() } @@ -3455,76 +3655,90 @@ pub mod wasi { ErrorCode::TlsCertificateError => { f.debug_tuple("ErrorCode::TlsCertificateError").finish() } - ErrorCode::TlsAlertReceived(e) => f - .debug_tuple("ErrorCode::TlsAlertReceived") - .field(e) - .finish(), + ErrorCode::TlsAlertReceived(e) => { + f.debug_tuple("ErrorCode::TlsAlertReceived") + .field(e) + .finish() + } ErrorCode::HttpRequestDenied => { f.debug_tuple("ErrorCode::HttpRequestDenied").finish() } - ErrorCode::HttpRequestLengthRequired => f - .debug_tuple("ErrorCode::HttpRequestLengthRequired") - .finish(), - ErrorCode::HttpRequestBodySize(e) => f - .debug_tuple("ErrorCode::HttpRequestBodySize") - .field(e) - .finish(), - ErrorCode::HttpRequestMethodInvalid => f - .debug_tuple("ErrorCode::HttpRequestMethodInvalid") - .finish(), + ErrorCode::HttpRequestLengthRequired => { + f.debug_tuple("ErrorCode::HttpRequestLengthRequired") + .finish() + } + ErrorCode::HttpRequestBodySize(e) => { + f.debug_tuple("ErrorCode::HttpRequestBodySize") + .field(e) + .finish() + } + ErrorCode::HttpRequestMethodInvalid => { + f.debug_tuple("ErrorCode::HttpRequestMethodInvalid").finish() + } ErrorCode::HttpRequestUriInvalid => { f.debug_tuple("ErrorCode::HttpRequestUriInvalid").finish() } ErrorCode::HttpRequestUriTooLong => { f.debug_tuple("ErrorCode::HttpRequestUriTooLong").finish() } - ErrorCode::HttpRequestHeaderSectionSize(e) => f - .debug_tuple("ErrorCode::HttpRequestHeaderSectionSize") - .field(e) - .finish(), - ErrorCode::HttpRequestHeaderSize(e) => f - .debug_tuple("ErrorCode::HttpRequestHeaderSize") - .field(e) - .finish(), - ErrorCode::HttpRequestTrailerSectionSize(e) => f - .debug_tuple("ErrorCode::HttpRequestTrailerSectionSize") - .field(e) - .finish(), - ErrorCode::HttpRequestTrailerSize(e) => f - .debug_tuple("ErrorCode::HttpRequestTrailerSize") - .field(e) - .finish(), + ErrorCode::HttpRequestHeaderSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestHeaderSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpRequestHeaderSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestHeaderSize") + .field(e) + .finish() + } + ErrorCode::HttpRequestTrailerSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestTrailerSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpRequestTrailerSize(e) => { + f.debug_tuple("ErrorCode::HttpRequestTrailerSize") + .field(e) + .finish() + } ErrorCode::HttpResponseIncomplete => { f.debug_tuple("ErrorCode::HttpResponseIncomplete").finish() } - ErrorCode::HttpResponseHeaderSectionSize(e) => f - .debug_tuple("ErrorCode::HttpResponseHeaderSectionSize") - .field(e) - .finish(), - ErrorCode::HttpResponseHeaderSize(e) => f - .debug_tuple("ErrorCode::HttpResponseHeaderSize") - .field(e) - .finish(), - ErrorCode::HttpResponseBodySize(e) => f - .debug_tuple("ErrorCode::HttpResponseBodySize") - .field(e) - .finish(), - ErrorCode::HttpResponseTrailerSectionSize(e) => f - .debug_tuple("ErrorCode::HttpResponseTrailerSectionSize") - .field(e) - .finish(), - ErrorCode::HttpResponseTrailerSize(e) => f - .debug_tuple("ErrorCode::HttpResponseTrailerSize") - .field(e) - .finish(), - ErrorCode::HttpResponseTransferCoding(e) => f - .debug_tuple("ErrorCode::HttpResponseTransferCoding") - .field(e) - .finish(), - ErrorCode::HttpResponseContentCoding(e) => f - .debug_tuple("ErrorCode::HttpResponseContentCoding") - .field(e) - .finish(), + ErrorCode::HttpResponseHeaderSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseHeaderSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseHeaderSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseHeaderSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseBodySize(e) => { + f.debug_tuple("ErrorCode::HttpResponseBodySize") + .field(e) + .finish() + } + ErrorCode::HttpResponseTrailerSectionSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseTrailerSectionSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseTrailerSize(e) => { + f.debug_tuple("ErrorCode::HttpResponseTrailerSize") + .field(e) + .finish() + } + ErrorCode::HttpResponseTransferCoding(e) => { + f.debug_tuple("ErrorCode::HttpResponseTransferCoding") + .field(e) + .finish() + } + ErrorCode::HttpResponseContentCoding(e) => { + f.debug_tuple("ErrorCode::HttpResponseContentCoding") + .field(e) + .finish() + } ErrorCode::HttpResponseTimeout => { f.debug_tuple("ErrorCode::HttpResponseTimeout").finish() } @@ -3547,22 +3761,24 @@ pub mod wasi { } } impl ::core::fmt::Display for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - #[cfg(feature = "std")] impl std::error::Error for ErrorCode {} /// This type enumerates the different kinds of errors that may occur when /// setting or appending to a `fields` resource. #[derive(Clone, Copy)] pub enum HeaderError { - /// This error indicates that a `field-key` or `field-value` was + /// This error indicates that a `field-name` or `field-value` was /// syntactically invalid when used with an operation that sets headers in a /// `fields`. InvalidSyntax, - /// This error indicates that a forbidden `field-key` was used when trying + /// This error indicates that a forbidden `field-name` was used when trying /// to set a header in a `fields`. Forbidden, /// This error indicates that the operation on the `fields` was not @@ -3570,26 +3786,47 @@ pub mod wasi { Immutable, } impl ::core::fmt::Debug for HeaderError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { HeaderError::InvalidSyntax => { f.debug_tuple("HeaderError::InvalidSyntax").finish() } - HeaderError::Forbidden => f.debug_tuple("HeaderError::Forbidden").finish(), - HeaderError::Immutable => f.debug_tuple("HeaderError::Immutable").finish(), + HeaderError::Forbidden => { + f.debug_tuple("HeaderError::Forbidden").finish() + } + HeaderError::Immutable => { + f.debug_tuple("HeaderError::Immutable").finish() + } } } } impl ::core::fmt::Display for HeaderError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - #[cfg(feature = "std")] impl std::error::Error for HeaderError {} /// Field keys are always strings. + /// + /// Field keys should always be treated as case insensitive by the `fields` + /// resource for the purposes of equality checking. + /// + /// # Deprecation + /// + /// This type has been deprecated in favor of the `field-name` type. pub type FieldKey = _rt::String; + /// Field names are always strings. + /// + /// Field names should always be treated as case insensitive by the `fields` + /// resource for the purposes of equality checking. + pub type FieldName = FieldKey; /// Field values should always be ASCII strings. However, in /// reality, HTTP implementations often have to interpret malformed values, /// so they are provided as a list of bytes. @@ -3601,16 +3838,14 @@ pub mod wasi { /// A `fields` may be mutable or immutable. A `fields` created using the /// constructor, `from-list`, or `clone` will be mutable, but a `fields` /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be + /// `incoming-request.headers`, `outgoing-request.headers`) might be /// immutable. In an immutable fields, the `set`, `append`, and `delete` /// operations will fail with `header-error.immutable`. - #[derive(Debug)] #[repr(transparent)] pub struct Fields { handle: _rt::Resource, } - impl Fields { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3618,49 +3853,41 @@ pub mod wasi { 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 Fields { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]fields"] fn drop(_: u32); } - drop(_handle); } } } - /// Headers is an alias for Fields. pub type Headers = Fields; /// Trailers is an alias for Fields. pub type Trailers = Fields; /// Represents an incoming HTTP Request. - #[derive(Debug)] #[repr(transparent)] pub struct IncomingRequest { handle: _rt::Resource, } - impl IncomingRequest { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3668,45 +3895,37 @@ pub mod wasi { 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 IncomingRequest { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]incoming-request"] fn drop(_: u32); } - drop(_handle); } } } - /// Represents an outgoing HTTP Request. - #[derive(Debug)] #[repr(transparent)] pub struct OutgoingRequest { handle: _rt::Resource, } - impl OutgoingRequest { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3714,50 +3933,42 @@ pub mod wasi { 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 OutgoingRequest { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]outgoing-request"] fn drop(_: u32); } - drop(_handle); } } } - /// Parameters for making an HTTP Request. Each of these parameters is /// currently an optional timeout applicable to the transport layer of the /// HTTP protocol. /// /// These timeouts are separate from any the user may use to bound a /// blocking call to `wasi:io/poll.poll`. - #[derive(Debug)] #[repr(transparent)] pub struct RequestOptions { handle: _rt::Resource, } - impl RequestOptions { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3765,49 +3976,41 @@ pub mod wasi { 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 RequestOptions { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]request-options"] fn drop(_: u32); } - drop(_handle); } } } - /// Represents the ability to send an HTTP Response. /// /// This resource is used by the `wasi:http/incoming-handler` interface to /// allow a Response to be sent corresponding to the Request provided as the /// other argument to `incoming-handler.handle`. - #[derive(Debug)] #[repr(transparent)] pub struct ResponseOutparam { handle: _rt::Resource, } - impl ResponseOutparam { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3815,47 +4018,39 @@ pub mod wasi { 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 ResponseOutparam { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]response-outparam"] fn drop(_: u32); } - drop(_handle); } } } - /// This type corresponds to the HTTP standard Status Code. pub type StatusCode = u16; /// Represents an incoming HTTP Response. - #[derive(Debug)] #[repr(transparent)] pub struct IncomingResponse { handle: _rt::Resource, } - impl IncomingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3863,37 +4058,31 @@ pub mod wasi { 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 IncomingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]incoming-response"] fn drop(_: u32); } - drop(_handle); } } } - /// Represents an incoming HTTP Request or Response's Body. /// /// A body has both its contents - a stream of bytes - and a (possibly @@ -3902,13 +4091,11 @@ pub mod wasi { /// an `input-stream` and the delivery of trailers as a `future-trailers`, /// and ensures that the user of this interface may only be consuming either /// the body contents or waiting on trailers at any given time. - #[derive(Debug)] #[repr(transparent)] pub struct IncomingBody { handle: _rt::Resource, } - impl IncomingBody { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3916,49 +4103,41 @@ pub mod wasi { 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 IncomingBody { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]incoming-body"] fn drop(_: u32); } - drop(_handle); } } } - - /// Represents a future which may eventaully return trailers, or an error. + /// Represents a future which may eventually return trailers, or an error. /// /// In the case that the incoming HTTP Request or Response did not have any /// trailers, this future will resolve to the empty set of trailers once the /// complete Request or Response body has been received. - #[derive(Debug)] #[repr(transparent)] pub struct FutureTrailers { handle: _rt::Resource, } - impl FutureTrailers { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -3966,45 +4145,37 @@ pub mod wasi { 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 FutureTrailers { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]future-trailers"] fn drop(_: u32); } - drop(_handle); } } } - /// Represents an outgoing HTTP Response. - #[derive(Debug)] #[repr(transparent)] pub struct OutgoingResponse { handle: _rt::Resource, } - impl OutgoingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -4012,37 +4183,31 @@ pub mod wasi { 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 OutgoingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]outgoing-response"] fn drop(_: u32); } - drop(_handle); } } } - /// Represents an outgoing HTTP Request or Response's Body. /// /// A body has both its contents - a stream of bytes - and a (possibly @@ -4055,17 +4220,15 @@ pub mod wasi { /// /// If the user code drops this resource, as opposed to calling the static /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this + /// and that an error has occurred. The implementation should propagate this /// error to the HTTP protocol by whatever means it has available, /// including: corrupting the body on the wire, aborting the associated /// Request, or sending a late status code for the Response. - #[derive(Debug)] #[repr(transparent)] pub struct OutgoingBody { handle: _rt::Resource, } - impl OutgoingBody { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -4073,49 +4236,41 @@ pub mod wasi { 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 OutgoingBody { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]outgoing-body"] fn drop(_: u32); } - drop(_handle); } } } - - /// Represents a future which may eventaully return an incoming HTTP + /// Represents a future which may eventually return an incoming HTTP /// Response, or an error. /// /// This resource is returned by the `wasi:http/outgoing-handler` interface to /// provide the HTTP Response corresponding to the sent Request. - #[derive(Debug)] #[repr(transparent)] pub struct FutureIncomingResponse { handle: _rt::Resource, } - impl FutureIncomingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -4123,37 +4278,31 @@ pub mod wasi { 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 FutureIncomingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[resource-drop]future-incoming-response"] fn drop(_: u32); } - drop(_handle); } } } - #[allow(unused_unsafe, clippy::all)] /// Attempts to extract a http-related `error` from the wasi:io `error` /// provided. @@ -4173,60 +4322,53 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "http-error-code"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((err).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((err).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result66 = match l2 { 0 => None, 1 => { let e = { - let l2 = i32::from(*ptr0.add(8).cast::()); - let v64 = match l2 { + let l3 = i32::from(*ptr0.add(8).cast::()); + let v65 = match l3 { 0 => ErrorCode::DnsTimeout, 1 => { - let e64 = { - let l3 = i32::from(*ptr0.add(16).cast::()); - let l7 = i32::from(*ptr0.add(28).cast::()); - + let e65 = { + let l4 = i32::from(*ptr0.add(16).cast::()); + let l8 = i32::from(*ptr0.add(28).cast::()); DnsErrorPayload { - rcode: match l3 { + rcode: match l4 { 0 => None, 1 => { let e = { - let l4 = - *ptr0.add(20).cast::<*mut u8>(); - let l5 = *ptr0.add(24).cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, + let l5 = *ptr0.add(20).cast::<*mut u8>(); + let l6 = *ptr0.add(24).cast::(); + let len7 = l6; + let bytes7 = _rt::Vec::from_raw_parts( + l5.cast(), + len7, + len7, ); - - _rt::string_lift(bytes6) + _rt::string_lift(bytes7) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - info_code: match l7 { + info_code: match l8 { 0 => None, 1 => { let e = { - let l8 = i32::from( - *ptr0.add(30).cast::(), - ); - - l8 as u16 + let l9 = i32::from(*ptr0.add(30).cast::()); + l9 as u16 }; Some(e) } @@ -4234,7 +4376,7 @@ pub mod wasi { }, } }; - ErrorCode::DnsError(e64) + ErrorCode::DnsError(e65) } 2 => ErrorCode::DestinationNotFound, 3 => ErrorCode::DestinationUnavailable, @@ -4249,40 +4391,34 @@ pub mod wasi { 12 => ErrorCode::TlsProtocolError, 13 => ErrorCode::TlsCertificateError, 14 => { - let e64 = { - let l9 = i32::from(*ptr0.add(16).cast::()); - let l11 = i32::from(*ptr0.add(20).cast::()); - + let e65 = { + let l10 = i32::from(*ptr0.add(16).cast::()); + let l12 = i32::from(*ptr0.add(20).cast::()); TlsAlertReceivedPayload { - alert_id: match l9 { + alert_id: match l10 { 0 => None, 1 => { let e = { - let l10 = i32::from( - *ptr0.add(17).cast::(), - ); - - l10 as u8 + let l11 = i32::from(*ptr0.add(17).cast::()); + l11 as u8 }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - alert_message: match l11 { + alert_message: match l12 { 0 => None, 1 => { let e = { - let l12 = - *ptr0.add(24).cast::<*mut u8>(); - let l13 = *ptr0.add(28).cast::(); - let len14 = l13; - let bytes14 = _rt::Vec::from_raw_parts( - l12.cast(), - len14, - len14, + let l13 = *ptr0.add(24).cast::<*mut u8>(); + let l14 = *ptr0.add(28).cast::(); + let len15 = l14; + let bytes15 = _rt::Vec::from_raw_parts( + l13.cast(), + len15, + len15, ); - - _rt::string_lift(bytes14) + _rt::string_lift(bytes15) }; Some(e) } @@ -4290,102 +4426,85 @@ pub mod wasi { }, } }; - ErrorCode::TlsAlertReceived(e64) + ErrorCode::TlsAlertReceived(e65) } 15 => ErrorCode::HttpRequestDenied, 16 => ErrorCode::HttpRequestLengthRequired, 17 => { - let e64 = { - let l15 = i32::from(*ptr0.add(16).cast::()); - - match l15 { + let e65 = { + let l16 = i32::from(*ptr0.add(16).cast::()); + match l16 { 0 => None, 1 => { let e = { - let l16 = *ptr0.add(24).cast::(); - - l16 as u64 + let l17 = *ptr0.add(24).cast::(); + l17 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestBodySize(e64) + ErrorCode::HttpRequestBodySize(e65) } 18 => ErrorCode::HttpRequestMethodInvalid, 19 => ErrorCode::HttpRequestUriInvalid, 20 => ErrorCode::HttpRequestUriTooLong, 21 => { - let e64 = { - let l17 = i32::from(*ptr0.add(16).cast::()); - - match l17 { + let e65 = { + let l18 = i32::from(*ptr0.add(16).cast::()); + match l18 { 0 => None, 1 => { let e = { - let l18 = *ptr0.add(20).cast::(); - - l18 as u32 + let l19 = *ptr0.add(20).cast::(); + l19 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestHeaderSectionSize(e64) + ErrorCode::HttpRequestHeaderSectionSize(e65) } 22 => { - let e64 = { - let l19 = i32::from(*ptr0.add(16).cast::()); - - match l19 { + let e65 = { + let l20 = i32::from(*ptr0.add(16).cast::()); + match l20 { 0 => None, 1 => { let e = { - let l20 = - i32::from(*ptr0.add(20).cast::()); - let l24 = - i32::from(*ptr0.add(32).cast::()); - + let l21 = i32::from(*ptr0.add(20).cast::()); + let l25 = i32::from(*ptr0.add(32).cast::()); FieldSizePayload { - field_name: match l20 { + field_name: match l21 { 0 => None, 1 => { let e = { - let l21 = *ptr0 - .add(24) - .cast::<*mut u8>( + let l22 = *ptr0.add(24).cast::<*mut u8>(); + let l23 = *ptr0.add(28).cast::(); + let len24 = l23; + let bytes24 = _rt::Vec::from_raw_parts( + l22.cast(), + len24, + len24, ); - let l22 = *ptr0 - .add(28) - .cast::(); - let len23 = l22; - let bytes23 = _rt::Vec::from_raw_parts(l21.cast(), len23, len23); - - _rt::string_lift(bytes23) + _rt::string_lift(bytes24) }; Some(e) } - _ => { - _rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), }, - field_size: match l24 { + field_size: match l25 { 0 => None, 1 => { let e = { - let l25 = *ptr0 - .add(36) - .cast::(); - - l25 as u32 + let l26 = *ptr0.add(36).cast::(); + l26 as u32 }; Some(e) } - _ => { - _rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -4394,60 +4513,54 @@ pub mod wasi { _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestHeaderSize(e64) + ErrorCode::HttpRequestHeaderSize(e65) } 23 => { - let e64 = { - let l26 = i32::from(*ptr0.add(16).cast::()); - - match l26 { + let e65 = { + let l27 = i32::from(*ptr0.add(16).cast::()); + match l27 { 0 => None, 1 => { let e = { - let l27 = *ptr0.add(20).cast::(); - - l27 as u32 + let l28 = *ptr0.add(20).cast::(); + l28 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestTrailerSectionSize(e64) + ErrorCode::HttpRequestTrailerSectionSize(e65) } 24 => { - let e64 = { - let l28 = i32::from(*ptr0.add(16).cast::()); - let l32 = i32::from(*ptr0.add(28).cast::()); - + let e65 = { + let l29 = i32::from(*ptr0.add(16).cast::()); + let l33 = i32::from(*ptr0.add(28).cast::()); FieldSizePayload { - field_name: match l28 { + field_name: match l29 { 0 => None, 1 => { let e = { - let l29 = - *ptr0.add(20).cast::<*mut u8>(); - let l30 = *ptr0.add(24).cast::(); - let len31 = l30; - let bytes31 = _rt::Vec::from_raw_parts( - l29.cast(), - len31, - len31, + let l30 = *ptr0.add(20).cast::<*mut u8>(); + let l31 = *ptr0.add(24).cast::(); + let len32 = l31; + let bytes32 = _rt::Vec::from_raw_parts( + l30.cast(), + len32, + len32, ); - - _rt::string_lift(bytes31) + _rt::string_lift(bytes32) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - field_size: match l32 { + field_size: match l33 { 0 => None, 1 => { let e = { - let l33 = *ptr0.add(32).cast::(); - - l33 as u32 + let l34 = *ptr0.add(32).cast::(); + l34 as u32 }; Some(e) } @@ -4455,61 +4568,55 @@ pub mod wasi { }, } }; - ErrorCode::HttpRequestTrailerSize(e64) + ErrorCode::HttpRequestTrailerSize(e65) } 25 => ErrorCode::HttpResponseIncomplete, 26 => { - let e64 = { - let l34 = i32::from(*ptr0.add(16).cast::()); - - match l34 { + let e65 = { + let l35 = i32::from(*ptr0.add(16).cast::()); + match l35 { 0 => None, 1 => { let e = { - let l35 = *ptr0.add(20).cast::(); - - l35 as u32 + let l36 = *ptr0.add(20).cast::(); + l36 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseHeaderSectionSize(e64) + ErrorCode::HttpResponseHeaderSectionSize(e65) } 27 => { - let e64 = { - let l36 = i32::from(*ptr0.add(16).cast::()); - let l40 = i32::from(*ptr0.add(28).cast::()); - + let e65 = { + let l37 = i32::from(*ptr0.add(16).cast::()); + let l41 = i32::from(*ptr0.add(28).cast::()); FieldSizePayload { - field_name: match l36 { + field_name: match l37 { 0 => None, 1 => { let e = { - let l37 = - *ptr0.add(20).cast::<*mut u8>(); - let l38 = *ptr0.add(24).cast::(); - let len39 = l38; - let bytes39 = _rt::Vec::from_raw_parts( - l37.cast(), - len39, - len39, + let l38 = *ptr0.add(20).cast::<*mut u8>(); + let l39 = *ptr0.add(24).cast::(); + let len40 = l39; + let bytes40 = _rt::Vec::from_raw_parts( + l38.cast(), + len40, + len40, ); - - _rt::string_lift(bytes39) + _rt::string_lift(bytes40) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - field_size: match l40 { + field_size: match l41 { 0 => None, 1 => { let e = { - let l41 = *ptr0.add(32).cast::(); - - l41 as u32 + let l42 = *ptr0.add(32).cast::(); + l42 as u32 }; Some(e) } @@ -4517,79 +4624,71 @@ pub mod wasi { }, } }; - ErrorCode::HttpResponseHeaderSize(e64) + ErrorCode::HttpResponseHeaderSize(e65) } 28 => { - let e64 = { - let l42 = i32::from(*ptr0.add(16).cast::()); - - match l42 { + let e65 = { + let l43 = i32::from(*ptr0.add(16).cast::()); + match l43 { 0 => None, 1 => { let e = { - let l43 = *ptr0.add(24).cast::(); - - l43 as u64 + let l44 = *ptr0.add(24).cast::(); + l44 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseBodySize(e64) + ErrorCode::HttpResponseBodySize(e65) } 29 => { - let e64 = { - let l44 = i32::from(*ptr0.add(16).cast::()); - - match l44 { + let e65 = { + let l45 = i32::from(*ptr0.add(16).cast::()); + match l45 { 0 => None, 1 => { let e = { - let l45 = *ptr0.add(20).cast::(); - - l45 as u32 + let l46 = *ptr0.add(20).cast::(); + l46 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseTrailerSectionSize(e64) + ErrorCode::HttpResponseTrailerSectionSize(e65) } 30 => { - let e64 = { - let l46 = i32::from(*ptr0.add(16).cast::()); - let l50 = i32::from(*ptr0.add(28).cast::()); - + let e65 = { + let l47 = i32::from(*ptr0.add(16).cast::()); + let l51 = i32::from(*ptr0.add(28).cast::()); FieldSizePayload { - field_name: match l46 { + field_name: match l47 { 0 => None, 1 => { let e = { - let l47 = - *ptr0.add(20).cast::<*mut u8>(); - let l48 = *ptr0.add(24).cast::(); - let len49 = l48; - let bytes49 = _rt::Vec::from_raw_parts( - l47.cast(), - len49, - len49, + let l48 = *ptr0.add(20).cast::<*mut u8>(); + let l49 = *ptr0.add(24).cast::(); + let len50 = l49; + let bytes50 = _rt::Vec::from_raw_parts( + l48.cast(), + len50, + len50, ); - - _rt::string_lift(bytes49) + _rt::string_lift(bytes50) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - field_size: match l50 { + field_size: match l51 { 0 => None, 1 => { let e = { - let l51 = *ptr0.add(32).cast::(); - - l51 as u32 + let l52 = *ptr0.add(32).cast::(); + l52 as u32 }; Some(e) } @@ -4597,59 +4696,55 @@ pub mod wasi { }, } }; - ErrorCode::HttpResponseTrailerSize(e64) + ErrorCode::HttpResponseTrailerSize(e65) } 31 => { - let e64 = { - let l52 = i32::from(*ptr0.add(16).cast::()); - - match l52 { + let e65 = { + let l53 = i32::from(*ptr0.add(16).cast::()); + match l53 { 0 => None, 1 => { let e = { - let l53 = *ptr0.add(20).cast::<*mut u8>(); - let l54 = *ptr0.add(24).cast::(); - let len55 = l54; - let bytes55 = _rt::Vec::from_raw_parts( - l53.cast(), - len55, - len55, + let l54 = *ptr0.add(20).cast::<*mut u8>(); + let l55 = *ptr0.add(24).cast::(); + let len56 = l55; + let bytes56 = _rt::Vec::from_raw_parts( + l54.cast(), + len56, + len56, ); - - _rt::string_lift(bytes55) + _rt::string_lift(bytes56) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseTransferCoding(e64) + ErrorCode::HttpResponseTransferCoding(e65) } 32 => { - let e64 = { - let l56 = i32::from(*ptr0.add(16).cast::()); - - match l56 { + let e65 = { + let l57 = i32::from(*ptr0.add(16).cast::()); + match l57 { 0 => None, 1 => { let e = { - let l57 = *ptr0.add(20).cast::<*mut u8>(); - let l58 = *ptr0.add(24).cast::(); - let len59 = l58; - let bytes59 = _rt::Vec::from_raw_parts( - l57.cast(), - len59, - len59, + let l58 = *ptr0.add(20).cast::<*mut u8>(); + let l59 = *ptr0.add(24).cast::(); + let len60 = l59; + let bytes60 = _rt::Vec::from_raw_parts( + l58.cast(), + len60, + len60, ); - - _rt::string_lift(bytes59) + _rt::string_lift(bytes60) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseContentCoding(e64) + ErrorCode::HttpResponseContentCoding(e65) } 33 => ErrorCode::HttpResponseTimeout, 34 => ErrorCode::HttpUpgradeFailed, @@ -4658,39 +4753,37 @@ pub mod wasi { 37 => ErrorCode::ConfigurationError, n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e64 = { - let l60 = i32::from(*ptr0.add(16).cast::()); - - match l60 { + let e65 = { + let l61 = i32::from(*ptr0.add(16).cast::()); + match l61 { 0 => None, 1 => { let e = { - let l61 = *ptr0.add(20).cast::<*mut u8>(); - let l62 = *ptr0.add(24).cast::(); - let len63 = l62; - let bytes63 = _rt::Vec::from_raw_parts( - l61.cast(), - len63, - len63, + let l62 = *ptr0.add(20).cast::<*mut u8>(); + let l63 = *ptr0.add(24).cast::(); + let len64 = l63; + let bytes64 = _rt::Vec::from_raw_parts( + l62.cast(), + len64, + len64, ); - - _rt::string_lift(bytes63) + _rt::string_lift(bytes64) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::InternalError(e64) + ErrorCode::InternalError(e65) } }; - - v64 + v65 }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result66 } } impl Fields { @@ -4701,17 +4794,16 @@ pub mod wasi { pub fn new() -> Self { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[constructor]fields"] - fn wit_import() -> i32; + fn wit_import0() -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { + extern "C" fn wit_import0() -> i32 { unreachable!() } - let ret = wit_import(); + let ret = wit_import0(); Fields::from_handle(ret as u32) } } @@ -4722,28 +4814,30 @@ pub mod wasi { /// /// The resulting `fields` is mutable. /// - /// The list represents each key-value pair in the Fields. Keys + /// The list represents each name-value pair in the Fields. Names /// which have multiple values are represented by multiple entries in this - /// list with the same key. + /// list with the same name. /// - /// The tuple is a pair of the field key, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all keys - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. + /// The tuple is a pair of the field name, represented as a string, and + /// Value, represented as a list of bytes. /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. + /// An error result will be returned if any `field-name` or `field-value` is + /// syntactically invalid, or if a field is forbidden. pub fn from_list( - entries: &[(FieldKey, FieldValue)], + entries: &[(FieldName, FieldValue)], ) -> Result { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let vec3 = entries; let len3 = vec3.len(); - let layout3 = - _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 16, 4); + let layout3 = _rt::alloc::Layout::from_size_align_unchecked( + vec3.len() * 16, + 4, + ); let result3 = if layout3.size() != 0 { let ptr = _rt::alloc::alloc(layout3).cast::(); if ptr.is_null() { @@ -4751,9 +4845,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec3.into_iter().enumerate() { let base = result3.add(i * 16); @@ -4773,34 +4865,29 @@ pub mod wasi { } let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[static]fields.from-list"] - fn wit_import(_: *mut u8, _: usize, _: *mut u8); + fn wit_import5(_: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import5(_: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import(result3, len3, ptr4); - let l5 = i32::from(*ptr4.add(0).cast::()); - if layout3.size() != 0 { - _rt::alloc::dealloc(result3.cast(), layout3); - } - match l5 { + wit_import5(result3, len3, ptr4); + let l6 = i32::from(*ptr4.add(0).cast::()); + let result10 = match l6 { 0 => { let e = { - let l6 = *ptr4.add(4).cast::(); - - Fields::from_handle(l6 as u32) + let l7 = *ptr4.add(4).cast::(); + Fields::from_handle(l7 as u32) }; Ok(e) } 1 => { let e = { - let l7 = i32::from(*ptr4.add(4).cast::()); - let v8 = match l7 { + let l8 = i32::from(*ptr4.add(4).cast::()); + let v9 = match l8 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, n => { @@ -4808,112 +4895,130 @@ pub mod wasi { HeaderError::Immutable } }; - - v8 + v9 }; Err(e) } _ => _rt::invalid_enum_discriminant(), + }; + if layout3.size() != 0 { + _rt::alloc::dealloc(result3.cast(), layout3); } + result10 } } } impl Fields { #[allow(unused_unsafe, clippy::all)] - /// Get all of the values corresponding to a key. If the key is not present - /// in this `fields`, an empty list is returned. However, if the key is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - pub fn get(&self, name: &FieldKey) -> _rt::Vec { + /// Get all of the values corresponding to a name. If the name is not present + /// in this `fields` or is syntactically invalid, an empty list is returned. + /// However, if the name is present but empty, this is represented by a list + /// with one or more empty field-values present. + pub fn get(&self, name: &str) -> _rt::Vec { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]fields.get"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = *ptr1.add(0).cast::<*mut u8>(); - let l3 = *ptr1.add(4).cast::(); - let base7 = l2; - let len7 = l3; - let mut result7 = _rt::Vec::with_capacity(len7); - for i in 0..len7 { - let base = base7.add(i * 8); - let e7 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base.add(4).cast::(); - let len6 = l5; - - _rt::Vec::from_raw_parts(l4.cast(), len6, len6) + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = *ptr1.add(0).cast::<*mut u8>(); + let l4 = *ptr1.add(4).cast::(); + let base8 = l3; + let len8 = l4; + let mut result8 = _rt::Vec::with_capacity(len8); + for i in 0..len8 { + let base = base8.add(i * 8); + let e8 = { + let l5 = *base.add(0).cast::<*mut u8>(); + let l6 = *base.add(4).cast::(); + let len7 = l6; + _rt::Vec::from_raw_parts(l5.cast(), len7, len7) }; - result7.push(e7); + result8.push(e8); } - _rt::cabi_dealloc(base7, len7 * 8, 4); - result7 + _rt::cabi_dealloc(base8, len8 * 8, 4); + let result9 = result8; + result9 } } } impl Fields { #[allow(unused_unsafe, clippy::all)] - /// Returns `true` when the key is present in this `fields`. If the key is + /// Returns `true` when the name is present in this `fields`. If the name is /// syntactically invalid, `false` is returned. - pub fn has(&self, name: &FieldKey) -> bool { + pub fn has(&self, name: &str) -> bool { unsafe { let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]fields.has"] - fn wit_import(_: i32, _: *mut u8, _: usize) -> i32; + fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 { + extern "C" fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, ptr0.cast_mut(), len0); + let ret = wit_import1( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + ); _rt::bool_lift(ret as u8) } } } impl Fields { #[allow(unused_unsafe, clippy::all)] - /// Set all of the values for a key. Clears any existing values for that - /// key, if they have been set. + /// Set all of the values for a name. Clears any existing values for that + /// name, if they have been set. /// /// Fails with `header-error.immutable` if the `fields` are immutable. + /// + /// Fails with `header-error.invalid-syntax` if the `field-name` or any of + /// the `field-value`s are syntactically invalid. pub fn set( &self, - name: &FieldKey, + name: &str, value: &[FieldValue], ) -> Result<(), HeaderError> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let vec2 = value; let len2 = vec2.len(); - let layout2 = - _rt::alloc::Layout::from_size_align_unchecked(vec2.len() * 8, 4); + let layout2 = _rt::alloc::Layout::from_size_align_unchecked( + vec2.len() * 8, + 4, + ); let result2 = if layout2.size() != 0 { let ptr = _rt::alloc::alloc(layout2).cast::(); if ptr.is_null() { @@ -4921,9 +5026,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec2.into_iter().enumerate() { let base = result2.add(i * 8); @@ -4937,10 +5040,10 @@ pub mod wasi { } let ptr3 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]fields.set"] - fn wit_import( + fn wit_import4( _: i32, _: *mut u8, _: usize, @@ -4949,9 +5052,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import4( _: i32, _: *mut u8, _: usize, @@ -4961,7 +5063,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import4( (self).handle() as i32, ptr0.cast_mut(), len0, @@ -4969,19 +5071,16 @@ pub mod wasi { len2, ptr3, ); - let l4 = i32::from(*ptr3.add(0).cast::()); - if layout2.size() != 0 { - _rt::alloc::dealloc(result2.cast(), layout2); - } - match l4 { + let l5 = i32::from(*ptr3.add(0).cast::()); + let result8 = match l5 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l5 = i32::from(*ptr3.add(1).cast::()); - let v6 = match l5 { + let l6 = i32::from(*ptr3.add(1).cast::()); + let v7 = match l6 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, n => { @@ -4989,134 +5088,64 @@ pub mod wasi { HeaderError::Immutable } }; - - v6 + v7 }; Err(e) } _ => _rt::invalid_enum_discriminant(), + }; + if layout2.size() != 0 { + _rt::alloc::dealloc(result2.cast(), layout2); } + result8 } } } impl Fields { #[allow(unused_unsafe, clippy::all)] - /// Delete all values for a key. Does nothing if no values for the key + /// Delete all values for a name. Does nothing if no values for the name /// exist. /// /// Fails with `header-error.immutable` if the `fields` are immutable. - pub fn delete(&self, name: &FieldKey) -> Result<(), HeaderError> { + /// + /// Fails with `header-error.invalid-syntax` if the `field-name` is + /// syntactically invalid. + pub fn delete(&self, name: &str) -> Result<(), HeaderError> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let vec0 = name; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]fields.delete"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr1.add(1).cast::()); - let v4 = match l3 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - - v4 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - /// Append a value for a key. Does not change or delete any existing - /// values for that key. - /// - /// Fails with `header-error.immutable` if the `fields` are immutable. - pub fn append( - &self, - name: &FieldKey, - value: &FieldValue, - ) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); - let vec0 = name; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - let vec1 = value; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - extern "C" { - #[link_name = "[method]fields.append"] - fn wit_import( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import2( _: i32, _: *mut u8, _: usize, _: *mut u8, - _: usize, - _: *mut u8, ) { unreachable!() } - wit_import( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ); - let l3 = i32::from(*ptr2.add(0).cast::()); - match l3 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result6 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr2.add(1).cast::()); + let l4 = i32::from(*ptr1.add(1).cast::()); let v5 = match l4 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, @@ -5125,89 +5154,182 @@ pub mod wasi { HeaderError::Immutable } }; - v5 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } impl Fields { #[allow(unused_unsafe, clippy::all)] - /// Retrieve the full set of keys and values in the Fields. Like the - /// constructor, the list represents each key-value pair. + /// Append a value for a name. Does not change or delete any existing + /// values for that name. /// - /// The outer list represents each key-value pair in the Fields. Keys + /// Fails with `header-error.immutable` if the `fields` are immutable. + /// + /// Fails with `header-error.invalid-syntax` if the `field-name` or + /// `field-value` are syntactically invalid. + pub fn append( + &self, + name: &str, + value: &[u8], + ) -> Result<(), HeaderError> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); + let vec0 = name; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = value; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let ptr2 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] + extern "C" { + #[link_name = "[method]fields.append"] + fn wit_import3( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + #[cfg(not(target_arch = "wasm32"))] + extern "C" fn wit_import3( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import3( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + ptr1.cast_mut(), + len1, + ptr2, + ); + let l4 = i32::from(*ptr2.add(0).cast::()); + let result7 = match l4 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l5 = i32::from(*ptr2.add(1).cast::()); + let v6 = match l5 { + 0 => HeaderError::InvalidSyntax, + 1 => HeaderError::Forbidden, + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + HeaderError::Immutable + } + }; + v6 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + }; + result7 + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + /// Retrieve the full set of names and values in the Fields. Like the + /// constructor, the list represents each name-value pair. + /// + /// The outer list represents each name-value pair in the Fields. Names /// which have multiple values are represented by multiple entries in this - /// list with the same key. - pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> { + /// list with the same name. + /// + /// The names and values are always returned in the original casing and in + /// the order in which they will be serialized for transport. + pub fn entries(&self) -> _rt::Vec<(FieldName, FieldValue)> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]fields.entries"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let base9 = l1; - let len9 = l2; - let mut result9 = _rt::Vec::with_capacity(len9); - for i in 0..len9 { - let base = base9.add(i * 16); - let e9 = { - let l3 = *base.add(0).cast::<*mut u8>(); - let l4 = *base.add(4).cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - let l6 = *base.add(8).cast::<*mut u8>(); - let l7 = *base.add(12).cast::(); - let len8 = l7; - + wit_import1((self).handle() as i32, ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let base10 = l2; + let len10 = l3; + let mut result10 = _rt::Vec::with_capacity(len10); + for i in 0..len10 { + let base = base10.add(i * 16); + let e10 = { + let l4 = *base.add(0).cast::<*mut u8>(); + let l5 = *base.add(4).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ); + let l7 = *base.add(8).cast::<*mut u8>(); + let l8 = *base.add(12).cast::(); + let len9 = l8; ( - _rt::string_lift(bytes5), - _rt::Vec::from_raw_parts(l6.cast(), len8, len8), + _rt::string_lift(bytes6), + _rt::Vec::from_raw_parts(l7.cast(), len9, len9), ) }; - result9.push(e9); + result10.push(e10); } - _rt::cabi_dealloc(base9, len9 * 16, 4); - result9 + _rt::cabi_dealloc(base10, len10 * 16, 4); + let result11 = result10; + result11 } } } impl Fields { #[allow(unused_unsafe, clippy::all)] - /// Make a deep copy of the Fields. Equivelant in behavior to calling the + /// Make a deep copy of the Fields. Equivalent in behavior to calling the /// `fields` constructor on the return value of `entries`. The resulting /// `fields` is mutable. pub fn clone(&self) -> Fields { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]fields.clone"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); Fields::from_handle(ret as u32) } } @@ -5219,22 +5341,23 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-request.method"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - let v5 = match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let v6 = match l2 { 0 => Method::Get, 1 => Method::Head, 2 => Method::Post, @@ -5246,18 +5369,22 @@ pub mod wasi { 8 => Method::Patch, n => { debug_assert_eq!(n, 9, "invalid enum discriminant"); - let e5 = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let e6 = { + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; - Method::Other(e5) + Method::Other(e6) } }; - v5 + let result7 = v6; + result7 } } } @@ -5268,36 +5395,41 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-request.path-with-query"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -5308,90 +5440,98 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-request.scheme"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result8 = match l2 { 0 => None, 1 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - let v6 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + let v7 = match l3 { 0 => Scheme::Http, 1 => Scheme::Https, n => { debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e6 = { - let l3 = *ptr0.add(8).cast::<*mut u8>(); - let l4 = *ptr0.add(12).cast::(); - let len5 = l4; - let bytes5 = - _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - - _rt::string_lift(bytes5) + let e7 = { + let l4 = *ptr0.add(8).cast::<*mut u8>(); + let l5 = *ptr0.add(12).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ); + _rt::string_lift(bytes6) }; - Scheme::Other(e6) + Scheme::Other(e7) } }; - - v6 + v7 }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result8 } } } impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] - /// Returns the authority from the request, if it was present. + /// Returns the authority of the Request's target URI, if present. pub fn authority(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-request.authority"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -5408,17 +5548,16 @@ pub mod wasi { pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-request.headers"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); Fields::from_handle(ret as u32) } } @@ -5431,27 +5570,27 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-request.consume"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - IncomingBody::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + IncomingBody::from_handle(l3 as u32) }; Ok(e) } @@ -5460,7 +5599,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -5479,17 +5619,16 @@ pub mod wasi { pub fn new(headers: Headers) -> Self { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[constructor]outgoing-request"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((&headers).take_handle() as i32); + let ret = wit_import0((&headers).take_handle() as i32); OutgoingRequest::from_handle(ret as u32) } } @@ -5506,27 +5645,27 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.body"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - OutgoingBody::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + OutgoingBody::from_handle(l3 as u32) }; Ok(e) } @@ -5535,7 +5674,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -5546,22 +5686,23 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.method"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - let v5 = match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let v6 = match l2 { 0 => Method::Get, 1 => Method::Head, 2 => Method::Post, @@ -5573,18 +5714,22 @@ pub mod wasi { 8 => Method::Patch, n => { debug_assert_eq!(n, 9, "invalid enum discriminant"); - let e5 = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let e6 = { + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; - Method::Other(e5) + Method::Other(e6) } }; - v5 + let result7 = v6; + result7 } } } @@ -5608,24 +5753,30 @@ pub mod wasi { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (9i32, ptr0.cast_mut(), len0) } }; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.set-method"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; + fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { + extern "C" fn wit_import2( + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32 { unreachable!() } - let ret = - wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + let ret = wit_import2( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + ); match ret { 0 => { let e = (); @@ -5648,36 +5799,41 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.path-with-query"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -5686,31 +5842,41 @@ pub mod wasi { /// Set the combination of the HTTP Path and Query for the Request. /// When `none`, this represents an empty Path and empty Query. Fails is the /// string given is not a syntactically valid path and query uri component. - pub fn set_path_with_query(&self, path_with_query: Option<&str>) -> Result<(), ()> { + pub fn set_path_with_query( + &self, + path_with_query: Option<&str>, + ) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match path_with_query { Some(e) => { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (1i32, ptr0.cast_mut(), len0) } None => (0i32, ::core::ptr::null_mut(), 0usize), }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.set-path-with-query"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; + fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { + extern "C" fn wit_import2( + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32 { unreachable!() } - let ret = - wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + let ret = wit_import2( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + ); match ret { 0 => { let e = (); @@ -5733,50 +5899,53 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.scheme"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result8 = match l2 { 0 => None, 1 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - let v6 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + let v7 = match l3 { 0 => Scheme::Http, 1 => Scheme::Https, n => { debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e6 = { - let l3 = *ptr0.add(8).cast::<*mut u8>(); - let l4 = *ptr0.add(12).cast::(); - let len5 = l4; - let bytes5 = - _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - - _rt::string_lift(bytes5) + let e7 = { + let l4 = *ptr0.add(8).cast::<*mut u8>(); + let l5 = *ptr0.add(12).cast::(); + let len6 = l5; + let bytes6 = _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ); + _rt::string_lift(bytes6) }; - Scheme::Other(e6) + Scheme::Other(e7) } }; - - v6 + v7 }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result8 } } } @@ -5796,27 +5965,36 @@ pub mod wasi { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (2i32, ptr0.cast_mut(), len0) } }; - (1i32, result1_0, result1_1, result1_2) } None => (0i32, 0i32, ::core::ptr::null_mut(), 0usize), }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.set-scheme"] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32; + fn wit_import3( + _: i32, + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32 { + extern "C" fn wit_import3( + _: i32, + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32 { unreachable!() } - let ret = wit_import( + let ret = wit_import3( (self).handle() as i32, result2_0, result2_1, @@ -5839,52 +6017,57 @@ pub mod wasi { } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] - /// Get the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and + /// Get the authority of the Request's target URI. A value of `none` may be used + /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. pub fn authority(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.authority"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - - _rt::string_lift(bytes4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts( + l3.cast(), + len5, + len5, + ); + _rt::string_lift(bytes5) }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } impl OutgoingRequest { #[allow(unused_unsafe, clippy::all)] - /// Set the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and + /// Set the authority of the Request's target URI. A value of `none` may be used + /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid uri authority. + /// not a syntactically valid URI authority. pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> { unsafe { let (result1_0, result1_1, result1_2) = match authority { @@ -5892,24 +6075,31 @@ pub mod wasi { let vec0 = e; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); - (1i32, ptr0.cast_mut(), len0) } None => (0i32, ::core::ptr::null_mut(), 0usize), }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.set-authority"] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; + fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { + extern "C" fn wit_import2( + _: i32, + _: i32, + _: *mut u8, + _: usize, + ) -> i32 { unreachable!() } - let ret = - wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + let ret = wit_import2( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + ); match ret { 0 => { let e = (); @@ -5932,22 +6122,21 @@ pub mod wasi { /// `delete` operations will fail with `header-error.immutable`. /// /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to + /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-request.headers"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); Fields::from_handle(ret as u32) } } @@ -5958,17 +6147,16 @@ pub mod wasi { pub fn new() -> Self { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[constructor]request-options"] - fn wit_import() -> i32; + fn wit_import0() -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { + extern "C" fn wit_import0() -> i32 { unreachable!() } - let ret = wit_import(); + let ret = wit_import0(); RequestOptions::from_handle(ret as u32) } } @@ -5980,33 +6168,34 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]request-options.connect-timeout"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -6014,24 +6203,30 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the timeout for the initial connect to the HTTP Server. An error /// return value indicates that this timeout is not supported. - pub fn set_connect_timeout(&self, duration: Option) -> Result<(), ()> { + pub fn set_connect_timeout( + &self, + duration: Option, + ) -> Result<(), ()> { unsafe { let (result0_0, result0_1) = match duration { Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]request-options.set-connect-timeout"] - fn wit_import(_: i32, _: i32, _: i64) -> i32; + fn wit_import1(_: i32, _: i32, _: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64) -> i32 { + extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, result0_0, result0_1); + let ret = wit_import1( + (self).handle() as i32, + result0_0, + result0_1, + ); match ret { 0 => { let e = (); @@ -6053,33 +6248,34 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]request-options.first-byte-timeout"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -6087,24 +6283,30 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the timeout for receiving the first byte of the Response body. An /// error return value indicates that this timeout is not supported. - pub fn set_first_byte_timeout(&self, duration: Option) -> Result<(), ()> { + pub fn set_first_byte_timeout( + &self, + duration: Option, + ) -> Result<(), ()> { unsafe { let (result0_0, result0_1) = match duration { Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]request-options.set-first-byte-timeout"] - fn wit_import(_: i32, _: i32, _: i64) -> i32; + fn wit_import1(_: i32, _: i32, _: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64) -> i32 { + extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, result0_0, result0_1); + let ret = wit_import1( + (self).handle() as i32, + result0_0, + result0_1, + ); match ret { 0 => { let e = (); @@ -6127,33 +6329,34 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]request-options.between-bytes-timeout"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => None, 1 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -6172,17 +6375,20 @@ pub mod wasi { None => (0i32, 0i64), }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]request-options.set-between-bytes-timeout"] - fn wit_import(_: i32, _: i32, _: i64) -> i32; + fn wit_import1(_: i32, _: i32, _: i64) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64) -> i32 { + extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, result0_0, result0_1); + let ret = wit_import1( + (self).handle() as i32, + result0_0, + result0_1, + ); match ret { 0 => { let e = (); @@ -6208,7 +6414,10 @@ pub mod wasi { /// /// The user may provide an `error` to `response` to allow the /// implementation determine how to respond with an HTTP error response. - pub fn set(param: ResponseOutparam, response: Result) { + pub fn set( + param: ResponseOutparam, + response: Result, + ) -> () { unsafe { let ( result38_0, @@ -6220,16 +6429,18 @@ pub mod wasi { result38_6, result38_7, ) = match &response { - Ok(e) => ( - 0i32, - (e).take_handle() as i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + Ok(e) => { + ( + 0i32, + (e).take_handle() as i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } Err(e) => { let ( result37_0, @@ -6240,15 +6451,17 @@ pub mod wasi { result37_5, result37_6, ) = match e { - ErrorCode::DnsTimeout => ( - 0i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::DnsTimeout => { + ( + 0i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::DnsError(e) => { let DnsErrorPayload { rcode: rcode0, @@ -6259,7 +6472,6 @@ pub mod wasi { let vec1 = e; let ptr1 = vec1.as_ptr().cast::(); let len1 = vec1.len(); - (1i32, ptr1.cast_mut(), len1) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -6272,8 +6484,7 @@ pub mod wasi { 1i32, result2_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result2_1); t }, @@ -6283,114 +6494,138 @@ pub mod wasi { 0i32, ) } - ErrorCode::DestinationNotFound => ( - 2i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::DestinationUnavailable => ( - 3i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::DestinationIpProhibited => ( - 4i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::DestinationIpUnroutable => ( - 5i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionRefused => ( - 6i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionTerminated => ( - 7i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionTimeout => ( - 8i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionReadTimeout => ( - 9i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionWriteTimeout => ( - 10i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConnectionLimitReached => ( - 11i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::TlsProtocolError => ( - 12i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::TlsCertificateError => ( - 13i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::DestinationNotFound => { + ( + 2i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::DestinationUnavailable => { + ( + 3i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::DestinationIpProhibited => { + ( + 4i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::DestinationIpUnroutable => { + ( + 5i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionRefused => { + ( + 6i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionTerminated => { + ( + 7i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionTimeout => { + ( + 8i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionReadTimeout => { + ( + 9i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionWriteTimeout => { + ( + 10i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConnectionLimitReached => { + ( + 11i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::TlsProtocolError => { + ( + 12i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::TlsCertificateError => { + ( + 13i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::TlsAlertReceived(e) => { let TlsAlertReceivedPayload { alert_id: alert_id4, @@ -6400,13 +6635,11 @@ pub mod wasi { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; - let (result7_0, result7_1, result7_2) = match alert_message4 - { + let (result7_0, result7_1, result7_2) = match alert_message4 { Some(e) => { let vec6 = e; let ptr6 = vec6.as_ptr().cast::(); let len6 = vec6.len(); - (1i32, ptr6.cast_mut(), len6) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -6414,33 +6647,35 @@ pub mod wasi { ( 14i32, result5_0, - ::core::mem::MaybeUninit::new( - i64::from(result5_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result5_1) as u64), result7_0 as *mut u8, result7_1, result7_2, 0i32, ) } - ErrorCode::HttpRequestDenied => ( - 15i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpRequestLengthRequired => ( - 16i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpRequestDenied => { + ( + 15i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestLengthRequired => { + ( + 16i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::HttpRequestBodySize(e) => { let (result8_0, result8_1) = match e { Some(e) => (1i32, _rt::as_i64(e)), @@ -6456,33 +6691,39 @@ pub mod wasi { 0i32, ) } - ErrorCode::HttpRequestMethodInvalid => ( - 18i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpRequestUriInvalid => ( - 19i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpRequestUriTooLong => ( - 20i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpRequestMethodInvalid => { + ( + 18i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestUriInvalid => { + ( + 19i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestUriTooLong => { + ( + 20i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::HttpRequestHeaderSectionSize(e) => { let (result9_0, result9_1) = match e { Some(e) => (1i32, _rt::as_i32(e)), @@ -6491,9 +6732,7 @@ pub mod wasi { ( 21i32, result9_0, - ::core::mem::MaybeUninit::new( - i64::from(result9_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result9_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -6514,43 +6753,36 @@ pub mod wasi { field_name: field_name10, field_size: field_size10, } = e; - let (result12_0, result12_1, result12_2) = - match field_name10 { - Some(e) => { - let vec11 = e; - let ptr11 = vec11.as_ptr().cast::(); - let len11 = vec11.len(); - - (1i32, ptr11.cast_mut(), len11) - } - None => { - (0i32, ::core::ptr::null_mut(), 0usize) - } - }; + let (result12_0, result12_1, result12_2) = match field_name10 { + Some(e) => { + let vec11 = e; + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + (1i32, ptr11.cast_mut(), len11) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result13_0, result13_1) = match field_size10 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( - 1i32, result12_0, result12_1, result12_2, - result13_0, result13_1, + 1i32, + result12_0, + result12_1, + result12_2, + result13_0, + result13_1, ) } - None => ( - 0i32, - 0i32, - ::core::ptr::null_mut(), - 0usize, - 0i32, - 0i32, - ), + None => { + (0i32, 0i32, ::core::ptr::null_mut(), 0usize, 0i32, 0i32) + } }; ( 22i32, result14_0, - ::core::mem::MaybeUninit::new( - i64::from(result14_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result14_1) as u64), result14_2, result14_3 as *mut u8, result14_4 as usize, @@ -6565,9 +6797,7 @@ pub mod wasi { ( 23i32, result15_0, - ::core::mem::MaybeUninit::new( - i64::from(result15_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result15_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -6579,17 +6809,15 @@ pub mod wasi { field_name: field_name16, field_size: field_size16, } = e; - let (result18_0, result18_1, result18_2) = - match field_name16 { - Some(e) => { - let vec17 = e; - let ptr17 = vec17.as_ptr().cast::(); - let len17 = vec17.len(); - - (1i32, ptr17.cast_mut(), len17) - } - None => (0i32, ::core::ptr::null_mut(), 0usize), - }; + let (result18_0, result18_1, result18_2) = match field_name16 { + Some(e) => { + let vec17 = e; + let ptr17 = vec17.as_ptr().cast::(); + let len17 = vec17.len(); + (1i32, ptr17.cast_mut(), len17) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result19_0, result19_1) = match field_size16 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), @@ -6598,8 +6826,7 @@ pub mod wasi { 24i32, result18_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result18_1); t }, @@ -6609,15 +6836,17 @@ pub mod wasi { 0i32, ) } - ErrorCode::HttpResponseIncomplete => ( - 25i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpResponseIncomplete => { + ( + 25i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::HttpResponseHeaderSectionSize(e) => { let (result20_0, result20_1) = match e { Some(e) => (1i32, _rt::as_i32(e)), @@ -6626,9 +6855,7 @@ pub mod wasi { ( 26i32, result20_0, - ::core::mem::MaybeUninit::new( - i64::from(result20_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result20_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -6640,17 +6867,15 @@ pub mod wasi { field_name: field_name21, field_size: field_size21, } = e; - let (result23_0, result23_1, result23_2) = - match field_name21 { - Some(e) => { - let vec22 = e; - let ptr22 = vec22.as_ptr().cast::(); - let len22 = vec22.len(); - - (1i32, ptr22.cast_mut(), len22) - } - None => (0i32, ::core::ptr::null_mut(), 0usize), - }; + let (result23_0, result23_1, result23_2) = match field_name21 { + Some(e) => { + let vec22 = e; + let ptr22 = vec22.as_ptr().cast::(); + let len22 = vec22.len(); + (1i32, ptr22.cast_mut(), len22) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result24_0, result24_1) = match field_size21 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), @@ -6659,8 +6884,7 @@ pub mod wasi { 27i32, result23_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result23_1); t }, @@ -6693,9 +6917,7 @@ pub mod wasi { ( 29i32, result26_0, - ::core::mem::MaybeUninit::new( - i64::from(result26_1) as u64 - ), + ::core::mem::MaybeUninit::new(i64::from(result26_1) as u64), ::core::ptr::null_mut(), ::core::ptr::null_mut(), 0usize, @@ -6707,17 +6929,15 @@ pub mod wasi { field_name: field_name27, field_size: field_size27, } = e; - let (result29_0, result29_1, result29_2) = - match field_name27 { - Some(e) => { - let vec28 = e; - let ptr28 = vec28.as_ptr().cast::(); - let len28 = vec28.len(); - - (1i32, ptr28.cast_mut(), len28) - } - None => (0i32, ::core::ptr::null_mut(), 0usize), - }; + let (result29_0, result29_1, result29_2) = match field_name27 { + Some(e) => { + let vec28 = e; + let ptr28 = vec28.as_ptr().cast::(); + let len28 = vec28.len(); + (1i32, ptr28.cast_mut(), len28) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; let (result30_0, result30_1) = match field_size27 { Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), @@ -6726,8 +6946,7 @@ pub mod wasi { 30i32, result29_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result29_1); t }, @@ -6743,7 +6962,6 @@ pub mod wasi { let vec31 = e; let ptr31 = vec31.as_ptr().cast::(); let len31 = vec31.len(); - (1i32, ptr31.cast_mut(), len31) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -6752,8 +6970,7 @@ pub mod wasi { 31i32, result32_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result32_1); t }, @@ -6769,7 +6986,6 @@ pub mod wasi { let vec33 = e; let ptr33 = vec33.as_ptr().cast::(); let len33 = vec33.len(); - (1i32, ptr33.cast_mut(), len33) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -6778,8 +6994,7 @@ pub mod wasi { 32i32, result34_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result34_1); t }, @@ -6789,58 +7004,67 @@ pub mod wasi { 0i32, ) } - ErrorCode::HttpResponseTimeout => ( - 33i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpUpgradeFailed => ( - 34i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::HttpProtocolError => ( - 35i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::LoopDetected => ( - 36i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), - ErrorCode::ConfigurationError => ( - 37i32, - 0i32, - ::core::mem::MaybeUninit::::zeroed(), - ::core::ptr::null_mut(), - ::core::ptr::null_mut(), - 0usize, - 0i32, - ), + ErrorCode::HttpResponseTimeout => { + ( + 33i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpUpgradeFailed => { + ( + 34i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpProtocolError => { + ( + 35i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::LoopDetected => { + ( + 36i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::ConfigurationError => { + ( + 37i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } ErrorCode::InternalError(e) => { let (result36_0, result36_1, result36_2) = match e { Some(e) => { let vec35 = e; let ptr35 = vec35.as_ptr().cast::(); let len35 = vec35.len(); - (1i32, ptr35.cast_mut(), len35) } None => (0i32, ::core::ptr::null_mut(), 0usize), @@ -6849,8 +7073,7 @@ pub mod wasi { 38i32, result36_0, { - let mut t = - ::core::mem::MaybeUninit::::uninit(); + let mut t = ::core::mem::MaybeUninit::::uninit(); t.as_mut_ptr().cast::<*mut u8>().write(result36_1); t }, @@ -6861,18 +7084,23 @@ pub mod wasi { ) } }; - ( - 1i32, result37_0, result37_1, result37_2, result37_3, - result37_4, result37_5, result37_6, + 1i32, + result37_0, + result37_1, + result37_2, + result37_3, + result37_4, + result37_5, + result37_6, ) } }; #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[static]response-outparam.set"] - fn wit_import( + fn wit_import39( _: i32, _: i32, _: i32, @@ -6884,9 +7112,8 @@ pub mod wasi { _: i32, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import39( _: i32, _: i32, _: i32, @@ -6899,7 +7126,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import39( (¶m).take_handle() as i32, result38_0, result38_1, @@ -6919,17 +7146,16 @@ pub mod wasi { pub fn status(&self) -> StatusCode { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-response.status"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); ret as u16 } } @@ -6946,17 +7172,16 @@ pub mod wasi { pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-response.headers"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); Fields::from_handle(ret as u32) } } @@ -6969,27 +7194,27 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-response.consume"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - IncomingBody::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + IncomingBody::from_handle(l3 as u32) }; Ok(e) } @@ -6998,7 +7223,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -7023,28 +7249,28 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]incoming-body.stream"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - + let l3 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::InputStream::from_handle( - l2 as u32, + l3 as u32, ) }; Ok(e) @@ -7054,7 +7280,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -7065,17 +7292,16 @@ pub mod wasi { pub fn finish(this: IncomingBody) -> FutureTrailers { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[static]incoming-body.finish"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((&this).take_handle() as i32); + let ret = wit_import0((&this).take_handle() as i32); FutureTrailers::from_handle(ret as u32) } } @@ -7083,29 +7309,30 @@ pub mod wasi { impl FutureTrailers { #[allow(unused_unsafe, clippy::all)] /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, + /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]future-trailers.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } impl FutureTrailers { #[allow(unused_unsafe, clippy::all)] - /// Returns the contents of the trailers, or an error which occured, + /// Returns the contents of the trailers, or an error which occurred, /// once the future is ready. /// /// The outer `option` represents future readiness. Users can wait on this @@ -7117,561 +7344,505 @@ pub mod wasi { /// /// The inner `result` represents that either the HTTP Request or Response /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether + /// error occurred receiving them. The optional `trailers` indicates whether /// or not trailers were present in the body. /// /// When some `trailers` are returned by this method, the `trailers` /// resource is immutable, and a child. Use of the `set`, `append`, or /// `delete` methods will return an error, and the resource must be /// dropped before the parent `future-trailers` is dropped. - pub fn get(&self) -> Option, ErrorCode>, ()>> { + pub fn get( + &self, + ) -> Option, ErrorCode>, ()>> { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 56]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 56]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 56], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]future-trailers.get"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result70 = match l2 { 0 => None, 1 => { let e = { - let l2 = i32::from(*ptr0.add(8).cast::()); - - match l2 { + let l3 = i32::from(*ptr0.add(8).cast::()); + match l3 { 0 => { let e = { - let l3 = i32::from(*ptr0.add(16).cast::()); - - match l3 { + let l4 = i32::from(*ptr0.add(16).cast::()); + match l4 { 0 => { - let e = - { - let l4 = i32::from( - *ptr0.add(24).cast::(), - ); - - match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *ptr0.add(28).cast::(); - - Fields::from_handle(l5 as u32) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; + let e = { + let l5 = i32::from(*ptr0.add(24).cast::()); + match l5 { + 0 => None, + 1 => { + let e = { + let l6 = *ptr0.add(28).cast::(); + Fields::from_handle(l6 as u32) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; Ok(e) } 1 => { let e = { - let l6 = i32::from( - *ptr0.add(24).cast::(), - ); - let v68 = match l6 { - 0 => { - ErrorCode::DnsTimeout - } - 1 => { - let e68 = { - let l7 = i32::from(*ptr0.add(32).cast::()); - let l11 = i32::from(*ptr0.add(44).cast::()); - - DnsErrorPayload{ - rcode: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr0.add(36).cast::<*mut u8>(); - let l9 = *ptr0.add(40).cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts(l8.cast(), len10, len10); - - _rt::string_lift(bytes10) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = i32::from(*ptr0.add(46).cast::()); - - l12 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e68) - } - 2 => { - ErrorCode::DestinationNotFound - } - 3 => { - ErrorCode::DestinationUnavailable - } - 4 => { - ErrorCode::DestinationIpProhibited - } - 5 => { - ErrorCode::DestinationIpUnroutable - } - 6 => { - ErrorCode::ConnectionRefused - } - 7 => { - ErrorCode::ConnectionTerminated - } - 8 => { - ErrorCode::ConnectionTimeout - } - 9 => { - ErrorCode::ConnectionReadTimeout - } - 10 => { - ErrorCode::ConnectionWriteTimeout - } - 11 => { - ErrorCode::ConnectionLimitReached - } - 12 => { - ErrorCode::TlsProtocolError - } - 13 => { - ErrorCode::TlsCertificateError - } - 14 => { - let e68 = { - let l13 = i32::from(*ptr0.add(32).cast::()); - let l15 = i32::from(*ptr0.add(36).cast::()); - - TlsAlertReceivedPayload{ - alert_id: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = i32::from(*ptr0.add(33).cast::()); - - l14 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l15 { - 0 => None, - 1 => { - let e = { - let l16 = *ptr0.add(40).cast::<*mut u8>(); - let l17 = *ptr0.add(44).cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); - - _rt::string_lift(bytes18) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e68) - } - 15 => { - ErrorCode::HttpRequestDenied - } - 16 => { - ErrorCode::HttpRequestLengthRequired - } - 17 => { - let e68 = { - let l19 = i32::from(*ptr0.add(32).cast::()); - - match l19 { - 0 => None, - 1 => { - let e = { - let l20 = *ptr0.add(40).cast::(); - - l20 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e68) - } - 18 => { - ErrorCode::HttpRequestMethodInvalid - } - 19 => { - ErrorCode::HttpRequestUriInvalid - } - 20 => { - ErrorCode::HttpRequestUriTooLong - } - 21 => { - let e68 = { - let l21 = i32::from(*ptr0.add(32).cast::()); - - match l21 { - 0 => None, - 1 => { - let e = { - let l22 = *ptr0.add(36).cast::(); - - l22 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e68) - } - 22 => { - let e68 = { - let l23 = i32::from(*ptr0.add(32).cast::()); - - match l23 { - 0 => None, - 1 => { - let e = { - let l24 = i32::from(*ptr0.add(36).cast::()); - let l28 = i32::from(*ptr0.add(48).cast::()); - - FieldSizePayload{ - field_name: match l24 { - 0 => None, - 1 => { - let e = { - let l25 = *ptr0.add(40).cast::<*mut u8>(); - let l26 = *ptr0.add(44).cast::(); - let len27 = l26; - let bytes27 = _rt::Vec::from_raw_parts(l25.cast(), len27, len27); - - _rt::string_lift(bytes27) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *ptr0.add(52).cast::(); - - l29 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e68) - } - 23 => { - let e68 = { - let l30 = i32::from(*ptr0.add(32).cast::()); - - match l30 { - 0 => None, - 1 => { - let e = { - let l31 = *ptr0.add(36).cast::(); - - l31 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e68) - } - 24 => { - let e68 = { - let l32 = i32::from(*ptr0.add(32).cast::()); - let l36 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *ptr0.add(36).cast::<*mut u8>(); - let l34 = *ptr0.add(40).cast::(); - let len35 = l34; - let bytes35 = _rt::Vec::from_raw_parts(l33.cast(), len35, len35); - - _rt::string_lift(bytes35) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *ptr0.add(48).cast::(); - - l37 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e68) - } - 25 => { - ErrorCode::HttpResponseIncomplete - } - 26 => { - let e68 = { - let l38 = i32::from(*ptr0.add(32).cast::()); - - match l38 { - 0 => None, - 1 => { - let e = { - let l39 = *ptr0.add(36).cast::(); - - l39 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e68) - } - 27 => { - let e68 = { - let l40 = i32::from(*ptr0.add(32).cast::()); - let l44 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l40 { - 0 => None, - 1 => { - let e = { - let l41 = *ptr0.add(36).cast::<*mut u8>(); - let l42 = *ptr0.add(40).cast::(); - let len43 = l42; - let bytes43 = _rt::Vec::from_raw_parts(l41.cast(), len43, len43); - - _rt::string_lift(bytes43) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l44 { - 0 => None, - 1 => { - let e = { - let l45 = *ptr0.add(48).cast::(); - - l45 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e68) - } - 28 => { - let e68 = { - let l46 = i32::from(*ptr0.add(32).cast::()); - - match l46 { - 0 => None, - 1 => { - let e = { - let l47 = *ptr0.add(40).cast::(); - - l47 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e68) - } - 29 => { - let e68 = { - let l48 = i32::from(*ptr0.add(32).cast::()); - - match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr0.add(36).cast::(); - - l49 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e68) - } - 30 => { - let e68 = { - let l50 = i32::from(*ptr0.add(32).cast::()); - let l54 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l50 { - 0 => None, - 1 => { - let e = { - let l51 = *ptr0.add(36).cast::<*mut u8>(); - let l52 = *ptr0.add(40).cast::(); - let len53 = l52; - let bytes53 = _rt::Vec::from_raw_parts(l51.cast(), len53, len53); - - _rt::string_lift(bytes53) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *ptr0.add(48).cast::(); - - l55 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e68) - } - 31 => { - let e68 = { - let l56 = i32::from(*ptr0.add(32).cast::()); - - match l56 { - 0 => None, - 1 => { - let e = { - let l57 = *ptr0.add(36).cast::<*mut u8>(); - let l58 = *ptr0.add(40).cast::(); - let len59 = l58; - let bytes59 = _rt::Vec::from_raw_parts(l57.cast(), len59, len59); - - _rt::string_lift(bytes59) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e68) - } - 32 => { - let e68 = { - let l60 = i32::from(*ptr0.add(32).cast::()); - - match l60 { - 0 => None, - 1 => { - let e = { - let l61 = *ptr0.add(36).cast::<*mut u8>(); - let l62 = *ptr0.add(40).cast::(); - let len63 = l62; - let bytes63 = _rt::Vec::from_raw_parts(l61.cast(), len63, len63); - - _rt::string_lift(bytes63) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e68) - } - 33 => { - ErrorCode::HttpResponseTimeout - } - 34 => { - ErrorCode::HttpUpgradeFailed - } - 35 => { - ErrorCode::HttpProtocolError - } - 36 => { - ErrorCode::LoopDetected - } - 37 => { - ErrorCode::ConfigurationError - } - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e68 = { - let l64 = i32::from(*ptr0.add(32).cast::()); - - match l64 { - 0 => None, - 1 => { - let e = { - let l65 = *ptr0.add(36).cast::<*mut u8>(); - let l66 = *ptr0.add(40).cast::(); - let len67 = l66; - let bytes67 = _rt::Vec::from_raw_parts(l65.cast(), len67, len67); - - _rt::string_lift(bytes67) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e68) - } - }; - - v68 + let l7 = i32::from(*ptr0.add(24).cast::()); + let v69 = match l7 { + 0 => ErrorCode::DnsTimeout, + 1 => { + let e69 = { + let l8 = i32::from(*ptr0.add(32).cast::()); + let l12 = i32::from(*ptr0.add(44).cast::()); + DnsErrorPayload { + rcode: match l8 { + 0 => None, + 1 => { + let e = { + let l9 = *ptr0.add(36).cast::<*mut u8>(); + let l10 = *ptr0.add(40).cast::(); + let len11 = l10; + let bytes11 = _rt::Vec::from_raw_parts( + l9.cast(), + len11, + len11, + ); + _rt::string_lift(bytes11) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l12 { + 0 => None, + 1 => { + let e = { + let l13 = i32::from(*ptr0.add(46).cast::()); + l13 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e69) + } + 2 => ErrorCode::DestinationNotFound, + 3 => ErrorCode::DestinationUnavailable, + 4 => ErrorCode::DestinationIpProhibited, + 5 => ErrorCode::DestinationIpUnroutable, + 6 => ErrorCode::ConnectionRefused, + 7 => ErrorCode::ConnectionTerminated, + 8 => ErrorCode::ConnectionTimeout, + 9 => ErrorCode::ConnectionReadTimeout, + 10 => ErrorCode::ConnectionWriteTimeout, + 11 => ErrorCode::ConnectionLimitReached, + 12 => ErrorCode::TlsProtocolError, + 13 => ErrorCode::TlsCertificateError, + 14 => { + let e69 = { + let l14 = i32::from(*ptr0.add(32).cast::()); + let l16 = i32::from(*ptr0.add(36).cast::()); + TlsAlertReceivedPayload { + alert_id: match l14 { + 0 => None, + 1 => { + let e = { + let l15 = i32::from(*ptr0.add(33).cast::()); + l15 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l16 { + 0 => None, + 1 => { + let e = { + let l17 = *ptr0.add(40).cast::<*mut u8>(); + let l18 = *ptr0.add(44).cast::(); + let len19 = l18; + let bytes19 = _rt::Vec::from_raw_parts( + l17.cast(), + len19, + len19, + ); + _rt::string_lift(bytes19) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::TlsAlertReceived(e69) + } + 15 => ErrorCode::HttpRequestDenied, + 16 => ErrorCode::HttpRequestLengthRequired, + 17 => { + let e69 = { + let l20 = i32::from(*ptr0.add(32).cast::()); + match l20 { + 0 => None, + 1 => { + let e = { + let l21 = *ptr0.add(40).cast::(); + l21 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e69) + } + 18 => ErrorCode::HttpRequestMethodInvalid, + 19 => ErrorCode::HttpRequestUriInvalid, + 20 => ErrorCode::HttpRequestUriTooLong, + 21 => { + let e69 = { + let l22 = i32::from(*ptr0.add(32).cast::()); + match l22 { + 0 => None, + 1 => { + let e = { + let l23 = *ptr0.add(36).cast::(); + l23 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e69) + } + 22 => { + let e69 = { + let l24 = i32::from(*ptr0.add(32).cast::()); + match l24 { + 0 => None, + 1 => { + let e = { + let l25 = i32::from(*ptr0.add(36).cast::()); + let l29 = i32::from(*ptr0.add(48).cast::()); + FieldSizePayload { + field_name: match l25 { + 0 => None, + 1 => { + let e = { + let l26 = *ptr0.add(40).cast::<*mut u8>(); + let l27 = *ptr0.add(44).cast::(); + let len28 = l27; + let bytes28 = _rt::Vec::from_raw_parts( + l26.cast(), + len28, + len28, + ); + _rt::string_lift(bytes28) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l29 { + 0 => None, + 1 => { + let e = { + let l30 = *ptr0.add(52).cast::(); + l30 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e69) + } + 23 => { + let e69 = { + let l31 = i32::from(*ptr0.add(32).cast::()); + match l31 { + 0 => None, + 1 => { + let e = { + let l32 = *ptr0.add(36).cast::(); + l32 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e69) + } + 24 => { + let e69 = { + let l33 = i32::from(*ptr0.add(32).cast::()); + let l37 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l33 { + 0 => None, + 1 => { + let e = { + let l34 = *ptr0.add(36).cast::<*mut u8>(); + let l35 = *ptr0.add(40).cast::(); + let len36 = l35; + let bytes36 = _rt::Vec::from_raw_parts( + l34.cast(), + len36, + len36, + ); + _rt::string_lift(bytes36) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l37 { + 0 => None, + 1 => { + let e = { + let l38 = *ptr0.add(48).cast::(); + l38 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e69) + } + 25 => ErrorCode::HttpResponseIncomplete, + 26 => { + let e69 = { + let l39 = i32::from(*ptr0.add(32).cast::()); + match l39 { + 0 => None, + 1 => { + let e = { + let l40 = *ptr0.add(36).cast::(); + l40 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e69) + } + 27 => { + let e69 = { + let l41 = i32::from(*ptr0.add(32).cast::()); + let l45 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l41 { + 0 => None, + 1 => { + let e = { + let l42 = *ptr0.add(36).cast::<*mut u8>(); + let l43 = *ptr0.add(40).cast::(); + let len44 = l43; + let bytes44 = _rt::Vec::from_raw_parts( + l42.cast(), + len44, + len44, + ); + _rt::string_lift(bytes44) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l45 { + 0 => None, + 1 => { + let e = { + let l46 = *ptr0.add(48).cast::(); + l46 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e69) + } + 28 => { + let e69 = { + let l47 = i32::from(*ptr0.add(32).cast::()); + match l47 { + 0 => None, + 1 => { + let e = { + let l48 = *ptr0.add(40).cast::(); + l48 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e69) + } + 29 => { + let e69 = { + let l49 = i32::from(*ptr0.add(32).cast::()); + match l49 { + 0 => None, + 1 => { + let e = { + let l50 = *ptr0.add(36).cast::(); + l50 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e69) + } + 30 => { + let e69 = { + let l51 = i32::from(*ptr0.add(32).cast::()); + let l55 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l51 { + 0 => None, + 1 => { + let e = { + let l52 = *ptr0.add(36).cast::<*mut u8>(); + let l53 = *ptr0.add(40).cast::(); + let len54 = l53; + let bytes54 = _rt::Vec::from_raw_parts( + l52.cast(), + len54, + len54, + ); + _rt::string_lift(bytes54) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l55 { + 0 => None, + 1 => { + let e = { + let l56 = *ptr0.add(48).cast::(); + l56 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e69) + } + 31 => { + let e69 = { + let l57 = i32::from(*ptr0.add(32).cast::()); + match l57 { + 0 => None, + 1 => { + let e = { + let l58 = *ptr0.add(36).cast::<*mut u8>(); + let l59 = *ptr0.add(40).cast::(); + let len60 = l59; + let bytes60 = _rt::Vec::from_raw_parts( + l58.cast(), + len60, + len60, + ); + _rt::string_lift(bytes60) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e69) + } + 32 => { + let e69 = { + let l61 = i32::from(*ptr0.add(32).cast::()); + match l61 { + 0 => None, + 1 => { + let e = { + let l62 = *ptr0.add(36).cast::<*mut u8>(); + let l63 = *ptr0.add(40).cast::(); + let len64 = l63; + let bytes64 = _rt::Vec::from_raw_parts( + l62.cast(), + len64, + len64, + ); + _rt::string_lift(bytes64) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e69) + } + 33 => ErrorCode::HttpResponseTimeout, + 34 => ErrorCode::HttpUpgradeFailed, + 35 => ErrorCode::HttpProtocolError, + 36 => ErrorCode::LoopDetected, + 37 => ErrorCode::ConfigurationError, + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e69 = { + let l65 = i32::from(*ptr0.add(32).cast::()); + match l65 { + 0 => None, + 1 => { + let e = { + let l66 = *ptr0.add(36).cast::<*mut u8>(); + let l67 = *ptr0.add(40).cast::(); + let len68 = l67; + let bytes68 = _rt::Vec::from_raw_parts( + l66.cast(), + len68, + len68, + ); + _rt::string_lift(bytes68) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e69) + } + }; + v69 }; Err(e) } @@ -7690,7 +7861,8 @@ pub mod wasi { Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result70 } } } @@ -7704,17 +7876,16 @@ pub mod wasi { pub fn new(headers: Headers) -> Self { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[constructor]outgoing-response"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((&headers).take_handle() as i32); + let ret = wit_import0((&headers).take_handle() as i32); OutgoingResponse::from_handle(ret as u32) } } @@ -7725,17 +7896,16 @@ pub mod wasi { pub fn status_code(&self) -> StatusCode { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-response.status-code"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); ret as u16 } } @@ -7744,20 +7914,25 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Set the HTTP Status Code for the Response. Fails if the status-code /// given is not a valid http status code. - pub fn set_status_code(&self, status_code: StatusCode) -> Result<(), ()> { + pub fn set_status_code( + &self, + status_code: StatusCode, + ) -> Result<(), ()> { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-response.set-status-code"] - fn wit_import(_: i32, _: i32) -> i32; + fn wit_import0(_: i32, _: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) -> i32 { + extern "C" fn wit_import0(_: i32, _: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, _rt::as_i32(status_code)); + let ret = wit_import0( + (self).handle() as i32, + _rt::as_i32(status_code), + ); match ret { 0 => { let e = (); @@ -7780,22 +7955,21 @@ pub mod wasi { /// `delete` operations will fail with `header-error.immutable`. /// /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to + /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. pub fn headers(&self) -> Headers { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-response.headers"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); Fields::from_handle(ret as u32) } } @@ -7811,27 +7985,27 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-response.body"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - OutgoingBody::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + OutgoingBody::from_handle(l3 as u32) }; Ok(e) } @@ -7840,7 +8014,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -7859,27 +8034,29 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]outgoing-body.write"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - super::super::super::wasi::io::streams::OutputStream::from_handle(l2 as u32) + let l3 = *ptr0.add(4).cast::(); + super::super::super::wasi::io::streams::OutputStream::from_handle( + l3 as u32, + ) }; Ok(e) } @@ -7888,7 +8065,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -7910,72 +8088,70 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 40]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 40], + ); let (result0_0, result0_1) = match &trailers { Some(e) => (1i32, (e).take_handle() as i32), None => (0i32, 0i32), }; let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[static]outgoing-body.finish"] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8); + fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((&this).take_handle() as i32, result0_0, result0_1, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2( + (&this).take_handle() as i32, + result0_0, + result0_1, + ptr1, + ); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result67 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr1.add(8).cast::()); - let v65 = match l3 { + let l4 = i32::from(*ptr1.add(8).cast::()); + let v66 = match l4 { 0 => ErrorCode::DnsTimeout, 1 => { - let e65 = { - let l4 = i32::from(*ptr1.add(16).cast::()); - let l8 = i32::from(*ptr1.add(28).cast::()); - + let e66 = { + let l5 = i32::from(*ptr1.add(16).cast::()); + let l9 = i32::from(*ptr1.add(28).cast::()); DnsErrorPayload { - rcode: match l4 { + rcode: match l5 { 0 => None, 1 => { let e = { - let l5 = - *ptr1.add(20).cast::<*mut u8>(); - let l6 = - *ptr1.add(24).cast::(); - let len7 = l6; - let bytes7 = - _rt::Vec::from_raw_parts( - l5.cast(), - len7, - len7, - ); - - _rt::string_lift(bytes7) + let l6 = *ptr1.add(20).cast::<*mut u8>(); + let l7 = *ptr1.add(24).cast::(); + let len8 = l7; + let bytes8 = _rt::Vec::from_raw_parts( + l6.cast(), + len8, + len8, + ); + _rt::string_lift(bytes8) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - info_code: match l8 { + info_code: match l9 { 0 => None, 1 => { let e = { - let l9 = i32::from( - *ptr1.add(30).cast::(), - ); - - l9 as u16 + let l10 = i32::from(*ptr1.add(30).cast::()); + l10 as u16 }; Some(e) } @@ -7983,7 +8159,7 @@ pub mod wasi { }, } }; - ErrorCode::DnsError(e65) + ErrorCode::DnsError(e66) } 2 => ErrorCode::DestinationNotFound, 3 => ErrorCode::DestinationUnavailable, @@ -7998,42 +8174,34 @@ pub mod wasi { 12 => ErrorCode::TlsProtocolError, 13 => ErrorCode::TlsCertificateError, 14 => { - let e65 = { - let l10 = i32::from(*ptr1.add(16).cast::()); - let l12 = i32::from(*ptr1.add(20).cast::()); - + let e66 = { + let l11 = i32::from(*ptr1.add(16).cast::()); + let l13 = i32::from(*ptr1.add(20).cast::()); TlsAlertReceivedPayload { - alert_id: match l10 { + alert_id: match l11 { 0 => None, 1 => { let e = { - let l11 = i32::from( - *ptr1.add(17).cast::(), - ); - - l11 as u8 + let l12 = i32::from(*ptr1.add(17).cast::()); + l12 as u8 }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - alert_message: match l12 { + alert_message: match l13 { 0 => None, 1 => { let e = { - let l13 = - *ptr1.add(24).cast::<*mut u8>(); - let l14 = - *ptr1.add(28).cast::(); - let len15 = l14; - let bytes15 = - _rt::Vec::from_raw_parts( - l13.cast(), - len15, - len15, - ); - - _rt::string_lift(bytes15) + let l14 = *ptr1.add(24).cast::<*mut u8>(); + let l15 = *ptr1.add(28).cast::(); + let len16 = l15; + let bytes16 = _rt::Vec::from_raw_parts( + l14.cast(), + len16, + len16, + ); + _rt::string_lift(bytes16) }; Some(e) } @@ -8041,158 +8209,141 @@ pub mod wasi { }, } }; - ErrorCode::TlsAlertReceived(e65) + ErrorCode::TlsAlertReceived(e66) } 15 => ErrorCode::HttpRequestDenied, 16 => ErrorCode::HttpRequestLengthRequired, 17 => { - let e65 = { - let l16 = i32::from(*ptr1.add(16).cast::()); - - match l16 { + let e66 = { + let l17 = i32::from(*ptr1.add(16).cast::()); + match l17 { 0 => None, 1 => { let e = { - let l17 = *ptr1.add(24).cast::(); - - l17 as u64 + let l18 = *ptr1.add(24).cast::(); + l18 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestBodySize(e65) + ErrorCode::HttpRequestBodySize(e66) } 18 => ErrorCode::HttpRequestMethodInvalid, 19 => ErrorCode::HttpRequestUriInvalid, 20 => ErrorCode::HttpRequestUriTooLong, 21 => { - let e65 = { - let l18 = i32::from(*ptr1.add(16).cast::()); - - match l18 { + let e66 = { + let l19 = i32::from(*ptr1.add(16).cast::()); + match l19 { 0 => None, 1 => { let e = { - let l19 = *ptr1.add(20).cast::(); - - l19 as u32 + let l20 = *ptr1.add(20).cast::(); + l20 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestHeaderSectionSize(e65) + ErrorCode::HttpRequestHeaderSectionSize(e66) } 22 => { - let e65 = { - let l20 = i32::from(*ptr1.add(16).cast::()); - - match l20 { + let e66 = { + let l21 = i32::from(*ptr1.add(16).cast::()); + match l21 { 0 => None, 1 => { let e = { - let l21 = i32::from( - *ptr1.add(20).cast::(), - ); - let l25 = i32::from( - *ptr1.add(32).cast::(), - ); - - FieldSizePayload{ - field_name: match l21 { - 0 => None, - 1 => { - let e = { - let l22 = *ptr1.add(24).cast::<*mut u8>(); - let l23 = *ptr1.add(28).cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - - _rt::string_lift(bytes24) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l25 { - 0 => None, - 1 => { - let e = { - let l26 = *ptr1.add(36).cast::(); - - l26 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let l22 = i32::from(*ptr1.add(20).cast::()); + let l26 = i32::from(*ptr1.add(32).cast::()); + FieldSizePayload { + field_name: match l22 { + 0 => None, + 1 => { + let e = { + let l23 = *ptr1.add(24).cast::<*mut u8>(); + let l24 = *ptr1.add(28).cast::(); + let len25 = l24; + let bytes25 = _rt::Vec::from_raw_parts( + l23.cast(), + len25, + len25, + ); + _rt::string_lift(bytes25) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l26 { + 0 => None, + 1 => { + let e = { + let l27 = *ptr1.add(36).cast::(); + l27 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestHeaderSize(e65) + ErrorCode::HttpRequestHeaderSize(e66) } 23 => { - let e65 = { - let l27 = i32::from(*ptr1.add(16).cast::()); - - match l27 { + let e66 = { + let l28 = i32::from(*ptr1.add(16).cast::()); + match l28 { 0 => None, 1 => { let e = { - let l28 = *ptr1.add(20).cast::(); - - l28 as u32 + let l29 = *ptr1.add(20).cast::(); + l29 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpRequestTrailerSectionSize(e65) + ErrorCode::HttpRequestTrailerSectionSize(e66) } 24 => { - let e65 = { - let l29 = i32::from(*ptr1.add(16).cast::()); - let l33 = i32::from(*ptr1.add(28).cast::()); - + let e66 = { + let l30 = i32::from(*ptr1.add(16).cast::()); + let l34 = i32::from(*ptr1.add(28).cast::()); FieldSizePayload { - field_name: match l29 { + field_name: match l30 { 0 => None, 1 => { let e = { - let l30 = - *ptr1.add(20).cast::<*mut u8>(); - let l31 = - *ptr1.add(24).cast::(); - let len32 = l31; - let bytes32 = - _rt::Vec::from_raw_parts( - l30.cast(), - len32, - len32, - ); - - _rt::string_lift(bytes32) + let l31 = *ptr1.add(20).cast::<*mut u8>(); + let l32 = *ptr1.add(24).cast::(); + let len33 = l32; + let bytes33 = _rt::Vec::from_raw_parts( + l31.cast(), + len33, + len33, + ); + _rt::string_lift(bytes33) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - field_size: match l33 { + field_size: match l34 { 0 => None, 1 => { let e = { - let l34 = - *ptr1.add(32).cast::(); - - l34 as u32 + let l35 = *ptr1.add(32).cast::(); + l35 as u32 }; Some(e) } @@ -8200,64 +8351,55 @@ pub mod wasi { }, } }; - ErrorCode::HttpRequestTrailerSize(e65) + ErrorCode::HttpRequestTrailerSize(e66) } 25 => ErrorCode::HttpResponseIncomplete, 26 => { - let e65 = { - let l35 = i32::from(*ptr1.add(16).cast::()); - - match l35 { + let e66 = { + let l36 = i32::from(*ptr1.add(16).cast::()); + match l36 { 0 => None, 1 => { let e = { - let l36 = *ptr1.add(20).cast::(); - - l36 as u32 + let l37 = *ptr1.add(20).cast::(); + l37 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseHeaderSectionSize(e65) + ErrorCode::HttpResponseHeaderSectionSize(e66) } 27 => { - let e65 = { - let l37 = i32::from(*ptr1.add(16).cast::()); - let l41 = i32::from(*ptr1.add(28).cast::()); - + let e66 = { + let l38 = i32::from(*ptr1.add(16).cast::()); + let l42 = i32::from(*ptr1.add(28).cast::()); FieldSizePayload { - field_name: match l37 { + field_name: match l38 { 0 => None, 1 => { let e = { - let l38 = - *ptr1.add(20).cast::<*mut u8>(); - let l39 = - *ptr1.add(24).cast::(); - let len40 = l39; - let bytes40 = - _rt::Vec::from_raw_parts( - l38.cast(), - len40, - len40, - ); - - _rt::string_lift(bytes40) + let l39 = *ptr1.add(20).cast::<*mut u8>(); + let l40 = *ptr1.add(24).cast::(); + let len41 = l40; + let bytes41 = _rt::Vec::from_raw_parts( + l39.cast(), + len41, + len41, + ); + _rt::string_lift(bytes41) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - field_size: match l41 { + field_size: match l42 { 0 => None, 1 => { let e = { - let l42 = - *ptr1.add(32).cast::(); - - l42 as u32 + let l43 = *ptr1.add(32).cast::(); + l43 as u32 }; Some(e) } @@ -8265,82 +8407,71 @@ pub mod wasi { }, } }; - ErrorCode::HttpResponseHeaderSize(e65) + ErrorCode::HttpResponseHeaderSize(e66) } 28 => { - let e65 = { - let l43 = i32::from(*ptr1.add(16).cast::()); - - match l43 { + let e66 = { + let l44 = i32::from(*ptr1.add(16).cast::()); + match l44 { 0 => None, 1 => { let e = { - let l44 = *ptr1.add(24).cast::(); - - l44 as u64 + let l45 = *ptr1.add(24).cast::(); + l45 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseBodySize(e65) + ErrorCode::HttpResponseBodySize(e66) } 29 => { - let e65 = { - let l45 = i32::from(*ptr1.add(16).cast::()); - - match l45 { + let e66 = { + let l46 = i32::from(*ptr1.add(16).cast::()); + match l46 { 0 => None, 1 => { let e = { - let l46 = *ptr1.add(20).cast::(); - - l46 as u32 + let l47 = *ptr1.add(20).cast::(); + l47 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseTrailerSectionSize(e65) + ErrorCode::HttpResponseTrailerSectionSize(e66) } 30 => { - let e65 = { - let l47 = i32::from(*ptr1.add(16).cast::()); - let l51 = i32::from(*ptr1.add(28).cast::()); - + let e66 = { + let l48 = i32::from(*ptr1.add(16).cast::()); + let l52 = i32::from(*ptr1.add(28).cast::()); FieldSizePayload { - field_name: match l47 { + field_name: match l48 { 0 => None, 1 => { let e = { - let l48 = - *ptr1.add(20).cast::<*mut u8>(); - let l49 = - *ptr1.add(24).cast::(); - let len50 = l49; - let bytes50 = - _rt::Vec::from_raw_parts( - l48.cast(), - len50, - len50, - ); - - _rt::string_lift(bytes50) + let l49 = *ptr1.add(20).cast::<*mut u8>(); + let l50 = *ptr1.add(24).cast::(); + let len51 = l50; + let bytes51 = _rt::Vec::from_raw_parts( + l49.cast(), + len51, + len51, + ); + _rt::string_lift(bytes51) }; Some(e) } _ => _rt::invalid_enum_discriminant(), }, - field_size: match l51 { + field_size: match l52 { 0 => None, 1 => { let e = { - let l52 = - *ptr1.add(32).cast::(); - - l52 as u32 + let l53 = *ptr1.add(32).cast::(); + l53 as u32 }; Some(e) } @@ -8348,61 +8479,55 @@ pub mod wasi { }, } }; - ErrorCode::HttpResponseTrailerSize(e65) + ErrorCode::HttpResponseTrailerSize(e66) } 31 => { - let e65 = { - let l53 = i32::from(*ptr1.add(16).cast::()); - - match l53 { + let e66 = { + let l54 = i32::from(*ptr1.add(16).cast::()); + match l54 { 0 => None, 1 => { let e = { - let l54 = - *ptr1.add(20).cast::<*mut u8>(); - let l55 = *ptr1.add(24).cast::(); - let len56 = l55; - let bytes56 = _rt::Vec::from_raw_parts( - l54.cast(), - len56, - len56, + let l55 = *ptr1.add(20).cast::<*mut u8>(); + let l56 = *ptr1.add(24).cast::(); + let len57 = l56; + let bytes57 = _rt::Vec::from_raw_parts( + l55.cast(), + len57, + len57, ); - - _rt::string_lift(bytes56) + _rt::string_lift(bytes57) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseTransferCoding(e65) + ErrorCode::HttpResponseTransferCoding(e66) } 32 => { - let e65 = { - let l57 = i32::from(*ptr1.add(16).cast::()); - - match l57 { + let e66 = { + let l58 = i32::from(*ptr1.add(16).cast::()); + match l58 { 0 => None, 1 => { let e = { - let l58 = - *ptr1.add(20).cast::<*mut u8>(); - let l59 = *ptr1.add(24).cast::(); - let len60 = l59; - let bytes60 = _rt::Vec::from_raw_parts( - l58.cast(), - len60, - len60, + let l59 = *ptr1.add(20).cast::<*mut u8>(); + let l60 = *ptr1.add(24).cast::(); + let len61 = l60; + let bytes61 = _rt::Vec::from_raw_parts( + l59.cast(), + len61, + len61, ); - - _rt::string_lift(bytes60) + _rt::string_lift(bytes61) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::HttpResponseContentCoding(e65) + ErrorCode::HttpResponseContentCoding(e66) } 33 => ErrorCode::HttpResponseTimeout, 34 => ErrorCode::HttpUpgradeFailed, @@ -8411,63 +8536,61 @@ pub mod wasi { 37 => ErrorCode::ConfigurationError, n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e65 = { - let l61 = i32::from(*ptr1.add(16).cast::()); - - match l61 { + let e66 = { + let l62 = i32::from(*ptr1.add(16).cast::()); + match l62 { 0 => None, 1 => { let e = { - let l62 = - *ptr1.add(20).cast::<*mut u8>(); - let l63 = *ptr1.add(24).cast::(); - let len64 = l63; - let bytes64 = _rt::Vec::from_raw_parts( - l62.cast(), - len64, - len64, + let l63 = *ptr1.add(20).cast::<*mut u8>(); + let l64 = *ptr1.add(24).cast::(); + let len65 = l64; + let bytes65 = _rt::Vec::from_raw_parts( + l63.cast(), + len65, + len65, ); - - _rt::string_lift(bytes64) + _rt::string_lift(bytes65) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - ErrorCode::InternalError(e65) + ErrorCode::InternalError(e66) } }; - - v65 + v66 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result67 } } } impl FutureIncomingResponse { #[allow(unused_unsafe, clippy::all)] /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, + /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]future-incoming-response.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -8483,544 +8606,492 @@ pub mod wasi { /// is `some`, and error on subsequent calls. /// /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, + /// status and headers have received successfully, or that an error + /// occurred. Errors may also occur while consuming the response body, /// but those will be reported by the `incoming-body` and its /// `output-stream` child. - pub fn get(&self) -> Option, ()>> { + pub fn get( + &self, + ) -> Option, ()>> { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 56]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 56]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 56], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] + #[link(wasm_import_module = "wasi:http/types@0.2.4")] extern "C" { #[link_name = "[method]future-incoming-response.get"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result69 = match l2 { 0 => None, 1 => { let e = { - let l2 = i32::from(*ptr0.add(8).cast::()); - - match l2 { + let l3 = i32::from(*ptr0.add(8).cast::()); + match l3 { 0 => { let e = { - let l3 = i32::from(*ptr0.add(16).cast::()); - - match l3 { + let l4 = i32::from(*ptr0.add(16).cast::()); + match l4 { 0 => { let e = { - let l4 = *ptr0.add(24).cast::(); - - IncomingResponse::from_handle(l4 as u32) + let l5 = *ptr0.add(24).cast::(); + IncomingResponse::from_handle(l5 as u32) }; Ok(e) } 1 => { let e = { - let l5 = i32::from( - *ptr0.add(24).cast::(), - ); - let v67 = match l5 { - 0 => { - ErrorCode::DnsTimeout - } - 1 => { - let e67 = { - let l6 = i32::from(*ptr0.add(32).cast::()); - let l10 = i32::from(*ptr0.add(44).cast::()); - - DnsErrorPayload{ - rcode: match l6 { - 0 => None, - 1 => { - let e = { - let l7 = *ptr0.add(36).cast::<*mut u8>(); - let l8 = *ptr0.add(40).cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - - _rt::string_lift(bytes9) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from(*ptr0.add(46).cast::()); - - l11 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e67) - } - 2 => { - ErrorCode::DestinationNotFound - } - 3 => { - ErrorCode::DestinationUnavailable - } - 4 => { - ErrorCode::DestinationIpProhibited - } - 5 => { - ErrorCode::DestinationIpUnroutable - } - 6 => { - ErrorCode::ConnectionRefused - } - 7 => { - ErrorCode::ConnectionTerminated - } - 8 => { - ErrorCode::ConnectionTimeout - } - 9 => { - ErrorCode::ConnectionReadTimeout - } - 10 => { - ErrorCode::ConnectionWriteTimeout - } - 11 => { - ErrorCode::ConnectionLimitReached - } - 12 => { - ErrorCode::TlsProtocolError - } - 13 => { - ErrorCode::TlsCertificateError - } - 14 => { - let e67 = { - let l12 = i32::from(*ptr0.add(32).cast::()); - let l14 = i32::from(*ptr0.add(36).cast::()); - - TlsAlertReceivedPayload{ - alert_id: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = i32::from(*ptr0.add(33).cast::()); - - l13 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = *ptr0.add(40).cast::<*mut u8>(); - let l16 = *ptr0.add(44).cast::(); - let len17 = l16; - let bytes17 = _rt::Vec::from_raw_parts(l15.cast(), len17, len17); - - _rt::string_lift(bytes17) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e67) - } - 15 => { - ErrorCode::HttpRequestDenied - } - 16 => { - ErrorCode::HttpRequestLengthRequired - } - 17 => { - let e67 = { - let l18 = i32::from(*ptr0.add(32).cast::()); - - match l18 { - 0 => None, - 1 => { - let e = { - let l19 = *ptr0.add(40).cast::(); - - l19 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e67) - } - 18 => { - ErrorCode::HttpRequestMethodInvalid - } - 19 => { - ErrorCode::HttpRequestUriInvalid - } - 20 => { - ErrorCode::HttpRequestUriTooLong - } - 21 => { - let e67 = { - let l20 = i32::from(*ptr0.add(32).cast::()); - - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *ptr0.add(36).cast::(); - - l21 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e67) - } - 22 => { - let e67 = { - let l22 = i32::from(*ptr0.add(32).cast::()); - - match l22 { - 0 => None, - 1 => { - let e = { - let l23 = i32::from(*ptr0.add(36).cast::()); - let l27 = i32::from(*ptr0.add(48).cast::()); - - FieldSizePayload{ - field_name: match l23 { - 0 => None, - 1 => { - let e = { - let l24 = *ptr0.add(40).cast::<*mut u8>(); - let l25 = *ptr0.add(44).cast::(); - let len26 = l25; - let bytes26 = _rt::Vec::from_raw_parts(l24.cast(), len26, len26); - - _rt::string_lift(bytes26) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l27 { - 0 => None, - 1 => { - let e = { - let l28 = *ptr0.add(52).cast::(); - - l28 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e67) - } - 23 => { - let e67 = { - let l29 = i32::from(*ptr0.add(32).cast::()); - - match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr0.add(36).cast::(); - - l30 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e67) - } - 24 => { - let e67 = { - let l31 = i32::from(*ptr0.add(32).cast::()); - let l35 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l31 { - 0 => None, - 1 => { - let e = { - let l32 = *ptr0.add(36).cast::<*mut u8>(); - let l33 = *ptr0.add(40).cast::(); - let len34 = l33; - let bytes34 = _rt::Vec::from_raw_parts(l32.cast(), len34, len34); - - _rt::string_lift(bytes34) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr0.add(48).cast::(); - - l36 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e67) - } - 25 => { - ErrorCode::HttpResponseIncomplete - } - 26 => { - let e67 = { - let l37 = i32::from(*ptr0.add(32).cast::()); - - match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr0.add(36).cast::(); - - l38 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e67) - } - 27 => { - let e67 = { - let l39 = i32::from(*ptr0.add(32).cast::()); - let l43 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *ptr0.add(36).cast::<*mut u8>(); - let l41 = *ptr0.add(40).cast::(); - let len42 = l41; - let bytes42 = _rt::Vec::from_raw_parts(l40.cast(), len42, len42); - - _rt::string_lift(bytes42) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *ptr0.add(48).cast::(); - - l44 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e67) - } - 28 => { - let e67 = { - let l45 = i32::from(*ptr0.add(32).cast::()); - - match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr0.add(40).cast::(); - - l46 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e67) - } - 29 => { - let e67 = { - let l47 = i32::from(*ptr0.add(32).cast::()); - - match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr0.add(36).cast::(); - - l48 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e67) - } - 30 => { - let e67 = { - let l49 = i32::from(*ptr0.add(32).cast::()); - let l53 = i32::from(*ptr0.add(44).cast::()); - - FieldSizePayload{ - field_name: match l49 { - 0 => None, - 1 => { - let e = { - let l50 = *ptr0.add(36).cast::<*mut u8>(); - let l51 = *ptr0.add(40).cast::(); - let len52 = l51; - let bytes52 = _rt::Vec::from_raw_parts(l50.cast(), len52, len52); - - _rt::string_lift(bytes52) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *ptr0.add(48).cast::(); - - l54 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e67) - } - 31 => { - let e67 = { - let l55 = i32::from(*ptr0.add(32).cast::()); - - match l55 { - 0 => None, - 1 => { - let e = { - let l56 = *ptr0.add(36).cast::<*mut u8>(); - let l57 = *ptr0.add(40).cast::(); - let len58 = l57; - let bytes58 = _rt::Vec::from_raw_parts(l56.cast(), len58, len58); - - _rt::string_lift(bytes58) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e67) - } - 32 => { - let e67 = { - let l59 = i32::from(*ptr0.add(32).cast::()); - - match l59 { - 0 => None, - 1 => { - let e = { - let l60 = *ptr0.add(36).cast::<*mut u8>(); - let l61 = *ptr0.add(40).cast::(); - let len62 = l61; - let bytes62 = _rt::Vec::from_raw_parts(l60.cast(), len62, len62); - - _rt::string_lift(bytes62) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e67) - } - 33 => { - ErrorCode::HttpResponseTimeout - } - 34 => { - ErrorCode::HttpUpgradeFailed - } - 35 => { - ErrorCode::HttpProtocolError - } - 36 => { - ErrorCode::LoopDetected - } - 37 => { - ErrorCode::ConfigurationError - } - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e67 = { - let l63 = i32::from(*ptr0.add(32).cast::()); - - match l63 { - 0 => None, - 1 => { - let e = { - let l64 = *ptr0.add(36).cast::<*mut u8>(); - let l65 = *ptr0.add(40).cast::(); - let len66 = l65; - let bytes66 = _rt::Vec::from_raw_parts(l64.cast(), len66, len66); - - _rt::string_lift(bytes66) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e67) - } - }; - - v67 + let l6 = i32::from(*ptr0.add(24).cast::()); + let v68 = match l6 { + 0 => ErrorCode::DnsTimeout, + 1 => { + let e68 = { + let l7 = i32::from(*ptr0.add(32).cast::()); + let l11 = i32::from(*ptr0.add(44).cast::()); + DnsErrorPayload { + rcode: match l7 { + 0 => None, + 1 => { + let e = { + let l8 = *ptr0.add(36).cast::<*mut u8>(); + let l9 = *ptr0.add(40).cast::(); + let len10 = l9; + let bytes10 = _rt::Vec::from_raw_parts( + l8.cast(), + len10, + len10, + ); + _rt::string_lift(bytes10) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l11 { + 0 => None, + 1 => { + let e = { + let l12 = i32::from(*ptr0.add(46).cast::()); + l12 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e68) + } + 2 => ErrorCode::DestinationNotFound, + 3 => ErrorCode::DestinationUnavailable, + 4 => ErrorCode::DestinationIpProhibited, + 5 => ErrorCode::DestinationIpUnroutable, + 6 => ErrorCode::ConnectionRefused, + 7 => ErrorCode::ConnectionTerminated, + 8 => ErrorCode::ConnectionTimeout, + 9 => ErrorCode::ConnectionReadTimeout, + 10 => ErrorCode::ConnectionWriteTimeout, + 11 => ErrorCode::ConnectionLimitReached, + 12 => ErrorCode::TlsProtocolError, + 13 => ErrorCode::TlsCertificateError, + 14 => { + let e68 = { + let l13 = i32::from(*ptr0.add(32).cast::()); + let l15 = i32::from(*ptr0.add(36).cast::()); + TlsAlertReceivedPayload { + alert_id: match l13 { + 0 => None, + 1 => { + let e = { + let l14 = i32::from(*ptr0.add(33).cast::()); + l14 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l15 { + 0 => None, + 1 => { + let e = { + let l16 = *ptr0.add(40).cast::<*mut u8>(); + let l17 = *ptr0.add(44).cast::(); + let len18 = l17; + let bytes18 = _rt::Vec::from_raw_parts( + l16.cast(), + len18, + len18, + ); + _rt::string_lift(bytes18) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::TlsAlertReceived(e68) + } + 15 => ErrorCode::HttpRequestDenied, + 16 => ErrorCode::HttpRequestLengthRequired, + 17 => { + let e68 = { + let l19 = i32::from(*ptr0.add(32).cast::()); + match l19 { + 0 => None, + 1 => { + let e = { + let l20 = *ptr0.add(40).cast::(); + l20 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e68) + } + 18 => ErrorCode::HttpRequestMethodInvalid, + 19 => ErrorCode::HttpRequestUriInvalid, + 20 => ErrorCode::HttpRequestUriTooLong, + 21 => { + let e68 = { + let l21 = i32::from(*ptr0.add(32).cast::()); + match l21 { + 0 => None, + 1 => { + let e = { + let l22 = *ptr0.add(36).cast::(); + l22 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e68) + } + 22 => { + let e68 = { + let l23 = i32::from(*ptr0.add(32).cast::()); + match l23 { + 0 => None, + 1 => { + let e = { + let l24 = i32::from(*ptr0.add(36).cast::()); + let l28 = i32::from(*ptr0.add(48).cast::()); + FieldSizePayload { + field_name: match l24 { + 0 => None, + 1 => { + let e = { + let l25 = *ptr0.add(40).cast::<*mut u8>(); + let l26 = *ptr0.add(44).cast::(); + let len27 = l26; + let bytes27 = _rt::Vec::from_raw_parts( + l25.cast(), + len27, + len27, + ); + _rt::string_lift(bytes27) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l28 { + 0 => None, + 1 => { + let e = { + let l29 = *ptr0.add(52).cast::(); + l29 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e68) + } + 23 => { + let e68 = { + let l30 = i32::from(*ptr0.add(32).cast::()); + match l30 { + 0 => None, + 1 => { + let e = { + let l31 = *ptr0.add(36).cast::(); + l31 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e68) + } + 24 => { + let e68 = { + let l32 = i32::from(*ptr0.add(32).cast::()); + let l36 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l32 { + 0 => None, + 1 => { + let e = { + let l33 = *ptr0.add(36).cast::<*mut u8>(); + let l34 = *ptr0.add(40).cast::(); + let len35 = l34; + let bytes35 = _rt::Vec::from_raw_parts( + l33.cast(), + len35, + len35, + ); + _rt::string_lift(bytes35) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l36 { + 0 => None, + 1 => { + let e = { + let l37 = *ptr0.add(48).cast::(); + l37 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e68) + } + 25 => ErrorCode::HttpResponseIncomplete, + 26 => { + let e68 = { + let l38 = i32::from(*ptr0.add(32).cast::()); + match l38 { + 0 => None, + 1 => { + let e = { + let l39 = *ptr0.add(36).cast::(); + l39 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e68) + } + 27 => { + let e68 = { + let l40 = i32::from(*ptr0.add(32).cast::()); + let l44 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l40 { + 0 => None, + 1 => { + let e = { + let l41 = *ptr0.add(36).cast::<*mut u8>(); + let l42 = *ptr0.add(40).cast::(); + let len43 = l42; + let bytes43 = _rt::Vec::from_raw_parts( + l41.cast(), + len43, + len43, + ); + _rt::string_lift(bytes43) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l44 { + 0 => None, + 1 => { + let e = { + let l45 = *ptr0.add(48).cast::(); + l45 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e68) + } + 28 => { + let e68 = { + let l46 = i32::from(*ptr0.add(32).cast::()); + match l46 { + 0 => None, + 1 => { + let e = { + let l47 = *ptr0.add(40).cast::(); + l47 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e68) + } + 29 => { + let e68 = { + let l48 = i32::from(*ptr0.add(32).cast::()); + match l48 { + 0 => None, + 1 => { + let e = { + let l49 = *ptr0.add(36).cast::(); + l49 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e68) + } + 30 => { + let e68 = { + let l50 = i32::from(*ptr0.add(32).cast::()); + let l54 = i32::from(*ptr0.add(44).cast::()); + FieldSizePayload { + field_name: match l50 { + 0 => None, + 1 => { + let e = { + let l51 = *ptr0.add(36).cast::<*mut u8>(); + let l52 = *ptr0.add(40).cast::(); + let len53 = l52; + let bytes53 = _rt::Vec::from_raw_parts( + l51.cast(), + len53, + len53, + ); + _rt::string_lift(bytes53) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l54 { + 0 => None, + 1 => { + let e = { + let l55 = *ptr0.add(48).cast::(); + l55 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e68) + } + 31 => { + let e68 = { + let l56 = i32::from(*ptr0.add(32).cast::()); + match l56 { + 0 => None, + 1 => { + let e = { + let l57 = *ptr0.add(36).cast::<*mut u8>(); + let l58 = *ptr0.add(40).cast::(); + let len59 = l58; + let bytes59 = _rt::Vec::from_raw_parts( + l57.cast(), + len59, + len59, + ); + _rt::string_lift(bytes59) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e68) + } + 32 => { + let e68 = { + let l60 = i32::from(*ptr0.add(32).cast::()); + match l60 { + 0 => None, + 1 => { + let e = { + let l61 = *ptr0.add(36).cast::<*mut u8>(); + let l62 = *ptr0.add(40).cast::(); + let len63 = l62; + let bytes63 = _rt::Vec::from_raw_parts( + l61.cast(), + len63, + len63, + ); + _rt::string_lift(bytes63) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e68) + } + 33 => ErrorCode::HttpResponseTimeout, + 34 => ErrorCode::HttpUpgradeFailed, + 35 => ErrorCode::HttpProtocolError, + 36 => ErrorCode::LoopDetected, + 37 => ErrorCode::ConfigurationError, + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e68 = { + let l64 = i32::from(*ptr0.add(32).cast::()); + match l64 { + 0 => None, + 1 => { + let e = { + let l65 = *ptr0.add(36).cast::<*mut u8>(); + let l66 = *ptr0.add(40).cast::(); + let len67 = l66; + let bytes67 = _rt::Vec::from_raw_parts( + l65.cast(), + len67, + len67, + ); + _rt::string_lift(bytes67) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e68) + } + }; + v68 }; Err(e) } @@ -9039,24 +9110,23 @@ pub mod wasi { Some(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result69 } } } } - - #[allow(clippy::all)] + /// This interface defines a handler of outgoing HTTP Requests. It should be + /// imported by components which wish to make HTTP Requests. + #[allow(dead_code, unused_imports, clippy::all)] pub mod outgoing_handler { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type OutgoingRequest = super::super::super::wasi::http::types::OutgoingRequest; pub type RequestOptions = super::super::super::wasi::http::types::RequestOptions; - pub type FutureIncomingResponse = - super::super::super::wasi::http::types::FutureIncomingResponse; + pub type FutureIncomingResponse = super::super::super::wasi::http::types::FutureIncomingResponse; pub type ErrorCode = super::super::super::wasi::http::types::ErrorCode; #[allow(unused_unsafe, clippy::all)] /// This function is invoked with an outgoing HTTP Request, and it returns @@ -9083,513 +9153,501 @@ pub mod wasi { }; let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/outgoing-handler@0.2.0")] + #[link(wasm_import_module = "wasi:http/outgoing-handler@0.2.4")] extern "C" { #[link_name = "handle"] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8); + fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((&request).take_handle() as i32, result0_0, result0_1, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2( + (&request).take_handle() as i32, + result0_0, + result0_1, + ptr1, + ); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result68 = match l3 { 0 => { let e = { - let l3 = *ptr1.add(8).cast::(); - - super::super::super::wasi::http::types::FutureIncomingResponse::from_handle(l3 as u32) + let l4 = *ptr1.add(8).cast::(); + super::super::super::wasi::http::types::FutureIncomingResponse::from_handle( + l4 as u32, + ) }; Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr1.add(8).cast::()); - use super::super::super::wasi::http::types::ErrorCode as V66; - let v66 = match l4 { - 0 => V66::DnsTimeout, + let l5 = i32::from(*ptr1.add(8).cast::()); + use super::super::super::wasi::http::types::ErrorCode as V67; + let v67 = match l5 { + 0 => V67::DnsTimeout, 1 => { - let e66 = { - let l5 = i32::from(*ptr1.add(16).cast::()); - let l9 = i32::from(*ptr1.add(28).cast::()); - - super::super::super::wasi::http::types::DnsErrorPayload{ - rcode: match l5 { - 0 => None, - 1 => { - let e = { - let l6 = *ptr1.add(20).cast::<*mut u8>(); - let l7 = *ptr1.add(24).cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); - - _rt::string_lift(bytes8) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = i32::from(*ptr1.add(30).cast::()); - - l10 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let e67 = { + let l6 = i32::from(*ptr1.add(16).cast::()); + let l10 = i32::from(*ptr1.add(28).cast::()); + super::super::super::wasi::http::types::DnsErrorPayload { + rcode: match l6 { + 0 => None, + 1 => { + let e = { + let l7 = *ptr1.add(20).cast::<*mut u8>(); + let l8 = *ptr1.add(24).cast::(); + let len9 = l8; + let bytes9 = _rt::Vec::from_raw_parts( + l7.cast(), + len9, + len9, + ); + _rt::string_lift(bytes9) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l10 { + 0 => None, + 1 => { + let e = { + let l11 = i32::from(*ptr1.add(30).cast::()); + l11 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; - V66::DnsError(e66) + V67::DnsError(e67) } - 2 => V66::DestinationNotFound, - 3 => V66::DestinationUnavailable, - 4 => V66::DestinationIpProhibited, - 5 => V66::DestinationIpUnroutable, - 6 => V66::ConnectionRefused, - 7 => V66::ConnectionTerminated, - 8 => V66::ConnectionTimeout, - 9 => V66::ConnectionReadTimeout, - 10 => V66::ConnectionWriteTimeout, - 11 => V66::ConnectionLimitReached, - 12 => V66::TlsProtocolError, - 13 => V66::TlsCertificateError, + 2 => V67::DestinationNotFound, + 3 => V67::DestinationUnavailable, + 4 => V67::DestinationIpProhibited, + 5 => V67::DestinationIpUnroutable, + 6 => V67::ConnectionRefused, + 7 => V67::ConnectionTerminated, + 8 => V67::ConnectionTimeout, + 9 => V67::ConnectionReadTimeout, + 10 => V67::ConnectionWriteTimeout, + 11 => V67::ConnectionLimitReached, + 12 => V67::TlsProtocolError, + 13 => V67::TlsCertificateError, 14 => { - let e66 = { - let l11 = i32::from(*ptr1.add(16).cast::()); - let l13 = i32::from(*ptr1.add(20).cast::()); - - super::super::super::wasi::http::types::TlsAlertReceivedPayload{ - alert_id: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = i32::from(*ptr1.add(17).cast::()); - - l12 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = *ptr1.add(24).cast::<*mut u8>(); - let l15 = *ptr1.add(28).cast::(); - let len16 = l15; - let bytes16 = _rt::Vec::from_raw_parts(l14.cast(), len16, len16); - - _rt::string_lift(bytes16) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let e67 = { + let l12 = i32::from(*ptr1.add(16).cast::()); + let l14 = i32::from(*ptr1.add(20).cast::()); + super::super::super::wasi::http::types::TlsAlertReceivedPayload { + alert_id: match l12 { + 0 => None, + 1 => { + let e = { + let l13 = i32::from(*ptr1.add(17).cast::()); + l13 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l14 { + 0 => None, + 1 => { + let e = { + let l15 = *ptr1.add(24).cast::<*mut u8>(); + let l16 = *ptr1.add(28).cast::(); + let len17 = l16; + let bytes17 = _rt::Vec::from_raw_parts( + l15.cast(), + len17, + len17, + ); + _rt::string_lift(bytes17) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; - V66::TlsAlertReceived(e66) + V67::TlsAlertReceived(e67) } - 15 => V66::HttpRequestDenied, - 16 => V66::HttpRequestLengthRequired, + 15 => V67::HttpRequestDenied, + 16 => V67::HttpRequestLengthRequired, 17 => { - let e66 = { - let l17 = i32::from(*ptr1.add(16).cast::()); - - match l17 { + let e67 = { + let l18 = i32::from(*ptr1.add(16).cast::()); + match l18 { 0 => None, 1 => { let e = { - let l18 = *ptr1.add(24).cast::(); - - l18 as u64 + let l19 = *ptr1.add(24).cast::(); + l19 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpRequestBodySize(e66) + V67::HttpRequestBodySize(e67) } - 18 => V66::HttpRequestMethodInvalid, - 19 => V66::HttpRequestUriInvalid, - 20 => V66::HttpRequestUriTooLong, + 18 => V67::HttpRequestMethodInvalid, + 19 => V67::HttpRequestUriInvalid, + 20 => V67::HttpRequestUriTooLong, 21 => { - let e66 = { - let l19 = i32::from(*ptr1.add(16).cast::()); - - match l19 { + let e67 = { + let l20 = i32::from(*ptr1.add(16).cast::()); + match l20 { 0 => None, 1 => { let e = { - let l20 = *ptr1.add(20).cast::(); - - l20 as u32 + let l21 = *ptr1.add(20).cast::(); + l21 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpRequestHeaderSectionSize(e66) + V67::HttpRequestHeaderSectionSize(e67) } 22 => { - let e66 = { - let l21 = i32::from(*ptr1.add(16).cast::()); - - match l21 { + let e67 = { + let l22 = i32::from(*ptr1.add(16).cast::()); + match l22 { 0 => None, 1 => { let e = { - let l22 = - i32::from(*ptr1.add(20).cast::()); - let l26 = - i32::from(*ptr1.add(32).cast::()); - - super::super::super::wasi::http::types::FieldSizePayload{ - field_name: match l22 { - 0 => None, - 1 => { - let e = { - let l23 = *ptr1.add(24).cast::<*mut u8>(); - let l24 = *ptr1.add(28).cast::(); - let len25 = l24; - let bytes25 = _rt::Vec::from_raw_parts(l23.cast(), len25, len25); - - _rt::string_lift(bytes25) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l26 { - 0 => None, - 1 => { - let e = { - let l27 = *ptr1.add(36).cast::(); - - l27 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let l23 = i32::from(*ptr1.add(20).cast::()); + let l27 = i32::from(*ptr1.add(32).cast::()); + super::super::super::wasi::http::types::FieldSizePayload { + field_name: match l23 { + 0 => None, + 1 => { + let e = { + let l24 = *ptr1.add(24).cast::<*mut u8>(); + let l25 = *ptr1.add(28).cast::(); + let len26 = l25; + let bytes26 = _rt::Vec::from_raw_parts( + l24.cast(), + len26, + len26, + ); + _rt::string_lift(bytes26) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l27 { + 0 => None, + 1 => { + let e = { + let l28 = *ptr1.add(36).cast::(); + l28 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpRequestHeaderSize(e66) + V67::HttpRequestHeaderSize(e67) } 23 => { - let e66 = { - let l28 = i32::from(*ptr1.add(16).cast::()); - - match l28 { + let e67 = { + let l29 = i32::from(*ptr1.add(16).cast::()); + match l29 { 0 => None, 1 => { let e = { - let l29 = *ptr1.add(20).cast::(); - - l29 as u32 + let l30 = *ptr1.add(20).cast::(); + l30 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpRequestTrailerSectionSize(e66) + V67::HttpRequestTrailerSectionSize(e67) } 24 => { - let e66 = { - let l30 = i32::from(*ptr1.add(16).cast::()); - let l34 = i32::from(*ptr1.add(28).cast::()); - - super::super::super::wasi::http::types::FieldSizePayload{ - field_name: match l30 { - 0 => None, - 1 => { - let e = { - let l31 = *ptr1.add(20).cast::<*mut u8>(); - let l32 = *ptr1.add(24).cast::(); - let len33 = l32; - let bytes33 = _rt::Vec::from_raw_parts(l31.cast(), len33, len33); - - _rt::string_lift(bytes33) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *ptr1.add(32).cast::(); - - l35 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let e67 = { + let l31 = i32::from(*ptr1.add(16).cast::()); + let l35 = i32::from(*ptr1.add(28).cast::()); + super::super::super::wasi::http::types::FieldSizePayload { + field_name: match l31 { + 0 => None, + 1 => { + let e = { + let l32 = *ptr1.add(20).cast::<*mut u8>(); + let l33 = *ptr1.add(24).cast::(); + let len34 = l33; + let bytes34 = _rt::Vec::from_raw_parts( + l32.cast(), + len34, + len34, + ); + _rt::string_lift(bytes34) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l35 { + 0 => None, + 1 => { + let e = { + let l36 = *ptr1.add(32).cast::(); + l36 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; - V66::HttpRequestTrailerSize(e66) + V67::HttpRequestTrailerSize(e67) } - 25 => V66::HttpResponseIncomplete, + 25 => V67::HttpResponseIncomplete, 26 => { - let e66 = { - let l36 = i32::from(*ptr1.add(16).cast::()); - - match l36 { + let e67 = { + let l37 = i32::from(*ptr1.add(16).cast::()); + match l37 { 0 => None, 1 => { let e = { - let l37 = *ptr1.add(20).cast::(); - - l37 as u32 + let l38 = *ptr1.add(20).cast::(); + l38 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpResponseHeaderSectionSize(e66) + V67::HttpResponseHeaderSectionSize(e67) } 27 => { - let e66 = { - let l38 = i32::from(*ptr1.add(16).cast::()); - let l42 = i32::from(*ptr1.add(28).cast::()); - - super::super::super::wasi::http::types::FieldSizePayload{ - field_name: match l38 { - 0 => None, - 1 => { - let e = { - let l39 = *ptr1.add(20).cast::<*mut u8>(); - let l40 = *ptr1.add(24).cast::(); - let len41 = l40; - let bytes41 = _rt::Vec::from_raw_parts(l39.cast(), len41, len41); - - _rt::string_lift(bytes41) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l42 { - 0 => None, - 1 => { - let e = { - let l43 = *ptr1.add(32).cast::(); - - l43 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let e67 = { + let l39 = i32::from(*ptr1.add(16).cast::()); + let l43 = i32::from(*ptr1.add(28).cast::()); + super::super::super::wasi::http::types::FieldSizePayload { + field_name: match l39 { + 0 => None, + 1 => { + let e = { + let l40 = *ptr1.add(20).cast::<*mut u8>(); + let l41 = *ptr1.add(24).cast::(); + let len42 = l41; + let bytes42 = _rt::Vec::from_raw_parts( + l40.cast(), + len42, + len42, + ); + _rt::string_lift(bytes42) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l43 { + 0 => None, + 1 => { + let e = { + let l44 = *ptr1.add(32).cast::(); + l44 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; - V66::HttpResponseHeaderSize(e66) + V67::HttpResponseHeaderSize(e67) } 28 => { - let e66 = { - let l44 = i32::from(*ptr1.add(16).cast::()); - - match l44 { + let e67 = { + let l45 = i32::from(*ptr1.add(16).cast::()); + match l45 { 0 => None, 1 => { let e = { - let l45 = *ptr1.add(24).cast::(); - - l45 as u64 + let l46 = *ptr1.add(24).cast::(); + l46 as u64 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpResponseBodySize(e66) + V67::HttpResponseBodySize(e67) } 29 => { - let e66 = { - let l46 = i32::from(*ptr1.add(16).cast::()); - - match l46 { + let e67 = { + let l47 = i32::from(*ptr1.add(16).cast::()); + match l47 { 0 => None, 1 => { let e = { - let l47 = *ptr1.add(20).cast::(); - - l47 as u32 + let l48 = *ptr1.add(20).cast::(); + l48 as u32 }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpResponseTrailerSectionSize(e66) + V67::HttpResponseTrailerSectionSize(e67) } 30 => { - let e66 = { - let l48 = i32::from(*ptr1.add(16).cast::()); - let l52 = i32::from(*ptr1.add(28).cast::()); - - super::super::super::wasi::http::types::FieldSizePayload{ - field_name: match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr1.add(20).cast::<*mut u8>(); - let l50 = *ptr1.add(24).cast::(); - let len51 = l50; - let bytes51 = _rt::Vec::from_raw_parts(l49.cast(), len51, len51); - - _rt::string_lift(bytes51) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l52 { - 0 => None, - 1 => { - let e = { - let l53 = *ptr1.add(32).cast::(); - - l53 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } + let e67 = { + let l49 = i32::from(*ptr1.add(16).cast::()); + let l53 = i32::from(*ptr1.add(28).cast::()); + super::super::super::wasi::http::types::FieldSizePayload { + field_name: match l49 { + 0 => None, + 1 => { + let e = { + let l50 = *ptr1.add(20).cast::<*mut u8>(); + let l51 = *ptr1.add(24).cast::(); + let len52 = l51; + let bytes52 = _rt::Vec::from_raw_parts( + l50.cast(), + len52, + len52, + ); + _rt::string_lift(bytes52) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l53 { + 0 => None, + 1 => { + let e = { + let l54 = *ptr1.add(32).cast::(); + l54 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; - V66::HttpResponseTrailerSize(e66) + V67::HttpResponseTrailerSize(e67) } 31 => { - let e66 = { - let l54 = i32::from(*ptr1.add(16).cast::()); - - match l54 { + let e67 = { + let l55 = i32::from(*ptr1.add(16).cast::()); + match l55 { 0 => None, 1 => { let e = { - let l55 = *ptr1.add(20).cast::<*mut u8>(); - let l56 = *ptr1.add(24).cast::(); - let len57 = l56; - let bytes57 = _rt::Vec::from_raw_parts( - l55.cast(), - len57, - len57, + let l56 = *ptr1.add(20).cast::<*mut u8>(); + let l57 = *ptr1.add(24).cast::(); + let len58 = l57; + let bytes58 = _rt::Vec::from_raw_parts( + l56.cast(), + len58, + len58, ); - - _rt::string_lift(bytes57) + _rt::string_lift(bytes58) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpResponseTransferCoding(e66) + V67::HttpResponseTransferCoding(e67) } 32 => { - let e66 = { - let l58 = i32::from(*ptr1.add(16).cast::()); - - match l58 { + let e67 = { + let l59 = i32::from(*ptr1.add(16).cast::()); + match l59 { 0 => None, 1 => { let e = { - let l59 = *ptr1.add(20).cast::<*mut u8>(); - let l60 = *ptr1.add(24).cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts( - l59.cast(), - len61, - len61, + let l60 = *ptr1.add(20).cast::<*mut u8>(); + let l61 = *ptr1.add(24).cast::(); + let len62 = l61; + let bytes62 = _rt::Vec::from_raw_parts( + l60.cast(), + len62, + len62, ); - - _rt::string_lift(bytes61) + _rt::string_lift(bytes62) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::HttpResponseContentCoding(e66) + V67::HttpResponseContentCoding(e67) } - 33 => V66::HttpResponseTimeout, - 34 => V66::HttpUpgradeFailed, - 35 => V66::HttpProtocolError, - 36 => V66::LoopDetected, - 37 => V66::ConfigurationError, + 33 => V67::HttpResponseTimeout, + 34 => V67::HttpUpgradeFailed, + 35 => V67::HttpProtocolError, + 36 => V67::LoopDetected, + 37 => V67::ConfigurationError, n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e66 = { - let l62 = i32::from(*ptr1.add(16).cast::()); - - match l62 { + let e67 = { + let l63 = i32::from(*ptr1.add(16).cast::()); + match l63 { 0 => None, 1 => { let e = { - let l63 = *ptr1.add(20).cast::<*mut u8>(); - let l64 = *ptr1.add(24).cast::(); - let len65 = l64; - let bytes65 = _rt::Vec::from_raw_parts( - l63.cast(), - len65, - len65, + let l64 = *ptr1.add(20).cast::<*mut u8>(); + let l65 = *ptr1.add(24).cast::(); + let len66 = l65; + let bytes66 = _rt::Vec::from_raw_parts( + l64.cast(), + len66, + len66, ); - - _rt::string_lift(bytes65) + _rt::string_lift(bytes66) }; Some(e) } _ => _rt::invalid_enum_discriminant(), } }; - V66::InternalError(e66) + V67::InternalError(e67) } }; - - v66 + v67 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result68 } } } } pub mod io { - #[allow(clippy::all)] + /// A poll API intended to let users wait for I/O events on multiple handles + /// at once. + #[allow(dead_code, unused_imports, clippy::all)] pub mod poll { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; /// `pollable` represents a single I/O event which may be ready, or not. - #[derive(Debug)] #[repr(transparent)] pub struct Pollable { handle: _rt::Resource, } - impl Pollable { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -9597,37 +9655,31 @@ pub mod wasi { 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 Pollable { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + #[link(wasm_import_module = "wasi:io/poll@0.2.4")] extern "C" { #[link_name = "[resource-drop]pollable"] fn drop(_: u32); } - drop(_handle); } } } - impl Pollable { #[allow(unused_unsafe, clippy::all)] /// Return the readiness of a pollable. This function never blocks. @@ -9636,17 +9688,16 @@ pub mod wasi { pub fn ready(&self) -> bool { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + #[link(wasm_import_module = "wasi:io/poll@0.2.4")] extern "C" { #[link_name = "[method]pollable.ready"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); _rt::bool_lift(ret as u8) } } @@ -9658,20 +9709,19 @@ pub mod wasi { /// /// This function is equivalent to calling `poll.poll` on a list /// containing only this pollable. - pub fn block(&self) { + pub fn block(&self) -> () { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + #[link(wasm_import_module = "wasi:io/poll@0.2.4")] extern "C" { #[link_name = "[method]pollable.block"] - fn wit_import(_: i32); + fn wit_import0(_: i32); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + extern "C" fn wit_import0(_: i32) { unreachable!() } - wit_import((self).handle() as i32); + wit_import0((self).handle() as i32); } } } @@ -9684,8 +9734,9 @@ pub mod wasi { /// The result `list` contains one or more indices of handles in the /// argument list that is ready for I/O. /// - /// If the list contains more elements than can be indexed with a `u32` - /// value, this function traps. + /// This function traps if either: + /// - the list is empty, or: + /// - the list contains more elements than can be indexed with a `u32` value. /// /// A timeout can be implemented by adding a pollable from the /// wasi-clocks API to the list. @@ -9693,7 +9744,7 @@ pub mod wasi { /// This function does not return a `result`; polling in itself does not /// do any I/O so it doesn't fail. If any of the I/O sources identified by /// the pollables has an error, it is indicated by marking the source as - /// being reaedy for I/O. + /// being ready for I/O. pub fn poll(in_: &[&Pollable]) -> _rt::Vec { unsafe { #[repr(align(4))] @@ -9701,7 +9752,10 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let vec0 = in_; let len0 = vec0.len(); - let layout0 = _rt::alloc::Layout::from_size_align_unchecked(vec0.len() * 4, 4); + let layout0 = _rt::alloc::Layout::from_size_align_unchecked( + vec0.len() * 4, + 4, + ); let result0 = if layout0.size() != 0 { let ptr = _rt::alloc::alloc(layout0).cast::(); if ptr.is_null() { @@ -9709,9 +9763,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec0.into_iter().enumerate() { let base = result0.add(i * 4); @@ -9721,35 +9773,32 @@ pub mod wasi { } let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + #[link(wasm_import_module = "wasi:io/poll@0.2.4")] extern "C" { #[link_name = "poll"] - fn wit_import(_: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import(result0, len0, ptr1); - let l2 = *ptr1.add(0).cast::<*mut u8>(); - let l3 = *ptr1.add(4).cast::(); - let len4 = l3; + wit_import2(result0, len0, ptr1); + let l3 = *ptr1.add(0).cast::<*mut u8>(); + let l4 = *ptr1.add(4).cast::(); + let len5 = l4; + let result6 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); if layout0.size() != 0 { _rt::alloc::dealloc(result0.cast(), layout0); } - _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + result6 } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod error { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; /// A resource which represents some error information. /// @@ -9760,23 +9809,19 @@ pub mod wasi { /// `wasi:io/streams/stream-error` type. /// /// To provide more specific error information, other interfaces may - /// provide functions to further "downcast" this error into more specific - /// error information. For example, `error`s returned in streams derived - /// from filesystem types to be described using the filesystem's own - /// error-code type, using the function - /// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter - /// `borrow` and returns - /// `option`. + /// offer functions to "downcast" this error into more specific types. For example, + /// errors returned from streams derived from filesystem types can be described using + /// the filesystem's own error-code type. This is done using the function + /// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow` + /// parameter and returns an `option`. /// /// The set of functions which can "downcast" an `error` into a more /// concrete type is open. - #[derive(Debug)] #[repr(transparent)] pub struct Error { handle: _rt::Resource, } - impl Error { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -9784,37 +9829,31 @@ pub mod wasi { 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 Error { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:io/error@0.2.0")] + #[link(wasm_import_module = "wasi:io/error@0.2.4")] extern "C" { #[link_name = "[resource-drop]error"] fn drop(_: u32); } - drop(_handle); } } } - impl Error { #[allow(unused_unsafe, clippy::all)] /// Returns a string that is suitable to assist humans in debugging @@ -9828,37 +9867,41 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/error@0.2.0")] + #[link(wasm_import_module = "wasi:io/error@0.2.4")] extern "C" { #[link_name = "[method]error.to-debug-string"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let len3 = l2; - let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); - _rt::string_lift(bytes3) + wit_import1((self).handle() as i32, ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + let result5 = _rt::string_lift(bytes4); + result5 } } } } - - #[allow(clippy::all)] + /// WASI I/O is an I/O abstraction API which is currently focused on providing + /// stream types. + /// + /// In the future, the component model is expected to add built-in stream types; + /// when it does, they are expected to subsume this API. + #[allow(dead_code, unused_imports, clippy::all)] pub mod streams { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Error = super::super::super::wasi::io::error::Error; pub type Pollable = super::super::super::wasi::io::poll::Pollable; @@ -9867,6 +9910,9 @@ pub mod wasi { /// The last operation (a write or flush) failed before completion. /// /// More information is available in the `error` payload. + /// + /// After this, the stream will be closed. All future operations return + /// `stream-error::closed`. LastOperationFailed(Error), /// The stream is closed: no more input will be accepted by the /// stream. A closed output-stream will return this error on all @@ -9874,22 +9920,30 @@ pub mod wasi { Closed, } impl ::core::fmt::Debug for StreamError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - StreamError::LastOperationFailed(e) => f - .debug_tuple("StreamError::LastOperationFailed") - .field(e) - .finish(), - StreamError::Closed => f.debug_tuple("StreamError::Closed").finish(), + StreamError::LastOperationFailed(e) => { + f.debug_tuple("StreamError::LastOperationFailed") + .field(e) + .finish() + } + StreamError::Closed => { + f.debug_tuple("StreamError::Closed").finish() + } } } } impl ::core::fmt::Display for StreamError { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { write!(f, "{:?}", self) } } - #[cfg(feature = "std")] impl std::error::Error for StreamError {} /// An input bytestream. @@ -9900,13 +9954,11 @@ pub mod wasi { /// available, which could even be zero. To wait for data to be available, /// use the `subscribe` function to obtain a `pollable` which can be polled /// for using `wasi:io/poll`. - #[derive(Debug)] #[repr(transparent)] pub struct InputStream { handle: _rt::Resource, } - impl InputStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -9914,37 +9966,31 @@ pub mod wasi { 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 InputStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[resource-drop]input-stream"] fn drop(_: u32); } - drop(_handle); } } } - /// An output bytestream. /// /// `output-stream`s are *non-blocking* to the extent practical on @@ -9953,13 +9999,15 @@ pub mod wasi { /// promptly, which could even be zero. To wait for the stream to be ready to /// accept data, the `subscribe` function to obtain a `pollable` which can be /// polled for using `wasi:io/poll`. - + /// + /// Dropping an `output-stream` while there's still an active write in + /// progress may result in the data being lost. Before dropping the stream, + /// be sure to fully flush your writes. #[derive(Debug)] #[repr(transparent)] pub struct OutputStream { handle: _rt::Resource, } - impl OutputStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -9967,37 +10015,31 @@ pub mod wasi { 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 OutputStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[resource-drop]output-stream"] fn drop(_: u32); } - drop(_handle); } } } - impl InputStream { #[allow(unused_unsafe, clippy::all)] /// Perform a non-blocking read from the stream. @@ -10030,56 +10072,57 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]input-stream.read"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result9 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - - _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + _rt::Vec::from_raw_parts(l3.cast(), len5, len5) }; Ok(e) } 1 => { let e = { - let l5 = i32::from(*ptr0.add(4).cast::()); - let v7 = match l5 { + let l6 = i32::from(*ptr0.add(4).cast::()); + let v8 = match l6 { 0 => { - let e7 = { - let l6 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l6 as u32) + let e8 = { + let l7 = *ptr0.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l7 as u32, + ) }; - StreamError::LastOperationFailed(e7) + StreamError::LastOperationFailed(e8) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v7 + v8 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result9 } } } @@ -10087,60 +10130,64 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Read bytes from a stream, after blocking until at least one byte can /// be read. Except for blocking, behavior is identical to `read`. - pub fn blocking_read(&self, len: u64) -> Result<_rt::Vec, StreamError> { + pub fn blocking_read( + &self, + len: u64, + ) -> Result<_rt::Vec, StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]input-stream.blocking-read"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result9 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let len4 = l3; - - _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let len5 = l4; + _rt::Vec::from_raw_parts(l3.cast(), len5, len5) }; Ok(e) } 1 => { let e = { - let l5 = i32::from(*ptr0.add(4).cast::()); - let v7 = match l5 { + let l6 = i32::from(*ptr0.add(4).cast::()); + let v8 = match l6 { 0 => { - let e7 = { - let l6 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l6 as u32) + let e8 = { + let l7 = *ptr0.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l7 as u32, + ) }; - StreamError::LastOperationFailed(e7) + StreamError::LastOperationFailed(e8) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v7 + v8 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result9 } } } @@ -10154,54 +10201,55 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]input-stream.skip"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result7 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr0.add(8).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr0.add(12).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -10213,54 +10261,55 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]input-stream.blocking-skip"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result7 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr0.add(8).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr0.add(12).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -10275,18 +10324,19 @@ pub mod wasi { pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]input-stream.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -10305,54 +10355,55 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.check-write"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result7 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr0.add(8).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr0.add(12).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -10375,53 +10426,60 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let vec0 = contents; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.write"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result7 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr1.add(4).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr1.add(4).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr1.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr1.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -10437,13 +10495,13 @@ pub mod wasi { /// ```text /// let pollable = this.subscribe(); /// while !contents.is_empty() { - /// // Wait for the stream to become writable - /// pollable.block(); - /// let Ok(n) = this.check-write(); // eliding error handling - /// let len = min(n, contents.len()); - /// let (chunk, rest) = contents.split_at(len); - /// this.write(chunk ); // eliding error handling - /// contents = rest; + /// // Wait for the stream to become writable + /// pollable.block(); + /// let Ok(n) = this.check-write(); // eliding error handling + /// let len = min(n, contents.len()); + /// let (chunk, rest) = contents.split_at(len); + /// this.write(chunk ); // eliding error handling + /// contents = rest; /// } /// this.flush(); /// // Wait for completion of `flush` @@ -10451,57 +10509,67 @@ pub mod wasi { /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` - pub fn blocking_write_and_flush(&self, contents: &[u8]) -> Result<(), StreamError> { + pub fn blocking_write_and_flush( + &self, + contents: &[u8], + ) -> Result<(), StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let vec0 = contents; let ptr0 = vec0.as_ptr().cast::(); let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.blocking-write-and-flush"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result7 = match l3 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr1.add(4).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr1.add(4).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr1.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr1.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -10521,50 +10589,52 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.flush"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - let v4 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + let v5 = match l3 { 0 => { - let e4 = { - let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l3 as u32) + let e5 = { + let l4 = *ptr0.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l4 as u32, + ) }; - StreamError::LastOperationFailed(e4) + StreamError::LastOperationFailed(e5) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v4 + v5 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -10576,57 +10646,59 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.blocking-flush"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - let v4 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + let v5 = match l3 { 0 => { - let e4 = { - let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l3 as u32) + let e5 = { + let l4 = *ptr0.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l4 as u32, + ) }; - StreamError::LastOperationFailed(e4) + StreamError::LastOperationFailed(e5) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v4 + v5 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } impl OutputStream { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the output-stream - /// is ready for more writing, or an error has occured. When this + /// is ready for more writing, or an error has occurred. When this /// pollable is ready, `check-write` will return `ok(n)` with n>0, or an /// error. /// @@ -10638,18 +10710,19 @@ pub mod wasi { pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -10665,50 +10738,52 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.write-zeroes"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - let v4 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + let v5 = match l3 { 0 => { - let e4 = { - let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l3 as u32) + let e5 = { + let l4 = *ptr0.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l4 as u32, + ) }; - StreamError::LastOperationFailed(e4) + StreamError::LastOperationFailed(e5) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v4 + v5 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -10725,12 +10800,12 @@ pub mod wasi { /// ```text /// let pollable = this.subscribe(); /// while num_zeroes != 0 { - /// // Wait for the stream to become writable - /// pollable.block(); - /// let Ok(n) = this.check-write(); // eliding error handling - /// let len = min(n, num_zeroes); - /// this.write-zeroes(len); // eliding error handling - /// num_zeroes -= len; + /// // Wait for the stream to become writable + /// pollable.block(); + /// let Ok(n) = this.check-write(); // eliding error handling + /// let len = min(n, num_zeroes); + /// this.write-zeroes(len); // eliding error handling + /// num_zeroes -= len; /// } /// this.flush(); /// // Wait for completion of `flush` @@ -10738,54 +10813,59 @@ pub mod wasi { /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` - pub fn blocking_write_zeroes_and_flush(&self, len: u64) -> Result<(), StreamError> { + pub fn blocking_write_zeroes_and_flush( + &self, + len: u64, + ) -> Result<(), StreamError> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - let v4 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + let v5 = match l3 { 0 => { - let e4 = { - let l3 = *ptr0.add(8).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l3 as u32) + let e5 = { + let l4 = *ptr0.add(8).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l4 as u32, + ) }; - StreamError::LastOperationFailed(e4) + StreamError::LastOperationFailed(e5) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v4 + v5 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -10793,7 +10873,7 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Read from one stream and write to another. /// - /// The behavior of splice is equivelant to: + /// The behavior of splice is equivalent to: /// 1. calling `check-write` on the `output-stream` /// 2. calling `read` on the `input-stream` with the smaller of the /// `check-write` permitted length and the `len` provided to `splice` @@ -10804,63 +10884,68 @@ pub mod wasi { /// /// This function returns the number of bytes transferred; it may be less /// than `len`. - pub fn splice(&self, src: &InputStream, len: u64) -> Result { + pub fn splice( + &self, + src: &InputStream, + len: u64, + ) -> Result { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.splice"] - fn wit_import(_: i32, _: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( + wit_import1( (self).handle() as i32, (src).handle() as i32, _rt::as_i64(&len), ptr0, ); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + let l2 = i32::from(*ptr0.add(0).cast::()); + let result7 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr0.add(8).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr0.add(12).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -10879,72 +10964,75 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + #[link(wasm_import_module = "wasi:io/streams@0.2.4")] extern "C" { #[link_name = "[method]output-stream.blocking-splice"] - fn wit_import(_: i32, _: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( + wit_import1( (self).handle() as i32, (src).handle() as i32, _rt::as_i64(&len), ptr0, ); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + let l2 = i32::from(*ptr0.add(0).cast::()); + let result7 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v5 = match l3 { + let l4 = i32::from(*ptr0.add(8).cast::()); + let v6 = match l4 { 0 => { - let e5 = { - let l4 = *ptr0.add(12).cast::(); - - super::super::super::wasi::io::error::Error::from_handle(l4 as u32) + let e6 = { + let l5 = *ptr0.add(12).cast::(); + super::super::super::wasi::io::error::Error::from_handle( + l5 as u32, + ) }; - StreamError::LastOperationFailed(e5) + StreamError::LastOperationFailed(e6) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); StreamError::Closed } }; - - v5 + v6 }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } } } pub mod random { - #[allow(clippy::all)] + /// WASI Random is a random data API. + /// + /// It is intended to be portable at least between Unix-family platforms and + /// Windows. + #[allow(dead_code, unused_imports, clippy::all)] pub mod random { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; #[allow(unused_unsafe, clippy::all)] /// Return `len` cryptographically-secure random or pseudo-random bytes. @@ -10966,21 +11054,21 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/random@0.2.0")] + #[link(wasm_import_module = "wasi:random/random@0.2.4")] extern "C" { #[link_name = "get-random-bytes"] - fn wit_import(_: i64, _: *mut u8); + fn wit_import1(_: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i64, _: *mut u8) { unreachable!() } - wit_import(_rt::as_i64(&len), ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let len3 = l2; - _rt::Vec::from_raw_parts(l1.cast(), len3, len3) + wit_import1(_rt::as_i64(&len), ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let len4 = l3; + let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + result5 } } #[allow(unused_unsafe, clippy::all)] @@ -10991,29 +11079,29 @@ pub mod wasi { pub fn get_random_u64() -> u64 { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/random@0.2.0")] + #[link(wasm_import_module = "wasi:random/random@0.2.4")] extern "C" { #[link_name = "get-random-u64"] - fn wit_import() -> i64; + fn wit_import0() -> i64; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i64 { + extern "C" fn wit_import0() -> i64 { unreachable!() } - let ret = wit_import(); + let ret = wit_import0(); ret as u64 } } } - - #[allow(clippy::all)] + /// The insecure interface for insecure pseudo-random numbers. + /// + /// It is intended to be portable at least between Unix-family platforms and + /// Windows. + #[allow(dead_code, unused_imports, clippy::all)] pub mod insecure { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; #[allow(unused_unsafe, clippy::all)] /// Return `len` insecure pseudo-random bytes. @@ -11031,21 +11119,21 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] + #[link(wasm_import_module = "wasi:random/insecure@0.2.4")] extern "C" { #[link_name = "get-insecure-random-bytes"] - fn wit_import(_: i64, _: *mut u8); + fn wit_import1(_: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i64, _: *mut u8) { unreachable!() } - wit_import(_rt::as_i64(&len), ptr0); - let l1 = *ptr0.add(0).cast::<*mut u8>(); - let l2 = *ptr0.add(4).cast::(); - let len3 = l2; - _rt::Vec::from_raw_parts(l1.cast(), len3, len3) + wit_import1(_rt::as_i64(&len), ptr0); + let l2 = *ptr0.add(0).cast::<*mut u8>(); + let l3 = *ptr0.add(4).cast::(); + let len4 = l3; + let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + result5 } } #[allow(unused_unsafe, clippy::all)] @@ -11056,29 +11144,29 @@ pub mod wasi { pub fn get_insecure_random_u64() -> u64 { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] + #[link(wasm_import_module = "wasi:random/insecure@0.2.4")] extern "C" { #[link_name = "get-insecure-random-u64"] - fn wit_import() -> i64; + fn wit_import0() -> i64; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i64 { + extern "C" fn wit_import0() -> i64 { unreachable!() } - let ret = wit_import(); + let ret = wit_import0(); ret as u64 } } } - - #[allow(clippy::all)] + /// The insecure-seed interface for seeding hash-map DoS resistance. + /// + /// It is intended to be portable at least between Unix-family platforms and + /// Windows. + #[allow(dead_code, unused_imports, clippy::all)] pub mod insecure_seed { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; #[allow(unused_unsafe, clippy::all)] /// Return a 128-bit value that may contain a pseudo-random value. /// @@ -11104,43 +11192,39 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure-seed@0.2.0")] + #[link(wasm_import_module = "wasi:random/insecure-seed@0.2.4")] extern "C" { #[link_name = "insecure-seed"] - fn wit_import(_: *mut u8); + fn wit_import1(_: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: *mut u8) { + extern "C" fn wit_import1(_: *mut u8) { unreachable!() } - wit_import(ptr0); - let l1 = *ptr0.add(0).cast::(); - let l2 = *ptr0.add(8).cast::(); - (l1 as u64, l2 as u64) + wit_import1(ptr0); + let l2 = *ptr0.add(0).cast::(); + let l3 = *ptr0.add(8).cast::(); + let result4 = (l2 as u64, l3 as u64); + result4 } } } } pub mod sockets { - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod network { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; /// An opaque resource that represents access to (a subset of) the network. /// This enables context-based security for networking. /// There is no need for this to map 1:1 to a physical network interface. - #[derive(Debug)] #[repr(transparent)] pub struct Network { handle: _rt::Resource, } - impl Network { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -11148,37 +11232,31 @@ pub mod wasi { 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 Network { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:sockets/network@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/network@0.2.4")] extern "C" { #[link_name = "[resource-drop]network"] fn drop(_: u32); } - drop(_handle); } } } - /// Error codes. /// /// In theory, every API can return any error code. @@ -11192,7 +11270,7 @@ pub mod wasi { /// /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum ErrorCode { /// Unknown error Unknown, @@ -11276,55 +11354,98 @@ pub mod wasi { ErrorCode::ConnectionAborted => "connection-aborted", ErrorCode::DatagramTooLarge => "datagram-too-large", ErrorCode::NameUnresolvable => "name-unresolvable", - ErrorCode::TemporaryResolverFailure => "temporary-resolver-failure", - ErrorCode::PermanentResolverFailure => "permanent-resolver-failure", + ErrorCode::TemporaryResolverFailure => { + "temporary-resolver-failure" + } + ErrorCode::PermanentResolverFailure => { + "permanent-resolver-failure" + } } } pub fn message(&self) -> &'static str { match self { - ErrorCode::Unknown => "Unknown error", - ErrorCode::AccessDenied => "Access denied. + ErrorCode::Unknown => "Unknown error", + ErrorCode::AccessDenied => { + "Access denied. - POSIX equivalent: EACCES, EPERM", - ErrorCode::NotSupported => "The operation is not supported. + POSIX equivalent: EACCES, EPERM" + } + ErrorCode::NotSupported => { + "The operation is not supported. - POSIX equivalent: EOPNOTSUPP", - ErrorCode::InvalidArgument => "One of the arguments is invalid. + POSIX equivalent: EOPNOTSUPP" + } + ErrorCode::InvalidArgument => { + "One of the arguments is invalid. - POSIX equivalent: EINVAL", - ErrorCode::OutOfMemory => "Not enough memory to complete the operation. + POSIX equivalent: EINVAL" + } + ErrorCode::OutOfMemory => { + "Not enough memory to complete the operation. - POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY", - ErrorCode::Timeout => "The operation timed out before it could finish completely.", - ErrorCode::ConcurrencyConflict => "This operation is incompatible with another asynchronous operation that is already in progress. + POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY" + } + ErrorCode::Timeout => { + "The operation timed out before it could finish completely." + } + ErrorCode::ConcurrencyConflict => { + "This operation is incompatible with another asynchronous operation that is already in progress. - POSIX equivalent: EALREADY", - ErrorCode::NotInProgress => "Trying to finish an asynchronous operation that: + POSIX equivalent: EALREADY" + } + ErrorCode::NotInProgress => { + "Trying to finish an asynchronous operation that: - has not been started yet, or: - was already finished by a previous `finish-*` call. - Note: this is scheduled to be removed when `future`s are natively supported.", - ErrorCode::WouldBlock => "The operation has been aborted because it could not be completed immediately. + Note: this is scheduled to be removed when `future`s are natively supported." + } + ErrorCode::WouldBlock => { + "The operation has been aborted because it could not be completed immediately. - Note: this is scheduled to be removed when `future`s are natively supported.", - ErrorCode::InvalidState => "The operation is not valid in the socket's current state.", - ErrorCode::NewSocketLimit => "A new socket resource could not be created because of a system limit.", - ErrorCode::AddressNotBindable => "A bind operation failed because the provided address is not an address that the `network` can bind to.", - ErrorCode::AddressInUse => "A bind operation failed because the provided address is already in use or because there are no ephemeral ports available.", - ErrorCode::RemoteUnreachable => "The remote address is not reachable", - ErrorCode::ConnectionRefused => "The TCP connection was forcefully rejected", - ErrorCode::ConnectionReset => "The TCP connection was reset.", - ErrorCode::ConnectionAborted => "A TCP connection was aborted.", - ErrorCode::DatagramTooLarge => "The size of a datagram sent to a UDP socket exceeded the maximum - supported size.", - ErrorCode::NameUnresolvable => "Name does not exist or has no suitable associated IP addresses.", - ErrorCode::TemporaryResolverFailure => "A temporary failure in name resolution occurred.", - ErrorCode::PermanentResolverFailure => "A permanent failure in name resolution occurred.", - } + Note: this is scheduled to be removed when `future`s are natively supported." + } + ErrorCode::InvalidState => { + "The operation is not valid in the socket's current state." + } + ErrorCode::NewSocketLimit => { + "A new socket resource could not be created because of a system limit." + } + ErrorCode::AddressNotBindable => { + "A bind operation failed because the provided address is not an address that the `network` can bind to." + } + ErrorCode::AddressInUse => { + "A bind operation failed because the provided address is already in use or because there are no ephemeral ports available." + } + ErrorCode::RemoteUnreachable => { + "The remote address is not reachable" + } + ErrorCode::ConnectionRefused => { + "The TCP connection was forcefully rejected" + } + ErrorCode::ConnectionReset => "The TCP connection was reset.", + ErrorCode::ConnectionAborted => "A TCP connection was aborted.", + ErrorCode::DatagramTooLarge => { + "The size of a datagram sent to a UDP socket exceeded the maximum + supported size." + } + ErrorCode::NameUnresolvable => { + "Name does not exist or has no suitable associated IP addresses." + } + ErrorCode::TemporaryResolverFailure => { + "A temporary failure in name resolution occurred." + } + ErrorCode::PermanentResolverFailure => { + "A permanent failure in name resolution occurred." + } + } } } impl ::core::fmt::Debug for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("ErrorCode") .field("code", &(*self as i32)) .field("name", &self.name()) @@ -11333,20 +11454,21 @@ pub mod wasi { } } impl ::core::fmt::Display for ErrorCode { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - write!(f, "{} (error {})", self.name(), *self as i32) + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { + write!(f, "{} (error {})", self.name(), * self as i32) } } - #[cfg(feature = "std")] impl std::error::Error for ErrorCode {} - impl ErrorCode { - pub(crate) unsafe fn _lift(val: u8) -> ErrorCode { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> ErrorCode { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => ErrorCode::Unknown, 1 => ErrorCode::AccessDenied, @@ -11369,14 +11491,12 @@ pub mod wasi { 18 => ErrorCode::NameUnresolvable, 19 => ErrorCode::TemporaryResolverFailure, 20 => ErrorCode::PermanentResolverFailure, - _ => panic!("invalid enum discriminant"), } } } - #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum IpAddressFamily { /// Similar to `AF_INET` in POSIX. Ipv4, @@ -11384,29 +11504,33 @@ pub mod wasi { Ipv6, } impl ::core::fmt::Debug for IpAddressFamily { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - IpAddressFamily::Ipv4 => f.debug_tuple("IpAddressFamily::Ipv4").finish(), - IpAddressFamily::Ipv6 => f.debug_tuple("IpAddressFamily::Ipv6").finish(), + IpAddressFamily::Ipv4 => { + f.debug_tuple("IpAddressFamily::Ipv4").finish() + } + IpAddressFamily::Ipv6 => { + f.debug_tuple("IpAddressFamily::Ipv6").finish() + } } } } - impl IpAddressFamily { - pub(crate) unsafe fn _lift(val: u8) -> IpAddressFamily { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> IpAddressFamily { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => IpAddressFamily::Ipv4, 1 => IpAddressFamily::Ipv6, - _ => panic!("invalid enum discriminant"), } } } - pub type Ipv4Address = (u8, u8, u8, u8); pub type Ipv6Address = (u16, u16, u16, u16, u16, u16, u16, u16); #[derive(Clone, Copy)] @@ -11415,10 +11539,17 @@ pub mod wasi { Ipv6(Ipv6Address), } impl ::core::fmt::Debug for IpAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - IpAddress::Ipv4(e) => f.debug_tuple("IpAddress::Ipv4").field(e).finish(), - IpAddress::Ipv6(e) => f.debug_tuple("IpAddress::Ipv6").field(e).finish(), + IpAddress::Ipv4(e) => { + f.debug_tuple("IpAddress::Ipv4").field(e).finish() + } + IpAddress::Ipv6(e) => { + f.debug_tuple("IpAddress::Ipv6").field(e).finish() + } } } } @@ -11431,7 +11562,10 @@ pub mod wasi { pub address: Ipv4Address, } impl ::core::fmt::Debug for Ipv4SocketAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Ipv4SocketAddress") .field("port", &self.port) .field("address", &self.address) @@ -11451,7 +11585,10 @@ pub mod wasi { pub scope_id: u32, } impl ::core::fmt::Debug for Ipv6SocketAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("Ipv6SocketAddress") .field("port", &self.port) .field("flow-info", &self.flow_info) @@ -11466,7 +11603,10 @@ pub mod wasi { Ipv6(Ipv6SocketAddress), } impl ::core::fmt::Debug for IpSocketAddress { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { IpSocketAddress::Ipv4(e) => { f.debug_tuple("IpSocketAddress::Ipv4").field(e).finish() @@ -11478,43 +11618,39 @@ pub mod wasi { } } } - - #[allow(clippy::all)] + /// This interface provides a value-export of the default network handle.. + #[allow(dead_code, unused_imports, clippy::all)] pub mod instance_network { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; pub type Network = super::super::super::wasi::sockets::network::Network; #[allow(unused_unsafe, clippy::all)] /// Get a handle to the default network. pub fn instance_network() -> Network { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.4")] extern "C" { #[link_name = "instance-network"] - fn wit_import() -> i32; + fn wit_import0() -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import() -> i32 { + extern "C" fn wit_import0() -> i32 { unreachable!() } - let ret = wit_import(); - super::super::super::wasi::sockets::network::Network::from_handle(ret as u32) + let ret = wit_import0(); + super::super::super::wasi::sockets::network::Network::from_handle( + ret as u32, + ) } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod udp { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Pollable = super::super::super::wasi::io::poll::Pollable; pub type Network = super::super::super::wasi::sockets::network::Network; @@ -11536,7 +11672,10 @@ pub mod wasi { pub remote_address: IpSocketAddress, } impl ::core::fmt::Debug for IncomingDatagram { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("IncomingDatagram") .field("data", &self.data) .field("remote-address", &self.remote_address) @@ -11558,7 +11697,10 @@ pub mod wasi { pub remote_address: Option, } impl ::core::fmt::Debug for OutgoingDatagram { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { f.debug_struct("OutgoingDatagram") .field("data", &self.data) .field("remote-address", &self.remote_address) @@ -11566,13 +11708,11 @@ pub mod wasi { } } /// A UDP socket handle. - #[derive(Debug)] #[repr(transparent)] pub struct UdpSocket { handle: _rt::Resource, } - impl UdpSocket { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -11580,43 +11720,36 @@ pub mod wasi { 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 UdpSocket { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[resource-drop]udp-socket"] fn drop(_: u32); } - drop(_handle); } } } - #[derive(Debug)] #[repr(transparent)] pub struct IncomingDatagramStream { handle: _rt::Resource, } - impl IncomingDatagramStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -11624,43 +11757,36 @@ pub mod wasi { 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 IncomingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[resource-drop]incoming-datagram-stream"] fn drop(_: u32); } - drop(_handle); } } } - #[derive(Debug)] #[repr(transparent)] pub struct OutgoingDatagramStream { handle: _rt::Resource, } - impl OutgoingDatagramStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -11668,37 +11794,31 @@ pub mod wasi { 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 OutgoingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[resource-drop]outgoing-datagram-stream"] fn drop(_: u32); } - drop(_handle); } } } - impl UdpSocket { #[allow(unused_unsafe, clippy::all)] /// Bind the socket to a specific network on the provided IP address and port. @@ -11735,7 +11855,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); use super::super::super::wasi::sockets::network::IpSocketAddress as V4; let ( result5_0, @@ -11752,9 +11874,11 @@ pub mod wasi { result5_11, ) = match local_address { V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress{ port:port0, address:address0, } = e; + let super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: port0, + address: address0, + } = e; let (t1_0, t1_1, t1_2, t1_3) = address0; - ( 0i32, _rt::as_i32(port0), @@ -11771,9 +11895,13 @@ pub mod wasi { ) } V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress{ port:port2, flow_info:flow_info2, address:address2, scope_id:scope_id2, } = e; + let super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: port2, + flow_info: flow_info2, + address: address2, + scope_id: scope_id2, + } = e; let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( 1i32, _rt::as_i32(port2), @@ -11792,10 +11920,10 @@ pub mod wasi { }; let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.start-bind"] - fn wit_import( + fn wit_import7( _: i32, _: i32, _: i32, @@ -11813,9 +11941,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import7( _: i32, _: i32, _: i32, @@ -11834,7 +11961,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import7( (self).handle() as i32, (network).handle() as i32, result5_0, @@ -11851,24 +11978,24 @@ pub mod wasi { result5_11, ptr6, ); - let l7 = i32::from(*ptr6.add(0).cast::()); - match l7 { + let l8 = i32::from(*ptr6.add(0).cast::()); + let result10 = match l8 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l8 = i32::from(*ptr6.add(1).cast::()); - + let l9 = i32::from(*ptr6.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l8 as u8, + l9 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result10 } } } @@ -11878,38 +12005,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.finish-bind"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -11932,10 +12060,10 @@ pub mod wasi { /// The POSIX equivalent in pseudo-code is: /// ```text /// if (was previously connected) { - /// connect(s, AF_UNSPEC) + /// connect(s, AF_UNSPEC) /// } /// if (remote_address is Some) { - /// connect(s, remote_address) + /// connect(s, remote_address) /// } /// ``` /// @@ -11958,12 +12086,16 @@ pub mod wasi { pub fn stream( &self, remote_address: Option, - ) -> Result<(IncomingDatagramStream, OutgoingDatagramStream), ErrorCode> - { + ) -> Result< + (IncomingDatagramStream, OutgoingDatagramStream), + ErrorCode, + > { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ( result6_0, result6_1, @@ -11996,9 +12128,11 @@ pub mod wasi { result5_11, ) = match e { V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress{ port:port0, address:address0, } = e; + let super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: port0, + address: address0, + } = e; let (t1_0, t1_1, t1_2, t1_3) = address0; - ( 0i32, _rt::as_i32(port0), @@ -12015,10 +12149,13 @@ pub mod wasi { ) } V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress{ port:port2, flow_info:flow_info2, address:address2, scope_id:scope_id2, } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = - address2; - + let super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: port2, + flow_info: flow_info2, + address: address2, + scope_id: scope_id2, + } = e; + let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; ( 1i32, _rt::as_i32(port2), @@ -12035,24 +12172,46 @@ pub mod wasi { ) } }; - ( - 1i32, result5_0, result5_1, result5_2, result5_3, result5_4, - result5_5, result5_6, result5_7, result5_8, result5_9, - result5_10, result5_11, + 1i32, + result5_0, + result5_1, + result5_2, + result5_3, + result5_4, + result5_5, + result5_6, + result5_7, + result5_8, + result5_9, + result5_10, + result5_11, + ) + } + None => { + ( + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, + 0i32, ) } - None => ( - 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, 0i32, - 0i32, 0i32, - ), }; let ptr7 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.stream"] - fn wit_import( + fn wit_import8( _: i32, _: i32, _: i32, @@ -12070,9 +12229,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import8( _: i32, _: i32, _: i32, @@ -12091,7 +12249,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import8( (self).handle() as i32, result6_0, result6_1, @@ -12108,32 +12266,31 @@ pub mod wasi { result6_12, ptr7, ); - let l8 = i32::from(*ptr7.add(0).cast::()); - match l8 { + let l9 = i32::from(*ptr7.add(0).cast::()); + let result13 = match l9 { 0 => { let e = { - let l9 = *ptr7.add(4).cast::(); - let l10 = *ptr7.add(8).cast::(); - + let l10 = *ptr7.add(4).cast::(); + let l11 = *ptr7.add(8).cast::(); ( - IncomingDatagramStream::from_handle(l9 as u32), - OutgoingDatagramStream::from_handle(l10 as u32), + IncomingDatagramStream::from_handle(l10 as u32), + OutgoingDatagramStream::from_handle(l11 as u32), ) }; Ok(e) } 1 => { let e = { - let l11 = i32::from(*ptr7.add(4).cast::()); - + let l12 = i32::from(*ptr7.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l11 as u8, + l12 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result13 } } } @@ -12159,84 +12316,91 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 36]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 36], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.local-address"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result22 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V19; - let v19 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + use super::super::super::wasi::sockets::network::IpSocketAddress as V20; + let v20 = match l3 { 0 => { - let e19 = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = i32::from(*ptr0.add(10).cast::()); - let l5 = i32::from(*ptr0.add(11).cast::()); - let l6 = i32::from(*ptr0.add(12).cast::()); - let l7 = i32::from(*ptr0.add(13).cast::()); - - super::super::super::wasi::sockets::network::Ipv4SocketAddress{ - port: l3 as u16, - address: (l4 as u8, l5 as u8, l6 as u8, l7 as u8), - } + let e20 = { + let l4 = i32::from(*ptr0.add(8).cast::()); + let l5 = i32::from(*ptr0.add(10).cast::()); + let l6 = i32::from(*ptr0.add(11).cast::()); + let l7 = i32::from(*ptr0.add(12).cast::()); + let l8 = i32::from(*ptr0.add(13).cast::()); + super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: l4 as u16, + address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), + } }; - V19::Ipv4(e19) + V20::Ipv4(e20) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e19 = { - let l8 = i32::from(*ptr0.add(8).cast::()); - let l9 = *ptr0.add(12).cast::(); - let l10 = i32::from(*ptr0.add(16).cast::()); - let l11 = i32::from(*ptr0.add(18).cast::()); - let l12 = i32::from(*ptr0.add(20).cast::()); - let l13 = i32::from(*ptr0.add(22).cast::()); - let l14 = i32::from(*ptr0.add(24).cast::()); - let l15 = i32::from(*ptr0.add(26).cast::()); - let l16 = i32::from(*ptr0.add(28).cast::()); - let l17 = i32::from(*ptr0.add(30).cast::()); - let l18 = *ptr0.add(32).cast::(); - - super::super::super::wasi::sockets::network::Ipv6SocketAddress{ - port: l8 as u16, - flow_info: l9 as u32, - address: (l10 as u16, l11 as u16, l12 as u16, l13 as u16, l14 as u16, l15 as u16, l16 as u16, l17 as u16), - scope_id: l18 as u32, - } + let e20 = { + let l9 = i32::from(*ptr0.add(8).cast::()); + let l10 = *ptr0.add(12).cast::(); + let l11 = i32::from(*ptr0.add(16).cast::()); + let l12 = i32::from(*ptr0.add(18).cast::()); + let l13 = i32::from(*ptr0.add(20).cast::()); + let l14 = i32::from(*ptr0.add(22).cast::()); + let l15 = i32::from(*ptr0.add(24).cast::()); + let l16 = i32::from(*ptr0.add(26).cast::()); + let l17 = i32::from(*ptr0.add(28).cast::()); + let l18 = i32::from(*ptr0.add(30).cast::()); + let l19 = *ptr0.add(32).cast::(); + super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: l9 as u16, + flow_info: l10 as u32, + address: ( + l11 as u16, + l12 as u16, + l13 as u16, + l14 as u16, + l15 as u16, + l16 as u16, + l17 as u16, + l18 as u16, + ), + scope_id: l19 as u32, + } }; - V19::Ipv6(e19) + V20::Ipv6(e20) } }; - - v19 + v20 }; Ok(e) } 1 => { let e = { - let l20 = i32::from(*ptr0.add(4).cast::()); - + let l21 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l20 as u8, + l21 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result22 } } } @@ -12256,84 +12420,91 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 36]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 36], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.remote-address"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result22 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V19; - let v19 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + use super::super::super::wasi::sockets::network::IpSocketAddress as V20; + let v20 = match l3 { 0 => { - let e19 = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = i32::from(*ptr0.add(10).cast::()); - let l5 = i32::from(*ptr0.add(11).cast::()); - let l6 = i32::from(*ptr0.add(12).cast::()); - let l7 = i32::from(*ptr0.add(13).cast::()); - - super::super::super::wasi::sockets::network::Ipv4SocketAddress{ - port: l3 as u16, - address: (l4 as u8, l5 as u8, l6 as u8, l7 as u8), - } + let e20 = { + let l4 = i32::from(*ptr0.add(8).cast::()); + let l5 = i32::from(*ptr0.add(10).cast::()); + let l6 = i32::from(*ptr0.add(11).cast::()); + let l7 = i32::from(*ptr0.add(12).cast::()); + let l8 = i32::from(*ptr0.add(13).cast::()); + super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: l4 as u16, + address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), + } }; - V19::Ipv4(e19) + V20::Ipv4(e20) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e19 = { - let l8 = i32::from(*ptr0.add(8).cast::()); - let l9 = *ptr0.add(12).cast::(); - let l10 = i32::from(*ptr0.add(16).cast::()); - let l11 = i32::from(*ptr0.add(18).cast::()); - let l12 = i32::from(*ptr0.add(20).cast::()); - let l13 = i32::from(*ptr0.add(22).cast::()); - let l14 = i32::from(*ptr0.add(24).cast::()); - let l15 = i32::from(*ptr0.add(26).cast::()); - let l16 = i32::from(*ptr0.add(28).cast::()); - let l17 = i32::from(*ptr0.add(30).cast::()); - let l18 = *ptr0.add(32).cast::(); - - super::super::super::wasi::sockets::network::Ipv6SocketAddress{ - port: l8 as u16, - flow_info: l9 as u32, - address: (l10 as u16, l11 as u16, l12 as u16, l13 as u16, l14 as u16, l15 as u16, l16 as u16, l17 as u16), - scope_id: l18 as u32, - } + let e20 = { + let l9 = i32::from(*ptr0.add(8).cast::()); + let l10 = *ptr0.add(12).cast::(); + let l11 = i32::from(*ptr0.add(16).cast::()); + let l12 = i32::from(*ptr0.add(18).cast::()); + let l13 = i32::from(*ptr0.add(20).cast::()); + let l14 = i32::from(*ptr0.add(22).cast::()); + let l15 = i32::from(*ptr0.add(24).cast::()); + let l16 = i32::from(*ptr0.add(26).cast::()); + let l17 = i32::from(*ptr0.add(28).cast::()); + let l18 = i32::from(*ptr0.add(30).cast::()); + let l19 = *ptr0.add(32).cast::(); + super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: l9 as u16, + flow_info: l10 as u32, + address: ( + l11 as u16, + l12 as u16, + l13 as u16, + l14 as u16, + l15 as u16, + l16 as u16, + l17 as u16, + l18 as u16, + ), + scope_id: l19 as u32, + } }; - V19::Ipv6(e19) + V20::Ipv6(e20) } }; - - v19 + v20 }; Ok(e) } 1 => { let e = { - let l20 = i32::from(*ptr0.add(4).cast::()); - + let l21 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l20 as u8, + l21 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result22 } } } @@ -12345,17 +12516,16 @@ pub mod wasi { pub fn address_family(&self) -> IpAddressFamily { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.address-family"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); super::super::super::wasi::sockets::network::IpAddressFamily::_lift( ret as u8, ) @@ -12374,42 +12544,42 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.unicast-hop-limit"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - l2 as u8 + let l3 = i32::from(*ptr0.add(1).cast::()); + l3 as u8 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - + let l4 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -12419,38 +12589,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.set-unicast-hop-limit"] - fn wit_import(_: i32, _: i32, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i32(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -12470,34 +12641,78 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.receive-buffer-size"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); + super::super::super::wasi::sockets::network::ErrorCode::_lift( + l4 as u8, + ) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + }; + result5 + } + } + } + impl UdpSocket { + #[allow(unused_unsafe, clippy::all)] + pub fn set_receive_buffer_size( + &self, + value: u64, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] + extern "C" { + #[link_name = "[method]udp-socket.set-receive-buffer-size"] + fn wit_import1(_: i32, _: i64, _: *mut u8); + } + #[cfg(not(target_arch = "wasm32"))] + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, ) @@ -12505,48 +12720,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - extern "C" { - #[link_name = "[method]udp-socket.set-receive-buffer-size"] - fn wit_import(_: i32, _: i64, _: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -12556,42 +12731,42 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.send-buffer-size"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -12601,38 +12776,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.set-send-buffer-size"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -12640,23 +12816,24 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the socket is ready for I/O. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]udp-socket.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -12692,125 +12869,114 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]incoming-datagram-stream.receive"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&max_results), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1( + (self).handle() as i32, + _rt::as_i64(&max_results), + ptr0, + ); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result28 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::<*mut u8>(); - let l3 = *ptr0.add(8).cast::(); - let base25 = l2; - let len25 = l3; - let mut result25 = _rt::Vec::with_capacity(len25); - for i in 0..len25 { - let base = base25.add(i * 40); - let e25 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base.add(4).cast::(); - let len6 = l5; - let l7 = i32::from(*base.add(8).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V24; - let v24 = match l7 { + let l3 = *ptr0.add(4).cast::<*mut u8>(); + let l4 = *ptr0.add(8).cast::(); + let base26 = l3; + let len26 = l4; + let mut result26 = _rt::Vec::with_capacity(len26); + for i in 0..len26 { + let base = base26.add(i * 40); + let e26 = { + let l5 = *base.add(0).cast::<*mut u8>(); + let l6 = *base.add(4).cast::(); + let len7 = l6; + let l8 = i32::from(*base.add(8).cast::()); + use super::super::super::wasi::sockets::network::IpSocketAddress as V25; + let v25 = match l8 { 0 => { - let e24 = { - let l8 = - i32::from(*base.add(12).cast::()); - let l9 = - i32::from(*base.add(14).cast::()); - let l10 = - i32::from(*base.add(15).cast::()); - let l11 = - i32::from(*base.add(16).cast::()); - let l12 = - i32::from(*base.add(17).cast::()); - - super::super::super::wasi::sockets::network::Ipv4SocketAddress{ - port: l8 as u16, - address: (l9 as u8, l10 as u8, l11 as u8, l12 as u8), - } + let e25 = { + let l9 = i32::from(*base.add(12).cast::()); + let l10 = i32::from(*base.add(14).cast::()); + let l11 = i32::from(*base.add(15).cast::()); + let l12 = i32::from(*base.add(16).cast::()); + let l13 = i32::from(*base.add(17).cast::()); + super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: l9 as u16, + address: (l10 as u8, l11 as u8, l12 as u8, l13 as u8), + } }; - V24::Ipv4(e24) + V25::Ipv4(e25) } n => { - debug_assert_eq!( - n, 1, - "invalid enum discriminant" - ); - let e24 = { - let l13 = - i32::from(*base.add(12).cast::()); - let l14 = *base.add(16).cast::(); - let l15 = - i32::from(*base.add(20).cast::()); - let l16 = - i32::from(*base.add(22).cast::()); - let l17 = - i32::from(*base.add(24).cast::()); - let l18 = - i32::from(*base.add(26).cast::()); - let l19 = - i32::from(*base.add(28).cast::()); - let l20 = - i32::from(*base.add(30).cast::()); - let l21 = - i32::from(*base.add(32).cast::()); - let l22 = - i32::from(*base.add(34).cast::()); - let l23 = *base.add(36).cast::(); - - super::super::super::wasi::sockets::network::Ipv6SocketAddress{ - port: l13 as u16, - flow_info: l14 as u32, - address: (l15 as u16, l16 as u16, l17 as u16, l18 as u16, l19 as u16, l20 as u16, l21 as u16, l22 as u16), - scope_id: l23 as u32, - } + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e25 = { + let l14 = i32::from(*base.add(12).cast::()); + let l15 = *base.add(16).cast::(); + let l16 = i32::from(*base.add(20).cast::()); + let l17 = i32::from(*base.add(22).cast::()); + let l18 = i32::from(*base.add(24).cast::()); + let l19 = i32::from(*base.add(26).cast::()); + let l20 = i32::from(*base.add(28).cast::()); + let l21 = i32::from(*base.add(30).cast::()); + let l22 = i32::from(*base.add(32).cast::()); + let l23 = i32::from(*base.add(34).cast::()); + let l24 = *base.add(36).cast::(); + super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: l14 as u16, + flow_info: l15 as u32, + address: ( + l16 as u16, + l17 as u16, + l18 as u16, + l19 as u16, + l20 as u16, + l21 as u16, + l22 as u16, + l23 as u16, + ), + scope_id: l24 as u32, + } }; - V24::Ipv6(e24) + V25::Ipv6(e25) } }; - IncomingDatagram { - data: _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ), - remote_address: v24, + data: _rt::Vec::from_raw_parts(l5.cast(), len7, len7), + remote_address: v25, } }; - result25.push(e25); + result26.push(e26); } - _rt::cabi_dealloc(base25, len25 * 40, 4); - - result25 + _rt::cabi_dealloc(base26, len26 * 40, 4); + result26 }; Ok(e) } 1 => { let e = { - let l26 = i32::from(*ptr0.add(4).cast::()); - + let l27 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l26 as u8, + l27 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result28 } } } @@ -12818,23 +12984,24 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the stream is ready to receive again. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]incoming-datagram-stream.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -12855,42 +13022,42 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]outgoing-datagram-stream.check-send"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -12930,15 +13097,22 @@ pub mod wasi { /// - /// - /// - - pub fn send(&self, datagrams: &[OutgoingDatagram]) -> Result { + pub fn send( + &self, + datagrams: &[OutgoingDatagram], + ) -> Result { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let vec7 = datagrams; let len7 = vec7.len(); - let layout7 = - _rt::alloc::Layout::from_size_align_unchecked(vec7.len() * 44, 4); + let layout7 = _rt::alloc::Layout::from_size_align_unchecked( + vec7.len() * 44, + 4, + ); let result7 = if layout7.size() != 0 { let ptr = _rt::alloc::alloc(layout7).cast::(); if ptr.is_null() { @@ -12946,9 +13120,7 @@ pub mod wasi { } ptr } else { - { - ::core::ptr::null_mut() - } + ::core::ptr::null_mut() }; for (i, e) in vec7.into_iter().enumerate() { let base = result7.add(i * 44); @@ -12969,54 +13141,37 @@ pub mod wasi { match e { V6::Ipv4(e) => { *base.add(12).cast::() = (0i32) as u8; - let super::super::super::wasi::sockets::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; - *base.add(16).cast::() = - (_rt::as_i32(port2)) as u16; + let super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: port2, + address: address2, + } = e; + *base.add(16).cast::() = (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; - *base.add(18).cast::() = - (_rt::as_i32(t3_0)) as u8; - *base.add(19).cast::() = - (_rt::as_i32(t3_1)) as u8; - *base.add(20).cast::() = - (_rt::as_i32(t3_2)) as u8; - *base.add(21).cast::() = - (_rt::as_i32(t3_3)) as u8; + *base.add(18).cast::() = (_rt::as_i32(t3_0)) as u8; + *base.add(19).cast::() = (_rt::as_i32(t3_1)) as u8; + *base.add(20).cast::() = (_rt::as_i32(t3_2)) as u8; + *base.add(21).cast::() = (_rt::as_i32(t3_3)) as u8; } V6::Ipv6(e) => { *base.add(12).cast::() = (1i32) as u8; - let super::super::super::wasi::sockets::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; - *base.add(16).cast::() = - (_rt::as_i32(port4)) as u16; - *base.add(20).cast::() = - _rt::as_i32(flow_info4); - let ( - t5_0, - t5_1, - t5_2, - t5_3, - t5_4, - t5_5, - t5_6, - t5_7, - ) = address4; - *base.add(24).cast::() = - (_rt::as_i32(t5_0)) as u16; - *base.add(26).cast::() = - (_rt::as_i32(t5_1)) as u16; - *base.add(28).cast::() = - (_rt::as_i32(t5_2)) as u16; - *base.add(30).cast::() = - (_rt::as_i32(t5_3)) as u16; - *base.add(32).cast::() = - (_rt::as_i32(t5_4)) as u16; - *base.add(34).cast::() = - (_rt::as_i32(t5_5)) as u16; - *base.add(36).cast::() = - (_rt::as_i32(t5_6)) as u16; - *base.add(38).cast::() = - (_rt::as_i32(t5_7)) as u16; - *base.add(40).cast::() = - _rt::as_i32(scope_id4); + let super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: port4, + flow_info: flow_info4, + address: address4, + scope_id: scope_id4, + } = e; + *base.add(16).cast::() = (_rt::as_i32(port4)) as u16; + *base.add(20).cast::() = _rt::as_i32(flow_info4); + let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; + *base.add(24).cast::() = (_rt::as_i32(t5_0)) as u16; + *base.add(26).cast::() = (_rt::as_i32(t5_1)) as u16; + *base.add(28).cast::() = (_rt::as_i32(t5_2)) as u16; + *base.add(30).cast::() = (_rt::as_i32(t5_3)) as u16; + *base.add(32).cast::() = (_rt::as_i32(t5_4)) as u16; + *base.add(34).cast::() = (_rt::as_i32(t5_5)) as u16; + *base.add(36).cast::() = (_rt::as_i32(t5_6)) as u16; + *base.add(38).cast::() = (_rt::as_i32(t5_7)) as u16; + *base.add(40).cast::() = _rt::as_i32(scope_id4); } } } @@ -13028,42 +13183,45 @@ pub mod wasi { } let ptr8 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]outgoing-datagram-stream.send"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import9(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import9( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, result7, len7, ptr8); - let l9 = i32::from(*ptr8.add(0).cast::()); - if layout7.size() != 0 { - _rt::alloc::dealloc(result7.cast(), layout7); - } - match l9 { + wit_import9((self).handle() as i32, result7, len7, ptr8); + let l10 = i32::from(*ptr8.add(0).cast::()); + let result13 = match l10 { 0 => { let e = { - let l10 = *ptr8.add(8).cast::(); - - l10 as u64 + let l11 = *ptr8.add(8).cast::(); + l11 as u64 }; Ok(e) } 1 => { let e = { - let l11 = i32::from(*ptr8.add(8).cast::()); - + let l12 = i32::from(*ptr8.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l11 as u8, + l12 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), + }; + if layout7.size() != 0 { + _rt::alloc::dealloc(result7.cast(), layout7); } + result13 } } } @@ -13071,35 +13229,33 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the stream is ready to send again. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp@0.2.4")] extern "C" { #[link_name = "[method]outgoing-datagram-stream.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod udp_create_socket { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; @@ -13134,52 +13290,47 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp-create-socket@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/udp-create-socket@0.2.4")] extern "C" { #[link_name = "create-udp-socket"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import(address_family.clone() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1(address_family.clone() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - + let l3 = *ptr0.add(4).cast::(); super::super::super::wasi::sockets::udp::UdpSocket::from_handle( - l2 as u32, + l3 as u32, ) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - + let l4 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod tcp { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type InputStream = super::super::super::wasi::io::streams::InputStream; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; @@ -13190,7 +13341,7 @@ pub mod wasi { pub type IpSocketAddress = super::super::super::wasi::sockets::network::IpSocketAddress; pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; #[repr(u8)] - #[derive(Clone, Copy, Eq, PartialEq)] + #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] pub enum ShutdownType { /// Similar to `SHUT_RD` in POSIX. Receive, @@ -13200,31 +13351,37 @@ pub mod wasi { Both, } impl ::core::fmt::Debug for ShutdownType { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + fn fmt( + &self, + f: &mut ::core::fmt::Formatter<'_>, + ) -> ::core::fmt::Result { match self { - ShutdownType::Receive => f.debug_tuple("ShutdownType::Receive").finish(), - ShutdownType::Send => f.debug_tuple("ShutdownType::Send").finish(), - ShutdownType::Both => f.debug_tuple("ShutdownType::Both").finish(), + ShutdownType::Receive => { + f.debug_tuple("ShutdownType::Receive").finish() + } + ShutdownType::Send => { + f.debug_tuple("ShutdownType::Send").finish() + } + ShutdownType::Both => { + f.debug_tuple("ShutdownType::Both").finish() + } } } } - impl ShutdownType { - pub(crate) unsafe fn _lift(val: u8) -> ShutdownType { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> ShutdownType { if !cfg!(debug_assertions) { return ::core::mem::transmute(val); } - match val { 0 => ShutdownType::Receive, 1 => ShutdownType::Send, 2 => ShutdownType::Both, - _ => panic!("invalid enum discriminant"), } } } - /// A TCP socket resource. /// /// The socket can be in one of the following states: @@ -13236,8 +13393,8 @@ pub mod wasi { /// - `connect-in-progress` /// - `connected` /// - `closed` - /// See - /// for a more information. + /// See + /// for more information. /// /// Note: Except where explicitly mentioned, whenever this documentation uses /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. @@ -13246,13 +13403,11 @@ pub mod wasi { /// In addition to the general error codes documented on the /// `network::error-code` type, TCP socket methods may always return /// `error(invalid-state)` when in the `closed` state. - #[derive(Debug)] #[repr(transparent)] pub struct TcpSocket { handle: _rt::Resource, } - impl TcpSocket { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -13260,37 +13415,31 @@ pub mod wasi { 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 TcpSocket { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[resource-drop]tcp-socket"] fn drop(_: u32); } - drop(_handle); } } } - impl TcpSocket { #[allow(unused_unsafe, clippy::all)] /// Bind the socket to a specific network on the provided IP address and port. @@ -13339,7 +13488,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); use super::super::super::wasi::sockets::network::IpSocketAddress as V4; let ( result5_0, @@ -13356,9 +13507,11 @@ pub mod wasi { result5_11, ) = match local_address { V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress{ port:port0, address:address0, } = e; + let super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: port0, + address: address0, + } = e; let (t1_0, t1_1, t1_2, t1_3) = address0; - ( 0i32, _rt::as_i32(port0), @@ -13375,9 +13528,13 @@ pub mod wasi { ) } V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress{ port:port2, flow_info:flow_info2, address:address2, scope_id:scope_id2, } = e; + let super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: port2, + flow_info: flow_info2, + address: address2, + scope_id: scope_id2, + } = e; let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( 1i32, _rt::as_i32(port2), @@ -13396,10 +13553,10 @@ pub mod wasi { }; let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.start-bind"] - fn wit_import( + fn wit_import7( _: i32, _: i32, _: i32, @@ -13417,9 +13574,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import7( _: i32, _: i32, _: i32, @@ -13438,7 +13594,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import7( (self).handle() as i32, (network).handle() as i32, result5_0, @@ -13455,24 +13611,24 @@ pub mod wasi { result5_11, ptr6, ); - let l7 = i32::from(*ptr6.add(0).cast::()); - match l7 { + let l8 = i32::from(*ptr6.add(0).cast::()); + let result10 = match l8 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l8 = i32::from(*ptr6.add(1).cast::()); - + let l9 = i32::from(*ptr6.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l8 as u8, + l9 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result10 } } } @@ -13482,38 +13638,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.finish-bind"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -13522,7 +13679,7 @@ pub mod wasi { /// Connect to a remote endpoint. /// /// On success: - /// - the socket is transitioned into the `connection` state. + /// - the socket is transitioned into the `connected` state. /// - a pair of streams is returned that can be used to read & write to the connection /// /// After a failed connection attempt, the socket will be in the `closed` @@ -13569,7 +13726,9 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); use super::super::super::wasi::sockets::network::IpSocketAddress as V4; let ( result5_0, @@ -13586,9 +13745,11 @@ pub mod wasi { result5_11, ) = match remote_address { V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress{ port:port0, address:address0, } = e; + let super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: port0, + address: address0, + } = e; let (t1_0, t1_1, t1_2, t1_3) = address0; - ( 0i32, _rt::as_i32(port0), @@ -13605,9 +13766,13 @@ pub mod wasi { ) } V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress{ port:port2, flow_info:flow_info2, address:address2, scope_id:scope_id2, } = e; + let super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: port2, + flow_info: flow_info2, + address: address2, + scope_id: scope_id2, + } = e; let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( 1i32, _rt::as_i32(port2), @@ -13626,10 +13791,10 @@ pub mod wasi { }; let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.start-connect"] - fn wit_import( + fn wit_import7( _: i32, _: i32, _: i32, @@ -13647,9 +13812,8 @@ pub mod wasi { _: *mut u8, ); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import( + extern "C" fn wit_import7( _: i32, _: i32, _: i32, @@ -13668,7 +13832,7 @@ pub mod wasi { ) { unreachable!() } - wit_import( + wit_import7( (self).handle() as i32, (network).handle() as i32, result5_0, @@ -13685,70 +13849,79 @@ pub mod wasi { result5_11, ptr6, ); - let l7 = i32::from(*ptr6.add(0).cast::()); - match l7 { + let l8 = i32::from(*ptr6.add(0).cast::()); + let result10 = match l8 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l8 = i32::from(*ptr6.add(1).cast::()); - + let l9 = i32::from(*ptr6.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l8 as u8, + l9 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result10 } } } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] - pub fn finish_connect(&self) -> Result<(InputStream, OutputStream), ErrorCode> { + pub fn finish_connect( + &self, + ) -> Result<(InputStream, OutputStream), ErrorCode> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 12], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.finish-connect"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result6 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - let l3 = *ptr0.add(8).cast::(); - - (super::super::super::wasi::io::streams::InputStream::from_handle(l2 as u32), super::super::super::wasi::io::streams::OutputStream::from_handle(l3 as u32)) + let l3 = *ptr0.add(4).cast::(); + let l4 = *ptr0.add(8).cast::(); + ( + super::super::super::wasi::io::streams::InputStream::from_handle( + l3 as u32, + ), + super::super::super::wasi::io::streams::OutputStream::from_handle( + l4 as u32, + ), + ) }; Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - + let l5 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, + l5 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } } @@ -13783,38 +13956,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.start-listen"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -13824,38 +13998,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.finish-listen"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -13887,48 +14062,58 @@ pub mod wasi { /// - /// - /// - - pub fn accept(&self) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { + pub fn accept( + &self, + ) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.accept"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result7 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - let l3 = *ptr0.add(8).cast::(); - let l4 = *ptr0.add(12).cast::(); - - (TcpSocket::from_handle(l2 as u32), super::super::super::wasi::io::streams::InputStream::from_handle(l3 as u32), super::super::super::wasi::io::streams::OutputStream::from_handle(l4 as u32)) + let l3 = *ptr0.add(4).cast::(); + let l4 = *ptr0.add(8).cast::(); + let l5 = *ptr0.add(12).cast::(); + ( + TcpSocket::from_handle(l3 as u32), + super::super::super::wasi::io::streams::InputStream::from_handle( + l4 as u32, + ), + super::super::super::wasi::io::streams::OutputStream::from_handle( + l5 as u32, + ), + ) }; Ok(e) } 1 => { let e = { - let l5 = i32::from(*ptr0.add(4).cast::()); - + let l6 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l5 as u8, + l6 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result7 } } } @@ -13954,84 +14139,91 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 36]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 36], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.local-address"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result22 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V19; - let v19 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + use super::super::super::wasi::sockets::network::IpSocketAddress as V20; + let v20 = match l3 { 0 => { - let e19 = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = i32::from(*ptr0.add(10).cast::()); - let l5 = i32::from(*ptr0.add(11).cast::()); - let l6 = i32::from(*ptr0.add(12).cast::()); - let l7 = i32::from(*ptr0.add(13).cast::()); - - super::super::super::wasi::sockets::network::Ipv4SocketAddress{ - port: l3 as u16, - address: (l4 as u8, l5 as u8, l6 as u8, l7 as u8), - } + let e20 = { + let l4 = i32::from(*ptr0.add(8).cast::()); + let l5 = i32::from(*ptr0.add(10).cast::()); + let l6 = i32::from(*ptr0.add(11).cast::()); + let l7 = i32::from(*ptr0.add(12).cast::()); + let l8 = i32::from(*ptr0.add(13).cast::()); + super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: l4 as u16, + address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), + } }; - V19::Ipv4(e19) + V20::Ipv4(e20) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e19 = { - let l8 = i32::from(*ptr0.add(8).cast::()); - let l9 = *ptr0.add(12).cast::(); - let l10 = i32::from(*ptr0.add(16).cast::()); - let l11 = i32::from(*ptr0.add(18).cast::()); - let l12 = i32::from(*ptr0.add(20).cast::()); - let l13 = i32::from(*ptr0.add(22).cast::()); - let l14 = i32::from(*ptr0.add(24).cast::()); - let l15 = i32::from(*ptr0.add(26).cast::()); - let l16 = i32::from(*ptr0.add(28).cast::()); - let l17 = i32::from(*ptr0.add(30).cast::()); - let l18 = *ptr0.add(32).cast::(); - - super::super::super::wasi::sockets::network::Ipv6SocketAddress{ - port: l8 as u16, - flow_info: l9 as u32, - address: (l10 as u16, l11 as u16, l12 as u16, l13 as u16, l14 as u16, l15 as u16, l16 as u16, l17 as u16), - scope_id: l18 as u32, - } + let e20 = { + let l9 = i32::from(*ptr0.add(8).cast::()); + let l10 = *ptr0.add(12).cast::(); + let l11 = i32::from(*ptr0.add(16).cast::()); + let l12 = i32::from(*ptr0.add(18).cast::()); + let l13 = i32::from(*ptr0.add(20).cast::()); + let l14 = i32::from(*ptr0.add(22).cast::()); + let l15 = i32::from(*ptr0.add(24).cast::()); + let l16 = i32::from(*ptr0.add(26).cast::()); + let l17 = i32::from(*ptr0.add(28).cast::()); + let l18 = i32::from(*ptr0.add(30).cast::()); + let l19 = *ptr0.add(32).cast::(); + super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: l9 as u16, + flow_info: l10 as u32, + address: ( + l11 as u16, + l12 as u16, + l13 as u16, + l14 as u16, + l15 as u16, + l16 as u16, + l17 as u16, + l18 as u16, + ), + scope_id: l19 as u32, + } }; - V19::Ipv6(e19) + V20::Ipv6(e20) } }; - - v19 + v20 }; Ok(e) } 1 => { let e = { - let l20 = i32::from(*ptr0.add(4).cast::()); - + let l21 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l20 as u8, + l21 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result22 } } } @@ -14051,84 +14243,91 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 36]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 36], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.remote-address"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result22 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V19; - let v19 = match l2 { + let l3 = i32::from(*ptr0.add(4).cast::()); + use super::super::super::wasi::sockets::network::IpSocketAddress as V20; + let v20 = match l3 { 0 => { - let e19 = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = i32::from(*ptr0.add(10).cast::()); - let l5 = i32::from(*ptr0.add(11).cast::()); - let l6 = i32::from(*ptr0.add(12).cast::()); - let l7 = i32::from(*ptr0.add(13).cast::()); - - super::super::super::wasi::sockets::network::Ipv4SocketAddress{ - port: l3 as u16, - address: (l4 as u8, l5 as u8, l6 as u8, l7 as u8), - } + let e20 = { + let l4 = i32::from(*ptr0.add(8).cast::()); + let l5 = i32::from(*ptr0.add(10).cast::()); + let l6 = i32::from(*ptr0.add(11).cast::()); + let l7 = i32::from(*ptr0.add(12).cast::()); + let l8 = i32::from(*ptr0.add(13).cast::()); + super::super::super::wasi::sockets::network::Ipv4SocketAddress { + port: l4 as u16, + address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), + } }; - V19::Ipv4(e19) + V20::Ipv4(e20) } n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e19 = { - let l8 = i32::from(*ptr0.add(8).cast::()); - let l9 = *ptr0.add(12).cast::(); - let l10 = i32::from(*ptr0.add(16).cast::()); - let l11 = i32::from(*ptr0.add(18).cast::()); - let l12 = i32::from(*ptr0.add(20).cast::()); - let l13 = i32::from(*ptr0.add(22).cast::()); - let l14 = i32::from(*ptr0.add(24).cast::()); - let l15 = i32::from(*ptr0.add(26).cast::()); - let l16 = i32::from(*ptr0.add(28).cast::()); - let l17 = i32::from(*ptr0.add(30).cast::()); - let l18 = *ptr0.add(32).cast::(); - - super::super::super::wasi::sockets::network::Ipv6SocketAddress{ - port: l8 as u16, - flow_info: l9 as u32, - address: (l10 as u16, l11 as u16, l12 as u16, l13 as u16, l14 as u16, l15 as u16, l16 as u16, l17 as u16), - scope_id: l18 as u32, - } + let e20 = { + let l9 = i32::from(*ptr0.add(8).cast::()); + let l10 = *ptr0.add(12).cast::(); + let l11 = i32::from(*ptr0.add(16).cast::()); + let l12 = i32::from(*ptr0.add(18).cast::()); + let l13 = i32::from(*ptr0.add(20).cast::()); + let l14 = i32::from(*ptr0.add(22).cast::()); + let l15 = i32::from(*ptr0.add(24).cast::()); + let l16 = i32::from(*ptr0.add(26).cast::()); + let l17 = i32::from(*ptr0.add(28).cast::()); + let l18 = i32::from(*ptr0.add(30).cast::()); + let l19 = *ptr0.add(32).cast::(); + super::super::super::wasi::sockets::network::Ipv6SocketAddress { + port: l9 as u16, + flow_info: l10 as u32, + address: ( + l11 as u16, + l12 as u16, + l13 as u16, + l14 as u16, + l15 as u16, + l16 as u16, + l17 as u16, + l18 as u16, + ), + scope_id: l19 as u32, + } }; - V19::Ipv6(e19) + V20::Ipv6(e20) } }; - - v19 + v20 }; Ok(e) } 1 => { let e = { - let l20 = i32::from(*ptr0.add(4).cast::()); - + let l21 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l20 as u8, + l21 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result22 } } } @@ -14140,17 +14339,16 @@ pub mod wasi { pub fn is_listening(&self) -> bool { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.is-listening"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); _rt::bool_lift(ret as u8) } } @@ -14163,17 +14361,16 @@ pub mod wasi { pub fn address_family(&self) -> IpAddressFamily { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.address-family"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); + let ret = wit_import0((self).handle() as i32); super::super::super::wasi::sockets::network::IpAddressFamily::_lift( ret as u8, ) @@ -14191,42 +14388,46 @@ pub mod wasi { /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. /// - `invalid-argument`: (set) The provided value was 0. /// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state. - pub fn set_listen_backlog_size(&self, value: u64) -> Result<(), ErrorCode> { + pub fn set_listen_backlog_size( + &self, + value: u64, + ) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.set-listen-backlog-size"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14245,65 +14446,69 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-enabled"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - _rt::bool_lift(l2 as u8) + let l3 = i32::from(*ptr0.add(1).cast::()); + _rt::bool_lift(l3 as u8) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - + let l4 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } impl TcpSocket { #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_enabled(&self, value: bool) -> Result<(), ErrorCode> { + pub fn set_keep_alive_enabled( + &self, + value: bool, + ) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.set-keep-alive-enabled"] - fn wit_import(_: i32, _: i32, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import( + wit_import1( (self).handle() as i32, match &value { true => 1, @@ -14311,24 +14516,24 @@ pub mod wasi { }, ptr0, ); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14348,34 +14553,78 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-idle-time"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); + super::super::super::wasi::sockets::network::ErrorCode::_lift( + l4 as u8, + ) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + }; + result5 + } + } + } + impl TcpSocket { + #[allow(unused_unsafe, clippy::all)] + pub fn set_keep_alive_idle_time( + &self, + value: Duration, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] + extern "C" { + #[link_name = "[method]tcp-socket.set-keep-alive-idle-time"] + fn wit_import1(_: i32, _: i64, _: *mut u8); + } + #[cfg(not(target_arch = "wasm32"))] + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, ) @@ -14383,48 +14632,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_idle_time(&self, value: Duration) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-idle-time"] - fn wit_import(_: i32, _: i64, _: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, _rt::as_i64(value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14444,34 +14653,78 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-interval"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); + super::super::super::wasi::sockets::network::ErrorCode::_lift( + l4 as u8, + ) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + }; + result5 + } + } + } + impl TcpSocket { + #[allow(unused_unsafe, clippy::all)] + pub fn set_keep_alive_interval( + &self, + value: Duration, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] + extern "C" { + #[link_name = "[method]tcp-socket.set-keep-alive-interval"] + fn wit_import1(_: i32, _: i64, _: *mut u8); + } + #[cfg(not(target_arch = "wasm32"))] + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, ) @@ -14479,48 +14732,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_interval(&self, value: Duration) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-interval"] - fn wit_import(_: i32, _: i64, _: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, _rt::as_i64(value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14540,42 +14753,42 @@ pub mod wasi { unsafe { #[repr(align(4))] struct RetArea([::core::mem::MaybeUninit; 8]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 8], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-count"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - - l2 as u32 + let l3 = *ptr0.add(4).cast::(); + l3 as u32 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - + let l4 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -14585,38 +14798,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.set-keep-alive-count"] - fn wit_import(_: i32, _: i32, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i32(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14632,42 +14846,42 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.hop-limit"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - l2 as u8 + let l3 = i32::from(*ptr0.add(1).cast::()); + l3 as u8 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - + let l4 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -14677,38 +14891,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.set-hop-limit"] - fn wit_import(_: i32, _: i32, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i32(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i32(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14728,34 +14943,78 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.receive-buffer-size"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); + super::super::super::wasi::sockets::network::ErrorCode::_lift( + l4 as u8, + ) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + }; + result5 + } + } + } + impl TcpSocket { + #[allow(unused_unsafe, clippy::all)] + pub fn set_receive_buffer_size( + &self, + value: u64, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] + extern "C" { + #[link_name = "[method]tcp-socket.set-receive-buffer-size"] + fn wit_import1(_: i32, _: i64, _: *mut u8); + } + #[cfg(not(target_arch = "wasm32"))] + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, ) @@ -14763,48 +15022,8 @@ pub mod wasi { Err(e) } _ => _rt::invalid_enum_discriminant(), - } - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - extern "C" { - #[link_name = "[method]tcp-socket.set-receive-buffer-size"] - fn wit_import(_: i32, _: i64, _: *mut u8); - } - - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14814,42 +15033,42 @@ pub mod wasi { unsafe { #[repr(align(8))] struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 16], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.send-buffer-size"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(8).cast::(); - - l2 as u64 + let l3 = *ptr0.add(8).cast::(); + l3 as u64 }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - + let l4 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } @@ -14859,38 +15078,39 @@ pub mod wasi { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.set-send-buffer-size"] - fn wit_import(_: i32, _: i64, _: *mut u8); + fn wit_import1(_: i32, _: i64, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } @@ -14908,26 +15128,27 @@ pub mod wasi { /// `subscribe` only has to be called once per socket and can then be /// (re)used for the remainder of the socket's lifetime. /// - /// See - /// for a more information. + /// See + /// for more information. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } @@ -14936,14 +15157,14 @@ pub mod wasi { /// Initiate a graceful shutdown. /// /// - `receive`: The socket is not expecting to receive any data from - /// the peer. The `input-stream` associated with this socket will be - /// closed. Any data still in the receive queue at time of calling - /// this method will be discarded. + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. /// - `send`: The socket has no more data to send to the peer. The `output-stream` - /// associated with this socket will be closed and a FIN packet will be sent. + /// associated with this socket will be closed and a FIN packet will be sent. /// - `both`: Same effect as `receive` & `send` combined. /// - /// This function is idempotent. Shutting a down a direction more than once + /// This function is idempotent; shutting down a direction more than once /// has no effect and returns `ok`. /// /// The shutdown function does not close (drop) the socket. @@ -14956,54 +15177,59 @@ pub mod wasi { /// - /// - /// - - pub fn shutdown(&self, shutdown_type: ShutdownType) -> Result<(), ErrorCode> { + pub fn shutdown( + &self, + shutdown_type: ShutdownType, + ) -> Result<(), ErrorCode> { unsafe { #[repr(align(1))] struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 2], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp@0.2.4")] extern "C" { #[link_name = "[method]tcp-socket.shutdown"] - fn wit_import(_: i32, _: i32, _: *mut u8); + fn wit_import1(_: i32, _: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, shutdown_type.clone() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1( + (self).handle() as i32, + shutdown_type.clone() as i32, + ptr0, + ); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result4 = match l2 { 0 => { let e = (); Ok(e) } 1 => { let e = { - let l2 = i32::from(*ptr0.add(1).cast::()); - + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l2 as u8, + l3 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result4 } } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod tcp_create_socket { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; @@ -15038,64 +15264,57 @@ pub mod wasi { let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp-create-socket@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/tcp-create-socket@0.2.4")] extern "C" { #[link_name = "create-tcp-socket"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import(address_family.clone() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1(address_family.clone() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result5 = match l2 { 0 => { let e = { - let l2 = *ptr0.add(4).cast::(); - + let l3 = *ptr0.add(4).cast::(); super::super::super::wasi::sockets::tcp::TcpSocket::from_handle( - l2 as u32, + l3 as u32, ) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - + let l4 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, + l4 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result5 } } } - - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod ip_name_lookup { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::__link_custom_section_describing_imports; + static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; use super::super::super::_rt; pub type Pollable = super::super::super::wasi::io::poll::Pollable; pub type Network = super::super::super::wasi::sockets::network::Network; pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; pub type IpAddress = super::super::super::wasi::sockets::network::IpAddress; - #[derive(Debug)] #[repr(transparent)] pub struct ResolveAddressStream { handle: _rt::Resource, } - impl ResolveAddressStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { @@ -15103,37 +15322,31 @@ pub mod wasi { 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 ResolveAddressStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] unreachable!(); - #[cfg(target_arch = "wasm32")] { - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] extern "C" { #[link_name = "[resource-drop]resolve-address-stream"] fn drop(_: u32); } - drop(_handle); } } } - #[allow(unused_unsafe, clippy::all)] /// Resolve an internet host name to a list of IP addresses. /// @@ -15168,39 +15381,37 @@ pub mod wasi { let len0 = vec0.len(); let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] extern "C" { #[link_name = "resolve-addresses"] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + extern "C" fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((network).handle() as i32, ptr0.cast_mut(), len0, ptr1); - let l2 = i32::from(*ptr1.add(0).cast::()); - match l2 { + wit_import2((network).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l3 = i32::from(*ptr1.add(0).cast::()); + let result6 = match l3 { 0 => { let e = { - let l3 = *ptr1.add(4).cast::(); - - ResolveAddressStream::from_handle(l3 as u32) + let l4 = *ptr1.add(4).cast::(); + ResolveAddressStream::from_handle(l4 as u32) }; Ok(e) } 1 => { let e = { - let l4 = i32::from(*ptr1.add(4).cast::()); - + let l5 = i32::from(*ptr1.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, + l5 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result6 } } impl ResolveAddressStream { @@ -15218,98 +15429,75 @@ pub mod wasi { /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) - pub fn resolve_next_address(&self) -> Result, ErrorCode> { + pub fn resolve_next_address( + &self, + ) -> Result, ErrorCode> { unsafe { #[repr(align(2))] struct RetArea([::core::mem::MaybeUninit; 22]); - let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 22]); + let mut ret_area = RetArea( + [::core::mem::MaybeUninit::uninit(); 22], + ); let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] extern "C" { #[link_name = "[method]resolve-address-stream.resolve-next-address"] - fn wit_import(_: i32, _: *mut u8); + fn wit_import1(_: i32, _: *mut u8); } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: *mut u8) { + extern "C" fn wit_import1(_: i32, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*ptr0.add(0).cast::()); - match l1 { + wit_import1((self).handle() as i32, ptr0); + let l2 = i32::from(*ptr0.add(0).cast::()); + let result19 = match l2 { 0 => { let e = { - let l2 = i32::from(*ptr0.add(2).cast::()); - - match l2 { + let l3 = i32::from(*ptr0.add(2).cast::()); + match l3 { 0 => None, 1 => { let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpAddress as V16; - let v16 = match l3 { + let l4 = i32::from(*ptr0.add(4).cast::()); + use super::super::super::wasi::sockets::network::IpAddress as V17; + let v17 = match l4 { 0 => { - let e16 = { - let l4 = i32::from( - *ptr0.add(6).cast::(), - ); - let l5 = i32::from( - *ptr0.add(7).cast::(), - ); - let l6 = i32::from( - *ptr0.add(8).cast::(), - ); - let l7 = i32::from( - *ptr0.add(9).cast::(), - ); - - (l4 as u8, l5 as u8, l6 as u8, l7 as u8) + let e17 = { + let l5 = i32::from(*ptr0.add(6).cast::()); + let l6 = i32::from(*ptr0.add(7).cast::()); + let l7 = i32::from(*ptr0.add(8).cast::()); + let l8 = i32::from(*ptr0.add(9).cast::()); + (l5 as u8, l6 as u8, l7 as u8, l8 as u8) }; - V16::Ipv4(e16) + V17::Ipv4(e17) } n => { - debug_assert_eq!( - n, 1, - "invalid enum discriminant" - ); - let e16 = { - let l8 = i32::from( - *ptr0.add(6).cast::(), - ); - let l9 = i32::from( - *ptr0.add(8).cast::(), - ); - let l10 = i32::from( - *ptr0.add(10).cast::(), - ); - let l11 = i32::from( - *ptr0.add(12).cast::(), - ); - let l12 = i32::from( - *ptr0.add(14).cast::(), - ); - let l13 = i32::from( - *ptr0.add(16).cast::(), - ); - let l14 = i32::from( - *ptr0.add(18).cast::(), - ); - let l15 = i32::from( - *ptr0.add(20).cast::(), - ); - + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e17 = { + let l9 = i32::from(*ptr0.add(6).cast::()); + let l10 = i32::from(*ptr0.add(8).cast::()); + let l11 = i32::from(*ptr0.add(10).cast::()); + let l12 = i32::from(*ptr0.add(12).cast::()); + let l13 = i32::from(*ptr0.add(14).cast::()); + let l14 = i32::from(*ptr0.add(16).cast::()); + let l15 = i32::from(*ptr0.add(18).cast::()); + let l16 = i32::from(*ptr0.add(20).cast::()); ( - l8 as u16, l9 as u16, l10 as u16, - l11 as u16, l12 as u16, l13 as u16, - l14 as u16, l15 as u16, + l9 as u16, + l10 as u16, + l11 as u16, + l12 as u16, + l13 as u16, + l14 as u16, + l15 as u16, + l16 as u16, ) }; - V16::Ipv6(e16) + V17::Ipv6(e17) } }; - - v16 + v17 }; Some(e) } @@ -15320,16 +15508,16 @@ pub mod wasi { } 1 => { let e = { - let l17 = i32::from(*ptr0.add(2).cast::()); - + let l18 = i32::from(*ptr0.add(2).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( - l17 as u8, + l18 as u8, ) }; Err(e) } _ => _rt::invalid_enum_discriminant(), - } + }; + result19 } } } @@ -15337,35 +15525,36 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Create a `pollable` which will resolve once the stream is ready for I/O. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { unsafe { #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] + #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.4")] extern "C" { #[link_name = "[method]resolve-address-stream.subscribe"] - fn wit_import(_: i32) -> i32; + fn wit_import0(_: i32) -> i32; } - #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) -> i32 { + extern "C" fn wit_import0(_: i32) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32); - super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) + let ret = wit_import0((self).handle() as i32); + super::super::super::wasi::io::poll::Pollable::from_handle( + ret as u32, + ) } } } } } } +#[rustfmt::skip] mod _rt { - + #![allow(dead_code, clippy::all)] 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. /// @@ -15380,25 +15569,18 @@ mod _rt { /// 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 { @@ -15408,7 +15590,6 @@ mod _rt { _marker: marker::PhantomData, } } - /// Takes ownership of the handle owned by `resource`. /// /// Note that this ideally would be `into_handle` taking `Resource` by @@ -15425,31 +15606,21 @@ mod _rt { 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() + 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), } } @@ -15463,33 +15634,28 @@ mod _rt { _ => panic!("invalid bool discriminant"), } } else { - ::core::mem::transmute::(val) + val != 0 } } - pub use alloc_crate::alloc; pub use alloc_crate::vec::Vec; - + pub use alloc_crate::alloc; pub fn as_i64(t: T) -> i64 { t.as_i64() } - pub trait AsI64 { fn as_i64(self) -> i64; } - impl<'a, T: Copy + AsI64> AsI64 for &'a T { fn as_i64(self) -> i64 { (*self).as_i64() } } - impl AsI64 for i64 { #[inline] fn as_i64(self) -> i64 { self as i64 } } - impl AsI64 for u64 { #[inline] fn as_i64(self) -> i64 { @@ -15516,72 +15682,61 @@ mod _rt { return; } let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr as *mut u8, layout); + alloc::dealloc(ptr, layout); } - 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 { @@ -15590,327 +15745,326 @@ mod _rt { } extern crate alloc as alloc_crate; } - #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:bindings:encoded worldrust-wasi-from-crates-io"] +#[unsafe( + link_section = "component-type:wit-bindgen:0.39.0:rust:wasi:bindings:encoded worldrust-wasi-from-crates-io" +)] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 15607] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xf8x\x01A\x02\x01AO\x01\ +#[allow(clippy::octal_escapes)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 15623] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x88y\x01A\x02\x01AO\x01\ B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[meth\ od]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.b\ -lock\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\ -\x12wasi:io/poll@0.2.0\x05\0\x02\x03\0\0\x08pollable\x01B\x0f\x02\x03\x02\x01\x01\ +lock\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\ +\x12wasi:io/poll@0.2.4\x05\0\x02\x03\0\0\x08pollable\x01B\x0f\x02\x03\x02\x01\x01\ \x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duratio\ n\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\ \x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\ -\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\x01!wasi:clocks/m\ -onotonic-clock@0.2.0\x05\x02\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04\ -self\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\x01\x13wasi:io/er\ -ror@0.2.0\x05\x03\x02\x03\0\x02\x05error\x01B(\x02\x03\x02\x01\x04\x04\0\x05erro\ -r\x03\0\0\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15l\ -ast-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\ -\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\ -\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.re\ -ad\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01\ -@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\ -\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\ -\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\ -\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04\ -self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0\ -.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\ -\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocki\ -ng-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subsc\ -ribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.wri\ -te-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\ -\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-strea\ -m.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\x01\x15\ -wasi:io/streams@0.2.0\x05\x05\x02\x03\0\x01\x08duration\x02\x03\0\x03\x0cinput-s\ -tream\x02\x03\0\x03\x0doutput-stream\x01B\xc0\x01\x02\x03\x02\x01\x06\x04\0\x08d\ -uration\x03\0\0\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01\ -\x08\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\x01\x04\x04\0\x08io-error\x03\0\ -\x06\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x08\x01q\x0a\x03get\0\0\x04head\ -\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07connect\0\0\x07options\0\0\x05trace\ -\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06method\x03\0\x0a\x01q\x03\x04HTTP\0\0\ -\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\0\x0c\x01ks\x01k{\x01r\x02\x05\ -rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-payload\x03\0\x10\x01k}\x01r\x02\x08\ -alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-alert-received-payload\x03\0\x13\x01\ -ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\x04\0\x12field-size-payload\x03\0\ -\x16\x01kw\x01k\x17\x01q'\x0bDNS-timeout\0\0\x09DNS-error\x01\x11\0\x15destinati\ -on-not-found\0\0\x17destination-unavailable\0\0\x19destination-IP-prohibited\0\0\ -\x19destination-IP-unroutable\0\0\x12connection-refused\0\0\x15connection-termin\ -ated\0\0\x12connection-timeout\0\0\x17connection-read-timeout\0\0\x18connection-\ -write-timeout\0\0\x18connection-limit-reached\0\0\x12TLS-protocol-error\0\0\x15T\ -LS-certificate-error\0\0\x12TLS-alert-received\x01\x14\0\x13HTTP-request-denied\0\ -\0\x1cHTTP-request-length-required\0\0\x16HTTP-request-body-size\x01\x18\0\x1bHT\ -TP-request-method-invalid\0\0\x18HTTP-request-URI-invalid\0\0\x19HTTP-request-UR\ -I-too-long\0\0\x20HTTP-request-header-section-size\x01\x15\0\x18HTTP-request-hea\ -der-size\x01\x19\0!HTTP-request-trailer-section-size\x01\x15\0\x19HTTP-request-t\ -railer-size\x01\x17\0\x18HTTP-response-incomplete\0\0!HTTP-response-header-secti\ -on-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0\x17HTTP-response-body-s\ -ize\x01\x18\0\"HTTP-response-trailer-section-size\x01\x15\0\x1aHTTP-response-tra\ -iler-size\x01\x17\0\x1dHTTP-response-transfer-coding\x01\x0e\0\x1cHTTP-response-\ -content-coding\x01\x0e\0\x15HTTP-response-timeout\0\0\x13HTTP-upgrade-failed\0\0\ -\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configuration-error\0\0\x0ei\ -nternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\x0einvalid-syntax\ -\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\0\x1c\x01s\x04\0\ -\x09field-key\x03\0\x1e\x01p}\x04\0\x0bfield-value\x03\0\x20\x04\0\x06fields\x03\ -\x01\x04\0\x07headers\x03\0\"\x04\0\x08trailers\x03\0\"\x04\0\x10incoming-reques\ -t\x03\x01\x04\0\x10outgoing-request\x03\x01\x04\0\x0frequest-options\x03\x01\x04\ -\0\x11response-outparam\x03\x01\x01{\x04\0\x0bstatus-code\x03\0)\x04\0\x11incomi\ -ng-response\x03\x01\x04\0\x0dincoming-body\x03\x01\x04\0\x0ffuture-trailers\x03\x01\ -\x04\0\x11outgoing-response\x03\x01\x04\0\x0doutgoing-body\x03\x01\x04\0\x18futu\ -re-incoming-response\x03\x01\x01i\"\x01@\0\01\x04\0\x13[constructor]fields\x012\x01\ -o\x02\x1f!\x01p3\x01j\x011\x01\x1d\x01@\x01\x07entries4\05\x04\0\x18[static]fiel\ -ds.from-list\x016\x01h\"\x01p!\x01@\x02\x04self7\x04name\x1f\08\x04\0\x12[method\ -]fields.get\x019\x01@\x02\x04self7\x04name\x1f\0\x7f\x04\0\x12[method]fields.has\ -\x01:\x01j\0\x01\x1d\x01@\x03\x04self7\x04name\x1f\x05value8\0;\x04\0\x12[method\ -]fields.set\x01<\x01@\x02\x04self7\x04name\x1f\0;\x04\0\x15[method]fields.delete\ -\x01=\x01@\x03\x04self7\x04name\x1f\x05value!\0;\x04\0\x15[method]fields.append\x01\ ->\x01@\x01\x04self7\04\x04\0\x16[method]fields.entries\x01?\x01@\x01\x04self7\01\ -\x04\0\x14[method]fields.clone\x01@\x01h%\x01@\x01\x04self\xc1\0\0\x0b\x04\0\x1f\ -[method]incoming-request.method\x01B\x01@\x01\x04self\xc1\0\0\x0e\x04\0([method]\ -incoming-request.path-with-query\x01C\x01k\x0d\x01@\x01\x04self\xc1\0\0\xc4\0\x04\ -\0\x1f[method]incoming-request.scheme\x01E\x04\0\"[method]incoming-request.autho\ -rity\x01C\x01i#\x01@\x01\x04self\xc1\0\0\xc6\0\x04\0\x20[method]incoming-request\ -.headers\x01G\x01i,\x01j\x01\xc8\0\0\x01@\x01\x04self\xc1\0\0\xc9\0\x04\0\x20[me\ -thod]incoming-request.consume\x01J\x01i&\x01@\x01\x07headers\xc6\0\0\xcb\0\x04\0\ -\x1d[constructor]outgoing-request\x01L\x01h&\x01i/\x01j\x01\xce\0\0\x01@\x01\x04\ -self\xcd\0\0\xcf\0\x04\0\x1d[method]outgoing-request.body\x01P\x01@\x01\x04self\xcd\ -\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01Q\x01j\0\0\x01@\x02\x04self\ -\xcd\0\x06method\x0b\0\xd2\0\x04\0#[method]outgoing-request.set-method\x01S\x01@\ -\x01\x04self\xcd\0\0\x0e\x04\0([method]outgoing-request.path-with-query\x01T\x01\ -@\x02\x04self\xcd\0\x0fpath-with-query\x0e\0\xd2\0\x04\0,[method]outgoing-reques\ -t.set-path-with-query\x01U\x01@\x01\x04self\xcd\0\0\xc4\0\x04\0\x1f[method]outgo\ -ing-request.scheme\x01V\x01@\x02\x04self\xcd\0\x06scheme\xc4\0\0\xd2\0\x04\0#[me\ -thod]outgoing-request.set-scheme\x01W\x04\0\"[method]outgoing-request.authority\x01\ -T\x01@\x02\x04self\xcd\0\x09authority\x0e\0\xd2\0\x04\0&[method]outgoing-request\ -.set-authority\x01X\x01@\x01\x04self\xcd\0\0\xc6\0\x04\0\x20[method]outgoing-req\ -uest.headers\x01Y\x01i'\x01@\0\0\xda\0\x04\0\x1c[constructor]request-options\x01\ -[\x01h'\x01k\x01\x01@\x01\x04self\xdc\0\0\xdd\0\x04\0'[method]request-options.co\ -nnect-timeout\x01^\x01@\x02\x04self\xdc\0\x08duration\xdd\0\0\xd2\0\x04\0+[metho\ -d]request-options.set-connect-timeout\x01_\x04\0*[method]request-options.first-b\ -yte-timeout\x01^\x04\0.[method]request-options.set-first-byte-timeout\x01_\x04\0\ --[method]request-options.between-bytes-timeout\x01^\x04\01[method]request-option\ -s.set-between-bytes-timeout\x01_\x01i(\x01i.\x01j\x01\xe1\0\x01\x1b\x01@\x02\x05\ -param\xe0\0\x08response\xe2\0\x01\0\x04\0\x1d[static]response-outparam.set\x01c\x01\ -h+\x01@\x01\x04self\xe4\0\0*\x04\0\x20[method]incoming-response.status\x01e\x01@\ -\x01\x04self\xe4\0\0\xc6\0\x04\0![method]incoming-response.headers\x01f\x01@\x01\ -\x04self\xe4\0\0\xc9\0\x04\0![method]incoming-response.consume\x01g\x01h,\x01i\x03\ -\x01j\x01\xe9\0\0\x01@\x01\x04self\xe8\0\0\xea\0\x04\0\x1c[method]incoming-body.\ -stream\x01k\x01i-\x01@\x01\x04this\xc8\0\0\xec\0\x04\0\x1c[static]incoming-body.\ -finish\x01m\x01h-\x01i\x09\x01@\x01\x04self\xee\0\0\xef\0\x04\0![method]future-t\ -railers.subscribe\x01p\x01i$\x01k\xf1\0\x01j\x01\xf2\0\x01\x1b\x01j\x01\xf3\0\0\x01\ -k\xf4\0\x01@\x01\x04self\xee\0\0\xf5\0\x04\0\x1b[method]future-trailers.get\x01v\ -\x01@\x01\x07headers\xc6\0\0\xe1\0\x04\0\x1e[constructor]outgoing-response\x01w\x01\ -h.\x01@\x01\x04self\xf8\0\0*\x04\0%[method]outgoing-response.status-code\x01y\x01\ -@\x02\x04self\xf8\0\x0bstatus-code*\0\xd2\0\x04\0)[method]outgoing-response.set-\ -status-code\x01z\x01@\x01\x04self\xf8\0\0\xc6\0\x04\0![method]outgoing-response.\ -headers\x01{\x01@\x01\x04self\xf8\0\0\xcf\0\x04\0\x1e[method]outgoing-response.b\ -ody\x01|\x01h/\x01i\x05\x01j\x01\xfe\0\0\x01@\x01\x04self\xfd\0\0\xff\0\x04\0\x1b\ -[method]outgoing-body.write\x01\x80\x01\x01j\0\x01\x1b\x01@\x02\x04this\xce\0\x08\ -trailers\xf2\0\0\x81\x01\x04\0\x1c[static]outgoing-body.finish\x01\x82\x01\x01h0\ -\x01@\x01\x04self\x83\x01\0\xef\0\x04\0*[method]future-incoming-response.subscri\ -be\x01\x84\x01\x01i+\x01j\x01\x85\x01\x01\x1b\x01j\x01\x86\x01\0\x01k\x87\x01\x01\ -@\x01\x04self\x83\x01\0\x88\x01\x04\0$[method]future-incoming-response.get\x01\x89\ -\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8a\x01\0\x8b\x01\x04\0\x0fhttp-error-cod\ -e\x01\x8c\x01\x03\x01\x15wasi:http/types@0.2.0\x05\x09\x02\x03\0\x04\x10outgoing\ --request\x02\x03\0\x04\x0frequest-options\x02\x03\0\x04\x18future-incoming-respo\ -nse\x02\x03\0\x04\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x0a\x04\0\x10outgoing-r\ -equest\x03\0\0\x02\x03\x02\x01\x0b\x04\0\x0frequest-options\x03\0\x02\x02\x03\x02\ -\x01\x0c\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01\x0d\x04\0\x0a\ -error-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01\ -@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x03\x01\x20was\ -i:http/outgoing-handler@0.2.0\x05\x0e\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\ -\0\x0fget-environment\x01\x02\x01ps\x01@\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01\ -ks\x01@\0\0\x05\x04\0\x0binitial-cwd\x01\x06\x03\x01\x1awasi:cli/environment@0.2\ -.0\x05\x0f\x01B\x03\x01j\0\0\x01@\x01\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\ -\x01\x13wasi:cli/exit@0.2.0\x05\x10\x01B\x05\x02\x03\x02\x01\x07\x04\0\x0cinput-\ -stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09get-stdin\x01\x03\x03\x01\x14wasi:\ -cli/stdin@0.2.0\x05\x11\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\ -\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\x03\x03\x01\x15wasi:cli/stdout@\ -0.2.0\x05\x12\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\0\x01i\x01\ -\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\x03\x01\x15wasi:cli/stderr@0.2.0\x05\x13\ -\x01B\x01\x04\0\x0eterminal-input\x03\x01\x03\x01\x1dwasi:cli/terminal-input@0.2\ -.0\x05\x14\x01B\x01\x04\0\x0fterminal-output\x03\x01\x03\x01\x1ewasi:cli/termina\ -l-output@0.2.0\x05\x15\x02\x03\0\x0b\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x16\ -\x04\0\x0eterminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-ter\ -minal-stdin\x01\x04\x03\x01\x1dwasi:cli/terminal-stdin@0.2.0\x05\x17\x02\x03\0\x0c\ -\x0fterminal-output\x01B\x06\x02\x03\x02\x01\x18\x04\0\x0fterminal-output\x03\0\0\ -\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\x01\x1e\ -wasi:cli/terminal-stdout@0.2.0\x05\x19\x01B\x06\x02\x03\x02\x01\x18\x04\0\x0fter\ -minal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\ -\x01\x04\x03\x01\x1ewasi:cli/terminal-stderr@0.2.0\x05\x1a\x01B\x05\x01r\x02\x07\ -secondsw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\ -\x02\x04\0\x0aresolution\x01\x02\x03\x01\x1cwasi:clocks/wall-clock@0.2.0\x05\x1b\ -\x02\x03\0\x03\x05error\x02\x03\0\x10\x08datetime\x01Br\x02\x03\x02\x01\x07\x04\0\ -\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\x02\x02\ -\x03\x02\x01\x1c\x04\0\x05error\x03\0\x04\x02\x03\x02\x01\x1d\x04\0\x08datetime\x03\ -\0\x06\x01w\x04\0\x08filesize\x03\0\x08\x01m\x08\x07unknown\x0cblock-device\x10c\ -haracter-device\x09directory\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\ -\0\x0fdescriptor-type\x03\0\x0a\x01n\x06\x04read\x05write\x13file-integrity-sync\ -\x13data-integrity-sync\x14requested-write-sync\x10mutate-directory\x04\0\x10des\ -criptor-flags\x03\0\x0c\x01n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\ -\x01n\x04\x06create\x09directory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\ -\0\x10\x01w\x04\0\x0alink-count\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-\ -count\x13\x04size\x09\x15data-access-timestamp\x14\x1bdata-modification-timestam\ -p\x14\x17status-change-timestamp\x14\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\ -\x09no-change\0\0\x03now\0\0\x09timestamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\ -\x17\x01r\x02\x04type\x0b\x04names\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06a\ -ccess\x0bwould-block\x07already\x0ebad-descriptor\x04busy\x08deadlock\x05quota\x05\ -exist\x0efile-too-large\x15illegal-byte-sequence\x0bin-progress\x0binterrupted\x07\ -invalid\x02io\x0cis-directory\x04loop\x0etoo-many-links\x0cmessage-size\x0dname-\ -too-long\x09no-device\x08no-entry\x07no-lock\x13insufficient-memory\x12insuffici\ -ent-space\x0dnot-directory\x09not-empty\x0fnot-recoverable\x0bunsupported\x06no-\ -tty\x0eno-such-device\x08overflow\x0dnot-permitted\x04pipe\x09read-only\x0cinval\ -id-seek\x0etext-file-busy\x0ccross-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\ -\x06normal\x0asequential\x06random\x09will-need\x09dont-need\x08no-reuse\x04\0\x06\ -advice\x03\0\x1d\x01r\x02\x05lowerw\x05upperw\x04\0\x13metadata-hash-value\x03\0\ -\x1f\x04\0\x0adescriptor\x03\x01\x04\0\x16directory-entry-stream\x03\x01\x01h!\x01\ -i\x01\x01j\x01$\x01\x1c\x01@\x02\x04self#\x06offset\x09\0%\x04\0\"[method]descri\ -ptor.read-via-stream\x01&\x01i\x03\x01j\x01'\x01\x1c\x01@\x02\x04self#\x06offset\ -\x09\0(\x04\0#[method]descriptor.write-via-stream\x01)\x01@\x01\x04self#\0(\x04\0\ -$[method]descriptor.append-via-stream\x01*\x01j\0\x01\x1c\x01@\x04\x04self#\x06o\ -ffset\x09\x06length\x09\x06advice\x1e\0+\x04\0\x19[method]descriptor.advise\x01,\ -\x01@\x01\x04self#\0+\x04\0\x1c[method]descriptor.sync-data\x01-\x01j\x01\x0d\x01\ -\x1c\x01@\x01\x04self#\0.\x04\0\x1c[method]descriptor.get-flags\x01/\x01j\x01\x0b\ -\x01\x1c\x01@\x01\x04self#\00\x04\0\x1b[method]descriptor.get-type\x011\x01@\x02\ -\x04self#\x04size\x09\0+\x04\0\x1b[method]descriptor.set-size\x012\x01@\x03\x04s\ -elf#\x15data-access-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1c\ -[method]descriptor.set-times\x013\x01p}\x01o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\ -\x04self#\x06length\x09\x06offset\x09\06\x04\0\x17[method]descriptor.read\x017\x01\ -j\x01\x09\x01\x1c\x01@\x03\x04self#\x06buffer4\x06offset\x09\08\x04\0\x18[method\ -]descriptor.write\x019\x01i\"\x01j\x01:\x01\x1c\x01@\x01\x04self#\0;\x04\0![meth\ -od]descriptor.read-directory\x01<\x04\0\x17[method]descriptor.sync\x01-\x01@\x02\ -\x04self#\x04paths\0+\x04\0&[method]descriptor.create-directory-at\x01=\x01j\x01\ -\x16\x01\x1c\x01@\x01\x04self#\0>\x04\0\x17[method]descriptor.stat\x01?\x01@\x03\ -\x04self#\x0apath-flags\x0f\x04paths\0>\x04\0\x1a[method]descriptor.stat-at\x01@\ -\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x15data-access-timestamp\x18\x1bda\ -ta-modification-timestamp\x18\0+\x04\0\x1f[method]descriptor.set-times-at\x01A\x01\ -@\x05\x04self#\x0eold-path-flags\x0f\x08old-paths\x0enew-descriptor#\x08new-path\ -s\0+\x04\0\x1a[method]descriptor.link-at\x01B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\ -\x04self#\x0apath-flags\x0f\x04paths\x0aopen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\ -\x1a[method]descriptor.open-at\x01E\x01j\x01s\x01\x1c\x01@\x02\x04self#\x04paths\ -\0\xc6\0\x04\0\x1e[method]descriptor.readlink-at\x01G\x04\0&[method]descriptor.r\ -emove-directory-at\x01=\x01@\x04\x04self#\x08old-paths\x0enew-descriptor#\x08new\ --paths\0+\x04\0\x1c[method]descriptor.rename-at\x01H\x01@\x03\x04self#\x08old-pa\ -ths\x08new-paths\0+\x04\0\x1d[method]descriptor.symlink-at\x01I\x04\0![method]de\ -scriptor.unlink-file-at\x01=\x01@\x02\x04self#\x05other#\0\x7f\x04\0![method]des\ -criptor.is-same-object\x01J\x01j\x01\x20\x01\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\ -\x20[method]descriptor.metadata-hash\x01L\x01@\x03\x04self#\x0apath-flags\x0f\x04\ -paths\0\xcb\0\x04\0#[method]descriptor.metadata-hash-at\x01M\x01h\"\x01k\x1a\x01\ -j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\xd0\0\x04\03[method]directory-entry\ --stream.read-directory-entry\x01Q\x01h\x05\x01k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\ -\x04\0\x15filesystem-error-code\x01T\x03\x01\x1bwasi:filesystem/types@0.2.0\x05\x1e\ -\x02\x03\0\x11\x0adescriptor\x01B\x07\x02\x03\x02\x01\x1f\x04\0\x0adescriptor\x03\ -\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\ -\x03\x01\x1ewasi:filesystem/preopens@0.2.0\x05\x20\x01B\x11\x04\0\x07network\x03\ -\x01\x01m\x15\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid-argument\x0d\ -out-of-memory\x07timeout\x14concurrency-conflict\x0fnot-in-progress\x0bwould-blo\ -ck\x0dinvalid-state\x10new-socket-limit\x14address-not-bindable\x0eaddress-in-us\ -e\x12remote-unreachable\x12connection-refused\x10connection-reset\x12connection-\ -aborted\x12datagram-too-large\x11name-unresolvable\x1atemporary-resolver-failure\ -\x1apermanent-resolver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04ipv4\x04\ -ipv6\x04\0\x11ip-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-address\x03\ -\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x07\x01q\x02\x04ipv4\x01\x06\ -\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\x09\x01r\x02\x04port{\x07address\x06\ -\x04\0\x13ipv4-socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07addre\ -ss\x08\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\ -\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\x01\x1awasi:socket\ -s/network@0.2.0\x05!\x02\x03\0\x13\x07network\x01B\x05\x02\x03\x02\x01\"\x04\0\x07\ -network\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x10instance-network\x01\x03\x03\x01#\ -wasi:sockets/instance-network@0.2.0\x05#\x02\x03\0\x13\x0aerror-code\x02\x03\0\x13\ -\x11ip-socket-address\x02\x03\0\x13\x11ip-address-family\x01BD\x02\x03\x02\x01\x01\ -\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01\"\x04\0\x07network\x03\0\x02\x02\x03\x02\ -\x01$\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01%\x04\0\x11ip-socket-address\x03\ -\0\x06\x02\x03\x02\x01&\x04\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04d\ -ata\x0a\x0eremote-address\x07\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\ -\x02\x04data\x0a\x0eremote-address\x0d\x04\0\x11outgoing-datagram\x03\0\x0e\x04\0\ -\x0audp-socket\x03\x01\x04\0\x18incoming-datagram-stream\x03\x01\x04\0\x18outgoi\ -ng-datagram-stream\x03\x01\x01h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\ -\x07network\x14\x0dlocal-address\x07\0\x15\x04\0\x1d[method]udp-socket.start-bin\ -d\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\ -\x17\x01i\x11\x01i\x12\x01o\x02\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\ -\x0eremote-address\x0d\0\x1b\x04\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\ -\x07\x01\x05\x01@\x01\x04self\x13\0\x1d\x04\0\x20[method]udp-socket.local-addres\ -s\x01\x1e\x04\0![method]udp-socket.remote-address\x01\x1e\x01@\x01\x04self\x13\0\ -\x09\x04\0![method]udp-socket.address-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04\ -self\x13\0\x20\x04\0$[method]udp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\ -\x05value}\0\x15\x04\0([method]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\ -\x05\x01@\x01\x04self\x13\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01\ -@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-si\ -ze\x01%\x04\0#[method]udp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.\ -set-send-buffer-size\x01%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-\ -socket.subscribe\x01'\x01h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bm\ -ax-resultsw\0*\x04\0([method]incoming-datagram-stream.receive\x01+\x01@\x01\x04s\ -elf(\0&\x04\0*[method]incoming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04\ -self-\0#\x04\0+[method]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\ -\x04self-\x09datagrams/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\ -\x01\x04self-\0&\x04\0*[method]outgoing-datagram-stream.subscribe\x011\x03\x01\x16\ -wasi:sockets/udp@0.2.0\x05'\x02\x03\0\x15\x0audp-socket\x01B\x0c\x02\x03\x02\x01\ -\"\x04\0\x07network\x03\0\0\x02\x03\x02\x01$\x04\0\x0aerror-code\x03\0\x02\x02\x03\ -\x02\x01&\x04\0\x11ip-address-family\x03\0\x04\x02\x03\x02\x01(\x04\0\x0audp-soc\ -ket\x03\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\ -\x04\0\x11create-udp-socket\x01\x0a\x03\x01$wasi:sockets/udp-create-socket@0.2.0\ -\x05)\x01BT\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x08\ -\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x04\ -\x02\x03\x02\x01\x06\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\"\x04\0\x07netw\ -ork\x03\0\x08\x02\x03\x02\x01$\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01%\x04\ -\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01&\x04\0\x11ip-address-family\x03\ -\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\0\ -\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07\ -network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\ -\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01\ -@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]tc\ -p-socket.start-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\x19\x1a\x01j\x01\x1b\x01\ -\x0b\x01@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socket.finish-connect\x01\x1d\x04\ -\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20[method]tcp-socket.finish\ --listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04s\ -elf\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\x01\x0d\x01\x0b\x01@\x01\ -\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-address\x01#\x04\0![method]tc\ -p-socket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\x04\0\x1f[method]tcp-soc\ -ket.is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0![method]tcp-socket.addres\ -s-family\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-\ -listen-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[met\ -hod]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\ -\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04\ -self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\ -\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0\ -&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-a\ -live-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\0#[method]tcp-s\ -ocket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\x04\0'[method]t\ -cp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\ -\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\ -\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\ -\03\x04\0&[method]tcp-socket.receive-buffer-size\x014\x04\0*[method]tcp-socket.s\ -et-receive-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0\ -'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\ -\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\ -\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x03\x01\x16wasi:sockets/tcp@0.2\ -.0\x05*\x02\x03\0\x17\x0atcp-socket\x01B\x0c\x02\x03\x02\x01\"\x04\0\x07network\x03\ -\0\0\x02\x03\x02\x01$\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01&\x04\0\x11ip\ --address-family\x03\0\x04\x02\x03\x02\x01+\x04\0\x0atcp-socket\x03\0\x06\x01i\x07\ -\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-tcp-s\ -ocket\x01\x0a\x03\x01$wasi:sockets/tcp-create-socket@0.2.0\x05,\x02\x03\0\x13\x0a\ -ip-address\x01B\x16\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01\ -\"\x04\0\x07network\x03\0\x02\x02\x03\x02\x01$\x04\0\x0aerror-code\x03\0\x04\x02\ -\x03\x02\x01-\x04\0\x0aip-address\x03\0\x06\x04\0\x16resolve-address-stream\x03\x01\ -\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\x01@\x01\x04self\x09\0\x0b\x04\03[method\ -]resolve-address-stream.resolve-next-address\x01\x0c\x01i\x01\x01@\x01\x04self\x09\ -\0\x0d\x04\0([method]resolve-address-stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01\ -j\x01\x10\x01\x05\x01@\x02\x07network\x0f\x04names\0\x11\x04\0\x11resolve-addres\ -ses\x01\x12\x03\x01!wasi:sockets/ip-name-lookup@0.2.0\x05.\x01B\x05\x01p}\x01@\x01\ -\x03lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\ -\x01\x02\x03\x01\x18wasi:random/random@0.2.0\x05/\x01B\x05\x01p}\x01@\x01\x03len\ -w\0\0\x04\0\x19get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure\ --random-u64\x01\x02\x03\x01\x1awasi:random/insecure@0.2.0\x050\x01B\x03\x01o\x02\ -ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\x01\x1fwasi:random/insecure-see\ -d@0.2.0\x051\x04\x01\x12rust:wasi/bindings\x04\0\x0b\x0e\x01\0\x08bindings\x03\0\ -\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bi\ -ndgen-rust\x060.21.0"; - +\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/mon\ +otonic-clock@0.2.4\x05\x02\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04se\ +lf\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/error@\ +0.2.4\x05\x03\x02\x03\0\x02\x05error\x01B(\x02\x03\x02\x01\x04\x04\0\x05error\x03\ +\0\0\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15last-o\ +peration-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\0\x0c\ +input-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\x0a\x01\ +\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.read\x01\x0c\ +\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01@\x02\x04\ +self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\"[method\ +]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\x04\0\x1e\ +[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\x0d\x04\0\ +![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04self\x11\x08\ +contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0.[method]ou\ +tput-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\x04\0\x1b\ +[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocking-flush\x01\ +\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subscribe\x01\x16\ +\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.write-zeroes\x01\ +\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\x17\x01@\x03\ +\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-stream.splice\x01\x18\ +\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wasi:io/streams@0.\ +2.4\x05\x05\x02\x03\0\x01\x08duration\x02\x03\0\x03\x0cinput-stream\x02\x03\0\x03\ +\x0doutput-stream\x01B\xc1\x01\x02\x03\x02\x01\x06\x04\0\x08duration\x03\0\0\x02\ +\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x0dou\ +tput-stream\x03\0\x04\x02\x03\x02\x01\x04\x04\0\x08io-error\x03\0\x06\x02\x03\x02\ +\x01\x01\x04\0\x08pollable\x03\0\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\ +\x03put\0\0\x06delete\0\0\x07connect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\ +\x05other\x01s\0\x04\0\x06method\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05\ +other\x01s\0\x04\0\x06scheme\x03\0\x0c\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info\ +-code\x0f\x04\0\x11DNS-error-payload\x03\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0d\ +alert-message\x0e\x04\0\x1aTLS-alert-received-payload\x03\0\x13\x01ky\x01r\x02\x0a\ +field-name\x0e\x0afield-size\x15\x04\0\x12field-size-payload\x03\0\x16\x01kw\x01\ +k\x17\x01q'\x0bDNS-timeout\0\0\x09DNS-error\x01\x11\0\x15destination-not-found\0\ +\0\x17destination-unavailable\0\0\x19destination-IP-prohibited\0\0\x19destinatio\ +n-IP-unroutable\0\0\x12connection-refused\0\0\x15connection-terminated\0\0\x12co\ +nnection-timeout\0\0\x17connection-read-timeout\0\0\x18connection-write-timeout\0\ +\0\x18connection-limit-reached\0\0\x12TLS-protocol-error\0\0\x15TLS-certificate-\ +error\0\0\x12TLS-alert-received\x01\x14\0\x13HTTP-request-denied\0\0\x1cHTTP-req\ +uest-length-required\0\0\x16HTTP-request-body-size\x01\x18\0\x1bHTTP-request-met\ +hod-invalid\0\0\x18HTTP-request-URI-invalid\0\0\x19HTTP-request-URI-too-long\0\0\ +\x20HTTP-request-header-section-size\x01\x15\0\x18HTTP-request-header-size\x01\x19\ +\0!HTTP-request-trailer-section-size\x01\x15\0\x19HTTP-request-trailer-size\x01\x17\ +\0\x18HTTP-response-incomplete\0\0!HTTP-response-header-section-size\x01\x15\0\x19\ +HTTP-response-header-size\x01\x17\0\x17HTTP-response-body-size\x01\x18\0\"HTTP-r\ +esponse-trailer-section-size\x01\x15\0\x1aHTTP-response-trailer-size\x01\x17\0\x1d\ +HTTP-response-transfer-coding\x01\x0e\0\x1cHTTP-response-content-coding\x01\x0e\0\ +\x15HTTP-response-timeout\0\0\x13HTTP-upgrade-failed\0\0\x13HTTP-protocol-error\0\ +\0\x0dloop-detected\0\0\x13configuration-error\0\0\x0einternal-error\x01\x0e\0\x04\ +\0\x0aerror-code\x03\0\x1a\x01q\x03\x0einvalid-syntax\0\0\x09forbidden\0\0\x09im\ +mutable\0\0\x04\0\x0cheader-error\x03\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x04\ +\0\x0afield-name\x03\0\x1f\x01p}\x04\0\x0bfield-value\x03\0!\x04\0\x06fields\x03\ +\x01\x04\0\x07headers\x03\0#\x04\0\x08trailers\x03\0#\x04\0\x10incoming-request\x03\ +\x01\x04\0\x10outgoing-request\x03\x01\x04\0\x0frequest-options\x03\x01\x04\0\x11\ +response-outparam\x03\x01\x01{\x04\0\x0bstatus-code\x03\0*\x04\0\x11incoming-res\ +ponse\x03\x01\x04\0\x0dincoming-body\x03\x01\x04\0\x0ffuture-trailers\x03\x01\x04\ +\0\x11outgoing-response\x03\x01\x04\0\x0doutgoing-body\x03\x01\x04\0\x18future-i\ +ncoming-response\x03\x01\x01i#\x01@\0\02\x04\0\x13[constructor]fields\x013\x01o\x02\ +\x20\"\x01p4\x01j\x012\x01\x1d\x01@\x01\x07entries5\06\x04\0\x18[static]fields.f\ +rom-list\x017\x01h#\x01p\"\x01@\x02\x04self8\x04name\x20\09\x04\0\x12[method]fie\ +lds.get\x01:\x01@\x02\x04self8\x04name\x20\0\x7f\x04\0\x12[method]fields.has\x01\ +;\x01j\0\x01\x1d\x01@\x03\x04self8\x04name\x20\x05value9\0<\x04\0\x12[method]fie\ +lds.set\x01=\x01@\x02\x04self8\x04name\x20\0<\x04\0\x15[method]fields.delete\x01\ +>\x01@\x03\x04self8\x04name\x20\x05value\"\0<\x04\0\x15[method]fields.append\x01\ +?\x01@\x01\x04self8\05\x04\0\x16[method]fields.entries\x01@\x01@\x01\x04self8\02\ +\x04\0\x14[method]fields.clone\x01A\x01h&\x01@\x01\x04self\xc2\0\0\x0b\x04\0\x1f\ +[method]incoming-request.method\x01C\x01@\x01\x04self\xc2\0\0\x0e\x04\0([method]\ +incoming-request.path-with-query\x01D\x01k\x0d\x01@\x01\x04self\xc2\0\0\xc5\0\x04\ +\0\x1f[method]incoming-request.scheme\x01F\x04\0\"[method]incoming-request.autho\ +rity\x01D\x01i$\x01@\x01\x04self\xc2\0\0\xc7\0\x04\0\x20[method]incoming-request\ +.headers\x01H\x01i-\x01j\x01\xc9\0\0\x01@\x01\x04self\xc2\0\0\xca\0\x04\0\x20[me\ +thod]incoming-request.consume\x01K\x01i'\x01@\x01\x07headers\xc7\0\0\xcc\0\x04\0\ +\x1d[constructor]outgoing-request\x01M\x01h'\x01i0\x01j\x01\xcf\0\0\x01@\x01\x04\ +self\xce\0\0\xd0\0\x04\0\x1d[method]outgoing-request.body\x01Q\x01@\x01\x04self\xce\ +\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01R\x01j\0\0\x01@\x02\x04self\ +\xce\0\x06method\x0b\0\xd3\0\x04\0#[method]outgoing-request.set-method\x01T\x01@\ +\x01\x04self\xce\0\0\x0e\x04\0([method]outgoing-request.path-with-query\x01U\x01\ +@\x02\x04self\xce\0\x0fpath-with-query\x0e\0\xd3\0\x04\0,[method]outgoing-reques\ +t.set-path-with-query\x01V\x01@\x01\x04self\xce\0\0\xc5\0\x04\0\x1f[method]outgo\ +ing-request.scheme\x01W\x01@\x02\x04self\xce\0\x06scheme\xc5\0\0\xd3\0\x04\0#[me\ +thod]outgoing-request.set-scheme\x01X\x04\0\"[method]outgoing-request.authority\x01\ +U\x01@\x02\x04self\xce\0\x09authority\x0e\0\xd3\0\x04\0&[method]outgoing-request\ +.set-authority\x01Y\x01@\x01\x04self\xce\0\0\xc7\0\x04\0\x20[method]outgoing-req\ +uest.headers\x01Z\x01i(\x01@\0\0\xdb\0\x04\0\x1c[constructor]request-options\x01\ +\\\x01h(\x01k\x01\x01@\x01\x04self\xdd\0\0\xde\0\x04\0'[method]request-options.c\ +onnect-timeout\x01_\x01@\x02\x04self\xdd\0\x08duration\xde\0\0\xd3\0\x04\0+[meth\ +od]request-options.set-connect-timeout\x01`\x04\0*[method]request-options.first-\ +byte-timeout\x01_\x04\0.[method]request-options.set-first-byte-timeout\x01`\x04\0\ +-[method]request-options.between-bytes-timeout\x01_\x04\01[method]request-option\ +s.set-between-bytes-timeout\x01`\x01i)\x01i/\x01j\x01\xe2\0\x01\x1b\x01@\x02\x05\ +param\xe1\0\x08response\xe3\0\x01\0\x04\0\x1d[static]response-outparam.set\x01d\x01\ +h,\x01@\x01\x04self\xe5\0\0+\x04\0\x20[method]incoming-response.status\x01f\x01@\ +\x01\x04self\xe5\0\0\xc7\0\x04\0![method]incoming-response.headers\x01g\x01@\x01\ +\x04self\xe5\0\0\xca\0\x04\0![method]incoming-response.consume\x01h\x01h-\x01i\x03\ +\x01j\x01\xea\0\0\x01@\x01\x04self\xe9\0\0\xeb\0\x04\0\x1c[method]incoming-body.\ +stream\x01l\x01i.\x01@\x01\x04this\xc9\0\0\xed\0\x04\0\x1c[static]incoming-body.\ +finish\x01n\x01h.\x01i\x09\x01@\x01\x04self\xef\0\0\xf0\0\x04\0![method]future-t\ +railers.subscribe\x01q\x01i%\x01k\xf2\0\x01j\x01\xf3\0\x01\x1b\x01j\x01\xf4\0\0\x01\ +k\xf5\0\x01@\x01\x04self\xef\0\0\xf6\0\x04\0\x1b[method]future-trailers.get\x01w\ +\x01@\x01\x07headers\xc7\0\0\xe2\0\x04\0\x1e[constructor]outgoing-response\x01x\x01\ +h/\x01@\x01\x04self\xf9\0\0+\x04\0%[method]outgoing-response.status-code\x01z\x01\ +@\x02\x04self\xf9\0\x0bstatus-code+\0\xd3\0\x04\0)[method]outgoing-response.set-\ +status-code\x01{\x01@\x01\x04self\xf9\0\0\xc7\0\x04\0![method]outgoing-response.\ +headers\x01|\x01@\x01\x04self\xf9\0\0\xd0\0\x04\0\x1e[method]outgoing-response.b\ +ody\x01}\x01h0\x01i\x05\x01j\x01\xff\0\0\x01@\x01\x04self\xfe\0\0\x80\x01\x04\0\x1b\ +[method]outgoing-body.write\x01\x81\x01\x01j\0\x01\x1b\x01@\x02\x04this\xcf\0\x08\ +trailers\xf3\0\0\x82\x01\x04\0\x1c[static]outgoing-body.finish\x01\x83\x01\x01h1\ +\x01@\x01\x04self\x84\x01\0\xf0\0\x04\0*[method]future-incoming-response.subscri\ +be\x01\x85\x01\x01i,\x01j\x01\x86\x01\x01\x1b\x01j\x01\x87\x01\0\x01k\x88\x01\x01\ +@\x01\x04self\x84\x01\0\x89\x01\x04\0$[method]future-incoming-response.get\x01\x8a\ +\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8b\x01\0\x8c\x01\x04\0\x0fhttp-error-cod\ +e\x01\x8d\x01\x03\0\x15wasi:http/types@0.2.4\x05\x09\x02\x03\0\x04\x10outgoing-r\ +equest\x02\x03\0\x04\x0frequest-options\x02\x03\0\x04\x18future-incoming-respons\ +e\x02\x03\0\x04\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x0a\x04\0\x10outgoing-req\ +uest\x03\0\0\x02\x03\x02\x01\x0b\x04\0\x0frequest-options\x03\0\x02\x02\x03\x02\x01\ +\x0c\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01\x0d\x04\0\x0aer\ +ror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01@\ +\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x03\0\x20wasi:h\ +ttp/outgoing-handler@0.2.4\x05\x0e\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\ +\x0fget-environment\x01\x02\x01ps\x01@\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01\ +ks\x01@\0\0\x05\x04\0\x0binitial-cwd\x01\x06\x03\0\x1awasi:cli/environment@0.2.4\ +\x05\x0f\x01B\x03\x01j\0\0\x01@\x01\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\0\ +\x13wasi:cli/exit@0.2.4\x05\x10\x01B\x05\x02\x03\x02\x01\x07\x04\0\x0cinput-stre\ +am\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09get-stdin\x01\x03\x03\0\x14wasi:cli/st\ +din@0.2.4\x05\x11\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\0\x01\ +i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\ +\x12\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\ +\0\x02\x04\0\x0aget-stderr\x01\x03\x03\0\x15wasi:cli/stderr@0.2.4\x05\x13\x01B\x01\ +\x04\0\x0eterminal-input\x03\x01\x03\0\x1dwasi:cli/terminal-input@0.2.4\x05\x14\x01\ +B\x01\x04\0\x0fterminal-output\x03\x01\x03\0\x1ewasi:cli/terminal-output@0.2.4\x05\ +\x15\x02\x03\0\x0b\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x16\x04\0\x0etermi\ +nal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\x01\ +\x04\x03\0\x1dwasi:cli/terminal-stdin@0.2.4\x05\x17\x02\x03\0\x0c\x0fterminal-ou\ +tput\x01B\x06\x02\x03\x02\x01\x18\x04\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\ +\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\0\x1ewasi:cli/termina\ +l-stdout@0.2.4\x05\x19\x01B\x06\x02\x03\x02\x01\x18\x04\0\x0fterminal-output\x03\ +\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\x01\x04\x03\0\x1e\ +wasi:cli/terminal-stderr@0.2.4\x05\x1a\x01B\x05\x01r\x02\x07secondsw\x0bnanoseco\ +ndsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolu\ +tion\x01\x02\x03\0\x1cwasi:clocks/wall-clock@0.2.4\x05\x1b\x02\x03\0\x03\x05erro\ +r\x02\x03\0\x10\x08datetime\x01Br\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\ +\0\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x1c\x04\0\ +\x05error\x03\0\x04\x02\x03\x02\x01\x1d\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08\ +filesize\x03\0\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09di\ +rectory\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-t\ +ype\x03\0\x0a\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity\ +-sync\x14requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\ +\x0c\x01n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\ +\x09directory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0a\ +link-count\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\ +\x15data-access-timestamp\x14\x1bdata-modification-timestamp\x14\x17status-chang\ +e-timestamp\x14\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03\ +now\0\0\x09timestamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\ +\x0b\x04names\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07\ +already\x0ebad-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-larg\ +e\x15illegal-byte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-\ +directory\x04loop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09no-devic\ +e\x08no-entry\x07no-lock\x13insufficient-memory\x12insufficient-space\x0dnot-dir\ +ectory\x09not-empty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-such-devic\ +e\x08overflow\x0dnot-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file\ +-busy\x0ccross-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequen\ +tial\x06random\x09will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01\ +r\x02\x05lowerw\x05upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescri\ +ptor\x03\x01\x04\0\x16directory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\ +\x1c\x01@\x02\x04self#\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-strea\ +m\x01&\x01i\x03\x01j\x01'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[meth\ +od]descriptor.write-via-stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]descripto\ +r.append-via-stream\x01*\x01j\0\x01\x1c\x01@\x04\x04self#\x06offset\x09\x06lengt\ +h\x09\x06advice\x1e\0+\x04\0\x19[method]descriptor.advise\x01,\x01@\x01\x04self#\ +\0+\x04\0\x1c[method]descriptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\x04\ +self#\0.\x04\0\x1c[method]descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01@\x01\ +\x04self#\00\x04\0\x1b[method]descriptor.get-type\x011\x01@\x02\x04self#\x04size\ +\x09\0+\x04\0\x1b[method]descriptor.set-size\x012\x01@\x03\x04self#\x15data-acce\ +ss-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1c[method]descript\ +or.set-times\x013\x01p}\x01o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\x04self#\x06len\ +gth\x09\x06offset\x09\06\x04\0\x17[method]descriptor.read\x017\x01j\x01\x09\x01\x1c\ +\x01@\x03\x04self#\x06buffer4\x06offset\x09\08\x04\0\x18[method]descriptor.write\ +\x019\x01i\"\x01j\x01:\x01\x1c\x01@\x01\x04self#\0;\x04\0![method]descriptor.rea\ +d-directory\x01<\x04\0\x17[method]descriptor.sync\x01-\x01@\x02\x04self#\x04path\ +s\0+\x04\0&[method]descriptor.create-directory-at\x01=\x01j\x01\x16\x01\x1c\x01@\ +\x01\x04self#\0>\x04\0\x17[method]descriptor.stat\x01?\x01@\x03\x04self#\x0apath\ +-flags\x0f\x04paths\0>\x04\0\x1a[method]descriptor.stat-at\x01@\x01@\x05\x04self\ +#\x0apath-flags\x0f\x04paths\x15data-access-timestamp\x18\x1bdata-modification-t\ +imestamp\x18\0+\x04\0\x1f[method]descriptor.set-times-at\x01A\x01@\x05\x04self#\x0e\ +old-path-flags\x0f\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a[met\ +hod]descriptor.link-at\x01B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0apa\ +th-flags\x0f\x04paths\x0aopen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]de\ +scriptor.open-at\x01E\x01j\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\0\ +\x1e[method]descriptor.readlink-at\x01G\x04\0&[method]descriptor.remove-director\ +y-at\x01=\x01@\x04\x04self#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\ +\x1c[method]descriptor.rename-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-path\ +s\0+\x04\0\x1d[method]descriptor.symlink-at\x01I\x04\0![method]descriptor.unlink\ +-file-at\x01=\x01@\x02\x04self#\x05other#\0\x7f\x04\0![method]descriptor.is-same\ +-object\x01J\x01j\x01\x20\x01\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\x20[method]des\ +criptor.metadata-hash\x01L\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\x04\ +\0#[method]descriptor.metadata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\x1c\ +\x01@\x01\x04self\xce\0\0\xd0\0\x04\03[method]directory-entry-stream.read-direct\ +ory-entry\x01Q\x01h\x05\x01k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesyst\ +em-error-code\x01T\x03\0\x1bwasi:filesystem/types@0.2.4\x05\x1e\x02\x03\0\x11\x0a\ +descriptor\x01B\x07\x02\x03\x02\x01\x1f\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01\ +o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\x03\0\x1ewasi:\ +filesystem/preopens@0.2.4\x05\x20\x01B\x11\x04\0\x07network\x03\x01\x01m\x15\x07\ +unknown\x0daccess-denied\x0dnot-supported\x10invalid-argument\x0dout-of-memory\x07\ +timeout\x14concurrency-conflict\x0fnot-in-progress\x0bwould-block\x0dinvalid-sta\ +te\x10new-socket-limit\x14address-not-bindable\x0eaddress-in-use\x12remote-unrea\ +chable\x12connection-refused\x10connection-reset\x12connection-aborted\x12datagr\ +am-too-large\x11name-unresolvable\x1atemporary-resolver-failure\x1apermanent-res\ +olver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04ipv4\x04ipv6\x04\0\x11ip\ +-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-address\x03\0\x05\x01o\x08{\ +{{{{{{{\x04\0\x0cipv6-address\x03\0\x07\x01q\x02\x04ipv4\x01\x06\0\x04ipv6\x01\x08\ +\0\x04\0\x0aip-address\x03\0\x09\x01r\x02\x04port{\x07address\x06\x04\0\x13ipv4-\ +socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07address\x08\x08scope\ +-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\0\x04ipv6\x01\ +\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\0\x1awasi:sockets/network@0.2.4\x05\ +!\x02\x03\0\x13\x07network\x01B\x05\x02\x03\x02\x01\"\x04\0\x07network\x03\0\0\x01\ +i\x01\x01@\0\0\x02\x04\0\x10instance-network\x01\x03\x03\0#wasi:sockets/instance\ +-network@0.2.4\x05#\x02\x03\0\x13\x0aerror-code\x02\x03\0\x13\x11ip-socket-addre\ +ss\x02\x03\0\x13\x11ip-address-family\x01BD\x02\x03\x02\x01\x01\x04\0\x08pollabl\ +e\x03\0\0\x02\x03\x02\x01\"\x04\0\x07network\x03\0\x02\x02\x03\x02\x01$\x04\0\x0a\ +error-code\x03\0\x04\x02\x03\x02\x01%\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\ +\x02\x01&\x04\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0erem\ +ote-address\x07\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\ +\x0eremote-address\x0d\x04\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\ +\x01\x04\0\x18incoming-datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\ +\x03\x01\x01h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0d\ +local-address\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04\ +self\x13\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\ +\x01o\x02\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\ +\0\x1b\x04\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04\ +self\x13\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]u\ +dp-socket.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-so\ +cket.address-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[\ +method]udp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\ +\0([method]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04\ +self\x13\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\ +\x05valuew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[me\ +thod]udp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-s\ +ize\x01%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01\ +'\x01h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0\ +([method]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[metho\ +d]incoming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[m\ +ethod]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09dat\ +agrams/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\ +\x04\0*[method]outgoing-datagram-stream.subscribe\x011\x03\0\x16wasi:sockets/udp\ +@0.2.4\x05'\x02\x03\0\x15\x0audp-socket\x01B\x0c\x02\x03\x02\x01\"\x04\0\x07netw\ +ork\x03\0\0\x02\x03\x02\x01$\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01&\x04\0\ +\x11ip-address-family\x03\0\x04\x02\x03\x02\x01(\x04\0\x0audp-socket\x03\0\x06\x01\ +i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-\ +udp-socket\x01\x0a\x03\0$wasi:sockets/udp-create-socket@0.2.4\x05)\x01BT\x02\x03\ +\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x08\x04\0\x0doutput-s\ +tream\x03\0\x02\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x04\x02\x03\x02\x01\x06\ +\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\"\x04\0\x07network\x03\0\x08\x02\x03\ +\x02\x01$\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01%\x04\0\x11ip-socket-addr\ +ess\x03\0\x0c\x02\x03\x02\x01&\x04\0\x11ip-address-family\x03\0\x0e\x01m\x03\x07\ +receive\x04send\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\0\x0atcp-socket\x03\ +\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07network\x14\x0dloc\ +al-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\x16\x01@\x01\x04\ +self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01@\x03\x04self\x13\ +\x07network\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]tcp-socket.start-co\ +nnect\x01\x18\x01i\x01\x01i\x03\x01o\x02\x19\x1a\x01j\x01\x1b\x01\x0b\x01@\x01\x04\ +self\x13\0\x1c\x04\0![method]tcp-socket.finish-connect\x01\x1d\x04\0\x1f[method]\ +tcp-socket.start-listen\x01\x17\x04\0\x20[method]tcp-socket.finish-listen\x01\x17\ +\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04self\x13\0\x20\x04\ +\0\x19[method]tcp-socket.accept\x01!\x01j\x01\x0d\x01\x0b\x01@\x01\x04self\x13\0\ +\"\x04\0\x20[method]tcp-socket.local-address\x01#\x04\0![method]tcp-socket.remot\ +e-address\x01#\x01@\x01\x04self\x13\0\x7f\x04\0\x1f[method]tcp-socket.is-listeni\ +ng\x01$\x01@\x01\x04self\x13\0\x0f\x04\0![method]tcp-socket.address-family\x01%\x01\ +@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-listen-backlog-si\ +ze\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[method]tcp-socket.ke\ +ep-alive-enabled\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\0)[method]tcp-\ +socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04self\x13\0*\x04\ +\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\x05value\x07\ +\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0&[method]tcp-\ +socket.keep-alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-alive-interval\ +\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\0#[method]tcp-socket.keep-al\ +ive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\x04\0'[method]tcp-socket.set\ +-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\0\x1c[metho\ +d]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\0\x20[metho\ +d]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\03\x04\0&\ +[method]tcp-socket.receive-buffer-size\x014\x04\0*[method]tcp-socket.set-receive\ +-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0'[method]t\ +cp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\0\x1c[m\ +ethod]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\0\x15\x04\ +\0\x1b[method]tcp-socket.shutdown\x017\x03\0\x16wasi:sockets/tcp@0.2.4\x05*\x02\x03\ +\0\x17\x0atcp-socket\x01B\x0c\x02\x03\x02\x01\"\x04\0\x07network\x03\0\0\x02\x03\ +\x02\x01$\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01&\x04\0\x11ip-address-fam\ +ily\x03\0\x04\x02\x03\x02\x01+\x04\0\x0atcp-socket\x03\0\x06\x01i\x07\x01j\x01\x08\ +\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-tcp-socket\x01\x0a\ +\x03\0$wasi:sockets/tcp-create-socket@0.2.4\x05,\x02\x03\0\x13\x0aip-address\x01\ +B\x16\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01\"\x04\0\x07n\ +etwork\x03\0\x02\x02\x03\x02\x01$\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01-\ +\x04\0\x0aip-address\x03\0\x06\x04\0\x16resolve-address-stream\x03\x01\x01h\x08\x01\ +k\x07\x01j\x01\x0a\x01\x05\x01@\x01\x04self\x09\0\x0b\x04\03[method]resolve-addr\ +ess-stream.resolve-next-address\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0\ +([method]resolve-address-stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\ +\x01\x05\x01@\x02\x07network\x0f\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\ +\x03\0!wasi:sockets/ip-name-lookup@0.2.4\x05.\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\ +\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\ +\0\x18wasi:random/random@0.2.4\x05/\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x19\ +get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure-random-u64\x01\ +\x02\x03\0\x1awasi:random/insecure@0.2.4\x050\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\ +\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-seed@0.2.4\x051\x04\0\x12\ +rust:wasi/bindings\x04\0\x0b\x0e\x01\0\x08bindings\x03\0\0\0G\x09producers\x01\x0c\ +processed-by\x02\x0dwit-component\x070.225.0\x10wit-bindgen-rust\x060.39.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/third_party/rust/wasi/src/command.rs b/third_party/rust/wasi/src/command.rs index b129a5fca77f..ba8ca574edc8 100644 --- a/third_party/rust/wasi/src/command.rs +++ b/third_party/rust/wasi/src/command.rs @@ -1,76 +1,80 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.39.0. DO NOT EDIT! // Options used: // * std_feature -// * with "wasi:cli/environment@0.2.0" = "crate::cli::environment" -// * with "wasi:cli/exit@0.2.0" = "crate::cli::exit" -// * with "wasi:cli/stdin@0.2.0" = "crate::cli::stdin" -// * with "wasi:cli/stdout@0.2.0" = "crate::cli::stdout" -// * with "wasi:cli/stderr@0.2.0" = "crate::cli::stderr" -// * with "wasi:cli/terminal-input@0.2.0" = "crate::cli::terminal_input" -// * with "wasi:cli/terminal-output@0.2.0" = "crate::cli::terminal_output" -// * with "wasi:cli/terminal-stdin@0.2.0" = "crate::cli::terminal_stdin" -// * with "wasi:cli/terminal-stdout@0.2.0" = "crate::cli::terminal_stdout" -// * with "wasi:cli/terminal-stderr@0.2.0" = "crate::cli::terminal_stderr" -// * with "wasi:clocks/monotonic-clock@0.2.0" = "crate::clocks::monotonic_clock" -// * with "wasi:clocks/wall-clock@0.2.0" = "crate::clocks::wall_clock" -// * with "wasi:filesystem/types@0.2.0" = "crate::filesystem::types" -// * with "wasi:filesystem/preopens@0.2.0" = "crate::filesystem::preopens" -// * with "wasi:io/error@0.2.0" = "crate::io::error" -// * with "wasi:io/poll@0.2.0" = "crate::io::poll" -// * with "wasi:io/streams@0.2.0" = "crate::io::streams" -// * with "wasi:random/random@0.2.0" = "crate::random::random" -// * with "wasi:random/insecure@0.2.0" = "crate::random::insecure" -// * with "wasi:random/insecure-seed@0.2.0" = "crate::random::insecure_seed" -// * with "wasi:sockets/network@0.2.0" = "crate::sockets::network" -// * with "wasi:sockets/instance-network@0.2.0" = "crate::sockets::instance_network" -// * with "wasi:sockets/tcp@0.2.0" = "crate::sockets::tcp" -// * with "wasi:sockets/tcp-create-socket@0.2.0" = "crate::sockets::tcp_create_socket" -// * with "wasi:sockets/udp@0.2.0" = "crate::sockets::udp" -// * with "wasi:sockets/udp-create-socket@0.2.0" = "crate::sockets::udp_create_socket" -// * with "wasi:sockets/ip-name-lookup@0.2.0" = "crate::sockets::ip_name_lookup" +// * runtime_path: "wit_bindgen_rt" +// * with "wasi:cli/environment@0.2.4" = "crate::cli::environment" +// * with "wasi:cli/exit@0.2.4" = "crate::cli::exit" +// * with "wasi:cli/stdin@0.2.4" = "crate::cli::stdin" +// * with "wasi:cli/stdout@0.2.4" = "crate::cli::stdout" +// * with "wasi:cli/stderr@0.2.4" = "crate::cli::stderr" +// * with "wasi:cli/terminal-input@0.2.4" = "crate::cli::terminal_input" +// * with "wasi:cli/terminal-output@0.2.4" = "crate::cli::terminal_output" +// * with "wasi:cli/terminal-stdin@0.2.4" = "crate::cli::terminal_stdin" +// * with "wasi:cli/terminal-stdout@0.2.4" = "crate::cli::terminal_stdout" +// * with "wasi:cli/terminal-stderr@0.2.4" = "crate::cli::terminal_stderr" +// * with "wasi:clocks/monotonic-clock@0.2.4" = "crate::clocks::monotonic_clock" +// * with "wasi:clocks/wall-clock@0.2.4" = "crate::clocks::wall_clock" +// * with "wasi:filesystem/types@0.2.4" = "crate::filesystem::types" +// * with "wasi:filesystem/preopens@0.2.4" = "crate::filesystem::preopens" +// * with "wasi:io/error@0.2.4" = "crate::io::error" +// * with "wasi:io/poll@0.2.4" = "crate::io::poll" +// * with "wasi:io/streams@0.2.4" = "crate::io::streams" +// * with "wasi:random/random@0.2.4" = "crate::random::random" +// * with "wasi:random/insecure@0.2.4" = "crate::random::insecure" +// * with "wasi:random/insecure-seed@0.2.4" = "crate::random::insecure_seed" +// * with "wasi:sockets/network@0.2.4" = "crate::sockets::network" +// * with "wasi:sockets/instance-network@0.2.4" = "crate::sockets::instance_network" +// * with "wasi:sockets/tcp@0.2.4" = "crate::sockets::tcp" +// * with "wasi:sockets/tcp-create-socket@0.2.4" = "crate::sockets::tcp_create_socket" +// * with "wasi:sockets/udp@0.2.4" = "crate::sockets::udp" +// * with "wasi:sockets/udp-create-socket@0.2.4" = "crate::sockets::udp_create_socket" +// * with "wasi:sockets/ip-name-lookup@0.2.4" = "crate::sockets::ip_name_lookup" +// * type_section_suffix: "rust-wasi-from-crates-io-command-world" // * default-bindings-module: "wasi" // * export-macro-name: _export_command // * pub-export-macro use crate::cli::environment as __with_name0; use crate::cli::exit as __with_name1; -use crate::cli::stderr as __with_name7; -use crate::cli::stdin as __with_name5; -use crate::cli::stdout as __with_name6; -use crate::cli::terminal_input as __with_name8; -use crate::cli::terminal_output as __with_name9; -use crate::cli::terminal_stderr as __with_name12; -use crate::cli::terminal_stdin as __with_name10; -use crate::cli::terminal_stdout as __with_name11; -use crate::clocks::monotonic_clock as __with_name13; -use crate::clocks::wall_clock as __with_name14; -use crate::filesystem::preopens as __with_name16; -use crate::filesystem::types as __with_name15; use crate::io::error as __with_name2; use crate::io::poll as __with_name3; use crate::io::streams as __with_name4; -use crate::random::insecure as __with_name25; -use crate::random::insecure_seed as __with_name26; -use crate::random::random as __with_name24; -use crate::sockets::instance_network as __with_name18; -use crate::sockets::ip_name_lookup as __with_name23; +use crate::cli::stdin as __with_name5; +use crate::cli::stdout as __with_name6; +use crate::cli::stderr as __with_name7; +use crate::cli::terminal_input as __with_name8; +use crate::cli::terminal_output as __with_name9; +use crate::cli::terminal_stdin as __with_name10; +use crate::cli::terminal_stdout as __with_name11; +use crate::cli::terminal_stderr as __with_name12; +use crate::clocks::monotonic_clock as __with_name13; +use crate::clocks::wall_clock as __with_name14; +use crate::filesystem::types as __with_name15; +use crate::filesystem::preopens as __with_name16; use crate::sockets::network as __with_name17; -use crate::sockets::tcp as __with_name21; -use crate::sockets::tcp_create_socket as __with_name22; +use crate::sockets::instance_network as __with_name18; use crate::sockets::udp as __with_name19; use crate::sockets::udp_create_socket as __with_name20; +use crate::sockets::tcp as __with_name21; +use crate::sockets::tcp_create_socket as __with_name22; +use crate::sockets::ip_name_lookup as __with_name23; +use crate::random::random as __with_name24; +use crate::random::insecure as __with_name25; +use crate::random::insecure_seed as __with_name26; +#[rustfmt::skip] +#[allow(dead_code, clippy::all)] pub mod exports { pub mod wasi { pub mod cli { - #[allow(clippy::all)] + #[allow(dead_code, unused_imports, clippy::all)] pub mod run { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; + 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_run_cabi() -> i32 { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); let result0 = T::run(); let result1 = match result0 { Ok(_) => 0i32, @@ -84,24 +88,29 @@ pub mod exports { } #[doc(hidden)] #[macro_export] - macro_rules! __export_wasi_cli_run_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:cli/run@0.2.0#run"] - unsafe extern "C" fn export_run() -> i32 { - $($path_to_types)*::_export_run_cabi::<$ty>() - } - };); - } + macro_rules! __export_wasi_cli_run_0_2_4_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[unsafe (export_name = + "wasi:cli/run@0.2.4#run")] unsafe extern "C" fn export_run() -> + i32 { $($path_to_types)*:: _export_run_cabi::<$ty > () } }; + }; + } #[doc(hidden)] - pub use __export_wasi_cli_run_0_2_0_cabi; + pub use __export_wasi_cli_run_0_2_4_cabi; } } } } - -/// Generates `#[no_mangle]` functions to export the specified type as the -/// root implementation of all generated traits. +#[rustfmt::skip] +mod _rt { + #![allow(dead_code, clippy::all)] + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen_rt::run_ctors_once(); + } +} +/// Generates `#[unsafe(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!`. /// @@ -120,465 +129,467 @@ pub mod exports { #[doc(hidden)] #[macro_export] macro_rules! __export_command_impl { - ($ty:ident) => (wasi::_export_command!($ty with_types_in wasi);); - ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( - $($path_to_types_root)*::exports::wasi::cli::run::__export_wasi_cli_run_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::cli::run); - const _: () = { - - #[cfg(target_arch = "wasm32")] - #[link_section = "component-type:wit-bindgen:0.21.0:command:imports and exportsrust-wasi-from-crates-io-command-world"] - #[doc(hidden)] - pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 10773] = *b"\ + ($ty:ident) => { + wasi::_export_command!($ty with_types_in wasi); + }; + ($ty:ident with_types_in $($path_to_types_root:tt)*) => { + $($path_to_types_root)*:: + exports::wasi::cli::run::__export_wasi_cli_run_0_2_4_cabi!($ty with_types_in + $($path_to_types_root)*:: exports::wasi::cli::run); const _ : () = { + #[cfg(target_arch = "wasm32")] #[unsafe (link_section = + "component-type:wit-bindgen:0.39.0:wasi:cli@0.2.4:command:imports and exportsrust-wasi-from-crates-io-command-world")] + #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static + __WIT_BINDGEN_COMPONENT_TYPE : [u8; 10773] = * + b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x97S\x01A\x02\x01AI\x01\ B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environment\x01\x02\x01ps\x01@\ \0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\x04\0\x0binitial-cwd\x01\ -\x06\x03\x01\x1awasi:cli/environment@0.2.0\x05\0\x01B\x03\x01j\0\0\x01@\x01\x06s\ -tatus\0\x01\0\x04\0\x04exit\x01\x01\x03\x01\x13wasi:cli/exit@0.2.0\x05\x01\x01B\x04\ -\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to\ --debug-string\x01\x02\x03\x01\x13wasi:io/error@0.2.0\x05\x02\x01B\x0a\x04\0\x08p\ -ollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable.read\ -y\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\x01\ -p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\x12wasi:io/po\ -ll@0.2.0\x05\x03\x02\x03\0\x02\x05error\x02\x03\0\x03\x08pollable\x01B(\x02\x03\x02\ -\x01\x04\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\x02\x01\ -i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-\ -error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01\ -h\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[me\ -thod]input-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\ -\x01j\x01w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-str\ -eam.skip\x01\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\ -\x01\x04self\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01\ -@\x01\x04self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\ -\x06\x01@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.w\ -rite\x01\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\ -\x04self\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]ou\ -tput-stream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]o\ -utput-stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method\ -]output-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-z\ -eroes-and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[\ -method]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\ -\x18\x03\x01\x15wasi:io/streams@0.2.0\x05\x06\x02\x03\0\x04\x0cinput-stream\x01B\ -\x05\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\ -\0\x09get-stdin\x01\x03\x03\x01\x14wasi:cli/stdin@0.2.0\x05\x08\x02\x03\0\x04\x0d\ -output-stream\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\ -\x01@\0\0\x02\x04\0\x0aget-stdout\x01\x03\x03\x01\x15wasi:cli/stdout@0.2.0\x05\x0a\ -\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\ -\x04\0\x0aget-stderr\x01\x03\x03\x01\x15wasi:cli/stderr@0.2.0\x05\x0b\x01B\x01\x04\ -\0\x0eterminal-input\x03\x01\x03\x01\x1dwasi:cli/terminal-input@0.2.0\x05\x0c\x01\ -B\x01\x04\0\x0fterminal-output\x03\x01\x03\x01\x1ewasi:cli/terminal-output@0.2.0\ -\x05\x0d\x02\x03\0\x08\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x0e\x04\0\x0et\ -erminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\ -\x01\x04\x03\x01\x1dwasi:cli/terminal-stdin@0.2.0\x05\x0f\x02\x03\0\x09\x0ftermi\ -nal-output\x01B\x06\x02\x03\x02\x01\x10\x04\0\x0fterminal-output\x03\0\0\x01i\x01\ -\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\x01\x1ewasi:cli/\ -terminal-stdout@0.2.0\x05\x11\x01B\x06\x02\x03\x02\x01\x10\x04\0\x0fterminal-out\ -put\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\x01\x04\x03\ -\x01\x1ewasi:cli/terminal-stderr@0.2.0\x05\x12\x01B\x0f\x02\x03\x02\x01\x05\x04\0\ -\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duration\x03\0\ -\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\x07\x01\ -i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\x01\x04\ -when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\x01!wasi:clocks/monotonic\ --clock@0.2.0\x05\x13\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08date\ -time\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\x01\ -\x1cwasi:clocks/wall-clock@0.2.0\x05\x14\x02\x03\0\x04\x05error\x02\x03\0\x0e\x08\ -datetime\x01Br\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\ -\x09\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x15\x04\0\x05error\x03\0\x04\ -\x02\x03\x02\x01\x16\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesize\x03\0\x08\ -\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\x04fifo\x0d\ -symbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\0\x0a\x01n\x06\ -\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14requested-wri\ -te-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x0c\x01n\x01\x0esyml\ -ink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\x09directory\x09excl\ -usive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-count\x03\0\x12\ -\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\x15data-access-time\ -stamp\x14\x1bdata-modification-timestamp\x14\x17status-change-timestamp\x14\x04\0\ -\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03now\0\0\x09timestamp\x01\ -\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04names\x04\0\x0fd\ -irectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07already\x0ebad-descri\ -ptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15illegal-byte-seq\ -uence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-directory\x04loop\x0e\ -too-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08no-entry\x07no-l\ -ock\x13insufficient-memory\x12insufficient-space\x0dnot-directory\x09not-empty\x0f\ -not-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08overflow\x0dnot-pe\ -rmitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-device\x04\ -\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequential\x06random\x09will-ne\ -ed\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05lowerw\x05uppe\ -rw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\x04\0\x16d\ -irectory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\x04self#\ -\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\x01j\x01\ -'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[method]descriptor.write-via-\ -stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]descriptor.append-via-stream\x01*\ -\x01j\0\x01\x1c\x01@\x04\x04self#\x06offset\x09\x06length\x09\x06advice\x1e\0+\x04\ -\0\x19[method]descriptor.advise\x01,\x01@\x01\x04self#\0+\x04\0\x1c[method]descr\ -iptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\x04self#\0.\x04\0\x1c[method]\ -descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01@\x01\x04self#\00\x04\0\x1b[me\ -thod]descriptor.get-type\x011\x01@\x02\x04self#\x04size\x09\0+\x04\0\x1b[method]\ -descriptor.set-size\x012\x01@\x03\x04self#\x15data-access-timestamp\x18\x1bdata-\ -modification-timestamp\x18\0+\x04\0\x1c[method]descriptor.set-times\x013\x01p}\x01\ -o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\x04self#\x06length\x09\x06offset\x09\06\x04\ -\0\x17[method]descriptor.read\x017\x01j\x01\x09\x01\x1c\x01@\x03\x04self#\x06buf\ -fer4\x06offset\x09\08\x04\0\x18[method]descriptor.write\x019\x01i\"\x01j\x01:\x01\ -\x1c\x01@\x01\x04self#\0;\x04\0![method]descriptor.read-directory\x01<\x04\0\x17\ -[method]descriptor.sync\x01-\x01@\x02\x04self#\x04paths\0+\x04\0&[method]descrip\ -tor.create-directory-at\x01=\x01j\x01\x16\x01\x1c\x01@\x01\x04self#\0>\x04\0\x17\ -[method]descriptor.stat\x01?\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0>\x04\ -\0\x1a[method]descriptor.stat-at\x01@\x01@\x05\x04self#\x0apath-flags\x0f\x04pat\ -hs\x15data-access-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1f[\ -method]descriptor.set-times-at\x01A\x01@\x05\x04self#\x0eold-path-flags\x0f\x08o\ -ld-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a[method]descriptor.link-at\x01\ -B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x0ao\ -pen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]descriptor.open-at\x01E\x01j\ -\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\0\x1e[method]descriptor.rea\ -dlink-at\x01G\x04\0&[method]descriptor.remove-directory-at\x01=\x01@\x04\x04self\ -#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1c[method]descriptor.re\ -name-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-paths\0+\x04\0\x1d[method]des\ -criptor.symlink-at\x01I\x04\0![method]descriptor.unlink-file-at\x01=\x01@\x02\x04\ -self#\x05other#\0\x7f\x04\0![method]descriptor.is-same-object\x01J\x01j\x01\x20\x01\ -\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\x20[method]descriptor.metadata-hash\x01L\x01\ -@\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\x04\0#[method]descriptor.metad\ -ata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\ -\xd0\0\x04\03[method]directory-entry-stream.read-directory-entry\x01Q\x01h\x05\x01\ -k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\x01\x1b\ -wasi:filesystem/types@0.2.0\x05\x17\x02\x03\0\x0f\x0adescriptor\x01B\x07\x02\x03\ -\x02\x01\x18\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\ -\x04\x04\0\x0fget-directories\x01\x05\x03\x01\x1ewasi:filesystem/preopens@0.2.0\x05\ -\x19\x01B\x11\x04\0\x07network\x03\x01\x01m\x15\x07unknown\x0daccess-denied\x0dn\ -ot-supported\x10invalid-argument\x0dout-of-memory\x07timeout\x14concurrency-conf\ -lict\x0fnot-in-progress\x0bwould-block\x0dinvalid-state\x10new-socket-limit\x14a\ -ddress-not-bindable\x0eaddress-in-use\x12remote-unreachable\x12connection-refuse\ -d\x10connection-reset\x12connection-aborted\x12datagram-too-large\x11name-unreso\ -lvable\x1atemporary-resolver-failure\x1apermanent-resolver-failure\x04\0\x0aerro\ -r-code\x03\0\x01\x01m\x02\x04ipv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\x01\ -o\x04}}}}\x04\0\x0cipv4-address\x03\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\ -\x03\0\x07\x01q\x02\x04ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\ -\x09\x01r\x02\x04port{\x07address\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01\ -r\x04\x04port{\x09flow-infoy\x07address\x08\x08scope-idy\x04\0\x13ipv6-socket-ad\ -dress\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-\ -address\x03\0\x0f\x03\x01\x1awasi:sockets/network@0.2.0\x05\x1a\x02\x03\0\x11\x07\ -network\x01B\x05\x02\x03\x02\x01\x1b\x04\0\x07network\x03\0\0\x01i\x01\x01@\0\0\x02\ -\x04\0\x10instance-network\x01\x03\x03\x01#wasi:sockets/instance-network@0.2.0\x05\ -\x1c\x02\x03\0\x11\x0aerror-code\x02\x03\0\x11\x11ip-socket-address\x02\x03\0\x11\ -\x11ip-address-family\x01BD\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x02\x03\ -\x02\x01\x1b\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\ -\0\x04\x02\x03\x02\x01\x1e\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01\x1f\ -\x04\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-addre\ -ss\x07\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0erem\ -ote-address\x0d\x04\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\x01\ -\x04\0\x18incoming-datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\x03\ -\x01\x01h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dloc\ -al-address\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04\ -self\x13\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\ -\x01o\x02\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\ -\0\x1b\x04\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04\ -self\x13\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]u\ -dp-socket.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-so\ -cket.address-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[\ -method]udp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\ -\0([method]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04\ -self\x13\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\ -\x05valuew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[me\ -thod]udp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-s\ -ize\x01%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01\ -'\x01h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0\ -([method]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[metho\ -d]incoming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[m\ -ethod]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09dat\ -agrams/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\ -\x04\0*[method]outgoing-datagram-stream.subscribe\x011\x03\x01\x16wasi:sockets/u\ -dp@0.2.0\x05\x20\x02\x03\0\x13\x0audp-socket\x01B\x0c\x02\x03\x02\x01\x1b\x04\0\x07\ -network\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\ -\x1f\x04\0\x11ip-address-family\x03\0\x04\x02\x03\x02\x01!\x04\0\x0audp-socket\x03\ -\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11\ -create-udp-socket\x01\x0a\x03\x01$wasi:sockets/udp-create-socket@0.2.0\x05\"\x02\ -\x03\0\x0d\x08duration\x01BT\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\ -\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x05\x04\0\x08p\ -ollable\x03\0\x04\x02\x03\x02\x01#\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x1b\ -\x04\0\x07network\x03\0\x08\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x0a\x02\ -\x03\x02\x01\x1e\x04\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01\x1f\x04\0\x11\ -ip-address-family\x03\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdow\ -n-type\x03\0\x10\x04\0\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01\ -@\x03\x04self\x13\x07network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp\ --socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socke\ -t.finish-bind\x01\x17\x01@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\ -\x15\x04\0\x20[method]tcp-socket.start-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\ -\x19\x1a\x01j\x01\x1b\x01\x0b\x01@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socke\ -t.finish-connect\x01\x1d\x04\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20\ -[method]tcp-socket.finish-listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\ -\x01\x0b\x01@\x01\x04self\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\ -\x01\x0d\x01\x0b\x01@\x01\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-addr\ -ess\x01#\x04\0![method]tcp-socket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\ -\x04\0\x1f[method]tcp-socket.is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0!\ -[method]tcp-socket.address-family\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0\ -*[method]tcp-socket.set-listen-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04\ -self\x13\0'\x04\0%[method]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\ -\x05value\x7f\0\x15\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\ -\x07\x01\x0b\x01@\x01\x04self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-ti\ -me\x01+\x01@\x02\x04self\x13\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-kee\ -p-alive-idle-time\x01,\x04\0&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[\ -method]tcp-socket.set-keep-alive-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04sel\ -f\x13\0-\x04\0#[method]tcp-socket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05\ -valuey\0\x15\x04\0'[method]tcp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\ -\x01@\x01\x04self\x13\00\x04\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04\ -self\x13\x05value}\0\x15\x04\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01\ -w\x01\x0b\x01@\x01\x04self\x13\03\x04\0&[method]tcp-socket.receive-buffer-size\x01\ -4\x04\0*[method]tcp-socket.set-receive-buffer-size\x01&\x04\0#[method]tcp-socket\ -.send-buffer-size\x014\x04\0'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\ -\x01@\x01\x04self\x13\05\x04\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04\ -self\x13\x0dshutdown-type\x11\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x03\ -\x01\x16wasi:sockets/tcp@0.2.0\x05$\x02\x03\0\x15\x0atcp-socket\x01B\x0c\x02\x03\ -\x02\x01\x1b\x04\0\x07network\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\ -\0\x02\x02\x03\x02\x01\x1f\x04\0\x11ip-address-family\x03\0\x04\x02\x03\x02\x01%\ -\x04\0\x0atcp-socket\x03\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress\ --family\x05\0\x09\x04\0\x11create-tcp-socket\x01\x0a\x03\x01$wasi:sockets/tcp-cr\ -eate-socket@0.2.0\x05&\x02\x03\0\x11\x0aip-address\x01B\x16\x02\x03\x02\x01\x05\x04\ -\0\x08pollable\x03\0\0\x02\x03\x02\x01\x1b\x04\0\x07network\x03\0\x02\x02\x03\x02\ -\x01\x1d\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01'\x04\0\x0aip-address\x03\0\ -\x06\x04\0\x16resolve-address-stream\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\ -\x01@\x01\x04self\x09\0\x0b\x04\03[method]resolve-address-stream.resolve-next-ad\ -dress\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]resolve-address-\ -stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07netw\ -ork\x0f\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x03\x01!wasi:sockets/i\ -p-name-lookup@0.2.0\x05(\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random\ --bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\x01\x18wasi:random/\ -random@0.2.0\x05)\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x19get-insecure-rand\ -om-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure-random-u64\x01\x02\x03\x01\x1aw\ -asi:random/insecure@0.2.0\x05*\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-\ -seed\x01\x01\x03\x01\x1fwasi:random/insecure-seed@0.2.0\x05+\x01B\x03\x01j\0\0\x01\ -@\0\0\0\x04\0\x03run\x01\x01\x04\x01\x12wasi:cli/run@0.2.0\x05,\x04\x01\x16wasi:\ -cli/command@0.2.0\x04\0\x0b\x0d\x01\0\x07command\x03\0\0\0G\x09producers\x01\x0c\ -processed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; - }; - ) +\x06\x03\0\x1awasi:cli/environment@0.2.4\x05\0\x01B\x03\x01j\0\0\x01@\x01\x06sta\ +tus\0\x01\0\x04\0\x04exit\x01\x01\x03\0\x13wasi:cli/exit@0.2.4\x05\x01\x01B\x04\x04\ +\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to-deb\ +ug-string\x01\x02\x03\0\x13wasi:io/error@0.2.4\x05\x02\x01B\x0a\x04\0\x08pollabl\ +e\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable.ready\x01\x02\ +\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\x01p\x01\x01\ +py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\x12wasi:io/poll@0.2.4\x05\ +\x03\x02\x03\0\x02\x05error\x02\x03\0\x03\x08pollable\x01B(\x02\x03\x02\x01\x04\x04\ +\0\x05error\x03\0\0\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\x02\x01i\x01\x01\ +q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\ +\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01\ +p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]inpu\ +t-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01\ +w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\ +\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\ +\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04\ +self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01\ +@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\ +\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04se\ +lf\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-s\ +tream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-\ +stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]outpu\ +t-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-\ +and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method\ +]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\ +\x03\0\x15wasi:io/streams@0.2.4\x05\x06\x02\x03\0\x04\x0cinput-stream\x01B\x05\x02\ +\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09ge\ +t-stdin\x01\x03\x03\0\x14wasi:cli/stdin@0.2.4\x05\x08\x02\x03\0\x04\x0doutput-st\ +ream\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\ +\0\x02\x04\0\x0aget-stdout\x01\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\x0a\x01B\x05\ +\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0a\ +get-stderr\x01\x03\x03\0\x15wasi:cli/stderr@0.2.4\x05\x0b\x01B\x01\x04\0\x0eterm\ +inal-input\x03\x01\x03\0\x1dwasi:cli/terminal-input@0.2.4\x05\x0c\x01B\x01\x04\0\ +\x0fterminal-output\x03\x01\x03\0\x1ewasi:cli/terminal-output@0.2.4\x05\x0d\x02\x03\ +\0\x08\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x0e\x04\0\x0eterminal-input\x03\ +\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\x01\x04\x03\0\x1d\ +wasi:cli/terminal-stdin@0.2.4\x05\x0f\x02\x03\0\x09\x0fterminal-output\x01B\x06\x02\ +\x03\x02\x01\x10\x04\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\ +\x04\0\x13get-terminal-stdout\x01\x04\x03\0\x1ewasi:cli/terminal-stdout@0.2.4\x05\ +\x11\x01B\x06\x02\x03\x02\x01\x10\x04\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\ +\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\x01\x04\x03\0\x1ewasi:cli/termina\ +l-stderr@0.2.4\x05\x12\x01B\x0f\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x01\ +w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duration\x03\0\x04\x01@\0\0\x03\x04\0\ +\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\x07\x01i\x01\x01@\x01\x04wh\ +en\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\x01\x04when\x05\0\x08\x04\0\ +\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/monotonic-clock@0.2.4\x05\x13\x01\ +B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\ +\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\0\x1cwasi:clocks/wall-cloc\ +k@0.2.4\x05\x14\x02\x03\0\x04\x05error\x02\x03\0\x0e\x08datetime\x01Br\x02\x03\x02\ +\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x09\x04\0\x0doutput-strea\ +m\x03\0\x02\x02\x03\x02\x01\x15\x04\0\x05error\x03\0\x04\x02\x03\x02\x01\x16\x04\ +\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesize\x03\0\x08\x01m\x08\x07unknown\x0c\ +block-device\x10character-device\x09directory\x04fifo\x0dsymbolic-link\x0cregula\ +r-file\x06socket\x04\0\x0fdescriptor-type\x03\0\x0a\x01n\x06\x04read\x05write\x13\ +file-integrity-sync\x13data-integrity-sync\x14requested-write-sync\x10mutate-dir\ +ectory\x04\0\x10descriptor-flags\x03\0\x0c\x01n\x01\x0esymlink-follow\x04\0\x0ap\ +ath-flags\x03\0\x0e\x01n\x04\x06create\x09directory\x09exclusive\x08truncate\x04\ +\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-count\x03\0\x12\x01k\x07\x01r\x06\x04\ +type\x0b\x0alink-count\x13\x04size\x09\x15data-access-timestamp\x14\x1bdata-modi\ +fication-timestamp\x14\x17status-change-timestamp\x14\x04\0\x0fdescriptor-stat\x03\ +\0\x15\x01q\x03\x09no-change\0\0\x03now\0\0\x09timestamp\x01\x07\0\x04\0\x0dnew-\ +timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04names\x04\0\x0fdirectory-entry\x03\0\ +\x19\x01m%\x06access\x0bwould-block\x07already\x0ebad-descriptor\x04busy\x08dead\ +lock\x05quota\x05exist\x0efile-too-large\x15illegal-byte-sequence\x0bin-progress\ +\x0binterrupted\x07invalid\x02io\x0cis-directory\x04loop\x0etoo-many-links\x0cme\ +ssage-size\x0dname-too-long\x09no-device\x08no-entry\x07no-lock\x13insufficient-\ +memory\x12insufficient-space\x0dnot-directory\x09not-empty\x0fnot-recoverable\x0b\ +unsupported\x06no-tty\x0eno-such-device\x08overflow\x0dnot-permitted\x04pipe\x09\ +read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-device\x04\0\x0aerror-code\x03\ +\0\x1b\x01m\x06\x06normal\x0asequential\x06random\x09will-need\x09dont-need\x08n\ +o-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05lowerw\x05upperw\x04\0\x13metadata\ +-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\x04\0\x16directory-entry-strea\ +m\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\x04self#\x06offset\x09\0%\x04\ +\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\x01j\x01'\x01\x1c\x01@\x02\x04\ +self#\x06offset\x09\0(\x04\0#[method]descriptor.write-via-stream\x01)\x01@\x01\x04\ +self#\0(\x04\0$[method]descriptor.append-via-stream\x01*\x01j\0\x01\x1c\x01@\x04\ +\x04self#\x06offset\x09\x06length\x09\x06advice\x1e\0+\x04\0\x19[method]descript\ +or.advise\x01,\x01@\x01\x04self#\0+\x04\0\x1c[method]descriptor.sync-data\x01-\x01\ +j\x01\x0d\x01\x1c\x01@\x01\x04self#\0.\x04\0\x1c[method]descriptor.get-flags\x01\ +/\x01j\x01\x0b\x01\x1c\x01@\x01\x04self#\00\x04\0\x1b[method]descriptor.get-type\ +\x011\x01@\x02\x04self#\x04size\x09\0+\x04\0\x1b[method]descriptor.set-size\x012\ +\x01@\x03\x04self#\x15data-access-timestamp\x18\x1bdata-modification-timestamp\x18\ +\0+\x04\0\x1c[method]descriptor.set-times\x013\x01p}\x01o\x024\x7f\x01j\x015\x01\ +\x1c\x01@\x03\x04self#\x06length\x09\x06offset\x09\06\x04\0\x17[method]descripto\ +r.read\x017\x01j\x01\x09\x01\x1c\x01@\x03\x04self#\x06buffer4\x06offset\x09\08\x04\ +\0\x18[method]descriptor.write\x019\x01i\"\x01j\x01:\x01\x1c\x01@\x01\x04self#\0\ +;\x04\0![method]descriptor.read-directory\x01<\x04\0\x17[method]descriptor.sync\x01\ +-\x01@\x02\x04self#\x04paths\0+\x04\0&[method]descriptor.create-directory-at\x01\ +=\x01j\x01\x16\x01\x1c\x01@\x01\x04self#\0>\x04\0\x17[method]descriptor.stat\x01\ +?\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0>\x04\0\x1a[method]descriptor.st\ +at-at\x01@\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x15data-access-timestamp\ +\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1f[method]descriptor.set-times\ +-at\x01A\x01@\x05\x04self#\x0eold-path-flags\x0f\x08old-paths\x0enew-descriptor#\ +\x08new-paths\0+\x04\0\x1a[method]descriptor.link-at\x01B\x01i!\x01j\x01\xc3\0\x01\ +\x1c\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x0aopen-flags\x11\x05flags\x0d\ +\0\xc4\0\x04\0\x1a[method]descriptor.open-at\x01E\x01j\x01s\x01\x1c\x01@\x02\x04\ +self#\x04paths\0\xc6\0\x04\0\x1e[method]descriptor.readlink-at\x01G\x04\0&[metho\ +d]descriptor.remove-directory-at\x01=\x01@\x04\x04self#\x08old-paths\x0enew-desc\ +riptor#\x08new-paths\0+\x04\0\x1c[method]descriptor.rename-at\x01H\x01@\x03\x04s\ +elf#\x08old-paths\x08new-paths\0+\x04\0\x1d[method]descriptor.symlink-at\x01I\x04\ +\0![method]descriptor.unlink-file-at\x01=\x01@\x02\x04self#\x05other#\0\x7f\x04\0\ +![method]descriptor.is-same-object\x01J\x01j\x01\x20\x01\x1c\x01@\x01\x04self#\0\ +\xcb\0\x04\0\x20[method]descriptor.metadata-hash\x01L\x01@\x03\x04self#\x0apath-\ +flags\x0f\x04paths\0\xcb\0\x04\0#[method]descriptor.metadata-hash-at\x01M\x01h\"\ +\x01k\x1a\x01j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\xd0\0\x04\03[method]di\ +rectory-entry-stream.read-directory-entry\x01Q\x01h\x05\x01k\x1c\x01@\x01\x03err\ +\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\0\x1bwasi:filesystem/type\ +s@0.2.4\x05\x17\x02\x03\0\x0f\x0adescriptor\x01B\x07\x02\x03\x02\x01\x18\x04\0\x0a\ +descriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-dir\ +ectories\x01\x05\x03\0\x1ewasi:filesystem/preopens@0.2.4\x05\x19\x01B\x11\x04\0\x07\ +network\x03\x01\x01m\x15\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid\ +-argument\x0dout-of-memory\x07timeout\x14concurrency-conflict\x0fnot-in-progress\ +\x0bwould-block\x0dinvalid-state\x10new-socket-limit\x14address-not-bindable\x0e\ +address-in-use\x12remote-unreachable\x12connection-refused\x10connection-reset\x12\ +connection-aborted\x12datagram-too-large\x11name-unresolvable\x1atemporary-resol\ +ver-failure\x1apermanent-resolver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\ +\x04ipv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4\ +-address\x03\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x07\x01q\x02\x04\ +ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\x09\x01r\x02\x04port{\ +\x07address\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow\ +-infoy\x07address\x08\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\ +\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\0\x1a\ +wasi:sockets/network@0.2.4\x05\x1a\x02\x03\0\x11\x07network\x01B\x05\x02\x03\x02\ +\x01\x1b\x04\0\x07network\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x10instance-networ\ +k\x01\x03\x03\0#wasi:sockets/instance-network@0.2.4\x05\x1c\x02\x03\0\x11\x0aerr\ +or-code\x02\x03\0\x11\x11ip-socket-address\x02\x03\0\x11\x11ip-address-family\x01\ +BD\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01\x1b\x04\0\x07ne\ +twork\x03\0\x02\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01\ +\x1e\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01\x1f\x04\0\x11ip-addres\ +s-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-address\x07\x04\0\x11inc\ +oming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0eremote-address\x0d\x04\ +\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\x01\x04\0\x18incoming-\ +datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\x03\x01\x01h\x10\x01h\x03\ +\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dlocal-address\x07\0\x15\x04\ +\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e\ +[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\x01o\x02\x18\x19\x01j\x01\ +\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\0\x1b\x04\0\x19[method]u\ +dp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04self\x13\0\x1d\x04\0\x20\ +[method]udp-socket.local-address\x01\x1e\x04\0![method]udp-socket.remote-address\ +\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-socket.address-family\x01\x1f\ +\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[method]udp-socket.unicast-h\ +op-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\0([method]udp-socket.set-\ +unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04self\x13\0#\x04\0&[method]\ +udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[\ +method]udp-socket.set-receive-buffer-size\x01%\x04\0#[method]udp-socket.send-buf\ +fer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-size\x01%\x01i\x01\x01@\x01\ +\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01'\x01h\x11\x01p\x0c\x01\ +j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0([method]incoming-datag\ +ram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[method]incoming-datagram-str\ +eam.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[method]outgoing-datagram\ +-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09datagrams/\0#\x04\0%[metho\ +d]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\x04\0*[method]outgoing\ +-datagram-stream.subscribe\x011\x03\0\x16wasi:sockets/udp@0.2.4\x05\x20\x02\x03\0\ +\x13\x0audp-socket\x01B\x0c\x02\x03\x02\x01\x1b\x04\0\x07network\x03\0\0\x02\x03\ +\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\x1f\x04\0\x11ip-addre\ +ss-family\x03\0\x04\x02\x03\x02\x01!\x04\0\x0audp-socket\x03\0\x06\x01i\x07\x01j\ +\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-udp-socket\ +\x01\x0a\x03\0$wasi:sockets/udp-create-socket@0.2.4\x05\"\x02\x03\0\x0d\x08durat\ +ion\x01BT\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x09\x04\ +\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\x04\x02\ +\x03\x02\x01#\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x1b\x04\0\x07network\x03\ +\0\x08\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01\x1e\x04\ +\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01\x1f\x04\0\x11ip-address-family\ +\x03\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\ +\0\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07\ +network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\ +\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01\ +@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]tc\ +p-socket.start-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\x19\x1a\x01j\x01\x1b\x01\ +\x0b\x01@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socket.finish-connect\x01\x1d\x04\ +\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20[method]tcp-socket.finish\ +-listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04s\ +elf\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\x01\x0d\x01\x0b\x01@\x01\ +\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-address\x01#\x04\0![method]tc\ +p-socket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\x04\0\x1f[method]tcp-soc\ +ket.is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0![method]tcp-socket.addres\ +s-family\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-\ +listen-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[met\ +hod]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\ +\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04\ +self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\ +\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0\ +&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-a\ +live-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\0#[method]tcp-s\ +ocket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\x04\0'[method]t\ +cp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\ +\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\ +\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\ +\03\x04\0&[method]tcp-socket.receive-buffer-size\x014\x04\0*[method]tcp-socket.s\ +et-receive-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0\ +'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\ +\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\ +\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x03\0\x16wasi:sockets/tcp@0.2.4\ +\x05$\x02\x03\0\x15\x0atcp-socket\x01B\x0c\x02\x03\x02\x01\x1b\x04\0\x07network\x03\ +\0\0\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\x1f\x04\0\ +\x11ip-address-family\x03\0\x04\x02\x03\x02\x01%\x04\0\x0atcp-socket\x03\0\x06\x01\ +i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-\ +tcp-socket\x01\x0a\x03\0$wasi:sockets/tcp-create-socket@0.2.4\x05&\x02\x03\0\x11\ +\x0aip-address\x01B\x16\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x02\x03\x02\ +\x01\x1b\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\ +\x04\x02\x03\x02\x01'\x04\0\x0aip-address\x03\0\x06\x04\0\x16resolve-address-str\ +eam\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\x01@\x01\x04self\x09\0\x0b\x04\ +\03[method]resolve-address-stream.resolve-next-address\x01\x0c\x01i\x01\x01@\x01\ +\x04self\x09\0\x0d\x04\0([method]resolve-address-stream.subscribe\x01\x0e\x01h\x03\ +\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07network\x0f\x04names\0\x11\x04\0\x11r\ +esolve-addresses\x01\x12\x03\0!wasi:sockets/ip-name-lookup@0.2.4\x05(\x01B\x05\x01\ +p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget\ +-random-u64\x01\x02\x03\0\x18wasi:random/random@0.2.4\x05)\x01B\x05\x01p}\x01@\x01\ +\x03lenw\0\0\x04\0\x19get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-i\ +nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01\ +o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\ +seed@0.2.4\x05+\x01B\x03\x01j\0\0\x01@\0\0\0\x04\0\x03run\x01\x01\x04\0\x12wasi:\ +cli/run@0.2.4\x05,\x04\0\x16wasi:cli/command@0.2.4\x04\0\x0b\x0d\x01\0\x07comman\ +d\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.225.0\x10\ +wit-bindgen-rust\x060.39.0"; + }; + }; } #[doc(inline)] pub use __export_command_impl as _export_command; - #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world"] +#[unsafe( + link_section = "component-type:wit-bindgen:0.39.0:wasi:cli@0.2.4:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world" +)] #[doc(hidden)] +#[allow(clippy::octal_escapes)] pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 10794] = *b"\ \0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x8cS\x01A\x02\x01AG\x01\ B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environment\x01\x02\x01ps\x01@\ \0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\x04\0\x0binitial-cwd\x01\ -\x06\x03\x01\x1awasi:cli/environment@0.2.0\x05\0\x01B\x03\x01j\0\0\x01@\x01\x06s\ -tatus\0\x01\0\x04\0\x04exit\x01\x01\x03\x01\x13wasi:cli/exit@0.2.0\x05\x01\x01B\x04\ -\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to\ --debug-string\x01\x02\x03\x01\x13wasi:io/error@0.2.0\x05\x02\x01B\x0a\x04\0\x08p\ -ollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable.read\ -y\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\x01\ -p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\x12wasi:io/po\ -ll@0.2.0\x05\x03\x02\x03\0\x02\x05error\x02\x03\0\x03\x08pollable\x01B(\x02\x03\x02\ -\x01\x04\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\x02\x01\ -i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-\ -error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01\ -h\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[me\ -thod]input-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\ -\x01j\x01w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-str\ -eam.skip\x01\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\ -\x01\x04self\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01\ -@\x01\x04self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\ -\x06\x01@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.w\ -rite\x01\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\ -\x04self\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]ou\ -tput-stream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]o\ -utput-stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method\ -]output-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-z\ -eroes-and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[\ -method]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\ -\x18\x03\x01\x15wasi:io/streams@0.2.0\x05\x06\x02\x03\0\x04\x0cinput-stream\x01B\ -\x05\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\ -\0\x09get-stdin\x01\x03\x03\x01\x14wasi:cli/stdin@0.2.0\x05\x08\x02\x03\0\x04\x0d\ -output-stream\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\ -\x01@\0\0\x02\x04\0\x0aget-stdout\x01\x03\x03\x01\x15wasi:cli/stdout@0.2.0\x05\x0a\ -\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\ -\x04\0\x0aget-stderr\x01\x03\x03\x01\x15wasi:cli/stderr@0.2.0\x05\x0b\x01B\x01\x04\ -\0\x0eterminal-input\x03\x01\x03\x01\x1dwasi:cli/terminal-input@0.2.0\x05\x0c\x01\ -B\x01\x04\0\x0fterminal-output\x03\x01\x03\x01\x1ewasi:cli/terminal-output@0.2.0\ -\x05\x0d\x02\x03\0\x08\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x0e\x04\0\x0et\ -erminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\ -\x01\x04\x03\x01\x1dwasi:cli/terminal-stdin@0.2.0\x05\x0f\x02\x03\0\x09\x0ftermi\ -nal-output\x01B\x06\x02\x03\x02\x01\x10\x04\0\x0fterminal-output\x03\0\0\x01i\x01\ -\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\x01\x1ewasi:cli/\ -terminal-stdout@0.2.0\x05\x11\x01B\x06\x02\x03\x02\x01\x10\x04\0\x0fterminal-out\ -put\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\x01\x04\x03\ -\x01\x1ewasi:cli/terminal-stderr@0.2.0\x05\x12\x01B\x0f\x02\x03\x02\x01\x05\x04\0\ -\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duration\x03\0\ -\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\x07\x01\ -i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\x01\x04\ -when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\x01!wasi:clocks/monotonic\ --clock@0.2.0\x05\x13\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08date\ -time\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\x01\ -\x1cwasi:clocks/wall-clock@0.2.0\x05\x14\x02\x03\0\x04\x05error\x02\x03\0\x0e\x08\ -datetime\x01Br\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\ -\x09\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x15\x04\0\x05error\x03\0\x04\ -\x02\x03\x02\x01\x16\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesize\x03\0\x08\ -\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\x04fifo\x0d\ -symbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\0\x0a\x01n\x06\ -\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14requested-wri\ -te-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x0c\x01n\x01\x0esyml\ -ink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\x09directory\x09excl\ -usive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-count\x03\0\x12\ -\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\x15data-access-time\ -stamp\x14\x1bdata-modification-timestamp\x14\x17status-change-timestamp\x14\x04\0\ -\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03now\0\0\x09timestamp\x01\ -\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04names\x04\0\x0fd\ -irectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07already\x0ebad-descri\ -ptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15illegal-byte-seq\ -uence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-directory\x04loop\x0e\ -too-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08no-entry\x07no-l\ -ock\x13insufficient-memory\x12insufficient-space\x0dnot-directory\x09not-empty\x0f\ -not-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08overflow\x0dnot-pe\ -rmitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-device\x04\ -\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequential\x06random\x09will-ne\ -ed\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05lowerw\x05uppe\ -rw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\x04\0\x16d\ -irectory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\x04self#\ -\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\x01j\x01\ -'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[method]descriptor.write-via-\ -stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]descriptor.append-via-stream\x01*\ -\x01j\0\x01\x1c\x01@\x04\x04self#\x06offset\x09\x06length\x09\x06advice\x1e\0+\x04\ -\0\x19[method]descriptor.advise\x01,\x01@\x01\x04self#\0+\x04\0\x1c[method]descr\ -iptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\x04self#\0.\x04\0\x1c[method]\ -descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01@\x01\x04self#\00\x04\0\x1b[me\ -thod]descriptor.get-type\x011\x01@\x02\x04self#\x04size\x09\0+\x04\0\x1b[method]\ -descriptor.set-size\x012\x01@\x03\x04self#\x15data-access-timestamp\x18\x1bdata-\ -modification-timestamp\x18\0+\x04\0\x1c[method]descriptor.set-times\x013\x01p}\x01\ -o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\x04self#\x06length\x09\x06offset\x09\06\x04\ -\0\x17[method]descriptor.read\x017\x01j\x01\x09\x01\x1c\x01@\x03\x04self#\x06buf\ -fer4\x06offset\x09\08\x04\0\x18[method]descriptor.write\x019\x01i\"\x01j\x01:\x01\ -\x1c\x01@\x01\x04self#\0;\x04\0![method]descriptor.read-directory\x01<\x04\0\x17\ -[method]descriptor.sync\x01-\x01@\x02\x04self#\x04paths\0+\x04\0&[method]descrip\ -tor.create-directory-at\x01=\x01j\x01\x16\x01\x1c\x01@\x01\x04self#\0>\x04\0\x17\ -[method]descriptor.stat\x01?\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0>\x04\ -\0\x1a[method]descriptor.stat-at\x01@\x01@\x05\x04self#\x0apath-flags\x0f\x04pat\ -hs\x15data-access-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1f[\ -method]descriptor.set-times-at\x01A\x01@\x05\x04self#\x0eold-path-flags\x0f\x08o\ -ld-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a[method]descriptor.link-at\x01\ -B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x0ao\ -pen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]descriptor.open-at\x01E\x01j\ -\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\0\x1e[method]descriptor.rea\ -dlink-at\x01G\x04\0&[method]descriptor.remove-directory-at\x01=\x01@\x04\x04self\ -#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1c[method]descriptor.re\ -name-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-paths\0+\x04\0\x1d[method]des\ -criptor.symlink-at\x01I\x04\0![method]descriptor.unlink-file-at\x01=\x01@\x02\x04\ -self#\x05other#\0\x7f\x04\0![method]descriptor.is-same-object\x01J\x01j\x01\x20\x01\ -\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\x20[method]descriptor.metadata-hash\x01L\x01\ -@\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\x04\0#[method]descriptor.metad\ -ata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\ -\xd0\0\x04\03[method]directory-entry-stream.read-directory-entry\x01Q\x01h\x05\x01\ -k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\x01\x1b\ -wasi:filesystem/types@0.2.0\x05\x17\x02\x03\0\x0f\x0adescriptor\x01B\x07\x02\x03\ -\x02\x01\x18\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\ -\x04\x04\0\x0fget-directories\x01\x05\x03\x01\x1ewasi:filesystem/preopens@0.2.0\x05\ -\x19\x01B\x11\x04\0\x07network\x03\x01\x01m\x15\x07unknown\x0daccess-denied\x0dn\ -ot-supported\x10invalid-argument\x0dout-of-memory\x07timeout\x14concurrency-conf\ -lict\x0fnot-in-progress\x0bwould-block\x0dinvalid-state\x10new-socket-limit\x14a\ -ddress-not-bindable\x0eaddress-in-use\x12remote-unreachable\x12connection-refuse\ -d\x10connection-reset\x12connection-aborted\x12datagram-too-large\x11name-unreso\ -lvable\x1atemporary-resolver-failure\x1apermanent-resolver-failure\x04\0\x0aerro\ -r-code\x03\0\x01\x01m\x02\x04ipv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\x01\ -o\x04}}}}\x04\0\x0cipv4-address\x03\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\ -\x03\0\x07\x01q\x02\x04ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\ -\x09\x01r\x02\x04port{\x07address\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01\ -r\x04\x04port{\x09flow-infoy\x07address\x08\x08scope-idy\x04\0\x13ipv6-socket-ad\ -dress\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-\ -address\x03\0\x0f\x03\x01\x1awasi:sockets/network@0.2.0\x05\x1a\x02\x03\0\x11\x07\ -network\x01B\x05\x02\x03\x02\x01\x1b\x04\0\x07network\x03\0\0\x01i\x01\x01@\0\0\x02\ -\x04\0\x10instance-network\x01\x03\x03\x01#wasi:sockets/instance-network@0.2.0\x05\ -\x1c\x02\x03\0\x11\x0aerror-code\x02\x03\0\x11\x11ip-socket-address\x02\x03\0\x11\ -\x11ip-address-family\x01BD\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x02\x03\ -\x02\x01\x1b\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\ -\0\x04\x02\x03\x02\x01\x1e\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01\x1f\ -\x04\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-addre\ -ss\x07\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0erem\ -ote-address\x0d\x04\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\x01\ -\x04\0\x18incoming-datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\x03\ -\x01\x01h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dloc\ -al-address\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04\ -self\x13\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\ -\x01o\x02\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\ -\0\x1b\x04\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04\ -self\x13\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]u\ -dp-socket.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-so\ -cket.address-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[\ -method]udp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\ -\0([method]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04\ -self\x13\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\ -\x05valuew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[me\ -thod]udp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-s\ -ize\x01%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01\ -'\x01h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0\ -([method]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[metho\ -d]incoming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[m\ -ethod]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09dat\ -agrams/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\ -\x04\0*[method]outgoing-datagram-stream.subscribe\x011\x03\x01\x16wasi:sockets/u\ -dp@0.2.0\x05\x20\x02\x03\0\x13\x0audp-socket\x01B\x0c\x02\x03\x02\x01\x1b\x04\0\x07\ -network\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\ -\x1f\x04\0\x11ip-address-family\x03\0\x04\x02\x03\x02\x01!\x04\0\x0audp-socket\x03\ -\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11\ -create-udp-socket\x01\x0a\x03\x01$wasi:sockets/udp-create-socket@0.2.0\x05\"\x02\ -\x03\0\x0d\x08duration\x01BT\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\ -\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x05\x04\0\x08p\ -ollable\x03\0\x04\x02\x03\x02\x01#\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x1b\ -\x04\0\x07network\x03\0\x08\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x0a\x02\ -\x03\x02\x01\x1e\x04\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01\x1f\x04\0\x11\ -ip-address-family\x03\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdow\ -n-type\x03\0\x10\x04\0\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01\ -@\x03\x04self\x13\x07network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp\ --socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socke\ -t.finish-bind\x01\x17\x01@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\ -\x15\x04\0\x20[method]tcp-socket.start-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\ -\x19\x1a\x01j\x01\x1b\x01\x0b\x01@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socke\ -t.finish-connect\x01\x1d\x04\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20\ -[method]tcp-socket.finish-listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\ -\x01\x0b\x01@\x01\x04self\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\ -\x01\x0d\x01\x0b\x01@\x01\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-addr\ -ess\x01#\x04\0![method]tcp-socket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\ -\x04\0\x1f[method]tcp-socket.is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0!\ -[method]tcp-socket.address-family\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0\ -*[method]tcp-socket.set-listen-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04\ -self\x13\0'\x04\0%[method]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\ -\x05value\x7f\0\x15\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\ -\x07\x01\x0b\x01@\x01\x04self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-ti\ -me\x01+\x01@\x02\x04self\x13\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-kee\ -p-alive-idle-time\x01,\x04\0&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[\ -method]tcp-socket.set-keep-alive-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04sel\ -f\x13\0-\x04\0#[method]tcp-socket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05\ -valuey\0\x15\x04\0'[method]tcp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\ -\x01@\x01\x04self\x13\00\x04\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04\ -self\x13\x05value}\0\x15\x04\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01\ -w\x01\x0b\x01@\x01\x04self\x13\03\x04\0&[method]tcp-socket.receive-buffer-size\x01\ -4\x04\0*[method]tcp-socket.set-receive-buffer-size\x01&\x04\0#[method]tcp-socket\ -.send-buffer-size\x014\x04\0'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\ -\x01@\x01\x04self\x13\05\x04\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04\ -self\x13\x0dshutdown-type\x11\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x03\ -\x01\x16wasi:sockets/tcp@0.2.0\x05$\x02\x03\0\x15\x0atcp-socket\x01B\x0c\x02\x03\ -\x02\x01\x1b\x04\0\x07network\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\ -\0\x02\x02\x03\x02\x01\x1f\x04\0\x11ip-address-family\x03\0\x04\x02\x03\x02\x01%\ -\x04\0\x0atcp-socket\x03\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress\ --family\x05\0\x09\x04\0\x11create-tcp-socket\x01\x0a\x03\x01$wasi:sockets/tcp-cr\ -eate-socket@0.2.0\x05&\x02\x03\0\x11\x0aip-address\x01B\x16\x02\x03\x02\x01\x05\x04\ -\0\x08pollable\x03\0\0\x02\x03\x02\x01\x1b\x04\0\x07network\x03\0\x02\x02\x03\x02\ -\x01\x1d\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01'\x04\0\x0aip-address\x03\0\ -\x06\x04\0\x16resolve-address-stream\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\ -\x01@\x01\x04self\x09\0\x0b\x04\03[method]resolve-address-stream.resolve-next-ad\ -dress\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]resolve-address-\ -stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07netw\ -ork\x0f\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x03\x01!wasi:sockets/i\ -p-name-lookup@0.2.0\x05(\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random\ --bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\x01\x18wasi:random/\ -random@0.2.0\x05)\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x19get-insecure-rand\ -om-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure-random-u64\x01\x02\x03\x01\x1aw\ -asi:random/insecure@0.2.0\x05*\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-\ -seed\x01\x01\x03\x01\x1fwasi:random/insecure-seed@0.2.0\x05+\x04\x016wasi:cli/co\ -mmand-with-all-of-its-exports-removed@0.2.0\x04\0\x0b-\x01\0'command-with-all-of\ --its-exports-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-comp\ -onent\x070.201.0\x10wit-bindgen-rust\x060.21.0"; - +\x06\x03\0\x1awasi:cli/environment@0.2.4\x05\0\x01B\x03\x01j\0\0\x01@\x01\x06sta\ +tus\0\x01\0\x04\0\x04exit\x01\x01\x03\0\x13wasi:cli/exit@0.2.4\x05\x01\x01B\x04\x04\ +\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to-deb\ +ug-string\x01\x02\x03\0\x13wasi:io/error@0.2.4\x05\x02\x01B\x0a\x04\0\x08pollabl\ +e\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable.ready\x01\x02\ +\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\x01p\x01\x01\ +py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\x12wasi:io/poll@0.2.4\x05\ +\x03\x02\x03\0\x02\x05error\x02\x03\0\x03\x08pollable\x01B(\x02\x03\x02\x01\x04\x04\ +\0\x05error\x03\0\0\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\x02\x01i\x01\x01\ +q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\ +\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01\ +p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]inpu\ +t-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01\ +w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\ +\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\ +\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04\ +self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01\ +@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\ +\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04se\ +lf\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-s\ +tream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-\ +stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]outpu\ +t-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-\ +and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method\ +]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\ +\x03\0\x15wasi:io/streams@0.2.4\x05\x06\x02\x03\0\x04\x0cinput-stream\x01B\x05\x02\ +\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09ge\ +t-stdin\x01\x03\x03\0\x14wasi:cli/stdin@0.2.4\x05\x08\x02\x03\0\x04\x0doutput-st\ +ream\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\ +\0\x02\x04\0\x0aget-stdout\x01\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\x0a\x01B\x05\ +\x02\x03\x02\x01\x09\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0a\ +get-stderr\x01\x03\x03\0\x15wasi:cli/stderr@0.2.4\x05\x0b\x01B\x01\x04\0\x0eterm\ +inal-input\x03\x01\x03\0\x1dwasi:cli/terminal-input@0.2.4\x05\x0c\x01B\x01\x04\0\ +\x0fterminal-output\x03\x01\x03\0\x1ewasi:cli/terminal-output@0.2.4\x05\x0d\x02\x03\ +\0\x08\x0eterminal-input\x01B\x06\x02\x03\x02\x01\x0e\x04\0\x0eterminal-input\x03\ +\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12get-terminal-stdin\x01\x04\x03\0\x1d\ +wasi:cli/terminal-stdin@0.2.4\x05\x0f\x02\x03\0\x09\x0fterminal-output\x01B\x06\x02\ +\x03\x02\x01\x10\x04\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\ +\x04\0\x13get-terminal-stdout\x01\x04\x03\0\x1ewasi:cli/terminal-stdout@0.2.4\x05\ +\x11\x01B\x06\x02\x03\x02\x01\x10\x04\0\x0fterminal-output\x03\0\0\x01i\x01\x01k\ +\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\x01\x04\x03\0\x1ewasi:cli/termina\ +l-stderr@0.2.4\x05\x12\x01B\x0f\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x01\ +w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duration\x03\0\x04\x01@\0\0\x03\x04\0\ +\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\x07\x01i\x01\x01@\x01\x04wh\ +en\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\x01\x04when\x05\0\x08\x04\0\ +\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/monotonic-clock@0.2.4\x05\x13\x01\ +B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\ +\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\0\x1cwasi:clocks/wall-cloc\ +k@0.2.4\x05\x14\x02\x03\0\x04\x05error\x02\x03\0\x0e\x08datetime\x01Br\x02\x03\x02\ +\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x09\x04\0\x0doutput-strea\ +m\x03\0\x02\x02\x03\x02\x01\x15\x04\0\x05error\x03\0\x04\x02\x03\x02\x01\x16\x04\ +\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesize\x03\0\x08\x01m\x08\x07unknown\x0c\ +block-device\x10character-device\x09directory\x04fifo\x0dsymbolic-link\x0cregula\ +r-file\x06socket\x04\0\x0fdescriptor-type\x03\0\x0a\x01n\x06\x04read\x05write\x13\ +file-integrity-sync\x13data-integrity-sync\x14requested-write-sync\x10mutate-dir\ +ectory\x04\0\x10descriptor-flags\x03\0\x0c\x01n\x01\x0esymlink-follow\x04\0\x0ap\ +ath-flags\x03\0\x0e\x01n\x04\x06create\x09directory\x09exclusive\x08truncate\x04\ +\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-count\x03\0\x12\x01k\x07\x01r\x06\x04\ +type\x0b\x0alink-count\x13\x04size\x09\x15data-access-timestamp\x14\x1bdata-modi\ +fication-timestamp\x14\x17status-change-timestamp\x14\x04\0\x0fdescriptor-stat\x03\ +\0\x15\x01q\x03\x09no-change\0\0\x03now\0\0\x09timestamp\x01\x07\0\x04\0\x0dnew-\ +timestamp\x03\0\x17\x01r\x02\x04type\x0b\x04names\x04\0\x0fdirectory-entry\x03\0\ +\x19\x01m%\x06access\x0bwould-block\x07already\x0ebad-descriptor\x04busy\x08dead\ +lock\x05quota\x05exist\x0efile-too-large\x15illegal-byte-sequence\x0bin-progress\ +\x0binterrupted\x07invalid\x02io\x0cis-directory\x04loop\x0etoo-many-links\x0cme\ +ssage-size\x0dname-too-long\x09no-device\x08no-entry\x07no-lock\x13insufficient-\ +memory\x12insufficient-space\x0dnot-directory\x09not-empty\x0fnot-recoverable\x0b\ +unsupported\x06no-tty\x0eno-such-device\x08overflow\x0dnot-permitted\x04pipe\x09\ +read-only\x0cinvalid-seek\x0etext-file-busy\x0ccross-device\x04\0\x0aerror-code\x03\ +\0\x1b\x01m\x06\x06normal\x0asequential\x06random\x09will-need\x09dont-need\x08n\ +o-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05lowerw\x05upperw\x04\0\x13metadata\ +-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\x04\0\x16directory-entry-strea\ +m\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\x04self#\x06offset\x09\0%\x04\ +\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\x01j\x01'\x01\x1c\x01@\x02\x04\ +self#\x06offset\x09\0(\x04\0#[method]descriptor.write-via-stream\x01)\x01@\x01\x04\ +self#\0(\x04\0$[method]descriptor.append-via-stream\x01*\x01j\0\x01\x1c\x01@\x04\ +\x04self#\x06offset\x09\x06length\x09\x06advice\x1e\0+\x04\0\x19[method]descript\ +or.advise\x01,\x01@\x01\x04self#\0+\x04\0\x1c[method]descriptor.sync-data\x01-\x01\ +j\x01\x0d\x01\x1c\x01@\x01\x04self#\0.\x04\0\x1c[method]descriptor.get-flags\x01\ +/\x01j\x01\x0b\x01\x1c\x01@\x01\x04self#\00\x04\0\x1b[method]descriptor.get-type\ +\x011\x01@\x02\x04self#\x04size\x09\0+\x04\0\x1b[method]descriptor.set-size\x012\ +\x01@\x03\x04self#\x15data-access-timestamp\x18\x1bdata-modification-timestamp\x18\ +\0+\x04\0\x1c[method]descriptor.set-times\x013\x01p}\x01o\x024\x7f\x01j\x015\x01\ +\x1c\x01@\x03\x04self#\x06length\x09\x06offset\x09\06\x04\0\x17[method]descripto\ +r.read\x017\x01j\x01\x09\x01\x1c\x01@\x03\x04self#\x06buffer4\x06offset\x09\08\x04\ +\0\x18[method]descriptor.write\x019\x01i\"\x01j\x01:\x01\x1c\x01@\x01\x04self#\0\ +;\x04\0![method]descriptor.read-directory\x01<\x04\0\x17[method]descriptor.sync\x01\ +-\x01@\x02\x04self#\x04paths\0+\x04\0&[method]descriptor.create-directory-at\x01\ +=\x01j\x01\x16\x01\x1c\x01@\x01\x04self#\0>\x04\0\x17[method]descriptor.stat\x01\ +?\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0>\x04\0\x1a[method]descriptor.st\ +at-at\x01@\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x15data-access-timestamp\ +\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1f[method]descriptor.set-times\ +-at\x01A\x01@\x05\x04self#\x0eold-path-flags\x0f\x08old-paths\x0enew-descriptor#\ +\x08new-paths\0+\x04\0\x1a[method]descriptor.link-at\x01B\x01i!\x01j\x01\xc3\0\x01\ +\x1c\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x0aopen-flags\x11\x05flags\x0d\ +\0\xc4\0\x04\0\x1a[method]descriptor.open-at\x01E\x01j\x01s\x01\x1c\x01@\x02\x04\ +self#\x04paths\0\xc6\0\x04\0\x1e[method]descriptor.readlink-at\x01G\x04\0&[metho\ +d]descriptor.remove-directory-at\x01=\x01@\x04\x04self#\x08old-paths\x0enew-desc\ +riptor#\x08new-paths\0+\x04\0\x1c[method]descriptor.rename-at\x01H\x01@\x03\x04s\ +elf#\x08old-paths\x08new-paths\0+\x04\0\x1d[method]descriptor.symlink-at\x01I\x04\ +\0![method]descriptor.unlink-file-at\x01=\x01@\x02\x04self#\x05other#\0\x7f\x04\0\ +![method]descriptor.is-same-object\x01J\x01j\x01\x20\x01\x1c\x01@\x01\x04self#\0\ +\xcb\0\x04\0\x20[method]descriptor.metadata-hash\x01L\x01@\x03\x04self#\x0apath-\ +flags\x0f\x04paths\0\xcb\0\x04\0#[method]descriptor.metadata-hash-at\x01M\x01h\"\ +\x01k\x1a\x01j\x01\xcf\0\x01\x1c\x01@\x01\x04self\xce\0\0\xd0\0\x04\03[method]di\ +rectory-entry-stream.read-directory-entry\x01Q\x01h\x05\x01k\x1c\x01@\x01\x03err\ +\xd2\0\0\xd3\0\x04\0\x15filesystem-error-code\x01T\x03\0\x1bwasi:filesystem/type\ +s@0.2.4\x05\x17\x02\x03\0\x0f\x0adescriptor\x01B\x07\x02\x03\x02\x01\x18\x04\0\x0a\ +descriptor\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-dir\ +ectories\x01\x05\x03\0\x1ewasi:filesystem/preopens@0.2.4\x05\x19\x01B\x11\x04\0\x07\ +network\x03\x01\x01m\x15\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid\ +-argument\x0dout-of-memory\x07timeout\x14concurrency-conflict\x0fnot-in-progress\ +\x0bwould-block\x0dinvalid-state\x10new-socket-limit\x14address-not-bindable\x0e\ +address-in-use\x12remote-unreachable\x12connection-refused\x10connection-reset\x12\ +connection-aborted\x12datagram-too-large\x11name-unresolvable\x1atemporary-resol\ +ver-failure\x1apermanent-resolver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\ +\x04ipv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4\ +-address\x03\0\x05\x01o\x08{{{{{{{{\x04\0\x0cipv6-address\x03\0\x07\x01q\x02\x04\ +ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0aip-address\x03\0\x09\x01r\x02\x04port{\ +\x07address\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow\ +-infoy\x07address\x08\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\ +\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\0\x1a\ +wasi:sockets/network@0.2.4\x05\x1a\x02\x03\0\x11\x07network\x01B\x05\x02\x03\x02\ +\x01\x1b\x04\0\x07network\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x10instance-networ\ +k\x01\x03\x03\0#wasi:sockets/instance-network@0.2.4\x05\x1c\x02\x03\0\x11\x0aerr\ +or-code\x02\x03\0\x11\x11ip-socket-address\x02\x03\0\x11\x11ip-address-family\x01\ +BD\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01\x1b\x04\0\x07ne\ +twork\x03\0\x02\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01\ +\x1e\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01\x1f\x04\0\x11ip-addres\ +s-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-address\x07\x04\0\x11inc\ +oming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0eremote-address\x0d\x04\ +\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\x01\x04\0\x18incoming-\ +datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\x03\x01\x01h\x10\x01h\x03\ +\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dlocal-address\x07\0\x15\x04\ +\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e\ +[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\x01o\x02\x18\x19\x01j\x01\ +\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\0\x1b\x04\0\x19[method]u\ +dp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04self\x13\0\x1d\x04\0\x20\ +[method]udp-socket.local-address\x01\x1e\x04\0![method]udp-socket.remote-address\ +\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-socket.address-family\x01\x1f\ +\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[method]udp-socket.unicast-h\ +op-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\0([method]udp-socket.set-\ +unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04self\x13\0#\x04\0&[method]\ +udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[\ +method]udp-socket.set-receive-buffer-size\x01%\x04\0#[method]udp-socket.send-buf\ +fer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-size\x01%\x01i\x01\x01@\x01\ +\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01'\x01h\x11\x01p\x0c\x01\ +j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0([method]incoming-datag\ +ram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[method]incoming-datagram-str\ +eam.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[method]outgoing-datagram\ +-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09datagrams/\0#\x04\0%[metho\ +d]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\x04\0*[method]outgoing\ +-datagram-stream.subscribe\x011\x03\0\x16wasi:sockets/udp@0.2.4\x05\x20\x02\x03\0\ +\x13\x0audp-socket\x01B\x0c\x02\x03\x02\x01\x1b\x04\0\x07network\x03\0\0\x02\x03\ +\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\x1f\x04\0\x11ip-addre\ +ss-family\x03\0\x04\x02\x03\x02\x01!\x04\0\x0audp-socket\x03\0\x06\x01i\x07\x01j\ +\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-udp-socket\ +\x01\x0a\x03\0$wasi:sockets/udp-create-socket@0.2.4\x05\"\x02\x03\0\x0d\x08durat\ +ion\x01BT\x02\x03\x02\x01\x07\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x09\x04\ +\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\x04\x02\ +\x03\x02\x01#\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x1b\x04\0\x07network\x03\ +\0\x08\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01\x1e\x04\ +\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01\x1f\x04\0\x11ip-address-family\ +\x03\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\ +\0\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07\ +network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\ +\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01\ +@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]tc\ +p-socket.start-connect\x01\x18\x01i\x01\x01i\x03\x01o\x02\x19\x1a\x01j\x01\x1b\x01\ +\x0b\x01@\x01\x04self\x13\0\x1c\x04\0![method]tcp-socket.finish-connect\x01\x1d\x04\ +\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20[method]tcp-socket.finish\ +-listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04s\ +elf\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\x01\x0d\x01\x0b\x01@\x01\ +\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-address\x01#\x04\0![method]tc\ +p-socket.remote-address\x01#\x01@\x01\x04self\x13\0\x7f\x04\0\x1f[method]tcp-soc\ +ket.is-listening\x01$\x01@\x01\x04self\x13\0\x0f\x04\0![method]tcp-socket.addres\ +s-family\x01%\x01@\x02\x04self\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-\ +listen-backlog-size\x01&\x01j\x01\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[met\ +hod]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\ +\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04\ +self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\ +\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0\ +&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-a\ +live-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\0#[method]tcp-s\ +ocket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\x04\0'[method]t\ +cp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\ +\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\ +\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\ +\03\x04\0&[method]tcp-socket.receive-buffer-size\x014\x04\0*[method]tcp-socket.s\ +et-receive-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0\ +'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\ +\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\ +\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x03\0\x16wasi:sockets/tcp@0.2.4\ +\x05$\x02\x03\0\x15\x0atcp-socket\x01B\x0c\x02\x03\x02\x01\x1b\x04\0\x07network\x03\ +\0\0\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01\x1f\x04\0\ +\x11ip-address-family\x03\0\x04\x02\x03\x02\x01%\x04\0\x0atcp-socket\x03\0\x06\x01\ +i\x07\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-\ +tcp-socket\x01\x0a\x03\0$wasi:sockets/tcp-create-socket@0.2.4\x05&\x02\x03\0\x11\ +\x0aip-address\x01B\x16\x02\x03\x02\x01\x05\x04\0\x08pollable\x03\0\0\x02\x03\x02\ +\x01\x1b\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x1d\x04\0\x0aerror-code\x03\0\ +\x04\x02\x03\x02\x01'\x04\0\x0aip-address\x03\0\x06\x04\0\x16resolve-address-str\ +eam\x03\x01\x01h\x08\x01k\x07\x01j\x01\x0a\x01\x05\x01@\x01\x04self\x09\0\x0b\x04\ +\03[method]resolve-address-stream.resolve-next-address\x01\x0c\x01i\x01\x01@\x01\ +\x04self\x09\0\x0d\x04\0([method]resolve-address-stream.subscribe\x01\x0e\x01h\x03\ +\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07network\x0f\x04names\0\x11\x04\0\x11r\ +esolve-addresses\x01\x12\x03\0!wasi:sockets/ip-name-lookup@0.2.4\x05(\x01B\x05\x01\ +p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget\ +-random-u64\x01\x02\x03\0\x18wasi:random/random@0.2.4\x05)\x01B\x05\x01p}\x01@\x01\ +\x03lenw\0\0\x04\0\x19get-insecure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-i\ +nsecure-random-u64\x01\x02\x03\0\x1awasi:random/insecure@0.2.4\x05*\x01B\x03\x01\ +o\x02ww\x01@\0\0\0\x04\0\x0dinsecure-seed\x01\x01\x03\0\x1fwasi:random/insecure-\ +seed@0.2.4\x05+\x04\06wasi:cli/command-with-all-of-its-exports-removed@0.2.4\x04\ +\0\x0b-\x01\0'command-with-all-of-its-exports-removed\x03\0\0\0G\x09producers\x01\ +\x0cprocessed-by\x02\x0dwit-component\x070.225.0\x10wit-bindgen-rust\x060.39.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/third_party/rust/wasi/src/ext/mod.rs b/third_party/rust/wasi/src/ext/mod.rs new file mode 100644 index 000000000000..b581f22d1ad4 --- /dev/null +++ b/third_party/rust/wasi/src/ext/mod.rs @@ -0,0 +1,8 @@ +#[cfg(feature = "std")] +mod std; + +impl core::fmt::Display for crate::io::error::Error { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + f.write_str(&self.to_debug_string()) + } +} diff --git a/third_party/rust/wasi/src/ext/std.rs b/third_party/rust/wasi/src/ext/std.rs new file mode 100644 index 000000000000..bd0178d03f40 --- /dev/null +++ b/third_party/rust/wasi/src/ext/std.rs @@ -0,0 +1,69 @@ +use std::error::Error; +use std::io; +use std::num::NonZeroU64; + +use crate::io::streams::StreamError; + +impl Error for crate::io::error::Error {} + +impl io::Read for crate::io::streams::InputStream { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + let n = buf + .len() + .try_into() + .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; + match self.blocking_read(n) { + Ok(chunk) => { + let n = chunk.len(); + if n > buf.len() { + return Err(io::Error::new( + io::ErrorKind::Other, + "more bytes read than requested", + )); + } + buf[..n].copy_from_slice(&chunk); + Ok(n) + } + Err(StreamError::Closed) => Ok(0), + Err(StreamError::LastOperationFailed(e)) => { + Err(io::Error::new(io::ErrorKind::Other, e.to_debug_string())) + } + } + } +} + +impl io::Write for crate::io::streams::OutputStream { + fn write(&mut self, buf: &[u8]) -> io::Result { + let n = loop { + match self.check_write().map(NonZeroU64::new) { + Ok(Some(n)) => { + break n; + } + Ok(None) => { + self.subscribe().block(); + } + Err(StreamError::Closed) => return Ok(0), + Err(StreamError::LastOperationFailed(e)) => { + return Err(io::Error::new(io::ErrorKind::Other, e.to_debug_string())) + } + }; + }; + let n = n + .get() + .try_into() + .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?; + let n = buf.len().min(n); + crate::io::streams::OutputStream::write(self, &buf[..n]).map_err(|e| match e { + StreamError::Closed => io::ErrorKind::UnexpectedEof.into(), + StreamError::LastOperationFailed(e) => { + io::Error::new(io::ErrorKind::Other, e.to_debug_string()) + } + })?; + Ok(n) + } + + fn flush(&mut self) -> io::Result<()> { + self.blocking_flush() + .map_err(|e| io::Error::new(io::ErrorKind::Other, e)) + } +} diff --git a/third_party/rust/wasi/src/lib.rs b/third_party/rust/wasi/src/lib.rs index 63df4ba1b5d5..1da4179b614d 100644 --- a/third_party/rust/wasi/src/lib.rs +++ b/third_party/rust/wasi/src/lib.rs @@ -127,14 +127,13 @@ //! //! This crate is intended to be easiest to use with a future //! `wasm32-wasip2` target added to the Rust compiler. In the meantime -//! it's recommended to use the `wasm32-wasi` target (soon to be renamed to -//! `wasm32-wasip1`) instead: +//! it's recommended to use the `wasm32-wasip1` target instead: //! //! ```sh -//! $ cargo build --target wasm32-wasi +//! $ cargo build --target wasm32-wasip1 //! ``` //! -//! Note that the output of the `wasm32-wasi` target is a core wasm module, not +//! Note that the output of the `wasm32-wasip1` target is a core wasm module, not //! a component, so to turn it into a component you can use the [`wasm-tools`] //! CLI in combination with an "adapter module" for the `wasi_snapshot_preview1` //! APIs that the Rust standard library uses (example adapters can be found on @@ -142,7 +141,7 @@ //! [`wasi_snapshot_preview1.command.wasm`] for example) //! //! ```sh -//! $ wasm-tools component new ./target/wasm32-wasi/debug/my-app.wasm \ +//! $ wasm-tools component new ./target/wasm32-wasip1/debug/my-app.wasm \ //! --adapt ./wasi_snapshot_preview1.command.wasm \ //! -o my-component.wasm //! ``` @@ -179,6 +178,8 @@ #[cfg(feature = "std")] extern crate std; +pub mod ext; + // These modules are all auto-generated by `./ci/regenerate.sh` mod bindings; #[allow(unused_imports)] @@ -219,16 +220,17 @@ pub mod cli { /// wasi::cli::command::export!(MyCliRunner); /// ``` /// - /// ## Compatibility with `wasm32-wasi` targets + /// ## Compatibility with `wasm32-wasip1` targets /// - /// This macro is not compatible with `wasm32-wasi` `bin` targets which - /// instead use a `fn main()` with the + /// This macro is not compatible with `wasm32-wasip1` `bin` targets + /// which instead use a `fn main()` with the /// `wasi_snapshot_preview1.command.wasm` adapter. This macro _can_ be /// used with the `reactor` or `proxy` adapters. /// /// #[doc(inline)] pub use crate::command::_export_command as export; } @@ -264,6 +266,7 @@ pub mod http { /// #[doc(inline)] pub use crate::proxy::_export_proxy as export; } diff --git a/third_party/rust/wasi/src/proxy.rs b/third_party/rust/wasi/src/proxy.rs index b1589231d2ed..ed41635d7157 100644 --- a/third_party/rust/wasi/src/proxy.rs +++ b/third_party/rust/wasi/src/proxy.rs @@ -1,53 +1,57 @@ -// Generated by `wit-bindgen` 0.21.0. DO NOT EDIT! +// Generated by `wit-bindgen` 0.39.0. DO NOT EDIT! // Options used: // * std_feature -// * with "wasi:cli/stdin@0.2.0" = "crate::cli::stdin" -// * with "wasi:cli/stdout@0.2.0" = "crate::cli::stdout" -// * with "wasi:cli/stderr@0.2.0" = "crate::cli::stderr" -// * with "wasi:clocks/monotonic-clock@0.2.0" = "crate::clocks::monotonic_clock" -// * with "wasi:clocks/wall-clock@0.2.0" = "crate::clocks::wall_clock" -// * with "wasi:io/error@0.2.0" = "crate::io::error" -// * with "wasi:io/poll@0.2.0" = "crate::io::poll" -// * with "wasi:io/streams@0.2.0" = "crate::io::streams" -// * with "wasi:random/random@0.2.0" = "crate::random::random" -// * with "wasi:http/types@0.2.0" = "crate::http::types" -// * with "wasi:http/outgoing-handler@0.2.0" = "crate::http::outgoing_handler" +// * runtime_path: "wit_bindgen_rt" +// * with "wasi:cli/stdin@0.2.4" = "crate::cli::stdin" +// * with "wasi:cli/stdout@0.2.4" = "crate::cli::stdout" +// * with "wasi:cli/stderr@0.2.4" = "crate::cli::stderr" +// * with "wasi:clocks/monotonic-clock@0.2.4" = "crate::clocks::monotonic_clock" +// * with "wasi:clocks/wall-clock@0.2.4" = "crate::clocks::wall_clock" +// * with "wasi:io/error@0.2.4" = "crate::io::error" +// * with "wasi:io/poll@0.2.4" = "crate::io::poll" +// * with "wasi:io/streams@0.2.4" = "crate::io::streams" +// * with "wasi:random/random@0.2.4" = "crate::random::random" +// * with "wasi:http/types@0.2.4" = "crate::http::types" +// * with "wasi:http/outgoing-handler@0.2.4" = "crate::http::outgoing_handler" +// * type_section_suffix: "rust-wasi-from-crates-io-proxy-world" // * default-bindings-module: "wasi" // * export-macro-name: _export_proxy // * pub-export-macro -use crate::cli::stderr as __with_name5; -use crate::cli::stdin as __with_name6; -use crate::cli::stdout as __with_name4; -use crate::clocks::monotonic_clock as __with_name7; -use crate::clocks::wall_clock as __with_name10; -use crate::http::outgoing_handler as __with_name9; -use crate::http::types as __with_name8; -use crate::io::error as __with_name1; -use crate::io::poll as __with_name2; -use crate::io::streams as __with_name3; -use crate::random::random as __with_name0; +use crate::io::poll as __with_name0; +use crate::clocks::monotonic_clock as __with_name1; +use crate::clocks::wall_clock as __with_name2; +use crate::random::random as __with_name3; +use crate::io::error as __with_name4; +use crate::io::streams as __with_name5; +use crate::cli::stdout as __with_name6; +use crate::cli::stderr as __with_name7; +use crate::cli::stdin as __with_name8; +use crate::http::types as __with_name9; +use crate::http::outgoing_handler as __with_name10; +#[rustfmt::skip] +#[allow(dead_code, clippy::all)] pub mod exports { pub mod wasi { pub mod http { - #[allow(clippy::all)] + /// This interface defines a handler of incoming HTTP Requests. It should + /// be exported by components which can respond to HTTP Requests. + #[allow(dead_code, unused_imports, clippy::all)] pub mod incoming_handler { #[used] #[doc(hidden)] - #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = - super::super::super::super::__link_custom_section_describing_imports; - pub type IncomingRequest = - super::super::super::super::__with_name8::IncomingRequest; - pub type ResponseOutparam = - super::super::super::super::__with_name8::ResponseOutparam; + static __FORCE_SECTION_REF: fn() = super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type IncomingRequest = super::super::super::super::__with_name9::IncomingRequest; + pub type ResponseOutparam = super::super::super::super::__with_name9::ResponseOutparam; #[doc(hidden)] #[allow(non_snake_case)] pub unsafe fn _export_handle_cabi(arg0: i32, arg1: i32) { + #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); T::handle( - super::super::super::super::__with_name8::IncomingRequest::from_handle( + super::super::super::super::__with_name9::IncomingRequest::from_handle( arg0 as u32, ), - super::super::super::super::__with_name8::ResponseOutparam::from_handle( + super::super::super::super::__with_name9::ResponseOutparam::from_handle( arg1 as u32, ), ); @@ -63,28 +67,37 @@ pub mod exports { /// The implementor of this function must write a response to the /// `response-outparam` before returning, or else the caller will respond /// with an error on its behalf. - fn handle(request: IncomingRequest, response_out: ResponseOutparam); + fn handle( + request: IncomingRequest, + response_out: ResponseOutparam, + ) -> (); } #[doc(hidden)] #[macro_export] - macro_rules! __export_wasi_http_incoming_handler_0_2_0_cabi{ - ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { - - #[export_name = "wasi:http/incoming-handler@0.2.0#handle"] - unsafe extern "C" fn export_handle(arg0: i32,arg1: i32,) { - $($path_to_types)*::_export_handle_cabi::<$ty>(arg0, arg1) - } - };); - } + macro_rules! __export_wasi_http_incoming_handler_0_2_4_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _ : () = { #[unsafe (export_name = + "wasi:http/incoming-handler@0.2.4#handle")] unsafe extern "C" fn + export_handle(arg0 : i32, arg1 : i32,) { $($path_to_types)*:: + _export_handle_cabi::<$ty > (arg0, arg1) } }; + }; + } #[doc(hidden)] - pub use __export_wasi_http_incoming_handler_0_2_0_cabi; + pub use __export_wasi_http_incoming_handler_0_2_4_cabi; } } } } - -/// Generates `#[no_mangle]` functions to export the specified type as the -/// root implementation of all generated traits. +#[rustfmt::skip] +mod _rt { + #![allow(dead_code, clippy::all)] + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen_rt::run_ctors_once(); + } +} +/// Generates `#[unsafe(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!`. /// @@ -103,59 +116,64 @@ pub mod exports { #[doc(hidden)] #[macro_export] macro_rules! __export_proxy_impl { - ($ty:ident) => (wasi::_export_proxy!($ty with_types_in wasi);); - ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( - $($path_to_types_root)*::exports::wasi::http::incoming_handler::__export_wasi_http_incoming_handler_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::http::incoming_handler); - const _: () = { - - #[cfg(target_arch = "wasm32")] - #[link_section = "component-type:wit-bindgen:0.21.0:proxy:imports and exportsrust-wasi-from-crates-io-proxy-world"] - #[doc(hidden)] - pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 7024] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xf45\x01A\x02\x01A#\x01\ -B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\ -\0\x0eget-random-u64\x01\x02\x03\x01\x18wasi:random/random@0.2.0\x05\0\x01B\x04\x04\ -\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to-deb\ -ug-string\x01\x02\x03\x01\x13wasi:io/error@0.2.0\x05\x01\x01B\x0a\x04\0\x08polla\ -ble\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable.ready\x01\ -\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\x01p\x01\ -\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\x12wasi:io/poll@0.\ -2.0\x05\x02\x02\x03\0\x01\x05error\x02\x03\0\x02\x08pollable\x01B(\x02\x03\x02\x01\ -\x03\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x04\x04\0\x08pollable\x03\0\x02\x01i\ -\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-e\ -rror\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\ -\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[met\ -hod]input-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01\ -j\x01w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.\ -skip\x01\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\ -\x04self\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\ -\x01\x04self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\ -\x06\x01@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.w\ -rite\x01\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\ -\x04self\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]ou\ -tput-stream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]o\ -utput-stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method\ -]output-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-z\ -eroes-and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[\ -method]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\ -\x18\x03\x01\x15wasi:io/streams@0.2.0\x05\x05\x02\x03\0\x03\x0doutput-stream\x01\ -B\x05\x02\x03\x02\x01\x06\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\ -\0\x0aget-stdout\x01\x03\x03\x01\x15wasi:cli/stdout@0.2.0\x05\x07\x01B\x05\x02\x03\ -\x02\x01\x06\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-s\ -tderr\x01\x03\x03\x01\x15wasi:cli/stderr@0.2.0\x05\x08\x02\x03\0\x03\x0cinput-st\ -ream\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\ -\x02\x04\0\x09get-stdin\x01\x03\x03\x01\x14wasi:cli/stdin@0.2.0\x05\x0a\x01B\x0f\ -\x02\x03\x02\x01\x04\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01\ -w\x04\0\x08duration\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\ -\0\x0aresolution\x01\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-\ -instant\x01\x09\x01@\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\ -\x01!wasi:clocks/monotonic-clock@0.2.0\x05\x0b\x02\x03\0\x07\x08duration\x01B\xc0\ -\x01\x02\x03\x02\x01\x0c\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x09\x04\0\x0c\ -input-stream\x03\0\x02\x02\x03\x02\x01\x06\x04\0\x0doutput-stream\x03\0\x04\x02\x03\ -\x02\x01\x03\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x04\x04\0\x08pollable\x03\ -\0\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07c\ -onnect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06met\ -hod\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\ + ($ty:ident) => { + wasi::_export_proxy!($ty with_types_in wasi); + }; + ($ty:ident with_types_in $($path_to_types_root:tt)*) => { + $($path_to_types_root)*:: + exports::wasi::http::incoming_handler::__export_wasi_http_incoming_handler_0_2_4_cabi!($ty + with_types_in $($path_to_types_root)*:: exports::wasi::http::incoming_handler); + const _ : () = { #[cfg(target_arch = "wasm32")] #[unsafe (link_section = + "component-type:wit-bindgen:0.39.0:wasi:http@0.2.4:proxy:imports and exportsrust-wasi-from-crates-io-proxy-world")] + #[doc(hidden)] #[allow(clippy::octal_escapes)] pub static + __WIT_BINDGEN_COMPONENT_TYPE : [u8; 7040] = * + b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\x846\x01A\x02\x01A#\x01\ +B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[meth\ +od]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.b\ +lock\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\ +\x12wasi:io/poll@0.2.4\x05\0\x02\x03\0\0\x08pollable\x01B\x0f\x02\x03\x02\x01\x01\ +\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duratio\ +n\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\ +\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\ +\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/mon\ +otonic-clock@0.2.4\x05\x02\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08\ +datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\ +\0\x1cwasi:clocks/wall-clock@0.2.4\x05\x03\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\ +\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\0\x18\ +wasi:random/random@0.2.4\x05\x04\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\ +\x04self\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/\ +error@0.2.4\x05\x05\x02\x03\0\x04\x05error\x01B(\x02\x03\x02\x01\x06\x04\0\x05er\ +ror\x03\0\0\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15\ +last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\ +\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\ +\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.re\ +ad\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01\ +@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\ +\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\ +\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\ +\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04\ +self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0\ +.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\ +\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocki\ +ng-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subsc\ +ribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.wri\ +te-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\ +\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-strea\ +m.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wa\ +si:io/streams@0.2.4\x05\x07\x02\x03\0\x05\x0doutput-stream\x01B\x05\x02\x03\x02\x01\ +\x08\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\ +\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\x09\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0d\ +output-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\x03\0\x15\ +wasi:cli/stderr@0.2.4\x05\x0a\x02\x03\0\x05\x0cinput-stream\x01B\x05\x02\x03\x02\ +\x01\x0b\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09get-stdin\x01\ +\x03\x03\0\x14wasi:cli/stdin@0.2.4\x05\x0c\x02\x03\0\x01\x08duration\x01B\xc1\x01\ +\x02\x03\x02\x01\x0d\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x0b\x04\0\x0cinpu\ +t-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\ +\x01\x06\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\ +\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07con\ +nect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06metho\ +d\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\ \0\x0c\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-pay\ load\x03\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-\ alert-received-payload\x03\0\x13\x01ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\ @@ -177,137 +195,138 @@ TP-response-header-section-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0 P-upgrade-failed\0\0\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configur\ ation-error\0\0\x0einternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\ \x0einvalid-syntax\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\ -\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x01p}\x04\0\x0bfield-value\x03\0\x20\x04\ -\0\x06fields\x03\x01\x04\0\x07headers\x03\0\"\x04\0\x08trailers\x03\0\"\x04\0\x10\ -incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\x04\0\x0frequest-opti\ -ons\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0bstatus-code\x03\0)\x04\ -\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\x01\x04\0\x0ffuture-t\ -railers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0doutgoing-body\x03\x01\ -\x04\0\x18future-incoming-response\x03\x01\x01i\"\x01@\0\01\x04\0\x13[constructo\ -r]fields\x012\x01o\x02\x1f!\x01p3\x01j\x011\x01\x1d\x01@\x01\x07entries4\05\x04\0\ -\x18[static]fields.from-list\x016\x01h\"\x01p!\x01@\x02\x04self7\x04name\x1f\08\x04\ -\0\x12[method]fields.get\x019\x01@\x02\x04self7\x04name\x1f\0\x7f\x04\0\x12[meth\ -od]fields.has\x01:\x01j\0\x01\x1d\x01@\x03\x04self7\x04name\x1f\x05value8\0;\x04\ -\0\x12[method]fields.set\x01<\x01@\x02\x04self7\x04name\x1f\0;\x04\0\x15[method]\ -fields.delete\x01=\x01@\x03\x04self7\x04name\x1f\x05value!\0;\x04\0\x15[method]f\ -ields.append\x01>\x01@\x01\x04self7\04\x04\0\x16[method]fields.entries\x01?\x01@\ -\x01\x04self7\01\x04\0\x14[method]fields.clone\x01@\x01h%\x01@\x01\x04self\xc1\0\ -\0\x0b\x04\0\x1f[method]incoming-request.method\x01B\x01@\x01\x04self\xc1\0\0\x0e\ -\x04\0([method]incoming-request.path-with-query\x01C\x01k\x0d\x01@\x01\x04self\xc1\ -\0\0\xc4\0\x04\0\x1f[method]incoming-request.scheme\x01E\x04\0\"[method]incoming\ --request.authority\x01C\x01i#\x01@\x01\x04self\xc1\0\0\xc6\0\x04\0\x20[method]in\ -coming-request.headers\x01G\x01i,\x01j\x01\xc8\0\0\x01@\x01\x04self\xc1\0\0\xc9\0\ -\x04\0\x20[method]incoming-request.consume\x01J\x01i&\x01@\x01\x07headers\xc6\0\0\ -\xcb\0\x04\0\x1d[constructor]outgoing-request\x01L\x01h&\x01i/\x01j\x01\xce\0\0\x01\ -@\x01\x04self\xcd\0\0\xcf\0\x04\0\x1d[method]outgoing-request.body\x01P\x01@\x01\ -\x04self\xcd\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01Q\x01j\0\0\x01@\ -\x02\x04self\xcd\0\x06method\x0b\0\xd2\0\x04\0#[method]outgoing-request.set-meth\ -od\x01S\x01@\x01\x04self\xcd\0\0\x0e\x04\0([method]outgoing-request.path-with-qu\ -ery\x01T\x01@\x02\x04self\xcd\0\x0fpath-with-query\x0e\0\xd2\0\x04\0,[method]out\ -going-request.set-path-with-query\x01U\x01@\x01\x04self\xcd\0\0\xc4\0\x04\0\x1f[\ -method]outgoing-request.scheme\x01V\x01@\x02\x04self\xcd\0\x06scheme\xc4\0\0\xd2\ -\0\x04\0#[method]outgoing-request.set-scheme\x01W\x04\0\"[method]outgoing-reques\ -t.authority\x01T\x01@\x02\x04self\xcd\0\x09authority\x0e\0\xd2\0\x04\0&[method]o\ -utgoing-request.set-authority\x01X\x01@\x01\x04self\xcd\0\0\xc6\0\x04\0\x20[meth\ -od]outgoing-request.headers\x01Y\x01i'\x01@\0\0\xda\0\x04\0\x1c[constructor]requ\ -est-options\x01[\x01h'\x01k\x01\x01@\x01\x04self\xdc\0\0\xdd\0\x04\0'[method]req\ -uest-options.connect-timeout\x01^\x01@\x02\x04self\xdc\0\x08duration\xdd\0\0\xd2\ -\0\x04\0+[method]request-options.set-connect-timeout\x01_\x04\0*[method]request-\ -options.first-byte-timeout\x01^\x04\0.[method]request-options.set-first-byte-tim\ -eout\x01_\x04\0-[method]request-options.between-bytes-timeout\x01^\x04\01[method\ -]request-options.set-between-bytes-timeout\x01_\x01i(\x01i.\x01j\x01\xe1\0\x01\x1b\ -\x01@\x02\x05param\xe0\0\x08response\xe2\0\x01\0\x04\0\x1d[static]response-outpa\ -ram.set\x01c\x01h+\x01@\x01\x04self\xe4\0\0*\x04\0\x20[method]incoming-response.\ -status\x01e\x01@\x01\x04self\xe4\0\0\xc6\0\x04\0![method]incoming-response.heade\ -rs\x01f\x01@\x01\x04self\xe4\0\0\xc9\0\x04\0![method]incoming-response.consume\x01\ -g\x01h,\x01i\x03\x01j\x01\xe9\0\0\x01@\x01\x04self\xe8\0\0\xea\0\x04\0\x1c[metho\ -d]incoming-body.stream\x01k\x01i-\x01@\x01\x04this\xc8\0\0\xec\0\x04\0\x1c[stati\ -c]incoming-body.finish\x01m\x01h-\x01i\x09\x01@\x01\x04self\xee\0\0\xef\0\x04\0!\ -[method]future-trailers.subscribe\x01p\x01i$\x01k\xf1\0\x01j\x01\xf2\0\x01\x1b\x01\ -j\x01\xf3\0\0\x01k\xf4\0\x01@\x01\x04self\xee\0\0\xf5\0\x04\0\x1b[method]future-\ -trailers.get\x01v\x01@\x01\x07headers\xc6\0\0\xe1\0\x04\0\x1e[constructor]outgoi\ -ng-response\x01w\x01h.\x01@\x01\x04self\xf8\0\0*\x04\0%[method]outgoing-response\ -.status-code\x01y\x01@\x02\x04self\xf8\0\x0bstatus-code*\0\xd2\0\x04\0)[method]o\ -utgoing-response.set-status-code\x01z\x01@\x01\x04self\xf8\0\0\xc6\0\x04\0![meth\ -od]outgoing-response.headers\x01{\x01@\x01\x04self\xf8\0\0\xcf\0\x04\0\x1e[metho\ -d]outgoing-response.body\x01|\x01h/\x01i\x05\x01j\x01\xfe\0\0\x01@\x01\x04self\xfd\ -\0\0\xff\0\x04\0\x1b[method]outgoing-body.write\x01\x80\x01\x01j\0\x01\x1b\x01@\x02\ -\x04this\xce\0\x08trailers\xf2\0\0\x81\x01\x04\0\x1c[static]outgoing-body.finish\ -\x01\x82\x01\x01h0\x01@\x01\x04self\x83\x01\0\xef\0\x04\0*[method]future-incomin\ -g-response.subscribe\x01\x84\x01\x01i+\x01j\x01\x85\x01\x01\x1b\x01j\x01\x86\x01\ -\0\x01k\x87\x01\x01@\x01\x04self\x83\x01\0\x88\x01\x04\0$[method]future-incoming\ --response.get\x01\x89\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8a\x01\0\x8b\x01\x04\ -\0\x0fhttp-error-code\x01\x8c\x01\x03\x01\x15wasi:http/types@0.2.0\x05\x0d\x02\x03\ -\0\x08\x10outgoing-request\x02\x03\0\x08\x0frequest-options\x02\x03\0\x08\x18fut\ -ure-incoming-response\x02\x03\0\x08\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x0e\x04\ -\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01\x0f\x04\0\x0frequest-options\x03\0\ -\x02\x02\x03\x02\x01\x10\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\ -\x01\x11\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\ -\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\ -\x03\x01\x20wasi:http/outgoing-handler@0.2.0\x05\x12\x01B\x05\x01r\x02\x07second\ -sw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\ -\0\x0aresolution\x01\x02\x03\x01\x1cwasi:clocks/wall-clock@0.2.0\x05\x13\x02\x03\ -\0\x08\x10incoming-request\x02\x03\0\x08\x11response-outparam\x01B\x08\x02\x03\x02\ -\x01\x14\x04\0\x10incoming-request\x03\0\0\x02\x03\x02\x01\x15\x04\0\x11response\ --outparam\x03\0\x02\x01i\x01\x01i\x03\x01@\x02\x07request\x04\x0cresponse-out\x05\ -\x01\0\x04\0\x06handle\x01\x06\x04\x01\x20wasi:http/incoming-handler@0.2.0\x05\x16\ -\x04\x01\x15wasi:http/proxy@0.2.0\x04\0\x0b\x0b\x01\0\x05proxy\x03\0\0\0G\x09pro\ -ducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bindgen-rust\x06\ -0.21.0"; - }; - ) +\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x04\0\x0afield-name\x03\0\x1f\x01p}\x04\ +\0\x0bfield-value\x03\0!\x04\0\x06fields\x03\x01\x04\0\x07headers\x03\0#\x04\0\x08\ +trailers\x03\0#\x04\0\x10incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\ +\x04\0\x0frequest-options\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0b\ +status-code\x03\0*\x04\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\ +\x01\x04\0\x0ffuture-trailers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0d\ +outgoing-body\x03\x01\x04\0\x18future-incoming-response\x03\x01\x01i#\x01@\0\02\x04\ +\0\x13[constructor]fields\x013\x01o\x02\x20\"\x01p4\x01j\x012\x01\x1d\x01@\x01\x07\ +entries5\06\x04\0\x18[static]fields.from-list\x017\x01h#\x01p\"\x01@\x02\x04self\ +8\x04name\x20\09\x04\0\x12[method]fields.get\x01:\x01@\x02\x04self8\x04name\x20\0\ +\x7f\x04\0\x12[method]fields.has\x01;\x01j\0\x01\x1d\x01@\x03\x04self8\x04name\x20\ +\x05value9\0<\x04\0\x12[method]fields.set\x01=\x01@\x02\x04self8\x04name\x20\0<\x04\ +\0\x15[method]fields.delete\x01>\x01@\x03\x04self8\x04name\x20\x05value\"\0<\x04\ +\0\x15[method]fields.append\x01?\x01@\x01\x04self8\05\x04\0\x16[method]fields.en\ +tries\x01@\x01@\x01\x04self8\02\x04\0\x14[method]fields.clone\x01A\x01h&\x01@\x01\ +\x04self\xc2\0\0\x0b\x04\0\x1f[method]incoming-request.method\x01C\x01@\x01\x04s\ +elf\xc2\0\0\x0e\x04\0([method]incoming-request.path-with-query\x01D\x01k\x0d\x01\ +@\x01\x04self\xc2\0\0\xc5\0\x04\0\x1f[method]incoming-request.scheme\x01F\x04\0\"\ +[method]incoming-request.authority\x01D\x01i$\x01@\x01\x04self\xc2\0\0\xc7\0\x04\ +\0\x20[method]incoming-request.headers\x01H\x01i-\x01j\x01\xc9\0\0\x01@\x01\x04s\ +elf\xc2\0\0\xca\0\x04\0\x20[method]incoming-request.consume\x01K\x01i'\x01@\x01\x07\ +headers\xc7\0\0\xcc\0\x04\0\x1d[constructor]outgoing-request\x01M\x01h'\x01i0\x01\ +j\x01\xcf\0\0\x01@\x01\x04self\xce\0\0\xd0\0\x04\0\x1d[method]outgoing-request.b\ +ody\x01Q\x01@\x01\x04self\xce\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01\ +R\x01j\0\0\x01@\x02\x04self\xce\0\x06method\x0b\0\xd3\0\x04\0#[method]outgoing-r\ +equest.set-method\x01T\x01@\x01\x04self\xce\0\0\x0e\x04\0([method]outgoing-reque\ +st.path-with-query\x01U\x01@\x02\x04self\xce\0\x0fpath-with-query\x0e\0\xd3\0\x04\ +\0,[method]outgoing-request.set-path-with-query\x01V\x01@\x01\x04self\xce\0\0\xc5\ +\0\x04\0\x1f[method]outgoing-request.scheme\x01W\x01@\x02\x04self\xce\0\x06schem\ +e\xc5\0\0\xd3\0\x04\0#[method]outgoing-request.set-scheme\x01X\x04\0\"[method]ou\ +tgoing-request.authority\x01U\x01@\x02\x04self\xce\0\x09authority\x0e\0\xd3\0\x04\ +\0&[method]outgoing-request.set-authority\x01Y\x01@\x01\x04self\xce\0\0\xc7\0\x04\ +\0\x20[method]outgoing-request.headers\x01Z\x01i(\x01@\0\0\xdb\0\x04\0\x1c[const\ +ructor]request-options\x01\\\x01h(\x01k\x01\x01@\x01\x04self\xdd\0\0\xde\0\x04\0\ +'[method]request-options.connect-timeout\x01_\x01@\x02\x04self\xdd\0\x08duration\ +\xde\0\0\xd3\0\x04\0+[method]request-options.set-connect-timeout\x01`\x04\0*[met\ +hod]request-options.first-byte-timeout\x01_\x04\0.[method]request-options.set-fi\ +rst-byte-timeout\x01`\x04\0-[method]request-options.between-bytes-timeout\x01_\x04\ +\01[method]request-options.set-between-bytes-timeout\x01`\x01i)\x01i/\x01j\x01\xe2\ +\0\x01\x1b\x01@\x02\x05param\xe1\0\x08response\xe3\0\x01\0\x04\0\x1d[static]resp\ +onse-outparam.set\x01d\x01h,\x01@\x01\x04self\xe5\0\0+\x04\0\x20[method]incoming\ +-response.status\x01f\x01@\x01\x04self\xe5\0\0\xc7\0\x04\0![method]incoming-resp\ +onse.headers\x01g\x01@\x01\x04self\xe5\0\0\xca\0\x04\0![method]incoming-response\ +.consume\x01h\x01h-\x01i\x03\x01j\x01\xea\0\0\x01@\x01\x04self\xe9\0\0\xeb\0\x04\ +\0\x1c[method]incoming-body.stream\x01l\x01i.\x01@\x01\x04this\xc9\0\0\xed\0\x04\ +\0\x1c[static]incoming-body.finish\x01n\x01h.\x01i\x09\x01@\x01\x04self\xef\0\0\xf0\ +\0\x04\0![method]future-trailers.subscribe\x01q\x01i%\x01k\xf2\0\x01j\x01\xf3\0\x01\ +\x1b\x01j\x01\xf4\0\0\x01k\xf5\0\x01@\x01\x04self\xef\0\0\xf6\0\x04\0\x1b[method\ +]future-trailers.get\x01w\x01@\x01\x07headers\xc7\0\0\xe2\0\x04\0\x1e[constructo\ +r]outgoing-response\x01x\x01h/\x01@\x01\x04self\xf9\0\0+\x04\0%[method]outgoing-\ +response.status-code\x01z\x01@\x02\x04self\xf9\0\x0bstatus-code+\0\xd3\0\x04\0)[\ +method]outgoing-response.set-status-code\x01{\x01@\x01\x04self\xf9\0\0\xc7\0\x04\ +\0![method]outgoing-response.headers\x01|\x01@\x01\x04self\xf9\0\0\xd0\0\x04\0\x1e\ +[method]outgoing-response.body\x01}\x01h0\x01i\x05\x01j\x01\xff\0\0\x01@\x01\x04\ +self\xfe\0\0\x80\x01\x04\0\x1b[method]outgoing-body.write\x01\x81\x01\x01j\0\x01\ +\x1b\x01@\x02\x04this\xcf\0\x08trailers\xf3\0\0\x82\x01\x04\0\x1c[static]outgoin\ +g-body.finish\x01\x83\x01\x01h1\x01@\x01\x04self\x84\x01\0\xf0\0\x04\0*[method]f\ +uture-incoming-response.subscribe\x01\x85\x01\x01i,\x01j\x01\x86\x01\x01\x1b\x01\ +j\x01\x87\x01\0\x01k\x88\x01\x01@\x01\x04self\x84\x01\0\x89\x01\x04\0$[method]fu\ +ture-incoming-response.get\x01\x8a\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8b\x01\ +\0\x8c\x01\x04\0\x0fhttp-error-code\x01\x8d\x01\x03\0\x15wasi:http/types@0.2.4\x05\ +\x0e\x02\x03\0\x09\x10outgoing-request\x02\x03\0\x09\x0frequest-options\x02\x03\0\ +\x09\x18future-incoming-response\x02\x03\0\x09\x0aerror-code\x01B\x0f\x02\x03\x02\ +\x01\x0f\x04\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01\x10\x04\0\x0frequest-\ +options\x03\0\x02\x02\x03\x02\x01\x11\x04\0\x18future-incoming-response\x03\0\x04\ +\x02\x03\x02\x01\x12\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01\ +i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06\ +handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.4\x05\x13\x02\x03\0\x09\x10\ +incoming-request\x02\x03\0\x09\x11response-outparam\x01B\x08\x02\x03\x02\x01\x14\ +\x04\0\x10incoming-request\x03\0\0\x02\x03\x02\x01\x15\x04\0\x11response-outpara\ +m\x03\0\x02\x01i\x01\x01i\x03\x01@\x02\x07request\x04\x0cresponse-out\x05\x01\0\x04\ +\0\x06handle\x01\x06\x04\0\x20wasi:http/incoming-handler@0.2.4\x05\x16\x04\0\x15\ +wasi:http/proxy@0.2.4\x04\0\x0b\x0b\x01\0\x05proxy\x03\0\0\0G\x09producers\x01\x0c\ +processed-by\x02\x0dwit-component\x070.225.0\x10wit-bindgen-rust\x060.39.0"; + }; + }; } #[doc(inline)] pub use __export_proxy_impl as _export_proxy; - #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:wit-bindgen:0.21.0:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world"] +#[unsafe( + link_section = "component-type:wit-bindgen:0.39.0:wasi:http@0.2.4:proxy-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-proxy-world" +)] #[doc(hidden)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 6905] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xdd4\x01A\x02\x01A\x1f\ -\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x10get-random-bytes\x01\x01\x01@\0\0w\ -\x04\0\x0eget-random-u64\x01\x02\x03\x01\x18wasi:random/random@0.2.0\x05\0\x01B\x04\ -\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\x04\0\x1d[method]error.to\ --debug-string\x01\x02\x03\x01\x13wasi:io/error@0.2.0\x05\x01\x01B\x0a\x04\0\x08p\ -ollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable.read\ -y\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\x01\ -p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\x12wasi:io/po\ -ll@0.2.0\x05\x02\x02\x03\0\x01\x05error\x02\x03\0\x02\x08pollable\x01B(\x02\x03\x02\ -\x01\x03\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x04\x04\0\x08pollable\x03\0\x02\x01\ -i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-\ -error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01\ -h\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[me\ -thod]input-stream.read\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\ -\x01j\x01w\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-str\ -eam.skip\x01\x0e\x04\0\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\ -\x01\x04self\x09\0\x0f\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01\ -@\x01\x04self\x11\0\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\ -\x06\x01@\x02\x04self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.w\ -rite\x01\x14\x04\0.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\ -\x04self\x11\0\x13\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]ou\ -tput-stream.blocking-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]o\ -utput-stream.subscribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method\ -]output-stream.write-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-z\ -eroes-and-flush\x01\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[\ -method]output-stream.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\ -\x18\x03\x01\x15wasi:io/streams@0.2.0\x05\x05\x02\x03\0\x03\x0doutput-stream\x01\ -B\x05\x02\x03\x02\x01\x06\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\ -\0\x0aget-stdout\x01\x03\x03\x01\x15wasi:cli/stdout@0.2.0\x05\x07\x01B\x05\x02\x03\ -\x02\x01\x06\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-s\ -tderr\x01\x03\x03\x01\x15wasi:cli/stderr@0.2.0\x05\x08\x02\x03\0\x03\x0cinput-st\ -ream\x01B\x05\x02\x03\x02\x01\x09\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\ -\x02\x04\0\x09get-stdin\x01\x03\x03\x01\x14wasi:cli/stdin@0.2.0\x05\x0a\x01B\x0f\ -\x02\x03\x02\x01\x04\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01\ -w\x04\0\x08duration\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\ -\0\x0aresolution\x01\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-\ -instant\x01\x09\x01@\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\ -\x01!wasi:clocks/monotonic-clock@0.2.0\x05\x0b\x02\x03\0\x07\x08duration\x01B\xc0\ -\x01\x02\x03\x02\x01\x0c\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x09\x04\0\x0c\ -input-stream\x03\0\x02\x02\x03\x02\x01\x06\x04\0\x0doutput-stream\x03\0\x04\x02\x03\ -\x02\x01\x03\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x04\x04\0\x08pollable\x03\ -\0\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07c\ -onnect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06met\ -hod\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\ +#[allow(clippy::octal_escapes)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 6921] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xed4\x01A\x02\x01A\x1f\ +\x01B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[\ +method]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollab\ +le.block\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\ +\0\x12wasi:io/poll@0.2.4\x05\0\x02\x03\0\0\x08pollable\x01B\x0f\x02\x03\x02\x01\x01\ +\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\x08duratio\ +n\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0aresolution\x01\ +\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\ +\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/mon\ +otonic-clock@0.2.4\x05\x02\x01B\x05\x01r\x02\x07secondsw\x0bnanosecondsy\x04\0\x08\ +datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0aresolution\x01\x02\x03\ +\0\x1cwasi:clocks/wall-clock@0.2.4\x05\x03\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\ +\0\x10get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\0\x18\ +wasi:random/random@0.2.4\x05\x04\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\ +\x04self\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/\ +error@0.2.4\x05\x05\x02\x03\0\x04\x05error\x01B(\x02\x03\x02\x01\x06\x04\0\x05er\ +ror\x03\0\0\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15\ +last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\ +\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\ +\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.re\ +ad\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01\ +@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\ +\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\ +\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\ +\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04\ +self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0\ +.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\ +\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocki\ +ng-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subsc\ +ribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.wri\ +te-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\ +\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-strea\ +m.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wa\ +si:io/streams@0.2.4\x05\x07\x02\x03\0\x05\x0doutput-stream\x01B\x05\x02\x03\x02\x01\ +\x08\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\ +\x03\x03\0\x15wasi:cli/stdout@0.2.4\x05\x09\x01B\x05\x02\x03\x02\x01\x08\x04\0\x0d\ +output-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\x03\0\x15\ +wasi:cli/stderr@0.2.4\x05\x0a\x02\x03\0\x05\x0cinput-stream\x01B\x05\x02\x03\x02\ +\x01\x0b\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09get-stdin\x01\ +\x03\x03\0\x14wasi:cli/stdin@0.2.4\x05\x0c\x02\x03\0\x01\x08duration\x01B\xc1\x01\ +\x02\x03\x02\x01\x0d\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x0b\x04\0\x0cinpu\ +t-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\ +\x01\x06\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\x01\x04\0\x08pollable\x03\0\ +\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07con\ +nect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06metho\ +d\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\ \0\x0c\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-pay\ load\x03\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-\ alert-received-payload\x03\0\x13\x01ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\ @@ -329,83 +348,79 @@ TP-response-header-section-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0 P-upgrade-failed\0\0\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configur\ ation-error\0\0\x0einternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\ \x0einvalid-syntax\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\ -\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x01p}\x04\0\x0bfield-value\x03\0\x20\x04\ -\0\x06fields\x03\x01\x04\0\x07headers\x03\0\"\x04\0\x08trailers\x03\0\"\x04\0\x10\ -incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\x04\0\x0frequest-opti\ -ons\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0bstatus-code\x03\0)\x04\ -\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\x01\x04\0\x0ffuture-t\ -railers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0doutgoing-body\x03\x01\ -\x04\0\x18future-incoming-response\x03\x01\x01i\"\x01@\0\01\x04\0\x13[constructo\ -r]fields\x012\x01o\x02\x1f!\x01p3\x01j\x011\x01\x1d\x01@\x01\x07entries4\05\x04\0\ -\x18[static]fields.from-list\x016\x01h\"\x01p!\x01@\x02\x04self7\x04name\x1f\08\x04\ -\0\x12[method]fields.get\x019\x01@\x02\x04self7\x04name\x1f\0\x7f\x04\0\x12[meth\ -od]fields.has\x01:\x01j\0\x01\x1d\x01@\x03\x04self7\x04name\x1f\x05value8\0;\x04\ -\0\x12[method]fields.set\x01<\x01@\x02\x04self7\x04name\x1f\0;\x04\0\x15[method]\ -fields.delete\x01=\x01@\x03\x04self7\x04name\x1f\x05value!\0;\x04\0\x15[method]f\ -ields.append\x01>\x01@\x01\x04self7\04\x04\0\x16[method]fields.entries\x01?\x01@\ -\x01\x04self7\01\x04\0\x14[method]fields.clone\x01@\x01h%\x01@\x01\x04self\xc1\0\ -\0\x0b\x04\0\x1f[method]incoming-request.method\x01B\x01@\x01\x04self\xc1\0\0\x0e\ -\x04\0([method]incoming-request.path-with-query\x01C\x01k\x0d\x01@\x01\x04self\xc1\ -\0\0\xc4\0\x04\0\x1f[method]incoming-request.scheme\x01E\x04\0\"[method]incoming\ --request.authority\x01C\x01i#\x01@\x01\x04self\xc1\0\0\xc6\0\x04\0\x20[method]in\ -coming-request.headers\x01G\x01i,\x01j\x01\xc8\0\0\x01@\x01\x04self\xc1\0\0\xc9\0\ -\x04\0\x20[method]incoming-request.consume\x01J\x01i&\x01@\x01\x07headers\xc6\0\0\ -\xcb\0\x04\0\x1d[constructor]outgoing-request\x01L\x01h&\x01i/\x01j\x01\xce\0\0\x01\ -@\x01\x04self\xcd\0\0\xcf\0\x04\0\x1d[method]outgoing-request.body\x01P\x01@\x01\ -\x04self\xcd\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01Q\x01j\0\0\x01@\ -\x02\x04self\xcd\0\x06method\x0b\0\xd2\0\x04\0#[method]outgoing-request.set-meth\ -od\x01S\x01@\x01\x04self\xcd\0\0\x0e\x04\0([method]outgoing-request.path-with-qu\ -ery\x01T\x01@\x02\x04self\xcd\0\x0fpath-with-query\x0e\0\xd2\0\x04\0,[method]out\ -going-request.set-path-with-query\x01U\x01@\x01\x04self\xcd\0\0\xc4\0\x04\0\x1f[\ -method]outgoing-request.scheme\x01V\x01@\x02\x04self\xcd\0\x06scheme\xc4\0\0\xd2\ -\0\x04\0#[method]outgoing-request.set-scheme\x01W\x04\0\"[method]outgoing-reques\ -t.authority\x01T\x01@\x02\x04self\xcd\0\x09authority\x0e\0\xd2\0\x04\0&[method]o\ -utgoing-request.set-authority\x01X\x01@\x01\x04self\xcd\0\0\xc6\0\x04\0\x20[meth\ -od]outgoing-request.headers\x01Y\x01i'\x01@\0\0\xda\0\x04\0\x1c[constructor]requ\ -est-options\x01[\x01h'\x01k\x01\x01@\x01\x04self\xdc\0\0\xdd\0\x04\0'[method]req\ -uest-options.connect-timeout\x01^\x01@\x02\x04self\xdc\0\x08duration\xdd\0\0\xd2\ -\0\x04\0+[method]request-options.set-connect-timeout\x01_\x04\0*[method]request-\ -options.first-byte-timeout\x01^\x04\0.[method]request-options.set-first-byte-tim\ -eout\x01_\x04\0-[method]request-options.between-bytes-timeout\x01^\x04\01[method\ -]request-options.set-between-bytes-timeout\x01_\x01i(\x01i.\x01j\x01\xe1\0\x01\x1b\ -\x01@\x02\x05param\xe0\0\x08response\xe2\0\x01\0\x04\0\x1d[static]response-outpa\ -ram.set\x01c\x01h+\x01@\x01\x04self\xe4\0\0*\x04\0\x20[method]incoming-response.\ -status\x01e\x01@\x01\x04self\xe4\0\0\xc6\0\x04\0![method]incoming-response.heade\ -rs\x01f\x01@\x01\x04self\xe4\0\0\xc9\0\x04\0![method]incoming-response.consume\x01\ -g\x01h,\x01i\x03\x01j\x01\xe9\0\0\x01@\x01\x04self\xe8\0\0\xea\0\x04\0\x1c[metho\ -d]incoming-body.stream\x01k\x01i-\x01@\x01\x04this\xc8\0\0\xec\0\x04\0\x1c[stati\ -c]incoming-body.finish\x01m\x01h-\x01i\x09\x01@\x01\x04self\xee\0\0\xef\0\x04\0!\ -[method]future-trailers.subscribe\x01p\x01i$\x01k\xf1\0\x01j\x01\xf2\0\x01\x1b\x01\ -j\x01\xf3\0\0\x01k\xf4\0\x01@\x01\x04self\xee\0\0\xf5\0\x04\0\x1b[method]future-\ -trailers.get\x01v\x01@\x01\x07headers\xc6\0\0\xe1\0\x04\0\x1e[constructor]outgoi\ -ng-response\x01w\x01h.\x01@\x01\x04self\xf8\0\0*\x04\0%[method]outgoing-response\ -.status-code\x01y\x01@\x02\x04self\xf8\0\x0bstatus-code*\0\xd2\0\x04\0)[method]o\ -utgoing-response.set-status-code\x01z\x01@\x01\x04self\xf8\0\0\xc6\0\x04\0![meth\ -od]outgoing-response.headers\x01{\x01@\x01\x04self\xf8\0\0\xcf\0\x04\0\x1e[metho\ -d]outgoing-response.body\x01|\x01h/\x01i\x05\x01j\x01\xfe\0\0\x01@\x01\x04self\xfd\ -\0\0\xff\0\x04\0\x1b[method]outgoing-body.write\x01\x80\x01\x01j\0\x01\x1b\x01@\x02\ -\x04this\xce\0\x08trailers\xf2\0\0\x81\x01\x04\0\x1c[static]outgoing-body.finish\ -\x01\x82\x01\x01h0\x01@\x01\x04self\x83\x01\0\xef\0\x04\0*[method]future-incomin\ -g-response.subscribe\x01\x84\x01\x01i+\x01j\x01\x85\x01\x01\x1b\x01j\x01\x86\x01\ -\0\x01k\x87\x01\x01@\x01\x04self\x83\x01\0\x88\x01\x04\0$[method]future-incoming\ --response.get\x01\x89\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8a\x01\0\x8b\x01\x04\ -\0\x0fhttp-error-code\x01\x8c\x01\x03\x01\x15wasi:http/types@0.2.0\x05\x0d\x02\x03\ -\0\x08\x10outgoing-request\x02\x03\0\x08\x0frequest-options\x02\x03\0\x08\x18fut\ -ure-incoming-response\x02\x03\0\x08\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x0e\x04\ -\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01\x0f\x04\0\x0frequest-options\x03\0\ -\x02\x02\x03\x02\x01\x10\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\ -\x01\x11\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\ -\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\ -\x03\x01\x20wasi:http/outgoing-handler@0.2.0\x05\x12\x01B\x05\x01r\x02\x07second\ -sw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\ -\0\x0aresolution\x01\x02\x03\x01\x1cwasi:clocks/wall-clock@0.2.0\x05\x13\x04\x01\ -5wasi:http/proxy-with-all-of-its-exports-removed@0.2.0\x04\0\x0b+\x01\0%proxy-wi\ -th-all-of-its-exports-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0d\ -wit-component\x070.201.0\x10wit-bindgen-rust\x060.21.0"; - +\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x04\0\x0afield-name\x03\0\x1f\x01p}\x04\ +\0\x0bfield-value\x03\0!\x04\0\x06fields\x03\x01\x04\0\x07headers\x03\0#\x04\0\x08\ +trailers\x03\0#\x04\0\x10incoming-request\x03\x01\x04\0\x10outgoing-request\x03\x01\ +\x04\0\x0frequest-options\x03\x01\x04\0\x11response-outparam\x03\x01\x01{\x04\0\x0b\ +status-code\x03\0*\x04\0\x11incoming-response\x03\x01\x04\0\x0dincoming-body\x03\ +\x01\x04\0\x0ffuture-trailers\x03\x01\x04\0\x11outgoing-response\x03\x01\x04\0\x0d\ +outgoing-body\x03\x01\x04\0\x18future-incoming-response\x03\x01\x01i#\x01@\0\02\x04\ +\0\x13[constructor]fields\x013\x01o\x02\x20\"\x01p4\x01j\x012\x01\x1d\x01@\x01\x07\ +entries5\06\x04\0\x18[static]fields.from-list\x017\x01h#\x01p\"\x01@\x02\x04self\ +8\x04name\x20\09\x04\0\x12[method]fields.get\x01:\x01@\x02\x04self8\x04name\x20\0\ +\x7f\x04\0\x12[method]fields.has\x01;\x01j\0\x01\x1d\x01@\x03\x04self8\x04name\x20\ +\x05value9\0<\x04\0\x12[method]fields.set\x01=\x01@\x02\x04self8\x04name\x20\0<\x04\ +\0\x15[method]fields.delete\x01>\x01@\x03\x04self8\x04name\x20\x05value\"\0<\x04\ +\0\x15[method]fields.append\x01?\x01@\x01\x04self8\05\x04\0\x16[method]fields.en\ +tries\x01@\x01@\x01\x04self8\02\x04\0\x14[method]fields.clone\x01A\x01h&\x01@\x01\ +\x04self\xc2\0\0\x0b\x04\0\x1f[method]incoming-request.method\x01C\x01@\x01\x04s\ +elf\xc2\0\0\x0e\x04\0([method]incoming-request.path-with-query\x01D\x01k\x0d\x01\ +@\x01\x04self\xc2\0\0\xc5\0\x04\0\x1f[method]incoming-request.scheme\x01F\x04\0\"\ +[method]incoming-request.authority\x01D\x01i$\x01@\x01\x04self\xc2\0\0\xc7\0\x04\ +\0\x20[method]incoming-request.headers\x01H\x01i-\x01j\x01\xc9\0\0\x01@\x01\x04s\ +elf\xc2\0\0\xca\0\x04\0\x20[method]incoming-request.consume\x01K\x01i'\x01@\x01\x07\ +headers\xc7\0\0\xcc\0\x04\0\x1d[constructor]outgoing-request\x01M\x01h'\x01i0\x01\ +j\x01\xcf\0\0\x01@\x01\x04self\xce\0\0\xd0\0\x04\0\x1d[method]outgoing-request.b\ +ody\x01Q\x01@\x01\x04self\xce\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01\ +R\x01j\0\0\x01@\x02\x04self\xce\0\x06method\x0b\0\xd3\0\x04\0#[method]outgoing-r\ +equest.set-method\x01T\x01@\x01\x04self\xce\0\0\x0e\x04\0([method]outgoing-reque\ +st.path-with-query\x01U\x01@\x02\x04self\xce\0\x0fpath-with-query\x0e\0\xd3\0\x04\ +\0,[method]outgoing-request.set-path-with-query\x01V\x01@\x01\x04self\xce\0\0\xc5\ +\0\x04\0\x1f[method]outgoing-request.scheme\x01W\x01@\x02\x04self\xce\0\x06schem\ +e\xc5\0\0\xd3\0\x04\0#[method]outgoing-request.set-scheme\x01X\x04\0\"[method]ou\ +tgoing-request.authority\x01U\x01@\x02\x04self\xce\0\x09authority\x0e\0\xd3\0\x04\ +\0&[method]outgoing-request.set-authority\x01Y\x01@\x01\x04self\xce\0\0\xc7\0\x04\ +\0\x20[method]outgoing-request.headers\x01Z\x01i(\x01@\0\0\xdb\0\x04\0\x1c[const\ +ructor]request-options\x01\\\x01h(\x01k\x01\x01@\x01\x04self\xdd\0\0\xde\0\x04\0\ +'[method]request-options.connect-timeout\x01_\x01@\x02\x04self\xdd\0\x08duration\ +\xde\0\0\xd3\0\x04\0+[method]request-options.set-connect-timeout\x01`\x04\0*[met\ +hod]request-options.first-byte-timeout\x01_\x04\0.[method]request-options.set-fi\ +rst-byte-timeout\x01`\x04\0-[method]request-options.between-bytes-timeout\x01_\x04\ +\01[method]request-options.set-between-bytes-timeout\x01`\x01i)\x01i/\x01j\x01\xe2\ +\0\x01\x1b\x01@\x02\x05param\xe1\0\x08response\xe3\0\x01\0\x04\0\x1d[static]resp\ +onse-outparam.set\x01d\x01h,\x01@\x01\x04self\xe5\0\0+\x04\0\x20[method]incoming\ +-response.status\x01f\x01@\x01\x04self\xe5\0\0\xc7\0\x04\0![method]incoming-resp\ +onse.headers\x01g\x01@\x01\x04self\xe5\0\0\xca\0\x04\0![method]incoming-response\ +.consume\x01h\x01h-\x01i\x03\x01j\x01\xea\0\0\x01@\x01\x04self\xe9\0\0\xeb\0\x04\ +\0\x1c[method]incoming-body.stream\x01l\x01i.\x01@\x01\x04this\xc9\0\0\xed\0\x04\ +\0\x1c[static]incoming-body.finish\x01n\x01h.\x01i\x09\x01@\x01\x04self\xef\0\0\xf0\ +\0\x04\0![method]future-trailers.subscribe\x01q\x01i%\x01k\xf2\0\x01j\x01\xf3\0\x01\ +\x1b\x01j\x01\xf4\0\0\x01k\xf5\0\x01@\x01\x04self\xef\0\0\xf6\0\x04\0\x1b[method\ +]future-trailers.get\x01w\x01@\x01\x07headers\xc7\0\0\xe2\0\x04\0\x1e[constructo\ +r]outgoing-response\x01x\x01h/\x01@\x01\x04self\xf9\0\0+\x04\0%[method]outgoing-\ +response.status-code\x01z\x01@\x02\x04self\xf9\0\x0bstatus-code+\0\xd3\0\x04\0)[\ +method]outgoing-response.set-status-code\x01{\x01@\x01\x04self\xf9\0\0\xc7\0\x04\ +\0![method]outgoing-response.headers\x01|\x01@\x01\x04self\xf9\0\0\xd0\0\x04\0\x1e\ +[method]outgoing-response.body\x01}\x01h0\x01i\x05\x01j\x01\xff\0\0\x01@\x01\x04\ +self\xfe\0\0\x80\x01\x04\0\x1b[method]outgoing-body.write\x01\x81\x01\x01j\0\x01\ +\x1b\x01@\x02\x04this\xcf\0\x08trailers\xf3\0\0\x82\x01\x04\0\x1c[static]outgoin\ +g-body.finish\x01\x83\x01\x01h1\x01@\x01\x04self\x84\x01\0\xf0\0\x04\0*[method]f\ +uture-incoming-response.subscribe\x01\x85\x01\x01i,\x01j\x01\x86\x01\x01\x1b\x01\ +j\x01\x87\x01\0\x01k\x88\x01\x01@\x01\x04self\x84\x01\0\x89\x01\x04\0$[method]fu\ +ture-incoming-response.get\x01\x8a\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8b\x01\ +\0\x8c\x01\x04\0\x0fhttp-error-code\x01\x8d\x01\x03\0\x15wasi:http/types@0.2.4\x05\ +\x0e\x02\x03\0\x09\x10outgoing-request\x02\x03\0\x09\x0frequest-options\x02\x03\0\ +\x09\x18future-incoming-response\x02\x03\0\x09\x0aerror-code\x01B\x0f\x02\x03\x02\ +\x01\x0f\x04\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01\x10\x04\0\x0frequest-\ +options\x03\0\x02\x02\x03\x02\x01\x11\x04\0\x18future-incoming-response\x03\0\x04\ +\x02\x03\x02\x01\x12\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01\ +i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06\ +handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.4\x05\x13\x04\05wasi:http\ +/proxy-with-all-of-its-exports-removed@0.2.4\x04\0\x0b+\x01\0%proxy-with-all-of-\ +its-exports-removed\x03\0\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-compo\ +nent\x070.225.0\x10wit-bindgen-rust\x060.39.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/third_party/rust/wasi/wit/deps/cli/command.wit b/third_party/rust/wasi/wit/deps/cli/command.wit index d8005bd38819..88ab2a97e3d1 100644 --- a/third_party/rust/wasi/wit/deps/cli/command.wit +++ b/third_party/rust/wasi/wit/deps/cli/command.wit @@ -1,7 +1,10 @@ -package wasi:cli@0.2.0; +package wasi:cli@0.2.4; +@since(version = 0.2.0) world command { + @since(version = 0.2.0) include imports; + @since(version = 0.2.0) export run; } diff --git a/third_party/rust/wasi/wit/deps/cli/environment.wit b/third_party/rust/wasi/wit/deps/cli/environment.wit index 70065233e81b..2f449bd7c1f2 100644 --- a/third_party/rust/wasi/wit/deps/cli/environment.wit +++ b/third_party/rust/wasi/wit/deps/cli/environment.wit @@ -1,3 +1,4 @@ +@since(version = 0.2.0) interface environment { /// Get the POSIX-style environment variables. /// @@ -7,12 +8,15 @@ interface environment { /// Morally, these are a value import, but until value imports are available /// in the component model, this import function should return the same /// values each time it is called. + @since(version = 0.2.0) get-environment: func() -> list>; /// Get the POSIX-style arguments to the program. + @since(version = 0.2.0) get-arguments: func() -> list; /// Return a path that programs should use as their initial current working /// directory, interpreting `.` as shorthand for this. + @since(version = 0.2.0) initial-cwd: func() -> option; } diff --git a/third_party/rust/wasi/wit/deps/cli/exit.wit b/third_party/rust/wasi/wit/deps/cli/exit.wit index d0c2b82ae2c7..427935c8d085 100644 --- a/third_party/rust/wasi/wit/deps/cli/exit.wit +++ b/third_party/rust/wasi/wit/deps/cli/exit.wit @@ -1,4 +1,17 @@ +@since(version = 0.2.0) interface exit { /// Exit the current instance and any linked instances. + @since(version = 0.2.0) exit: func(status: result); + + /// Exit the current instance and any linked instances, reporting the + /// specified status code to the host. + /// + /// The meaning of the code depends on the context, with 0 usually meaning + /// "success", and other values indicating various types of failure. + /// + /// This function does not return; the effect is analogous to a trap, but + /// without the connotation that something bad has happened. + @unstable(feature = cli-exit-with-code) + exit-with-code: func(status-code: u8); } diff --git a/third_party/rust/wasi/wit/deps/cli/imports.wit b/third_party/rust/wasi/wit/deps/cli/imports.wit index 083b84a036d7..ad5c6bb2395e 100644 --- a/third_party/rust/wasi/wit/deps/cli/imports.wit +++ b/third_party/rust/wasi/wit/deps/cli/imports.wit @@ -1,20 +1,36 @@ -package wasi:cli@0.2.0; +package wasi:cli@0.2.4; +@since(version = 0.2.0) world imports { - include wasi:clocks/imports@0.2.0; - include wasi:filesystem/imports@0.2.0; - include wasi:sockets/imports@0.2.0; - include wasi:random/imports@0.2.0; - include wasi:io/imports@0.2.0; + @since(version = 0.2.0) + include wasi:clocks/imports@0.2.4; + @since(version = 0.2.0) + include wasi:filesystem/imports@0.2.4; + @since(version = 0.2.0) + include wasi:sockets/imports@0.2.4; + @since(version = 0.2.0) + include wasi:random/imports@0.2.4; + @since(version = 0.2.0) + include wasi:io/imports@0.2.4; + @since(version = 0.2.0) import environment; + @since(version = 0.2.0) import exit; + @since(version = 0.2.0) import stdin; + @since(version = 0.2.0) import stdout; + @since(version = 0.2.0) import stderr; + @since(version = 0.2.0) import terminal-input; + @since(version = 0.2.0) import terminal-output; + @since(version = 0.2.0) import terminal-stdin; + @since(version = 0.2.0) import terminal-stdout; + @since(version = 0.2.0) import terminal-stderr; } diff --git a/third_party/rust/wasi/wit/deps/cli/run.wit b/third_party/rust/wasi/wit/deps/cli/run.wit index a70ee8c038f2..655346efb6dd 100644 --- a/third_party/rust/wasi/wit/deps/cli/run.wit +++ b/third_party/rust/wasi/wit/deps/cli/run.wit @@ -1,4 +1,6 @@ +@since(version = 0.2.0) interface run { /// Run the program. + @since(version = 0.2.0) run: func() -> result; } diff --git a/third_party/rust/wasi/wit/deps/cli/stdio.wit b/third_party/rust/wasi/wit/deps/cli/stdio.wit index 31ef35b5a760..60727a93071a 100644 --- a/third_party/rust/wasi/wit/deps/cli/stdio.wit +++ b/third_party/rust/wasi/wit/deps/cli/stdio.wit @@ -1,17 +1,26 @@ +@since(version = 0.2.0) interface stdin { - use wasi:io/streams@0.2.0.{input-stream}; + @since(version = 0.2.0) + use wasi:io/streams@0.2.4.{input-stream}; + @since(version = 0.2.0) get-stdin: func() -> input-stream; } +@since(version = 0.2.0) interface stdout { - use wasi:io/streams@0.2.0.{output-stream}; + @since(version = 0.2.0) + use wasi:io/streams@0.2.4.{output-stream}; + @since(version = 0.2.0) get-stdout: func() -> output-stream; } +@since(version = 0.2.0) interface stderr { - use wasi:io/streams@0.2.0.{output-stream}; + @since(version = 0.2.0) + use wasi:io/streams@0.2.4.{output-stream}; + @since(version = 0.2.0) get-stderr: func() -> output-stream; } diff --git a/third_party/rust/wasi/wit/deps/cli/terminal.wit b/third_party/rust/wasi/wit/deps/cli/terminal.wit index 38c724efc840..d305498c64de 100644 --- a/third_party/rust/wasi/wit/deps/cli/terminal.wit +++ b/third_party/rust/wasi/wit/deps/cli/terminal.wit @@ -3,8 +3,10 @@ /// In the future, this may include functions for disabling echoing, /// disabling input buffering so that keyboard events are sent through /// immediately, querying supported features, and so on. +@since(version = 0.2.0) interface terminal-input { /// The input side of a terminal. + @since(version = 0.2.0) resource terminal-input; } @@ -13,37 +15,48 @@ interface terminal-input { /// In the future, this may include functions for querying the terminal /// size, being notified of terminal size changes, querying supported /// features, and so on. +@since(version = 0.2.0) interface terminal-output { /// The output side of a terminal. + @since(version = 0.2.0) resource terminal-output; } /// An interface providing an optional `terminal-input` for stdin as a /// link-time authority. +@since(version = 0.2.0) interface terminal-stdin { + @since(version = 0.2.0) use terminal-input.{terminal-input}; /// If stdin is connected to a terminal, return a `terminal-input` handle /// allowing further interaction with it. + @since(version = 0.2.0) get-terminal-stdin: func() -> option; } /// An interface providing an optional `terminal-output` for stdout as a /// link-time authority. +@since(version = 0.2.0) interface terminal-stdout { + @since(version = 0.2.0) use terminal-output.{terminal-output}; /// If stdout is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. + @since(version = 0.2.0) get-terminal-stdout: func() -> option; } /// An interface providing an optional `terminal-output` for stderr as a /// link-time authority. +@since(version = 0.2.0) interface terminal-stderr { + @since(version = 0.2.0) use terminal-output.{terminal-output}; /// If stderr is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. + @since(version = 0.2.0) get-terminal-stderr: func() -> option; } diff --git a/third_party/rust/wasi/wit/deps/clocks/monotonic-clock.wit b/third_party/rust/wasi/wit/deps/clocks/monotonic-clock.wit index 4e4dc3a19967..175f8fe2d768 100644 --- a/third_party/rust/wasi/wit/deps/clocks/monotonic-clock.wit +++ b/third_party/rust/wasi/wit/deps/clocks/monotonic-clock.wit @@ -1,4 +1,4 @@ -package wasi:clocks@0.2.0; +package wasi:clocks@0.2.4; /// WASI Monotonic Clock is a clock API intended to let users measure elapsed /// time. /// @@ -7,38 +7,43 @@ package wasi:clocks@0.2.0; /// /// A monotonic clock is a clock which has an unspecified initial value, and /// successive reads of the clock will produce non-decreasing values. -/// -/// It is intended for measuring elapsed time. +@since(version = 0.2.0) interface monotonic-clock { - use wasi:io/poll@0.2.0.{pollable}; + @since(version = 0.2.0) + use wasi:io/poll@0.2.4.{pollable}; /// An instant in time, in nanoseconds. An instant is relative to an /// unspecified initial value, and can only be compared to instances from /// the same monotonic-clock. + @since(version = 0.2.0) type instant = u64; /// A duration of time, in nanoseconds. + @since(version = 0.2.0) type duration = u64; /// Read the current value of the clock. /// /// The clock is monotonic, therefore calling this function repeatedly will /// produce a sequence of non-decreasing values. + @since(version = 0.2.0) now: func() -> instant; /// Query the resolution of the clock. Returns the duration of time /// corresponding to a clock tick. + @since(version = 0.2.0) resolution: func() -> duration; /// Create a `pollable` which will resolve once the specified instant - /// occured. + /// has occurred. + @since(version = 0.2.0) subscribe-instant: func( when: instant, ) -> pollable; - /// Create a `pollable` which will resolve once the given duration has - /// elapsed, starting at the time at which this function was called. - /// occured. + /// Create a `pollable` that will resolve after the specified duration has + /// elapsed from the time this function is invoked. + @since(version = 0.2.0) subscribe-duration: func( when: duration, ) -> pollable; diff --git a/third_party/rust/wasi/wit/deps/clocks/timezone.wit b/third_party/rust/wasi/wit/deps/clocks/timezone.wit new file mode 100644 index 000000000000..658cb17e772e --- /dev/null +++ b/third_party/rust/wasi/wit/deps/clocks/timezone.wit @@ -0,0 +1,55 @@ +package wasi:clocks@0.2.4; + +@unstable(feature = clocks-timezone) +interface timezone { + @unstable(feature = clocks-timezone) + use wall-clock.{datetime}; + + /// Return information needed to display the given `datetime`. This includes + /// the UTC offset, the time zone name, and a flag indicating whether + /// daylight saving time is active. + /// + /// If the timezone cannot be determined for the given `datetime`, return a + /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight + /// saving time. + @unstable(feature = clocks-timezone) + display: func(when: datetime) -> timezone-display; + + /// The same as `display`, but only return the UTC offset. + @unstable(feature = clocks-timezone) + utc-offset: func(when: datetime) -> s32; + + /// Information useful for displaying the timezone of a specific `datetime`. + /// + /// This information may vary within a single `timezone` to reflect daylight + /// saving time adjustments. + @unstable(feature = clocks-timezone) + record timezone-display { + /// The number of seconds difference between UTC time and the local + /// time of the timezone. + /// + /// The returned value will always be less than 86400 which is the + /// number of seconds in a day (24*60*60). + /// + /// In implementations that do not expose an actual time zone, this + /// should return 0. + utc-offset: s32, + + /// The abbreviated name of the timezone to display to a user. The name + /// `UTC` indicates Coordinated Universal Time. Otherwise, this should + /// reference local standards for the name of the time zone. + /// + /// In implementations that do not expose an actual time zone, this + /// should be the string `UTC`. + /// + /// In time zones that do not have an applicable name, a formatted + /// representation of the UTC offset may be returned, such as `-04:00`. + name: string, + + /// Whether daylight saving time is active. + /// + /// In implementations that do not expose an actual time zone, this + /// should return false. + in-daylight-saving-time: bool, + } +} diff --git a/third_party/rust/wasi/wit/deps/clocks/wall-clock.wit b/third_party/rust/wasi/wit/deps/clocks/wall-clock.wit index 440ca0f3364f..f826cd1e04f4 100644 --- a/third_party/rust/wasi/wit/deps/clocks/wall-clock.wit +++ b/third_party/rust/wasi/wit/deps/clocks/wall-clock.wit @@ -1,4 +1,4 @@ -package wasi:clocks@0.2.0; +package wasi:clocks@0.2.4; /// WASI Wall Clock is a clock API intended to let users query the current /// time. The name "wall" makes an analogy to a "clock on the wall", which /// is not necessarily monotonic as it may be reset. @@ -13,8 +13,10 @@ package wasi:clocks@0.2.0; /// monotonic, making it unsuitable for measuring elapsed time. /// /// It is intended for reporting the current date and time for humans. +@since(version = 0.2.0) interface wall-clock { /// A time and date in seconds plus nanoseconds. + @since(version = 0.2.0) record datetime { seconds: u64, nanoseconds: u32, @@ -33,10 +35,12 @@ interface wall-clock { /// /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time + @since(version = 0.2.0) now: func() -> datetime; /// Query the resolution of the clock. /// /// The nanoseconds field of the output is always less than 1000000000. + @since(version = 0.2.0) resolution: func() -> datetime; } diff --git a/third_party/rust/wasi/wit/deps/clocks/world.wit b/third_party/rust/wasi/wit/deps/clocks/world.wit index c0224572a55b..9e2087447246 100644 --- a/third_party/rust/wasi/wit/deps/clocks/world.wit +++ b/third_party/rust/wasi/wit/deps/clocks/world.wit @@ -1,6 +1,11 @@ -package wasi:clocks@0.2.0; +package wasi:clocks@0.2.4; +@since(version = 0.2.0) world imports { + @since(version = 0.2.0) import monotonic-clock; + @since(version = 0.2.0) import wall-clock; + @unstable(feature = clocks-timezone) + import timezone; } diff --git a/third_party/rust/wasi/wit/deps/filesystem/preopens.wit b/third_party/rust/wasi/wit/deps/filesystem/preopens.wit index da801f6d604e..6e6003954ac3 100644 --- a/third_party/rust/wasi/wit/deps/filesystem/preopens.wit +++ b/third_party/rust/wasi/wit/deps/filesystem/preopens.wit @@ -1,8 +1,11 @@ -package wasi:filesystem@0.2.0; +package wasi:filesystem@0.2.4; +@since(version = 0.2.0) interface preopens { + @since(version = 0.2.0) use types.{descriptor}; - /// Return the set of preopened directories, and their path. + /// Return the set of preopened directories, and their paths. + @since(version = 0.2.0) get-directories: func() -> list>; } diff --git a/third_party/rust/wasi/wit/deps/filesystem/types.wit b/third_party/rust/wasi/wit/deps/filesystem/types.wit index 11108fcda230..962cadfefb27 100644 --- a/third_party/rust/wasi/wit/deps/filesystem/types.wit +++ b/third_party/rust/wasi/wit/deps/filesystem/types.wit @@ -1,4 +1,4 @@ -package wasi:filesystem@0.2.0; +package wasi:filesystem@0.2.4; /// WASI filesystem is a filesystem API primarily intended to let users run WASI /// programs that access their files on their existing filesystems, without /// significant overhead. @@ -23,16 +23,21 @@ package wasi:filesystem@0.2.0; /// [WASI filesystem path resolution]. /// /// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md +@since(version = 0.2.0) interface types { - use wasi:io/streams@0.2.0.{input-stream, output-stream, error}; - use wasi:clocks/wall-clock@0.2.0.{datetime}; + @since(version = 0.2.0) + use wasi:io/streams@0.2.4.{input-stream, output-stream, error}; + @since(version = 0.2.0) + use wasi:clocks/wall-clock@0.2.4.{datetime}; /// File size or length of a region within a file. + @since(version = 0.2.0) type filesize = u64; /// The type of a filesystem object referenced by a descriptor. /// /// Note: This was called `filetype` in earlier versions of WASI. + @since(version = 0.2.0) enum descriptor-type { /// The type of the descriptor or file is unknown or is different from /// any of the other types specified. @@ -56,6 +61,7 @@ interface types { /// Descriptor flags. /// /// Note: This was called `fdflags` in earlier versions of WASI. + @since(version = 0.2.0) flags descriptor-flags { /// Read mode: Data can be read. read, @@ -77,7 +83,7 @@ interface types { /// WASI. At this time, it should be interpreted as a request, and not a /// requirement. data-integrity-sync, - /// Requests that reads be performed at the same level of integrety + /// Requests that reads be performed at the same level of integrity /// requested for writes. This is similar to `O_RSYNC` in POSIX. /// /// The precise semantics of this operation have not yet been defined for @@ -99,6 +105,7 @@ interface types { /// File attributes. /// /// Note: This was called `filestat` in earlier versions of WASI. + @since(version = 0.2.0) record descriptor-stat { /// File type. %type: descriptor-type, @@ -125,6 +132,7 @@ interface types { } /// Flags determining the method of how paths are resolved. + @since(version = 0.2.0) flags path-flags { /// As long as the resolved path corresponds to a symbolic link, it is /// expanded. @@ -132,6 +140,7 @@ interface types { } /// Open flags used by `open-at`. + @since(version = 0.2.0) flags open-flags { /// Create file if it does not exist, similar to `O_CREAT` in POSIX. create, @@ -144,9 +153,11 @@ interface types { } /// Number of hard links to an inode. + @since(version = 0.2.0) type link-count = u64; /// When setting a timestamp, this gives the value to set it to. + @since(version = 0.2.0) variant new-timestamp { /// Leave the timestamp set to its previous value. no-change, @@ -248,6 +259,7 @@ interface types { } /// File or memory access pattern advisory information. + @since(version = 0.2.0) enum advice { /// The application has no advice to give on its behavior with respect /// to the specified data. @@ -271,6 +283,7 @@ interface types { /// A 128-bit hash value, split into parts because wasm doesn't have a /// 128-bit integer type. + @since(version = 0.2.0) record metadata-hash-value { /// 64 bits of a 128-bit hash value. lower: u64, @@ -281,6 +294,7 @@ interface types { /// A descriptor is a reference to a filesystem object, which may be a file, /// directory, named pipe, special file, or other object on which filesystem /// calls may be made. + @since(version = 0.2.0) resource descriptor { /// Return a stream for reading from a file, if available. /// @@ -290,6 +304,7 @@ interface types { /// file and they do not interfere with each other. /// /// Note: This allows using `read-stream`, which is similar to `read` in POSIX. + @since(version = 0.2.0) read-via-stream: func( /// The offset within the file at which to start reading. offset: filesize, @@ -301,6 +316,7 @@ interface types { /// /// Note: This allows using `write-stream`, which is similar to `write` in /// POSIX. + @since(version = 0.2.0) write-via-stream: func( /// The offset within the file at which to start writing. offset: filesize, @@ -311,12 +327,14 @@ interface types { /// May fail with an error-code describing why the file cannot be appended. /// /// Note: This allows using `write-stream`, which is similar to `write` with - /// `O_APPEND` in in POSIX. + /// `O_APPEND` in POSIX. + @since(version = 0.2.0) append-via-stream: func() -> result; /// Provide file advisory information on a descriptor. /// /// This is similar to `posix_fadvise` in POSIX. + @since(version = 0.2.0) advise: func( /// The offset within the file to which the advisory applies. offset: filesize, @@ -332,6 +350,7 @@ interface types { /// opened for writing. /// /// Note: This is similar to `fdatasync` in POSIX. + @since(version = 0.2.0) sync-data: func() -> result<_, error-code>; /// Get flags associated with a descriptor. @@ -340,6 +359,7 @@ interface types { /// /// Note: This returns the value that was the `fs_flags` value returned /// from `fdstat_get` in earlier versions of WASI. + @since(version = 0.2.0) get-flags: func() -> result; /// Get the dynamic type of a descriptor. @@ -352,12 +372,14 @@ interface types { /// /// Note: This returns the value that was the `fs_filetype` value returned /// from `fdstat_get` in earlier versions of WASI. + @since(version = 0.2.0) get-type: func() -> result; /// Adjust the size of an open file. If this increases the file's size, the /// extra bytes are filled with zeros. /// /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. + @since(version = 0.2.0) set-size: func(size: filesize) -> result<_, error-code>; /// Adjust the timestamps of an open file or directory. @@ -365,6 +387,7 @@ interface types { /// Note: This is similar to `futimens` in POSIX. /// /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. + @since(version = 0.2.0) set-times: func( /// The desired values of the data access timestamp. data-access-timestamp: new-timestamp, @@ -383,6 +406,7 @@ interface types { /// In the future, this may change to return a `stream`. /// /// Note: This is similar to `pread` in POSIX. + @since(version = 0.2.0) read: func( /// The maximum number of bytes to read. length: filesize, @@ -399,6 +423,7 @@ interface types { /// In the future, this may change to take a `stream`. /// /// Note: This is similar to `pwrite` in POSIX. + @since(version = 0.2.0) write: func( /// Data to write buffer: list, @@ -415,6 +440,7 @@ interface types { /// This always returns a new stream which starts at the beginning of the /// directory. Multiple streams may be active on the same directory, and they /// do not interfere with each other. + @since(version = 0.2.0) read-directory: func() -> result; /// Synchronize the data and metadata of a file to disk. @@ -423,11 +449,13 @@ interface types { /// opened for writing. /// /// Note: This is similar to `fsync` in POSIX. + @since(version = 0.2.0) sync: func() -> result<_, error-code>; /// Create a directory. /// /// Note: This is similar to `mkdirat` in POSIX. + @since(version = 0.2.0) create-directory-at: func( /// The relative path at which to create the directory. path: string, @@ -442,6 +470,7 @@ interface types { /// modified, use `metadata-hash`. /// /// Note: This was called `fd_filestat_get` in earlier versions of WASI. + @since(version = 0.2.0) stat: func() -> result; /// Return the attributes of a file or directory. @@ -451,6 +480,7 @@ interface types { /// discussion of alternatives. /// /// Note: This was called `path_filestat_get` in earlier versions of WASI. + @since(version = 0.2.0) stat-at: func( /// Flags determining the method of how the path is resolved. path-flags: path-flags, @@ -464,6 +494,7 @@ interface types { /// /// Note: This was called `path_filestat_set_times` in earlier versions of /// WASI. + @since(version = 0.2.0) set-times-at: func( /// Flags determining the method of how the path is resolved. path-flags: path-flags, @@ -477,7 +508,12 @@ interface types { /// Create a hard link. /// + /// Fails with `error-code::no-entry` if the old path does not exist, + /// with `error-code::exist` if the new path already exists, and + /// `error-code::not-permitted` if the old path is not a file. + /// /// Note: This is similar to `linkat` in POSIX. + @since(version = 0.2.0) link-at: func( /// Flags determining the method of how the path is resolved. old-path-flags: path-flags, @@ -491,12 +527,6 @@ interface types { /// Open a file or directory. /// - /// The returned descriptor is not guaranteed to be the lowest-numbered - /// descriptor not currently open/ it is randomized to prevent applications - /// from depending on making assumptions about indexes, since this is - /// error-prone in multi-threaded contexts. The returned descriptor is - /// guaranteed to be less than 2**31. - /// /// If `flags` contains `descriptor-flags::mutate-directory`, and the base /// descriptor doesn't have `descriptor-flags::mutate-directory` set, /// `open-at` fails with `error-code::read-only`. @@ -507,6 +537,7 @@ interface types { /// `error-code::read-only`. /// /// Note: This is similar to `openat` in POSIX. + @since(version = 0.2.0) open-at: func( /// Flags determining the method of how the path is resolved. path-flags: path-flags, @@ -524,6 +555,7 @@ interface types { /// filesystem, this function fails with `error-code::not-permitted`. /// /// Note: This is similar to `readlinkat` in POSIX. + @since(version = 0.2.0) readlink-at: func( /// The relative path of the symbolic link from which to read. path: string, @@ -534,6 +566,7 @@ interface types { /// Return `error-code::not-empty` if the directory is not empty. /// /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. + @since(version = 0.2.0) remove-directory-at: func( /// The relative path to a directory to remove. path: string, @@ -542,6 +575,7 @@ interface types { /// Rename a filesystem object. /// /// Note: This is similar to `renameat` in POSIX. + @since(version = 0.2.0) rename-at: func( /// The relative source path of the file or directory to rename. old-path: string, @@ -557,6 +591,7 @@ interface types { /// `error-code::not-permitted`. /// /// Note: This is similar to `symlinkat` in POSIX. + @since(version = 0.2.0) symlink-at: func( /// The contents of the symbolic link. old-path: string, @@ -568,6 +603,7 @@ interface types { /// /// Return `error-code::is-directory` if the path refers to a directory. /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. + @since(version = 0.2.0) unlink-file-at: func( /// The relative path to a file to unlink. path: string, @@ -579,6 +615,7 @@ interface types { /// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. /// wasi-filesystem does not expose device and inode numbers, so this function /// may be used instead. + @since(version = 0.2.0) is-same-object: func(other: borrow) -> bool; /// Return a hash of the metadata associated with a filesystem object referred @@ -590,7 +627,7 @@ interface types { /// replaced. It may also include a secret value chosen by the /// implementation and not otherwise exposed. /// - /// Implementations are encourated to provide the following properties: + /// Implementations are encouraged to provide the following properties: /// /// - If the file is not modified or replaced, the computed hash value should /// usually not change. @@ -600,12 +637,14 @@ interface types { /// computed hash. /// /// However, none of these is required. + @since(version = 0.2.0) metadata-hash: func() -> result; /// Return a hash of the metadata associated with a filesystem object referred /// to by a directory descriptor and a relative path. /// /// This performs the same hash computation as `metadata-hash`. + @since(version = 0.2.0) metadata-hash-at: func( /// Flags determining the method of how the path is resolved. path-flags: path-flags, @@ -615,8 +654,10 @@ interface types { } /// A stream of directory entries. + @since(version = 0.2.0) resource directory-entry-stream { /// Read a single directory entry from a `directory-entry-stream`. + @since(version = 0.2.0) read-directory-entry: func() -> result, error-code>; } @@ -630,5 +671,6 @@ interface types { /// /// Note that this function is fallible because not all stream-related /// errors are filesystem-related errors. + @since(version = 0.2.0) filesystem-error-code: func(err: borrow) -> option; } diff --git a/third_party/rust/wasi/wit/deps/filesystem/world.wit b/third_party/rust/wasi/wit/deps/filesystem/world.wit index 663f57920d5d..7742ed6bb8f1 100644 --- a/third_party/rust/wasi/wit/deps/filesystem/world.wit +++ b/third_party/rust/wasi/wit/deps/filesystem/world.wit @@ -1,6 +1,9 @@ -package wasi:filesystem@0.2.0; +package wasi:filesystem@0.2.4; +@since(version = 0.2.0) world imports { + @since(version = 0.2.0) import types; + @since(version = 0.2.0) import preopens; } diff --git a/third_party/rust/wasi/wit/deps/http/handler.wit b/third_party/rust/wasi/wit/deps/http/handler.wit index a34a0649d5b0..6a6c62966f11 100644 --- a/third_party/rust/wasi/wit/deps/http/handler.wit +++ b/third_party/rust/wasi/wit/deps/http/handler.wit @@ -1,6 +1,8 @@ /// This interface defines a handler of incoming HTTP Requests. It should /// be exported by components which can respond to HTTP Requests. +@since(version = 0.2.0) interface incoming-handler { + @since(version = 0.2.0) use types.{incoming-request, response-outparam}; /// This function is invoked with an incoming HTTP Request, and a resource @@ -13,6 +15,7 @@ interface incoming-handler { /// The implementor of this function must write a response to the /// `response-outparam` before returning, or else the caller will respond /// with an error on its behalf. + @since(version = 0.2.0) handle: func( request: incoming-request, response-out: response-outparam @@ -21,7 +24,9 @@ interface incoming-handler { /// This interface defines a handler of outgoing HTTP Requests. It should be /// imported by components which wish to make HTTP Requests. +@since(version = 0.2.0) interface outgoing-handler { + @since(version = 0.2.0) use types.{ outgoing-request, request-options, future-incoming-response, error-code }; @@ -36,6 +41,7 @@ interface outgoing-handler { /// This function may return an error if the `outgoing-request` is invalid /// or not allowed to be made. Otherwise, protocol errors are reported /// through the `future-incoming-response`. + @since(version = 0.2.0) handle: func( request: outgoing-request, options: option diff --git a/third_party/rust/wasi/wit/deps/http/proxy.wit b/third_party/rust/wasi/wit/deps/http/proxy.wit index 687c24d23332..cd3af25c616c 100644 --- a/third_party/rust/wasi/wit/deps/http/proxy.wit +++ b/third_party/rust/wasi/wit/deps/http/proxy.wit @@ -1,32 +1,50 @@ -package wasi:http@0.2.0; +package wasi:http@0.2.4; -/// The `wasi:http/proxy` world captures a widely-implementable intersection of -/// hosts that includes HTTP forward and reverse proxies. Components targeting -/// this world may concurrently stream in and out any number of incoming and -/// outgoing HTTP requests. -world proxy { +/// The `wasi:http/imports` world imports all the APIs for HTTP proxies. +/// It is intended to be `include`d in other worlds. +@since(version = 0.2.0) +world imports { /// HTTP proxies have access to time and randomness. - include wasi:clocks/imports@0.2.0; - import wasi:random/random@0.2.0; + @since(version = 0.2.0) + import wasi:clocks/monotonic-clock@0.2.4; + @since(version = 0.2.0) + import wasi:clocks/wall-clock@0.2.4; + @since(version = 0.2.0) + import wasi:random/random@0.2.4; /// Proxies have standard output and error streams which are expected to /// terminate in a developer-facing console provided by the host. - import wasi:cli/stdout@0.2.0; - import wasi:cli/stderr@0.2.0; + @since(version = 0.2.0) + import wasi:cli/stdout@0.2.4; + @since(version = 0.2.0) + import wasi:cli/stderr@0.2.4; /// TODO: this is a temporary workaround until component tooling is able to /// gracefully handle the absence of stdin. Hosts must return an eof stream /// for this import, which is what wasi-libc + tooling will do automatically /// when this import is properly removed. - import wasi:cli/stdin@0.2.0; + @since(version = 0.2.0) + import wasi:cli/stdin@0.2.4; /// This is the default handler to use when user code simply wants to make an /// HTTP request (e.g., via `fetch()`). + @since(version = 0.2.0) import outgoing-handler; +} + +/// The `wasi:http/proxy` world captures a widely-implementable intersection of +/// hosts that includes HTTP forward and reverse proxies. Components targeting +/// this world may concurrently stream in and out any number of incoming and +/// outgoing HTTP requests. +@since(version = 0.2.0) +world proxy { + @since(version = 0.2.0) + include imports; /// The host delivers incoming HTTP requests to a component by calling the /// `handle` function of this exported interface. A host may arbitrarily reuse /// or not reuse component instance when delivering incoming HTTP requests and /// thus a component must be able to handle 0..N calls to `handle`. + @since(version = 0.2.0) export incoming-handler; } diff --git a/third_party/rust/wasi/wit/deps/http/types.wit b/third_party/rust/wasi/wit/deps/http/types.wit index 755ac6a6bc96..254a1bbed4d1 100644 --- a/third_party/rust/wasi/wit/deps/http/types.wit +++ b/third_party/rust/wasi/wit/deps/http/types.wit @@ -1,13 +1,19 @@ /// This interface defines all of the types and methods for implementing /// HTTP Requests and Responses, both incoming and outgoing, as well as /// their headers, trailers, and bodies. +@since(version = 0.2.0) interface types { - use wasi:clocks/monotonic-clock@0.2.0.{duration}; - use wasi:io/streams@0.2.0.{input-stream, output-stream}; - use wasi:io/error@0.2.0.{error as io-error}; - use wasi:io/poll@0.2.0.{pollable}; + @since(version = 0.2.0) + use wasi:clocks/monotonic-clock@0.2.4.{duration}; + @since(version = 0.2.0) + use wasi:io/streams@0.2.4.{input-stream, output-stream}; + @since(version = 0.2.0) + use wasi:io/error@0.2.4.{error as io-error}; + @since(version = 0.2.0) + use wasi:io/poll@0.2.4.{pollable}; /// This type corresponds to HTTP standard Methods. + @since(version = 0.2.0) variant method { get, head, @@ -22,6 +28,7 @@ interface types { } /// This type corresponds to HTTP standard Related Schemes. + @since(version = 0.2.0) variant scheme { HTTP, HTTPS, @@ -29,7 +36,8 @@ interface types { } /// These cases are inspired by the IANA HTTP Proxy Error Types: - /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types + /// + @since(version = 0.2.0) variant error-code { DNS-timeout, DNS-error(DNS-error-payload), @@ -78,18 +86,21 @@ interface types { } /// Defines the case payload type for `DNS-error` above: + @since(version = 0.2.0) record DNS-error-payload { rcode: option, info-code: option } /// Defines the case payload type for `TLS-alert-received` above: + @since(version = 0.2.0) record TLS-alert-received-payload { alert-id: option, alert-message: option } /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: + @since(version = 0.2.0) record field-size-payload { field-name: option, field-size: option @@ -106,17 +117,19 @@ interface types { /// /// Note that this function is fallible because not all io-errors are /// http-related errors. + @since(version = 0.2.0) http-error-code: func(err: borrow) -> option; /// This type enumerates the different kinds of errors that may occur when /// setting or appending to a `fields` resource. + @since(version = 0.2.0) variant header-error { - /// This error indicates that a `field-key` or `field-value` was + /// This error indicates that a `field-name` or `field-value` was /// syntactically invalid when used with an operation that sets headers in a /// `fields`. invalid-syntax, - /// This error indicates that a forbidden `field-key` was used when trying + /// This error indicates that a forbidden `field-name` was used when trying /// to set a header in a `fields`. forbidden, @@ -125,12 +138,29 @@ interface types { immutable, } + /// Field names are always strings. + /// + /// Field names should always be treated as case insensitive by the `fields` + /// resource for the purposes of equality checking. + @since(version = 0.2.1) + type field-name = field-key; + /// Field keys are always strings. + /// + /// Field keys should always be treated as case insensitive by the `fields` + /// resource for the purposes of equality checking. + /// + /// # Deprecation + /// + /// This type has been deprecated in favor of the `field-name` type. + @since(version = 0.2.0) + @deprecated(version = 0.2.2) type field-key = string; /// Field values should always be ASCII strings. However, in /// reality, HTTP implementations often have to interpret malformed values, /// so they are provided as a list of bytes. + @since(version = 0.2.0) type field-value = list; /// This following block defines the `fields` resource which corresponds to @@ -140,96 +170,123 @@ interface types { /// A `fields` may be mutable or immutable. A `fields` created using the /// constructor, `from-list`, or `clone` will be mutable, but a `fields` /// resource given by other means (including, but not limited to, - /// `incoming-request.headers`, `outgoing-request.headers`) might be be + /// `incoming-request.headers`, `outgoing-request.headers`) might be /// immutable. In an immutable fields, the `set`, `append`, and `delete` /// operations will fail with `header-error.immutable`. + @since(version = 0.2.0) resource fields { /// Construct an empty HTTP Fields. /// /// The resulting `fields` is mutable. + @since(version = 0.2.0) constructor(); /// Construct an HTTP Fields. /// /// The resulting `fields` is mutable. /// - /// The list represents each key-value pair in the Fields. Keys + /// The list represents each name-value pair in the Fields. Names /// which have multiple values are represented by multiple entries in this - /// list with the same key. + /// list with the same name. /// - /// The tuple is a pair of the field key, represented as a string, and - /// Value, represented as a list of bytes. In a valid Fields, all keys - /// and values are valid UTF-8 strings. However, values are not always - /// well-formed, so they are represented as a raw list of bytes. + /// The tuple is a pair of the field name, represented as a string, and + /// Value, represented as a list of bytes. /// - /// An error result will be returned if any header or value was - /// syntactically invalid, or if a header was forbidden. + /// An error result will be returned if any `field-name` or `field-value` is + /// syntactically invalid, or if a field is forbidden. + @since(version = 0.2.0) from-list: static func( - entries: list> + entries: list> ) -> result; - /// Get all of the values corresponding to a key. If the key is not present - /// in this `fields`, an empty list is returned. However, if the key is - /// present but empty, this is represented by a list with one or more - /// empty field-values present. - get: func(name: field-key) -> list; + /// Get all of the values corresponding to a name. If the name is not present + /// in this `fields` or is syntactically invalid, an empty list is returned. + /// However, if the name is present but empty, this is represented by a list + /// with one or more empty field-values present. + @since(version = 0.2.0) + get: func(name: field-name) -> list; - /// Returns `true` when the key is present in this `fields`. If the key is + /// Returns `true` when the name is present in this `fields`. If the name is /// syntactically invalid, `false` is returned. - has: func(name: field-key) -> bool; + @since(version = 0.2.0) + has: func(name: field-name) -> bool; - /// Set all of the values for a key. Clears any existing values for that - /// key, if they have been set. + /// Set all of the values for a name. Clears any existing values for that + /// name, if they have been set. /// /// Fails with `header-error.immutable` if the `fields` are immutable. - set: func(name: field-key, value: list) -> result<_, header-error>; + /// + /// Fails with `header-error.invalid-syntax` if the `field-name` or any of + /// the `field-value`s are syntactically invalid. + @since(version = 0.2.0) + set: func(name: field-name, value: list) -> result<_, header-error>; - /// Delete all values for a key. Does nothing if no values for the key + /// Delete all values for a name. Does nothing if no values for the name /// exist. /// /// Fails with `header-error.immutable` if the `fields` are immutable. - delete: func(name: field-key) -> result<_, header-error>; + /// + /// Fails with `header-error.invalid-syntax` if the `field-name` is + /// syntactically invalid. + @since(version = 0.2.0) + delete: func(name: field-name) -> result<_, header-error>; - /// Append a value for a key. Does not change or delete any existing - /// values for that key. + /// Append a value for a name. Does not change or delete any existing + /// values for that name. /// /// Fails with `header-error.immutable` if the `fields` are immutable. - append: func(name: field-key, value: field-value) -> result<_, header-error>; - - /// Retrieve the full set of keys and values in the Fields. Like the - /// constructor, the list represents each key-value pair. /// - /// The outer list represents each key-value pair in the Fields. Keys - /// which have multiple values are represented by multiple entries in this - /// list with the same key. - entries: func() -> list>; + /// Fails with `header-error.invalid-syntax` if the `field-name` or + /// `field-value` are syntactically invalid. + @since(version = 0.2.0) + append: func(name: field-name, value: field-value) -> result<_, header-error>; - /// Make a deep copy of the Fields. Equivelant in behavior to calling the + /// Retrieve the full set of names and values in the Fields. Like the + /// constructor, the list represents each name-value pair. + /// + /// The outer list represents each name-value pair in the Fields. Names + /// which have multiple values are represented by multiple entries in this + /// list with the same name. + /// + /// The names and values are always returned in the original casing and in + /// the order in which they will be serialized for transport. + @since(version = 0.2.0) + entries: func() -> list>; + + /// Make a deep copy of the Fields. Equivalent in behavior to calling the /// `fields` constructor on the return value of `entries`. The resulting /// `fields` is mutable. + @since(version = 0.2.0) clone: func() -> fields; } /// Headers is an alias for Fields. + @since(version = 0.2.0) type headers = fields; /// Trailers is an alias for Fields. + @since(version = 0.2.0) type trailers = fields; /// Represents an incoming HTTP Request. + @since(version = 0.2.0) resource incoming-request { /// Returns the method of the incoming request. + @since(version = 0.2.0) method: func() -> method; /// Returns the path with query parameters from the request, as a string. + @since(version = 0.2.0) path-with-query: func() -> option; /// Returns the protocol scheme from the request. + @since(version = 0.2.0) scheme: func() -> option; - /// Returns the authority from the request, if it was present. + /// Returns the authority of the Request's target URI, if present. + @since(version = 0.2.0) authority: func() -> option; /// Get the `headers` associated with the request. @@ -240,14 +297,17 @@ interface types { /// The `headers` returned are a child resource: it must be dropped before /// the parent `incoming-request` is dropped. Dropping this /// `incoming-request` before all children are dropped will trap. + @since(version = 0.2.0) headers: func() -> headers; /// Gives the `incoming-body` associated with this request. Will only /// return success at most once, and subsequent calls will return error. + @since(version = 0.2.0) consume: func() -> result; } /// Represents an outgoing HTTP Request. + @since(version = 0.2.0) resource outgoing-request { /// Construct a new `outgoing-request` with a default `method` of `GET`, and @@ -260,6 +320,7 @@ interface types { /// and `authority`, or `headers` which are not permitted to be sent. /// It is the obligation of the `outgoing-handler.handle` implementation /// to reject invalid constructions of `outgoing-request`. + @since(version = 0.2.0) constructor( headers: headers ); @@ -270,38 +331,47 @@ interface types { /// Returns success on the first call: the `outgoing-body` resource for /// this `outgoing-request` can be retrieved at most once. Subsequent /// calls will return error. + @since(version = 0.2.0) body: func() -> result; /// Get the Method for the Request. + @since(version = 0.2.0) method: func() -> method; /// Set the Method for the Request. Fails if the string present in a /// `method.other` argument is not a syntactically valid method. + @since(version = 0.2.0) set-method: func(method: method) -> result; /// Get the combination of the HTTP Path and Query for the Request. /// When `none`, this represents an empty Path and empty Query. + @since(version = 0.2.0) path-with-query: func() -> option; /// Set the combination of the HTTP Path and Query for the Request. /// When `none`, this represents an empty Path and empty Query. Fails is the /// string given is not a syntactically valid path and query uri component. + @since(version = 0.2.0) set-path-with-query: func(path-with-query: option) -> result; /// Get the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. + @since(version = 0.2.0) scheme: func() -> option; /// Set the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. Fails if the /// string given is not a syntactically valid uri scheme. + @since(version = 0.2.0) set-scheme: func(scheme: option) -> result; - /// Get the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and + /// Get the authority of the Request's target URI. A value of `none` may be used + /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. + @since(version = 0.2.0) authority: func() -> option; - /// Set the HTTP Authority for the Request. A value of `none` may be used - /// with Related Schemes which do not require an Authority. The HTTP and + /// Set the authority of the Request's target URI. A value of `none` may be used + /// with Related Schemes which do not require an authority. The HTTP and /// HTTPS schemes always require an authority. Fails if the string given is - /// not a syntactically valid uri authority. + /// not a syntactically valid URI authority. + @since(version = 0.2.0) set-authority: func(authority: option) -> result; /// Get the headers associated with the Request. @@ -310,8 +380,9 @@ interface types { /// `delete` operations will fail with `header-error.immutable`. /// /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to + /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. + @since(version = 0.2.0) headers: func() -> headers; } @@ -321,31 +392,39 @@ interface types { /// /// These timeouts are separate from any the user may use to bound a /// blocking call to `wasi:io/poll.poll`. + @since(version = 0.2.0) resource request-options { /// Construct a default `request-options` value. + @since(version = 0.2.0) constructor(); /// The timeout for the initial connect to the HTTP Server. + @since(version = 0.2.0) connect-timeout: func() -> option; /// Set the timeout for the initial connect to the HTTP Server. An error /// return value indicates that this timeout is not supported. + @since(version = 0.2.0) set-connect-timeout: func(duration: option) -> result; /// The timeout for receiving the first byte of the Response body. + @since(version = 0.2.0) first-byte-timeout: func() -> option; /// Set the timeout for receiving the first byte of the Response body. An /// error return value indicates that this timeout is not supported. + @since(version = 0.2.0) set-first-byte-timeout: func(duration: option) -> result; /// The timeout for receiving subsequent chunks of bytes in the Response /// body stream. + @since(version = 0.2.0) between-bytes-timeout: func() -> option; /// Set the timeout for receiving subsequent chunks of bytes in the Response /// body stream. An error return value indicates that this timeout is not /// supported. + @since(version = 0.2.0) set-between-bytes-timeout: func(duration: option) -> result; } @@ -354,7 +433,23 @@ interface types { /// This resource is used by the `wasi:http/incoming-handler` interface to /// allow a Response to be sent corresponding to the Request provided as the /// other argument to `incoming-handler.handle`. + @since(version = 0.2.0) resource response-outparam { + /// Send an HTTP 1xx response. + /// + /// Unlike `response-outparam.set`, this does not consume the + /// `response-outparam`, allowing the guest to send an arbitrary number of + /// informational responses before sending the final response using + /// `response-outparam.set`. + /// + /// This will return an `HTTP-protocol-error` if `status` is not in the + /// range [100-199], or an `internal-error` if the implementation does not + /// support informational responses. + @unstable(feature = informational-outbound-responses) + send-informational: func( + status: u16, + headers: headers + ) -> result<_, error-code>; /// Set the value of the `response-outparam` to either send a response, /// or indicate an error. @@ -365,6 +460,7 @@ interface types { /// /// The user may provide an `error` to `response` to allow the /// implementation determine how to respond with an HTTP error response. + @since(version = 0.2.0) set: static func( param: response-outparam, response: result, @@ -372,12 +468,15 @@ interface types { } /// This type corresponds to the HTTP standard Status Code. + @since(version = 0.2.0) type status-code = u16; /// Represents an incoming HTTP Response. + @since(version = 0.2.0) resource incoming-response { /// Returns the status code from the incoming response. + @since(version = 0.2.0) status: func() -> status-code; /// Returns the headers from the incoming response. @@ -387,10 +486,12 @@ interface types { /// /// This headers resource is a child: it must be dropped before the parent /// `incoming-response` is dropped. + @since(version = 0.2.0) headers: func() -> headers; /// Returns the incoming body. May be called at most once. Returns error /// if called additional times. + @since(version = 0.2.0) consume: func() -> result; } @@ -402,6 +503,7 @@ interface types { /// an `input-stream` and the delivery of trailers as a `future-trailers`, /// and ensures that the user of this interface may only be consuming either /// the body contents or waiting on trailers at any given time. + @since(version = 0.2.0) resource incoming-body { /// Returns the contents of the body, as a stream of bytes. @@ -419,26 +521,30 @@ interface types { /// backpressure is to be applied when the user is consuming the body, /// and for that backpressure to not inhibit delivery of the trailers if /// the user does not read the entire body. + @since(version = 0.2.0) %stream: func() -> result; /// Takes ownership of `incoming-body`, and returns a `future-trailers`. /// This function will trap if the `input-stream` child is still alive. + @since(version = 0.2.0) finish: static func(this: incoming-body) -> future-trailers; } - /// Represents a future which may eventaully return trailers, or an error. + /// Represents a future which may eventually return trailers, or an error. /// /// In the case that the incoming HTTP Request or Response did not have any /// trailers, this future will resolve to the empty set of trailers once the /// complete Request or Response body has been received. + @since(version = 0.2.0) resource future-trailers { /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, + /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. + @since(version = 0.2.0) subscribe: func() -> pollable; - /// Returns the contents of the trailers, or an error which occured, + /// Returns the contents of the trailers, or an error which occurred, /// once the future is ready. /// /// The outer `option` represents future readiness. Users can wait on this @@ -450,17 +556,19 @@ interface types { /// /// The inner `result` represents that either the HTTP Request or Response /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether + /// error occurred receiving them. The optional `trailers` indicates whether /// or not trailers were present in the body. /// /// When some `trailers` are returned by this method, the `trailers` /// resource is immutable, and a child. Use of the `set`, `append`, or /// `delete` methods will return an error, and the resource must be /// dropped before the parent `future-trailers` is dropped. + @since(version = 0.2.0) get: func() -> option, error-code>>>; } /// Represents an outgoing HTTP Response. + @since(version = 0.2.0) resource outgoing-response { /// Construct an `outgoing-response`, with a default `status-code` of `200`. @@ -468,13 +576,16 @@ interface types { /// `set-status-code` method. /// /// * `headers` is the HTTP Headers for the Response. + @since(version = 0.2.0) constructor(headers: headers); /// Get the HTTP Status Code for the Response. + @since(version = 0.2.0) status-code: func() -> status-code; /// Set the HTTP Status Code for the Response. Fails if the status-code /// given is not a valid http status code. + @since(version = 0.2.0) set-status-code: func(status-code: status-code) -> result; /// Get the headers associated with the Request. @@ -483,8 +594,9 @@ interface types { /// `delete` operations will fail with `header-error.immutable`. /// /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to + /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. + @since(version = 0.2.0) headers: func() -> headers; /// Returns the resource corresponding to the outgoing Body for this Response. @@ -492,6 +604,7 @@ interface types { /// Returns success on the first call: the `outgoing-body` resource for /// this `outgoing-response` can be retrieved at most once. Subsequent /// calls will return error. + @since(version = 0.2.0) body: func() -> result; } @@ -507,10 +620,11 @@ interface types { /// /// If the user code drops this resource, as opposed to calling the static /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this + /// and that an error has occurred. The implementation should propagate this /// error to the HTTP protocol by whatever means it has available, /// including: corrupting the body on the wire, aborting the associated /// Request, or sending a late status code for the Response. + @since(version = 0.2.0) resource outgoing-body { /// Returns a stream for writing the body contents. @@ -522,6 +636,7 @@ interface types { /// Returns success on the first call: the `output-stream` resource for /// this `outgoing-body` may be retrieved at most once. Subsequent calls /// will return error. + @since(version = 0.2.0) write: func() -> result; /// Finalize an outgoing body, optionally providing trailers. This must be @@ -533,21 +648,24 @@ interface types { /// constructed with a Content-Length header, and the contents written /// to the body (via `write`) does not match the value given in the /// Content-Length. + @since(version = 0.2.0) finish: static func( this: outgoing-body, trailers: option ) -> result<_, error-code>; } - /// Represents a future which may eventaully return an incoming HTTP + /// Represents a future which may eventually return an incoming HTTP /// Response, or an error. /// /// This resource is returned by the `wasi:http/outgoing-handler` interface to /// provide the HTTP Response corresponding to the sent Request. + @since(version = 0.2.0) resource future-incoming-response { /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, + /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. + @since(version = 0.2.0) subscribe: func() -> pollable; /// Returns the incoming HTTP Response, or an error, once one is ready. @@ -560,11 +678,11 @@ interface types { /// is `some`, and error on subsequent calls. /// /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, + /// status and headers have received successfully, or that an error + /// occurred. Errors may also occur while consuming the response body, /// but those will be reported by the `incoming-body` and its /// `output-stream` child. + @since(version = 0.2.0) get: func() -> option>>; - } } diff --git a/third_party/rust/wasi/wit/deps/io/error.wit b/third_party/rust/wasi/wit/deps/io/error.wit index 22e5b64894b8..eb0600f9e78b 100644 --- a/third_party/rust/wasi/wit/deps/io/error.wit +++ b/third_party/rust/wasi/wit/deps/io/error.wit @@ -1,6 +1,6 @@ -package wasi:io@0.2.0; - +package wasi:io@0.2.4; +@since(version = 0.2.0) interface error { /// A resource which represents some error information. /// @@ -11,16 +11,15 @@ interface error { /// `wasi:io/streams/stream-error` type. /// /// To provide more specific error information, other interfaces may - /// provide functions to further "downcast" this error into more specific - /// error information. For example, `error`s returned in streams derived - /// from filesystem types to be described using the filesystem's own - /// error-code type, using the function - /// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter - /// `borrow` and returns - /// `option`. + /// offer functions to "downcast" this error into more specific types. For example, + /// errors returned from streams derived from filesystem types can be described using + /// the filesystem's own error-code type. This is done using the function + /// `wasi:filesystem/types/filesystem-error-code`, which takes a `borrow` + /// parameter and returns an `option`. /// /// The set of functions which can "downcast" an `error` into a more /// concrete type is open. + @since(version = 0.2.0) resource error { /// Returns a string that is suitable to assist humans in debugging /// this error. @@ -29,6 +28,7 @@ interface error { /// It may change across platforms, hosts, or other implementation /// details. Parsing this string is a major platform-compatibility /// hazard. + @since(version = 0.2.0) to-debug-string: func() -> string; } } diff --git a/third_party/rust/wasi/wit/deps/io/poll.wit b/third_party/rust/wasi/wit/deps/io/poll.wit index ddc67f8b7ace..170deff70af9 100644 --- a/third_party/rust/wasi/wit/deps/io/poll.wit +++ b/third_party/rust/wasi/wit/deps/io/poll.wit @@ -1,22 +1,26 @@ -package wasi:io@0.2.0; +package wasi:io@0.2.4; /// A poll API intended to let users wait for I/O events on multiple handles /// at once. +@since(version = 0.2.0) interface poll { /// `pollable` represents a single I/O event which may be ready, or not. + @since(version = 0.2.0) resource pollable { - /// Return the readiness of a pollable. This function never blocks. - /// - /// Returns `true` when the pollable is ready, and `false` otherwise. - ready: func() -> bool; + /// Return the readiness of a pollable. This function never blocks. + /// + /// Returns `true` when the pollable is ready, and `false` otherwise. + @since(version = 0.2.0) + ready: func() -> bool; - /// `block` returns immediately if the pollable is ready, and otherwise - /// blocks until ready. - /// - /// This function is equivalent to calling `poll.poll` on a list - /// containing only this pollable. - block: func(); + /// `block` returns immediately if the pollable is ready, and otherwise + /// blocks until ready. + /// + /// This function is equivalent to calling `poll.poll` on a list + /// containing only this pollable. + @since(version = 0.2.0) + block: func(); } /// Poll for completion on a set of pollables. @@ -27,8 +31,9 @@ interface poll { /// The result `list` contains one or more indices of handles in the /// argument list that is ready for I/O. /// - /// If the list contains more elements than can be indexed with a `u32` - /// value, this function traps. + /// This function traps if either: + /// - the list is empty, or: + /// - the list contains more elements than can be indexed with a `u32` value. /// /// A timeout can be implemented by adding a pollable from the /// wasi-clocks API to the list. @@ -36,6 +41,7 @@ interface poll { /// This function does not return a `result`; polling in itself does not /// do any I/O so it doesn't fail. If any of the I/O sources identified by /// the pollables has an error, it is indicated by marking the source as - /// being reaedy for I/O. + /// being ready for I/O. + @since(version = 0.2.0) poll: func(in: list>) -> list; } diff --git a/third_party/rust/wasi/wit/deps/io/streams.wit b/third_party/rust/wasi/wit/deps/io/streams.wit index 6d2f871e3b6f..bb9a31e818c4 100644 --- a/third_party/rust/wasi/wit/deps/io/streams.wit +++ b/third_party/rust/wasi/wit/deps/io/streams.wit @@ -1,19 +1,26 @@ -package wasi:io@0.2.0; +package wasi:io@0.2.4; /// WASI I/O is an I/O abstraction API which is currently focused on providing /// stream types. /// /// In the future, the component model is expected to add built-in stream types; /// when it does, they are expected to subsume this API. +@since(version = 0.2.0) interface streams { + @since(version = 0.2.0) use error.{error}; + @since(version = 0.2.0) use poll.{pollable}; /// An error for input-stream and output-stream operations. + @since(version = 0.2.0) variant stream-error { /// The last operation (a write or flush) failed before completion. /// /// More information is available in the `error` payload. + /// + /// After this, the stream will be closed. All future operations return + /// `stream-error::closed`. last-operation-failed(error), /// The stream is closed: no more input will be accepted by the /// stream. A closed output-stream will return this error on all @@ -29,6 +36,7 @@ interface streams { /// available, which could even be zero. To wait for data to be available, /// use the `subscribe` function to obtain a `pollable` which can be polled /// for using `wasi:io/poll`. + @since(version = 0.2.0) resource input-stream { /// Perform a non-blocking read from the stream. /// @@ -56,6 +64,7 @@ interface streams { /// is not possible to allocate in wasm32, or not desirable to allocate as /// as a return value by the callee. The callee may return a list of bytes /// less than `len` in size while more bytes are available for reading. + @since(version = 0.2.0) read: func( /// The maximum number of bytes to read len: u64 @@ -63,6 +72,7 @@ interface streams { /// Read bytes from a stream, after blocking until at least one byte can /// be read. Except for blocking, behavior is identical to `read`. + @since(version = 0.2.0) blocking-read: func( /// The maximum number of bytes to read len: u64 @@ -72,6 +82,7 @@ interface streams { /// /// Behaves identical to `read`, except instead of returning a list /// of bytes, returns the number of bytes consumed from the stream. + @since(version = 0.2.0) skip: func( /// The maximum number of bytes to skip. len: u64, @@ -79,6 +90,7 @@ interface streams { /// Skip bytes from a stream, after blocking until at least one byte /// can be skipped. Except for blocking behavior, identical to `skip`. + @since(version = 0.2.0) blocking-skip: func( /// The maximum number of bytes to skip. len: u64, @@ -90,6 +102,7 @@ interface streams { /// The created `pollable` is a child resource of the `input-stream`. /// Implementations may trap if the `input-stream` is dropped before /// all derived `pollable`s created with this function are dropped. + @since(version = 0.2.0) subscribe: func() -> pollable; } @@ -102,6 +115,11 @@ interface streams { /// promptly, which could even be zero. To wait for the stream to be ready to /// accept data, the `subscribe` function to obtain a `pollable` which can be /// polled for using `wasi:io/poll`. + /// + /// Dropping an `output-stream` while there's still an active write in + /// progress may result in the data being lost. Before dropping the stream, + /// be sure to fully flush your writes. + @since(version = 0.2.0) resource output-stream { /// Check readiness for writing. This function never blocks. /// @@ -112,6 +130,7 @@ interface streams { /// When this function returns 0 bytes, the `subscribe` pollable will /// become ready when this function will report at least 1 byte, or an /// error. + @since(version = 0.2.0) check-write: func() -> result; /// Perform a write. This function never blocks. @@ -127,6 +146,7 @@ interface streams { /// /// returns Err(closed) without writing if the stream has closed since /// the last call to check-write provided a permit. + @since(version = 0.2.0) write: func( contents: list ) -> result<_, stream-error>; @@ -155,6 +175,7 @@ interface streams { /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` + @since(version = 0.2.0) blocking-write-and-flush: func( contents: list ) -> result<_, stream-error>; @@ -169,14 +190,16 @@ interface streams { /// writes (`check-write` will return `ok(0)`) until the flush has /// completed. The `subscribe` pollable will become ready when the /// flush has completed and the stream can accept more writes. + @since(version = 0.2.0) flush: func() -> result<_, stream-error>; /// Request to flush buffered output, and block until flush completes /// and stream is ready for writing again. + @since(version = 0.2.0) blocking-flush: func() -> result<_, stream-error>; /// Create a `pollable` which will resolve once the output-stream - /// is ready for more writing, or an error has occured. When this + /// is ready for more writing, or an error has occurred. When this /// pollable is ready, `check-write` will return `ok(n)` with n>0, or an /// error. /// @@ -185,6 +208,7 @@ interface streams { /// The created `pollable` is a child resource of the `output-stream`. /// Implementations may trap if the `output-stream` is dropped before /// all derived `pollable`s created with this function are dropped. + @since(version = 0.2.0) subscribe: func() -> pollable; /// Write zeroes to a stream. @@ -193,6 +217,7 @@ interface streams { /// preconditions (must use check-write first), but instead of /// passing a list of bytes, you simply pass the number of zero-bytes /// that should be written. + @since(version = 0.2.0) write-zeroes: func( /// The number of zero-bytes to write len: u64 @@ -222,6 +247,7 @@ interface streams { /// // Check for any errors that arose during `flush` /// let _ = this.check-write(); // eliding error handling /// ``` + @since(version = 0.2.0) blocking-write-zeroes-and-flush: func( /// The number of zero-bytes to write len: u64 @@ -229,7 +255,7 @@ interface streams { /// Read from one stream and write to another. /// - /// The behavior of splice is equivelant to: + /// The behavior of splice is equivalent to: /// 1. calling `check-write` on the `output-stream` /// 2. calling `read` on the `input-stream` with the smaller of the /// `check-write` permitted length and the `len` provided to `splice` @@ -240,6 +266,7 @@ interface streams { /// /// This function returns the number of bytes transferred; it may be less /// than `len`. + @since(version = 0.2.0) splice: func( /// The stream to read from src: borrow, @@ -252,6 +279,7 @@ interface streams { /// This is similar to `splice`, except that it blocks until the /// `output-stream` is ready for writing, and the `input-stream` /// is ready for reading, before performing the `splice`. + @since(version = 0.2.0) blocking-splice: func( /// The stream to read from src: borrow, diff --git a/third_party/rust/wasi/wit/deps/io/world.wit b/third_party/rust/wasi/wit/deps/io/world.wit index 5f0b43fe50d1..8e0fa5c53c69 100644 --- a/third_party/rust/wasi/wit/deps/io/world.wit +++ b/third_party/rust/wasi/wit/deps/io/world.wit @@ -1,6 +1,10 @@ -package wasi:io@0.2.0; +package wasi:io@0.2.4; +@since(version = 0.2.0) world imports { + @since(version = 0.2.0) import streams; + + @since(version = 0.2.0) import poll; } diff --git a/third_party/rust/wasi/wit/deps/random/insecure-seed.wit b/third_party/rust/wasi/wit/deps/random/insecure-seed.wit index 47210ac6bdab..45e8bafdbf8c 100644 --- a/third_party/rust/wasi/wit/deps/random/insecure-seed.wit +++ b/third_party/rust/wasi/wit/deps/random/insecure-seed.wit @@ -1,8 +1,9 @@ -package wasi:random@0.2.0; +package wasi:random@0.2.4; /// The insecure-seed interface for seeding hash-map DoS resistance. /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. +@since(version = 0.2.0) interface insecure-seed { /// Return a 128-bit value that may contain a pseudo-random value. /// @@ -21,5 +22,6 @@ interface insecure-seed { /// This will likely be changed to a value import, to prevent it from being /// called multiple times and potentially used for purposes other than DoS /// protection. + @since(version = 0.2.0) insecure-seed: func() -> tuple; } diff --git a/third_party/rust/wasi/wit/deps/random/insecure.wit b/third_party/rust/wasi/wit/deps/random/insecure.wit index c58f4ee8522a..5ab5030c5749 100644 --- a/third_party/rust/wasi/wit/deps/random/insecure.wit +++ b/third_party/rust/wasi/wit/deps/random/insecure.wit @@ -1,8 +1,9 @@ -package wasi:random@0.2.0; +package wasi:random@0.2.4; /// The insecure interface for insecure pseudo-random numbers. /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. +@since(version = 0.2.0) interface insecure { /// Return `len` insecure pseudo-random bytes. /// @@ -12,11 +13,13 @@ interface insecure { /// There are no requirements on the values of the returned bytes, however /// implementations are encouraged to return evenly distributed values with /// a long period. + @since(version = 0.2.0) get-insecure-random-bytes: func(len: u64) -> list; /// Return an insecure pseudo-random `u64` value. /// /// This function returns the same type of pseudo-random data as /// `get-insecure-random-bytes`, represented as a `u64`. + @since(version = 0.2.0) get-insecure-random-u64: func() -> u64; } diff --git a/third_party/rust/wasi/wit/deps/random/random.wit b/third_party/rust/wasi/wit/deps/random/random.wit index 0c017f09340e..9e5220d829af 100644 --- a/third_party/rust/wasi/wit/deps/random/random.wit +++ b/third_party/rust/wasi/wit/deps/random/random.wit @@ -1,8 +1,9 @@ -package wasi:random@0.2.0; +package wasi:random@0.2.4; /// WASI Random is a random data API. /// /// It is intended to be portable at least between Unix-family platforms and /// Windows. +@since(version = 0.2.0) interface random { /// Return `len` cryptographically-secure random or pseudo-random bytes. /// @@ -16,11 +17,13 @@ interface random { /// This function must always return fresh data. Deterministic environments /// must omit this function, rather than implementing it with deterministic /// data. + @since(version = 0.2.0) get-random-bytes: func(len: u64) -> list; /// Return a cryptographically-secure random or pseudo-random `u64` value. /// /// This function returns the same type of data as `get-random-bytes`, /// represented as a `u64`. + @since(version = 0.2.0) get-random-u64: func() -> u64; } diff --git a/third_party/rust/wasi/wit/deps/random/world.wit b/third_party/rust/wasi/wit/deps/random/world.wit index 3da34914a4a7..d8905581947f 100644 --- a/third_party/rust/wasi/wit/deps/random/world.wit +++ b/third_party/rust/wasi/wit/deps/random/world.wit @@ -1,7 +1,13 @@ -package wasi:random@0.2.0; +package wasi:random@0.2.4; +@since(version = 0.2.0) world imports { + @since(version = 0.2.0) import random; + + @since(version = 0.2.0) import insecure; + + @since(version = 0.2.0) import insecure-seed; } diff --git a/third_party/rust/wasi/wit/deps/sockets/instance-network.wit b/third_party/rust/wasi/wit/deps/sockets/instance-network.wit index e455d0ff7b63..5f6e6c1cc983 100644 --- a/third_party/rust/wasi/wit/deps/sockets/instance-network.wit +++ b/third_party/rust/wasi/wit/deps/sockets/instance-network.wit @@ -1,9 +1,11 @@ /// This interface provides a value-export of the default network handle.. +@since(version = 0.2.0) interface instance-network { + @since(version = 0.2.0) use network.{network}; /// Get a handle to the default network. + @since(version = 0.2.0) instance-network: func() -> network; - } diff --git a/third_party/rust/wasi/wit/deps/sockets/ip-name-lookup.wit b/third_party/rust/wasi/wit/deps/sockets/ip-name-lookup.wit index 8e639ec59691..48b41a5b1f2f 100644 --- a/third_party/rust/wasi/wit/deps/sockets/ip-name-lookup.wit +++ b/third_party/rust/wasi/wit/deps/sockets/ip-name-lookup.wit @@ -1,9 +1,10 @@ - +@since(version = 0.2.0) interface ip-name-lookup { - use wasi:io/poll@0.2.0.{pollable}; + @since(version = 0.2.0) + use wasi:io/poll@0.2.4.{pollable}; + @since(version = 0.2.0) use network.{network, error-code, ip-address}; - /// Resolve an internet host name to a list of IP addresses. /// /// Unicode domain names are automatically converted to ASCII using IDNA encoding. @@ -24,8 +25,10 @@ interface ip-name-lookup { /// - /// - /// - + @since(version = 0.2.0) resolve-addresses: func(network: borrow, name: string) -> result; + @since(version = 0.2.0) resource resolve-address-stream { /// Returns the next address from the resolver. /// @@ -40,12 +43,14 @@ interface ip-name-lookup { /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) + @since(version = 0.2.0) resolve-next-address: func() -> result, error-code>; /// Create a `pollable` which will resolve once the stream is ready for I/O. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + @since(version = 0.2.0) subscribe: func() -> pollable; } } diff --git a/third_party/rust/wasi/wit/deps/sockets/network.wit b/third_party/rust/wasi/wit/deps/sockets/network.wit index 9cadf0650a49..aa4985e1488c 100644 --- a/third_party/rust/wasi/wit/deps/sockets/network.wit +++ b/third_party/rust/wasi/wit/deps/sockets/network.wit @@ -1,8 +1,12 @@ - +@since(version = 0.2.0) interface network { + @unstable(feature = network-error-code) + use wasi:io/error@0.2.4.{error}; + /// An opaque resource that represents access to (a subset of) the network. /// This enables context-based security for networking. /// There is no need for this to map 1:1 to a physical network interface. + @since(version = 0.2.0) resource network; /// Error codes. @@ -17,6 +21,7 @@ interface network { /// - `concurrency-conflict` /// /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. + @since(version = 0.2.0) enum error-code { /// Unknown error unknown, @@ -103,6 +108,20 @@ interface network { permanent-resolver-failure, } + /// Attempts to extract a network-related `error-code` from the stream + /// `error` provided. + /// + /// Stream operations which return `stream-error::last-operation-failed` + /// have a payload with more information about the operation that failed. + /// This payload can be passed through to this function to see if there's + /// network-related information about the error to return. + /// + /// Note that this function is fallible because not all stream-related + /// errors are network-related errors. + @unstable(feature = network-error-code) + network-error-code: func(err: borrow) -> option; + + @since(version = 0.2.0) enum ip-address-family { /// Similar to `AF_INET` in POSIX. ipv4, @@ -111,14 +130,18 @@ interface network { ipv6, } + @since(version = 0.2.0) type ipv4-address = tuple; + @since(version = 0.2.0) type ipv6-address = tuple; + @since(version = 0.2.0) variant ip-address { ipv4(ipv4-address), ipv6(ipv6-address), } + @since(version = 0.2.0) record ipv4-socket-address { /// sin_port port: u16, @@ -126,6 +149,7 @@ interface network { address: ipv4-address, } + @since(version = 0.2.0) record ipv6-socket-address { /// sin6_port port: u16, @@ -137,9 +161,9 @@ interface network { scope-id: u32, } + @since(version = 0.2.0) variant ip-socket-address { ipv4(ipv4-socket-address), ipv6(ipv6-socket-address), } - } diff --git a/third_party/rust/wasi/wit/deps/sockets/tcp-create-socket.wit b/third_party/rust/wasi/wit/deps/sockets/tcp-create-socket.wit index c7ddf1f228ef..eedbd30768c9 100644 --- a/third_party/rust/wasi/wit/deps/sockets/tcp-create-socket.wit +++ b/third_party/rust/wasi/wit/deps/sockets/tcp-create-socket.wit @@ -1,6 +1,8 @@ - +@since(version = 0.2.0) interface tcp-create-socket { + @since(version = 0.2.0) use network.{network, error-code, ip-address-family}; + @since(version = 0.2.0) use tcp.{tcp-socket}; /// Create a new TCP socket. @@ -23,5 +25,6 @@ interface tcp-create-socket { /// - /// - /// - + @since(version = 0.2.0) create-tcp-socket: func(address-family: ip-address-family) -> result; } diff --git a/third_party/rust/wasi/wit/deps/sockets/tcp.wit b/third_party/rust/wasi/wit/deps/sockets/tcp.wit index 5902b9ee0519..b3311332f612 100644 --- a/third_party/rust/wasi/wit/deps/sockets/tcp.wit +++ b/third_party/rust/wasi/wit/deps/sockets/tcp.wit @@ -1,10 +1,15 @@ - +@since(version = 0.2.0) interface tcp { - use wasi:io/streams@0.2.0.{input-stream, output-stream}; - use wasi:io/poll@0.2.0.{pollable}; - use wasi:clocks/monotonic-clock@0.2.0.{duration}; + @since(version = 0.2.0) + use wasi:io/streams@0.2.4.{input-stream, output-stream}; + @since(version = 0.2.0) + use wasi:io/poll@0.2.4.{pollable}; + @since(version = 0.2.0) + use wasi:clocks/monotonic-clock@0.2.4.{duration}; + @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; + @since(version = 0.2.0) enum shutdown-type { /// Similar to `SHUT_RD` in POSIX. receive, @@ -27,8 +32,8 @@ interface tcp { /// - `connect-in-progress` /// - `connected` /// - `closed` - /// See - /// for a more information. + /// See + /// for more information. /// /// Note: Except where explicitly mentioned, whenever this documentation uses /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. @@ -37,6 +42,7 @@ interface tcp { /// In addition to the general error codes documented on the /// `network::error-code` type, TCP socket methods may always return /// `error(invalid-state)` when in the `closed` state. + @since(version = 0.2.0) resource tcp-socket { /// Bind the socket to a specific network on the provided IP address and port. /// @@ -76,13 +82,15 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; + @since(version = 0.2.0) finish-bind: func() -> result<_, error-code>; /// Connect to a remote endpoint. /// /// On success: - /// - the socket is transitioned into the `connection` state. + /// - the socket is transitioned into the `connected` state. /// - a pair of streams is returned that can be used to read & write to the connection /// /// After a failed connection attempt, the socket will be in the `closed` @@ -121,7 +129,9 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) start-connect: func(network: borrow, remote-address: ip-socket-address) -> result<_, error-code>; + @since(version = 0.2.0) finish-connect: func() -> result, error-code>; /// Start listening for new connections. @@ -149,7 +159,9 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) start-listen: func() -> result<_, error-code>; + @since(version = 0.2.0) finish-listen: func() -> result<_, error-code>; /// Accept a new client socket. @@ -178,6 +190,7 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) accept: func() -> result, error-code>; /// Get the bound local address. @@ -196,6 +209,7 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) local-address: func() -> result; /// Get the remote address. @@ -208,16 +222,19 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) remote-address: func() -> result; /// Whether the socket is in the `listening` state. /// /// Equivalent to the SO_ACCEPTCONN socket option. + @since(version = 0.2.0) is-listening: func() -> bool; /// Whether this is a IPv4 or IPv6 socket. /// /// Equivalent to the SO_DOMAIN socket option. + @since(version = 0.2.0) address-family: func() -> ip-address-family; /// Hints the desired listen queue size. Implementations are free to ignore this. @@ -229,6 +246,7 @@ interface tcp { /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. /// - `invalid-argument`: (set) The provided value was 0. /// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state. + @since(version = 0.2.0) set-listen-backlog-size: func(value: u64) -> result<_, error-code>; /// Enables or disables keepalive. @@ -240,7 +258,9 @@ interface tcp { /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. /// /// Equivalent to the SO_KEEPALIVE socket option. + @since(version = 0.2.0) keep-alive-enabled: func() -> result; + @since(version = 0.2.0) set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; /// Amount of time the connection has to be idle before TCP starts sending keepalive packets. @@ -253,7 +273,9 @@ interface tcp { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + @since(version = 0.2.0) keep-alive-idle-time: func() -> result; + @since(version = 0.2.0) set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; /// The time between keepalive packets. @@ -266,7 +288,9 @@ interface tcp { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + @since(version = 0.2.0) keep-alive-interval: func() -> result; + @since(version = 0.2.0) set-keep-alive-interval: func(value: duration) -> result<_, error-code>; /// The maximum amount of keepalive packets TCP should send before aborting the connection. @@ -279,7 +303,9 @@ interface tcp { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + @since(version = 0.2.0) keep-alive-count: func() -> result; + @since(version = 0.2.0) set-keep-alive-count: func(value: u32) -> result<_, error-code>; /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. @@ -288,7 +314,9 @@ interface tcp { /// /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + @since(version = 0.2.0) hop-limit: func() -> result; + @since(version = 0.2.0) set-hop-limit: func(value: u8) -> result<_, error-code>; /// The kernel buffer space reserved for sends/receives on this socket. @@ -301,9 +329,13 @@ interface tcp { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + @since(version = 0.2.0) receive-buffer-size: func() -> result; + @since(version = 0.2.0) set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + @since(version = 0.2.0) send-buffer-size: func() -> result; + @since(version = 0.2.0) set-send-buffer-size: func(value: u64) -> result<_, error-code>; /// Create a `pollable` which can be used to poll for, or block on, @@ -318,11 +350,12 @@ interface tcp { /// `subscribe` only has to be called once per socket and can then be /// (re)used for the remainder of the socket's lifetime. /// - /// See - /// for a more information. + /// See + /// for more information. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + @since(version = 0.2.0) subscribe: func() -> pollable; /// Initiate a graceful shutdown. @@ -335,7 +368,7 @@ interface tcp { /// associated with this socket will be closed and a FIN packet will be sent. /// - `both`: Same effect as `receive` & `send` combined. /// - /// This function is idempotent. Shutting a down a direction more than once + /// This function is idempotent; shutting down a direction more than once /// has no effect and returns `ok`. /// /// The shutdown function does not close (drop) the socket. @@ -348,6 +381,7 @@ interface tcp { /// - /// - /// - + @since(version = 0.2.0) shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>; } } diff --git a/third_party/rust/wasi/wit/deps/sockets/udp-create-socket.wit b/third_party/rust/wasi/wit/deps/sockets/udp-create-socket.wit index 0482d1fe7350..e8eeacbfefb4 100644 --- a/third_party/rust/wasi/wit/deps/sockets/udp-create-socket.wit +++ b/third_party/rust/wasi/wit/deps/sockets/udp-create-socket.wit @@ -1,6 +1,8 @@ - +@since(version = 0.2.0) interface udp-create-socket { + @since(version = 0.2.0) use network.{network, error-code, ip-address-family}; + @since(version = 0.2.0) use udp.{udp-socket}; /// Create a new UDP socket. @@ -23,5 +25,6 @@ interface udp-create-socket { /// - /// - /// - + @since(version = 0.2.0) create-udp-socket: func(address-family: ip-address-family) -> result; } diff --git a/third_party/rust/wasi/wit/deps/sockets/udp.wit b/third_party/rust/wasi/wit/deps/sockets/udp.wit index d987a0a90801..cfc07ba8100a 100644 --- a/third_party/rust/wasi/wit/deps/sockets/udp.wit +++ b/third_party/rust/wasi/wit/deps/sockets/udp.wit @@ -1,9 +1,12 @@ - +@since(version = 0.2.0) interface udp { - use wasi:io/poll@0.2.0.{pollable}; + @since(version = 0.2.0) + use wasi:io/poll@0.2.4.{pollable}; + @since(version = 0.2.0) use network.{network, error-code, ip-socket-address, ip-address-family}; /// A received datagram. + @since(version = 0.2.0) record incoming-datagram { /// The payload. /// @@ -19,6 +22,7 @@ interface udp { } /// A datagram to be sent out. + @since(version = 0.2.0) record outgoing-datagram { /// The payload. data: list, @@ -33,9 +37,8 @@ interface udp { remote-address: option, } - - /// A UDP socket handle. + @since(version = 0.2.0) resource udp-socket { /// Bind the socket to a specific network on the provided IP address and port. /// @@ -63,7 +66,9 @@ interface udp { /// - /// - /// - + @since(version = 0.2.0) start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; + @since(version = 0.2.0) finish-bind: func() -> result<_, error-code>; /// Set up inbound & outbound communication channels, optionally to a specific peer. @@ -106,6 +111,7 @@ interface udp { /// - /// - /// - + @since(version = 0.2.0) %stream: func(remote-address: option) -> result, error-code>; /// Get the current bound address. @@ -124,6 +130,7 @@ interface udp { /// - /// - /// - + @since(version = 0.2.0) local-address: func() -> result; /// Get the address the socket is currently streaming to. @@ -136,11 +143,13 @@ interface udp { /// - /// - /// - + @since(version = 0.2.0) remote-address: func() -> result; /// Whether this is a IPv4 or IPv6 socket. /// /// Equivalent to the SO_DOMAIN socket option. + @since(version = 0.2.0) address-family: func() -> ip-address-family; /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. @@ -149,7 +158,9 @@ interface udp { /// /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + @since(version = 0.2.0) unicast-hop-limit: func() -> result; + @since(version = 0.2.0) set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; /// The kernel buffer space reserved for sends/receives on this socket. @@ -162,18 +173,24 @@ interface udp { /// /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. + @since(version = 0.2.0) receive-buffer-size: func() -> result; + @since(version = 0.2.0) set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + @since(version = 0.2.0) send-buffer-size: func() -> result; + @since(version = 0.2.0) set-send-buffer-size: func(value: u64) -> result<_, error-code>; /// Create a `pollable` which will resolve once the socket is ready for I/O. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + @since(version = 0.2.0) subscribe: func() -> pollable; } + @since(version = 0.2.0) resource incoming-datagram-stream { /// Receive messages on the socket. /// @@ -198,15 +215,18 @@ interface udp { /// - /// - /// - + @since(version = 0.2.0) receive: func(max-results: u64) -> result, error-code>; /// Create a `pollable` which will resolve once the stream is ready to receive again. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + @since(version = 0.2.0) subscribe: func() -> pollable; } + @since(version = 0.2.0) resource outgoing-datagram-stream { /// Check readiness for sending. This function never blocks. /// @@ -255,12 +275,14 @@ interface udp { /// - /// - /// - + @since(version = 0.2.0) send: func(datagrams: list) -> result; /// Create a `pollable` which will resolve once the stream is ready to send again. /// - /// Note: this function is here for WASI Preview2 only. + /// Note: this function is here for WASI 0.2 only. /// It's planned to be removed when `future` is natively supported in Preview3. + @since(version = 0.2.0) subscribe: func() -> pollable; } } diff --git a/third_party/rust/wasi/wit/deps/sockets/world.wit b/third_party/rust/wasi/wit/deps/sockets/world.wit index f8bb92ae0457..82acdb9f0cce 100644 --- a/third_party/rust/wasi/wit/deps/sockets/world.wit +++ b/third_party/rust/wasi/wit/deps/sockets/world.wit @@ -1,11 +1,19 @@ -package wasi:sockets@0.2.0; +package wasi:sockets@0.2.4; +@since(version = 0.2.0) world imports { + @since(version = 0.2.0) import instance-network; + @since(version = 0.2.0) import network; + @since(version = 0.2.0) import udp; + @since(version = 0.2.0) import udp-create-socket; + @since(version = 0.2.0) import tcp; + @since(version = 0.2.0) import tcp-create-socket; + @since(version = 0.2.0) import ip-name-lookup; } diff --git a/third_party/rust/wasi/wit/wasi-crate.wit b/third_party/rust/wasi/wit/wasi-crate.wit index ce5184a3bab3..1b1118c11f37 100644 --- a/third_party/rust/wasi/wit/wasi-crate.wit +++ b/third_party/rust/wasi/wit/wasi-crate.wit @@ -1,6 +1,6 @@ package rust:wasi; world bindings { - include wasi:cli/imports@0.2.0; - import wasi:http/outgoing-handler@0.2.0; + include wasi:cli/imports@0.2.4; + import wasi:http/outgoing-handler@0.2.4; } diff --git a/third_party/rust/wit-bindgen-rt/.cargo-checksum.json b/third_party/rust/wit-bindgen-rt/.cargo-checksum.json index f9848fbf9199..7aa5112b7ee6 100644 --- a/third_party/rust/wit-bindgen-rt/.cargo-checksum.json +++ b/third_party/rust/wit-bindgen-rt/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"d11d004edff258bb755a8f65b93e003878c099ae6c59105cbcb3a6c4009c87c8","build.rs":"b5f489b495fdfc6698018e490f4a74f775f890c390d2b51762987ead1cc74bad","src/cabi_realloc.c":"6efae14edc8d5fe6720f98f397c00c221f90fc24e42f3e3aa73967dd85731b37","src/cabi_realloc.o":"dc00f8efbf0edb7c16e0b64c657525479c06df964077ad6edc6c963c2d31679a","src/cabi_realloc.rs":"78f95db23c168a10753365b766f7d78eb07cd40c821a4f4ffa346b94d442389f","src/lib.rs":"d7a198c12c9ddb38e691a0d51e81548e7074804353ba863100c3acc4cf933be7","src/libwit_bindgen_cabi_realloc.a":"25ff7e22d45ef353a6c94863a93a1b734a8f4166b5a0922826408b5193fd7af4"},"package":"026d24a27f6712541fa534f2954bd9e0eb66172f033c2157c0f31d106255c497"} \ No newline at end of file +{"files":{"Cargo.lock":"0bee2394dcb6175165bf8f23a02c3a12b88b40de935ef6f9a19f17142fda5c88","Cargo.toml":"3afc3d79b7c8dc63f0c9bc2c795f4f7dbca85807618636a4b594524ed20d53ed","build.rs":"0bdde396dbbacde8feb367515f30a3243fd9a1e675865bd990d73ffdd7947d07","src/async_support.rs":"fa22d8968988f85f541c1c1ad448db64479c7d230390ba3da897795e9e9048ff","src/async_support/future_support.rs":"c926e84f5c97ac6eff87f3d2f0ba42896a7fe750a6186e9f3b7954306724b8f6","src/async_support/stream_support.rs":"750a67840f6e1b1e7b15de65566be5dc31cf93ab75fd05db6ce6c887a4470e42","src/cabi_realloc.c":"b8f9fad807706b4b1280c6bf7daf7aae4a01f747754f649d7070efd69633270a","src/cabi_realloc.o":"174c31f5cf1136305232c0b83db0aaa422e8428ae84973e85116d799325850df","src/cabi_realloc.rs":"17082a05eefe80f93140960427e5d1ef287e1f8c71c8833e71ed5e146c08c347","src/lib.rs":"c8f78ff78e66fddd8641f11e95f2d8b87870be5c034ea87c445d23f6306879b0","src/libwit_bindgen_cabi_realloc.a":"b7b6a5fec27dd1abf3d888d387cb3e02dc66772fab86f5543cef301140a99fd6"},"package":"6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"} \ No newline at end of file diff --git a/third_party/rust/wit-bindgen-rt/Cargo.lock b/third_party/rust/wit-bindgen-rt/Cargo.lock new file mode 100644 index 000000000000..c2bac0b7fcad --- /dev/null +++ b/third_party/rust/wit-bindgen-rt/Cargo.lock @@ -0,0 +1,181 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "pin-project-lite" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "proc-macro2" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "307e3004becf10f5a6e0d59d20f3cd28231b0e0827a96cd3e0ce6d14bc1e4bb3" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "syn" +version = "2.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +dependencies = [ + "bitflags", + "futures", + "once_cell", +] diff --git a/third_party/rust/wit-bindgen-rt/Cargo.toml b/third_party/rust/wit-bindgen-rt/Cargo.toml index 8c384badc818..a1ae71c6e75b 100644 --- a/third_party/rust/wit-bindgen-rt/Cargo.toml +++ b/third_party/rust/wit-bindgen-rt/Cargo.toml @@ -12,10 +12,39 @@ [package] edition = "2021" name = "wit-bindgen-rt" -version = "0.21.0" +version = "0.39.0" +build = "build.rs" +autolib = false +autobins = false +autoexamples = false +autotests = false +autobenches = false description = """ Runtime support for the `wit-bindgen` crate """ homepage = "https://github.com/bytecodealliance/wit-bindgen" -license = "Apache-2.0 WITH LLVM-exception" +readme = false +license = "Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT" repository = "https://github.com/bytecodealliance/wit-bindgen" + +[lib] +name = "wit_bindgen_rt" +path = "src/lib.rs" + +[dependencies.bitflags] +version = "2.3.3" +optional = true + +[dependencies.futures] +version = "0.3.30" +optional = true + +[dependencies.once_cell] +version = "1.19.0" +optional = true + +[features] +async = [ + "dep:futures", + "dep:once_cell", +] diff --git a/third_party/rust/wit-bindgen-rt/build.rs b/third_party/rust/wit-bindgen-rt/build.rs index 9742e6e3df09..b0d5d1831d3b 100644 --- a/third_party/rust/wit-bindgen-rt/build.rs +++ b/third_party/rust/wit-bindgen-rt/build.rs @@ -1,6 +1,10 @@ +use std::env; +use std::path::PathBuf; + fn main() { - let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or(String::new()); - let target_family = std::env::var("CARGO_CFG_TARGET_FAMILY").unwrap_or(String::new()); + let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or(String::new()); + let target_family = env::var("CARGO_CFG_TARGET_FAMILY").unwrap_or(String::new()); + let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap()); if target_family != "wasm" { return; @@ -10,8 +14,18 @@ fn main() { panic!("only wasm32 supports cabi-realloc right now"); } - println!("cargo:rustc-link-lib=wit_bindgen_cabi_realloc"); - let cwd = std::env::current_dir().unwrap(); - let cwd = cwd.display(); - println!("cargo:rustc-link-search=native={cwd}/src"); + let mut src = env::current_dir().unwrap(); + src.push("src"); + src.push("libwit_bindgen_cabi_realloc.a"); + + let dst_name = format!( + "wit_bindgen_cabi_realloc{}", + env!("CARGO_PKG_VERSION").replace(".", "_") + ); + let dst = out_dir.join(format!("lib{dst_name}.a")); + + std::fs::copy(&src, &dst).unwrap(); + + println!("cargo:rustc-link-lib={dst_name}"); + println!("cargo:rustc-link-search=native={}", out_dir.display()); } diff --git a/third_party/rust/wit-bindgen-rt/src/async_support.rs b/third_party/rust/wit-bindgen-rt/src/async_support.rs new file mode 100644 index 000000000000..b60cabaf8c61 --- /dev/null +++ b/third_party/rust/wit-bindgen-rt/src/async_support.rs @@ -0,0 +1,515 @@ +#![deny(missing_docs)] +#![allow(static_mut_refs)] + +extern crate std; +use std::alloc::{self, Layout}; +use std::any::Any; +use std::boxed::Box; +use std::collections::{hash_map, HashMap}; +use std::fmt::{self, Debug, Display}; +use std::future::Future; +use std::pin::Pin; +use std::ptr; +use std::string::String; +use std::sync::Arc; +use std::task::{Context, Poll, Wake, Waker}; +use std::vec::Vec; + +use futures::channel::oneshot; +use futures::future::FutureExt; +use futures::stream::{FuturesUnordered, StreamExt}; +use once_cell::sync::Lazy; + +mod future_support; +mod stream_support; + +pub use { + future_support::{FutureReader, FutureVtable, FutureWriter}, + stream_support::{StreamReader, StreamVtable, StreamWriter}, +}; + +pub use futures; + +type BoxFuture = Pin + 'static>>; + +/// Represents a task created by either a call to an async-lifted export or a +/// future run using `block_on` or `poll_future`. +struct FutureState { + /// Number of in-progress async-lowered import calls and/or stream/future reads/writes. + todo: usize, + /// Remaining work to do (if any) before this task can be considered "done". + /// + /// Note that we won't tell the host the task is done until this is drained + /// and `todo` is zero. + tasks: Option>, +} + +/// Represents the state of a stream or future. +#[doc(hidden)] +pub enum Handle { + LocalOpen, + LocalReady(Box, Waker), + LocalWaiting(oneshot::Sender>), + LocalClosed, + Read, + Write, +} + +/// The current task being polled (or null if none). +static mut CURRENT: *mut FutureState = ptr::null_mut(); + +/// Map of any in-progress calls to async-lowered imports, keyed by the +/// identifiers issued by the host. +static mut CALLS: Lazy>> = Lazy::new(HashMap::new); + +/// Any newly-deferred work queued by calls to the `spawn` function while +/// polling the current task. +static mut SPAWNED: Vec = Vec::new(); + +/// The states of all currently-open streams and futures. +static mut HANDLES: Lazy> = Lazy::new(HashMap::new); + +#[doc(hidden)] +pub fn with_entry(handle: u32, fun: impl FnOnce(hash_map::Entry<'_, u32, Handle>) -> T) -> T { + fun(unsafe { HANDLES.entry(handle) }) +} + +fn dummy_waker() -> Waker { + struct DummyWaker; + + impl Wake for DummyWaker { + fn wake(self: Arc) {} + } + + static WAKER: Lazy> = Lazy::new(|| Arc::new(DummyWaker)); + + WAKER.clone().into() +} + +/// Poll the specified task until it either completes or can't make immediate +/// progress. +unsafe fn poll(state: *mut FutureState) -> Poll<()> { + loop { + if let Some(futures) = (*state).tasks.as_mut() { + CURRENT = state; + let poll = futures.poll_next_unpin(&mut Context::from_waker(&dummy_waker())); + CURRENT = ptr::null_mut(); + + if SPAWNED.is_empty() { + match poll { + Poll::Ready(Some(())) => (), + Poll::Ready(None) => { + (*state).tasks = None; + break Poll::Ready(()); + } + Poll::Pending => break Poll::Pending, + } + } else { + futures.extend(SPAWNED.drain(..)); + } + } else { + break Poll::Ready(()); + } + } +} + +/// Poll the future generated by a call to an async-lifted export once, calling +/// the specified closure (presumably backed by a call to `task.return`) when it +/// generates a value. +/// +/// This will return a non-null pointer representing the task if it hasn't +/// completed immediately; otherwise it returns null. +#[doc(hidden)] +pub fn first_poll( + future: impl Future + 'static, + fun: impl FnOnce(&T) + 'static, +) -> *mut u8 { + let state = Box::into_raw(Box::new(FutureState { + todo: 0, + tasks: Some( + [Box::pin(future.map(|v| fun(&v))) as BoxFuture] + .into_iter() + .collect(), + ), + })); + match unsafe { poll(state) } { + Poll::Ready(()) => ptr::null_mut(), + Poll::Pending => state as _, + } +} + +/// Await the completion of a call to an async-lowered import. +#[doc(hidden)] +pub async unsafe fn await_result( + import: unsafe extern "C" fn(*mut u8, *mut u8) -> i32, + params_layout: Layout, + params: *mut u8, + results: *mut u8, +) { + const STATUS_STARTING: u32 = 0; + const STATUS_STARTED: u32 = 1; + const STATUS_RETURNED: u32 = 2; + const STATUS_DONE: u32 = 3; + + let result = import(params, results) as u32; + let status = result >> 30; + let call = (result & !(0b11 << 30)) as i32; + + if status != STATUS_DONE { + assert!(!CURRENT.is_null()); + (*CURRENT).todo += 1; + } + + match status { + STATUS_STARTING => { + let (tx, rx) = oneshot::channel(); + CALLS.insert(call, tx); + rx.await.unwrap(); + alloc::dealloc(params, params_layout); + } + STATUS_STARTED => { + alloc::dealloc(params, params_layout); + let (tx, rx) = oneshot::channel(); + CALLS.insert(call, tx); + rx.await.unwrap(); + } + STATUS_RETURNED | STATUS_DONE => { + alloc::dealloc(params, params_layout); + } + _ => unreachable!(), + } +} + +/// stream/future read/write results defined by the Component Model ABI. +mod results { + pub const BLOCKED: u32 = 0xffff_ffff; + pub const CLOSED: u32 = 0x8000_0000; + pub const CANCELED: u32 = 0; +} + +/// Await the completion of a future read or write. +#[doc(hidden)] +pub async unsafe fn await_future_result( + import: unsafe extern "C" fn(u32, *mut u8) -> u32, + future: u32, + address: *mut u8, +) -> bool { + let result = import(future, address); + match result { + results::BLOCKED => { + assert!(!CURRENT.is_null()); + (*CURRENT).todo += 1; + let (tx, rx) = oneshot::channel(); + CALLS.insert(future as _, tx); + let v = rx.await.unwrap(); + v == 1 + } + results::CLOSED | results::CANCELED => false, + 1 => true, + _ => unreachable!(), + } +} + +/// Await the completion of a stream read or write. +#[doc(hidden)] +pub async unsafe fn await_stream_result( + import: unsafe extern "C" fn(u32, *mut u8, u32) -> u32, + stream: u32, + address: *mut u8, + count: u32, +) -> Option { + let result = import(stream, address, count); + match result { + results::BLOCKED => { + assert!(!CURRENT.is_null()); + (*CURRENT).todo += 1; + let (tx, rx) = oneshot::channel(); + CALLS.insert(stream as _, tx); + let v = rx.await.unwrap(); + if let results::CLOSED | results::CANCELED = v { + None + } else { + Some(usize::try_from(v).unwrap()) + } + } + results::CLOSED | results::CANCELED => None, + v => Some(usize::try_from(v).unwrap()), + } +} + +/// Call the `subtask.drop` canonical built-in function. +fn subtask_drop(subtask: u32) { + #[cfg(not(target_arch = "wasm32"))] + { + _ = subtask; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[subtask-drop]"] + fn subtask_drop(_: u32); + } + unsafe { + subtask_drop(subtask); + } + } +} + +/// Handle a progress notification from the host regarding either a call to an +/// async-lowered import or a stream/future read/write operation. +#[doc(hidden)] +pub unsafe fn callback(ctx: *mut u8, event0: i32, event1: i32, event2: i32) -> i32 { + const _EVENT_CALL_STARTING: i32 = 0; + const EVENT_CALL_STARTED: i32 = 1; + const EVENT_CALL_RETURNED: i32 = 2; + const EVENT_CALL_DONE: i32 = 3; + const _EVENT_YIELDED: i32 = 4; + const EVENT_STREAM_READ: i32 = 5; + const EVENT_STREAM_WRITE: i32 = 6; + const EVENT_FUTURE_READ: i32 = 7; + const EVENT_FUTURE_WRITE: i32 = 8; + + match event0 { + EVENT_CALL_STARTED => 0, + EVENT_CALL_RETURNED | EVENT_CALL_DONE | EVENT_STREAM_READ | EVENT_STREAM_WRITE + | EVENT_FUTURE_READ | EVENT_FUTURE_WRITE => { + if let Some(call) = CALLS.remove(&event1) { + _ = call.send(event2 as _); + } + + let state = ctx as *mut FutureState; + let done = poll(state).is_ready(); + + if event0 == EVENT_CALL_DONE { + subtask_drop(event1 as u32); + } + + if matches!( + event0, + EVENT_CALL_DONE + | EVENT_STREAM_READ + | EVENT_STREAM_WRITE + | EVENT_FUTURE_READ + | EVENT_FUTURE_WRITE + ) { + (*state).todo -= 1; + } + + if done && (*state).todo == 0 { + drop(Box::from_raw(state)); + 1 + } else { + 0 + } + } + _ => unreachable!(), + } +} + +/// Represents the Component Model `error-context` type. +pub struct ErrorContext { + handle: u32, +} + +impl ErrorContext { + #[doc(hidden)] + pub fn from_handle(handle: u32) -> Self { + Self { handle } + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + self.handle + } + + /// Extract the debug message from a given [`ErrorContext`] + pub fn debug_message(&self) -> String { + #[cfg(not(target_arch = "wasm32"))] + { + _ = self; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[error-context-debug-message;encoding=utf8;realloc=cabi_realloc]"] + fn error_context_debug_message(_: u32, _: *mut u8); + } + + unsafe { + let mut ret = [0u32; 2]; + error_context_debug_message(self.handle, ret.as_mut_ptr() as *mut _); + let len = usize::try_from(ret[1]).unwrap(); + String::from_raw_parts(usize::try_from(ret[0]).unwrap() as *mut _, len, len) + } + } + } +} + +impl Debug for ErrorContext { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("ErrorContext").finish() + } +} + +impl Display for ErrorContext { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Error") + } +} + +impl std::error::Error for ErrorContext {} + +impl Drop for ErrorContext { + fn drop(&mut self) { + #[cfg(not(target_arch = "wasm32"))] + { + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[error-context-drop]"] + fn error_drop(_: u32); + } + if self.handle != 0 { + unsafe { error_drop(self.handle) } + } + } + } +} + +/// Defer the specified future to be run after the current async-lifted export +/// task has returned a value. +/// +/// The task will remain in a running state until all spawned futures have +/// completed. +pub fn spawn(future: impl Future + 'static) { + unsafe { SPAWNED.push(Box::pin(future)) } +} + +fn task_wait(state: &mut FutureState) { + #[cfg(not(target_arch = "wasm32"))] + { + _ = state; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[task-wait]"] + fn wait(_: *mut i32) -> i32; + } + let mut payload = [0i32; 2]; + unsafe { + let event0 = wait(payload.as_mut_ptr()); + callback(state as *mut _ as _, event0, payload[0], payload[1]); + } + } +} + +/// Run the specified future to completion, returning the result. +/// +/// This uses `task.wait` to poll for progress on any in-progress calls to +/// async-lowered imports as necessary. +// TODO: refactor so `'static` bounds aren't necessary +pub fn block_on(future: impl Future + 'static) -> T { + let (tx, mut rx) = oneshot::channel(); + let state = &mut FutureState { + todo: 0, + tasks: Some( + [Box::pin(future.map(move |v| drop(tx.send(v)))) as BoxFuture] + .into_iter() + .collect(), + ), + }; + loop { + match unsafe { poll(state) } { + Poll::Ready(()) => break rx.try_recv().unwrap().unwrap(), + Poll::Pending => task_wait(state), + } + } +} + +/// Call the `task.yield` canonical built-in function. +/// +/// This yields control to the host temporarily, allowing other tasks to make +/// progress. It's a good idea to call this inside a busy loop which does not +/// otherwise ever yield control the the host. +pub fn task_yield() { + #[cfg(not(target_arch = "wasm32"))] + { + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[task-yield]"] + fn yield_(); + } + unsafe { + yield_(); + } + } +} + +/// Call the `task.backpressure` canonical built-in function. +/// +/// When `enabled` is `true`, this tells the host to defer any new calls to this +/// component instance until further notice (i.e. until `task.backpressure` is +/// called again with `enabled` set to `false`). +pub fn task_backpressure(enabled: bool) { + #[cfg(not(target_arch = "wasm32"))] + { + _ = enabled; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[task-backpressure]"] + fn backpressure(_: i32); + } + unsafe { + backpressure(if enabled { 1 } else { 0 }); + } + } +} + +/// Call the `error-context.new` canonical built-in function. +pub fn error_context_new(debug_message: &str) -> ErrorContext { + #[cfg(not(target_arch = "wasm32"))] + { + _ = debug_message; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "$root")] + extern "C" { + #[link_name = "[error-context-new;encoding=utf8]"] + fn context_new(_: *const u8, _: usize) -> i32; + } + + unsafe { + let handle = context_new(debug_message.as_ptr(), debug_message.len()); + // SAFETY: Handles (including error context handles are guaranteed to + // fit inside u32 by the Component Model ABI + ErrorContext::from_handle(u32::try_from(handle).unwrap()) + } + } +} diff --git a/third_party/rust/wit-bindgen-rt/src/async_support/future_support.rs b/third_party/rust/wit-bindgen-rt/src/async_support/future_support.rs new file mode 100644 index 000000000000..8477ec48135e --- /dev/null +++ b/third_party/rust/wit-bindgen-rt/src/async_support/future_support.rs @@ -0,0 +1,362 @@ +extern crate std; + +use { + super::Handle, + futures::{ + channel::oneshot, + future::{self, FutureExt}, + }, + std::{ + boxed::Box, + collections::hash_map::Entry, + fmt, + future::{Future, IntoFuture}, + pin::Pin, + sync::atomic::{AtomicU32, Ordering::Relaxed}, + task::{Context, Poll}, + }, +}; + +#[doc(hidden)] +pub struct FutureVtable { + pub write: fn(future: u32, value: T) -> Pin>>, + pub read: fn(future: u32) -> Pin>>>, + pub cancel_write: fn(future: u32), + pub cancel_read: fn(future: u32), + pub close_writable: fn(future: u32), + pub close_readable: fn(future: u32), +} + +/// Represents the writable end of a Component Model `future`. +pub struct FutureWriter { + handle: u32, + vtable: &'static FutureVtable, +} + +impl fmt::Debug for FutureWriter { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FutureWriter") + .field("handle", &self.handle) + .finish() + } +} + +/// Represents a write operation which may be canceled prior to completion. +pub struct CancelableWrite { + writer: Option>, + future: Pin>>, +} + +impl Future for CancelableWrite { + type Output = (); + + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<()> { + let me = self.get_mut(); + match me.future.poll_unpin(cx) { + Poll::Ready(()) => { + me.writer = None; + Poll::Ready(()) + } + Poll::Pending => Poll::Pending, + } + } +} + +impl CancelableWrite { + /// Cancel this write if it hasn't already completed, returning the original `FutureWriter`. + /// + /// This method will panic if the write has already completed. + pub fn cancel(mut self) -> FutureWriter { + self.cancel_mut() + } + + fn cancel_mut(&mut self) -> FutureWriter { + let writer = self.writer.take().unwrap(); + super::with_entry(writer.handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen + | Handle::LocalWaiting(_) + | Handle::Read + | Handle::LocalClosed => unreachable!(), + Handle::LocalReady(..) => { + entry.insert(Handle::LocalOpen); + } + Handle::Write => (writer.vtable.cancel_write)(writer.handle), + }, + }); + writer + } +} + +impl Drop for CancelableWrite { + fn drop(&mut self) { + if self.writer.is_some() { + self.cancel_mut(); + } + } +} + +impl FutureWriter { + #[doc(hidden)] + pub fn new(handle: u32, vtable: &'static FutureVtable) -> Self { + Self { handle, vtable } + } + + /// Write the specified value to this `future`. + pub fn write(self, v: T) -> CancelableWrite { + let handle = self.handle; + let vtable = self.vtable; + CancelableWrite { + writer: Some(self), + future: super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen => { + let mut v = Some(v); + Box::pin(future::poll_fn(move |cx| { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen => { + entry.insert(Handle::LocalReady( + Box::new(v.take().unwrap()), + cx.waker().clone(), + )); + Poll::Pending + } + Handle::LocalReady(..) => Poll::Pending, + Handle::LocalClosed => Poll::Ready(()), + Handle::LocalWaiting(_) | Handle::Read | Handle::Write => { + unreachable!() + } + }, + }) + })) as Pin>> + } + Handle::LocalWaiting(_) => { + let Handle::LocalWaiting(tx) = entry.insert(Handle::LocalClosed) else { + unreachable!() + }; + _ = tx.send(Box::new(v)); + Box::pin(future::ready(())) + } + Handle::LocalClosed => Box::pin(future::ready(())), + Handle::Read | Handle::LocalReady(..) => unreachable!(), + Handle::Write => Box::pin((vtable.write)(handle, v).map(drop)), + }, + }), + } + } +} + +impl Drop for FutureWriter { + fn drop(&mut self) { + super::with_entry(self.handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get_mut() { + Handle::LocalOpen | Handle::LocalWaiting(_) | Handle::LocalReady(..) => { + entry.insert(Handle::LocalClosed); + } + Handle::Read => unreachable!(), + Handle::Write | Handle::LocalClosed => { + entry.remove(); + (self.vtable.close_writable)(self.handle); + } + }, + }); + } +} + +/// Represents a read operation which may be canceled prior to completion. +pub struct CancelableRead { + reader: Option>, + future: Pin>>>, +} + +impl Future for CancelableRead { + type Output = Option; + + fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let me = self.get_mut(); + match me.future.poll_unpin(cx) { + Poll::Ready(v) => { + me.reader = None; + Poll::Ready(v) + } + Poll::Pending => Poll::Pending, + } + } +} + +impl CancelableRead { + /// Cancel this read if it hasn't already completed, returning the original `FutureReader`. + /// + /// This method will panic if the read has already completed. + pub fn cancel(mut self) -> FutureReader { + self.cancel_mut() + } + + fn cancel_mut(&mut self) -> FutureReader { + let reader = self.reader.take().unwrap(); + let handle = reader.handle.load(Relaxed); + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen + | Handle::LocalReady(..) + | Handle::Write + | Handle::LocalClosed => unreachable!(), + Handle::LocalWaiting(_) => { + entry.insert(Handle::LocalOpen); + } + Handle::Read => (reader.vtable.cancel_read)(handle), + }, + }); + reader + } +} + +impl Drop for CancelableRead { + fn drop(&mut self) { + if self.reader.is_some() { + self.cancel_mut(); + } + } +} + +/// Represents the readable end of a Component Model `future`. +pub struct FutureReader { + handle: AtomicU32, + vtable: &'static FutureVtable, +} + +impl fmt::Debug for FutureReader { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("FutureReader") + .field("handle", &self.handle) + .finish() + } +} + +impl FutureReader { + #[doc(hidden)] + pub fn new(handle: u32, vtable: &'static FutureVtable) -> Self { + Self { + handle: AtomicU32::new(handle), + vtable, + } + } + + #[doc(hidden)] + pub fn from_handle_and_vtable(handle: u32, vtable: &'static FutureVtable) -> Self { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(entry) => { + entry.insert(Handle::Read); + } + Entry::Occupied(mut entry) => match entry.get() { + Handle::Write => { + entry.insert(Handle::LocalOpen); + } + Handle::Read + | Handle::LocalOpen + | Handle::LocalReady(..) + | Handle::LocalWaiting(_) + | Handle::LocalClosed => { + unreachable!() + } + }, + }); + + Self { + handle: AtomicU32::new(handle), + vtable, + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + let handle = self.handle.swap(u32::MAX, Relaxed); + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen => { + entry.insert(Handle::Write); + } + Handle::Read | Handle::LocalClosed => { + entry.remove(); + } + Handle::LocalReady(..) | Handle::LocalWaiting(_) | Handle::Write => unreachable!(), + }, + }); + + handle + } +} + +impl IntoFuture for FutureReader { + type Output = Option; + type IntoFuture = CancelableRead; + + /// Convert this object into a `Future` which will resolve when a value is + /// written to the writable end of this `future` (yielding a `Some` result) + /// or when the writable end is dropped (yielding a `None` result). + fn into_future(self) -> Self::IntoFuture { + let handle = self.handle.load(Relaxed); + let vtable = self.vtable; + CancelableRead { + reader: Some(self), + future: super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::Write | Handle::LocalWaiting(_) => unreachable!(), + Handle::Read => Box::pin(async move { (vtable.read)(handle).await }) + as Pin>>, + Handle::LocalOpen => { + let (tx, rx) = oneshot::channel(); + entry.insert(Handle::LocalWaiting(tx)); + Box::pin(async move { rx.await.ok().map(|v| *v.downcast().unwrap()) }) + } + Handle::LocalClosed => Box::pin(future::ready(None)), + Handle::LocalReady(..) => { + let Handle::LocalReady(v, waker) = entry.insert(Handle::LocalClosed) else { + unreachable!() + }; + waker.wake(); + Box::pin(future::ready(Some(*v.downcast().unwrap()))) + } + }, + }), + } + } +} + +impl Drop for FutureReader { + fn drop(&mut self) { + match self.handle.load(Relaxed) { + u32::MAX => {} + handle => { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get_mut() { + Handle::LocalReady(..) => { + let Handle::LocalReady(_, waker) = entry.insert(Handle::LocalClosed) + else { + unreachable!() + }; + waker.wake(); + } + Handle::LocalOpen | Handle::LocalWaiting(_) => { + entry.insert(Handle::LocalClosed); + } + Handle::Read | Handle::LocalClosed => { + entry.remove(); + (self.vtable.close_readable)(handle); + } + Handle::Write => unreachable!(), + }, + }); + } + } + } +} diff --git a/third_party/rust/wit-bindgen-rt/src/async_support/stream_support.rs b/third_party/rust/wit-bindgen-rt/src/async_support/stream_support.rs new file mode 100644 index 000000000000..d80b96d60aee --- /dev/null +++ b/third_party/rust/wit-bindgen-rt/src/async_support/stream_support.rs @@ -0,0 +1,431 @@ +extern crate std; + +use { + super::Handle, + futures::{ + channel::oneshot, + future::{self, FutureExt}, + sink::Sink, + stream::Stream, + }, + std::{ + boxed::Box, + collections::hash_map::Entry, + convert::Infallible, + fmt, + future::Future, + iter, + mem::{self, MaybeUninit}, + pin::Pin, + sync::atomic::{AtomicU32, Ordering::Relaxed}, + task::{Context, Poll}, + vec::Vec, + }, +}; + +fn ceiling(x: usize, y: usize) -> usize { + (x / y) + if x % y == 0 { 0 } else { 1 } +} + +#[doc(hidden)] +pub struct StreamVtable { + pub write: fn(future: u32, values: &[T]) -> Pin + '_>>, + pub read: fn( + future: u32, + values: &mut [MaybeUninit], + ) -> Pin> + '_>>, + pub cancel_write: fn(future: u32), + pub cancel_read: fn(future: u32), + pub close_writable: fn(future: u32), + pub close_readable: fn(future: u32), +} + +struct CancelWriteOnDrop { + handle: Option, + vtable: &'static StreamVtable, +} + +impl Drop for CancelWriteOnDrop { + fn drop(&mut self) { + if let Some(handle) = self.handle.take() { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen + | Handle::LocalWaiting(_) + | Handle::Read + | Handle::LocalClosed => unreachable!(), + Handle::LocalReady(..) => { + entry.insert(Handle::LocalOpen); + } + Handle::Write => (self.vtable.cancel_write)(handle), + }, + }); + } + } +} + +/// Represents the writable end of a Component Model `stream`. +pub struct StreamWriter { + handle: u32, + future: Option + 'static>>>, + vtable: &'static StreamVtable, +} + +impl StreamWriter { + #[doc(hidden)] + pub fn new(handle: u32, vtable: &'static StreamVtable) -> Self { + Self { + handle, + future: None, + vtable, + } + } + + /// Cancel the current pending write operation. + /// + /// This will panic if no such operation is pending. + pub fn cancel(&mut self) { + assert!(self.future.is_some()); + self.future = None; + } +} + +impl fmt::Debug for StreamWriter { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("StreamWriter") + .field("handle", &self.handle) + .finish() + } +} + +impl Sink> for StreamWriter { + type Error = Infallible; + + fn poll_ready(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let me = self.get_mut(); + + if let Some(future) = &mut me.future { + match future.as_mut().poll(cx) { + Poll::Ready(_) => { + me.future = None; + Poll::Ready(Ok(())) + } + Poll::Pending => Poll::Pending, + } + } else { + Poll::Ready(Ok(())) + } + } + + fn start_send(self: Pin<&mut Self>, item: Vec) -> Result<(), Self::Error> { + assert!(self.future.is_none()); + super::with_entry(self.handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen => { + let handle = self.handle; + let mut item = Some(item); + let mut cancel_on_drop = Some(CancelWriteOnDrop:: { + handle: Some(handle), + vtable: self.vtable, + }); + self.get_mut().future = Some(Box::pin(future::poll_fn(move |cx| { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen => { + if let Some(item) = item.take() { + entry.insert(Handle::LocalReady( + Box::new(item), + cx.waker().clone(), + )); + Poll::Pending + } else { + cancel_on_drop.take().unwrap().handle = None; + Poll::Ready(()) + } + } + Handle::LocalReady(..) => Poll::Pending, + Handle::LocalClosed => { + cancel_on_drop.take().unwrap().handle = None; + Poll::Ready(()) + } + Handle::LocalWaiting(_) | Handle::Read | Handle::Write => { + unreachable!() + } + }, + }) + }))); + } + Handle::LocalWaiting(_) => { + let Handle::LocalWaiting(tx) = entry.insert(Handle::LocalOpen) else { + unreachable!() + }; + _ = tx.send(Box::new(item)); + } + Handle::LocalClosed => (), + Handle::Read | Handle::LocalReady(..) => unreachable!(), + Handle::Write => { + let handle = self.handle; + let vtable = self.vtable; + let mut cancel_on_drop = CancelWriteOnDrop:: { + handle: Some(handle), + vtable, + }; + self.get_mut().future = Some(Box::pin(async move { + (vtable.write)(handle, &item).await; + cancel_on_drop.handle = None; + drop(cancel_on_drop); + })); + } + }, + }); + Ok(()) + } + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + self.poll_ready(cx) + } + + fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + self.poll_ready(cx) + } +} + +impl Drop for StreamWriter { + fn drop(&mut self) { + self.future = None; + + super::with_entry(self.handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get_mut() { + Handle::LocalOpen | Handle::LocalWaiting(_) | Handle::LocalReady(..) => { + entry.insert(Handle::LocalClosed); + } + Handle::Read => unreachable!(), + Handle::Write | Handle::LocalClosed => { + entry.remove(); + (self.vtable.close_writable)(self.handle); + } + }, + }); + } +} + +struct CancelReadOnDrop { + handle: Option, + vtable: &'static StreamVtable, +} + +impl Drop for CancelReadOnDrop { + fn drop(&mut self) { + if let Some(handle) = self.handle.take() { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen + | Handle::LocalReady(..) + | Handle::Write + | Handle::LocalClosed => unreachable!(), + Handle::LocalWaiting(_) => { + entry.insert(Handle::LocalOpen); + } + Handle::Read => (self.vtable.cancel_read)(handle), + }, + }); + } + } +} + +/// Represents the readable end of a Component Model `stream`. +pub struct StreamReader { + handle: AtomicU32, + future: Option>> + 'static>>>, + vtable: &'static StreamVtable, +} + +impl StreamReader { + /// Cancel the current pending read operation. + /// + /// This will panic if no such operation is pending. + pub fn cancel(&mut self) { + assert!(self.future.is_some()); + self.future = None; + } +} + +impl fmt::Debug for StreamReader { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("StreamReader") + .field("handle", &self.handle) + .finish() + } +} + +impl StreamReader { + #[doc(hidden)] + pub fn new(handle: u32, vtable: &'static StreamVtable) -> Self { + Self { + handle: AtomicU32::new(handle), + future: None, + vtable, + } + } + + #[doc(hidden)] + pub fn from_handle_and_vtable(handle: u32, vtable: &'static StreamVtable) -> Self { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(entry) => { + entry.insert(Handle::Read); + } + Entry::Occupied(mut entry) => match entry.get() { + Handle::Write => { + entry.insert(Handle::LocalOpen); + } + Handle::Read + | Handle::LocalOpen + | Handle::LocalReady(..) + | Handle::LocalWaiting(_) + | Handle::LocalClosed => { + unreachable!() + } + }, + }); + + Self { + handle: AtomicU32::new(handle), + future: None, + vtable, + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + let handle = self.handle.swap(u32::MAX, Relaxed); + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::LocalOpen => { + entry.insert(Handle::Write); + } + Handle::Read | Handle::LocalClosed => { + entry.remove(); + } + Handle::LocalReady(..) | Handle::LocalWaiting(_) | Handle::Write => unreachable!(), + }, + }); + + handle + } +} + +impl Stream for StreamReader { + type Item = Vec; + + fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let me = self.get_mut(); + + if me.future.is_none() { + me.future = Some(super::with_entry( + me.handle.load(Relaxed), + |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get() { + Handle::Write | Handle::LocalWaiting(_) => unreachable!(), + Handle::Read => { + let handle = me.handle.load(Relaxed); + let vtable = me.vtable; + let mut cancel_on_drop = CancelReadOnDrop:: { + handle: Some(handle), + vtable, + }; + Box::pin(async move { + let mut buffer = iter::repeat_with(MaybeUninit::uninit) + .take(ceiling(64 * 1024, mem::size_of::().max(1))) + .collect::>(); + + let result = + if let Some(count) = (vtable.read)(handle, &mut buffer).await { + buffer.truncate(count); + Some(unsafe { + mem::transmute::>, Vec>(buffer) + }) + } else { + None + }; + cancel_on_drop.handle = None; + drop(cancel_on_drop); + result + }) as Pin>> + } + Handle::LocalOpen => { + let (tx, rx) = oneshot::channel(); + entry.insert(Handle::LocalWaiting(tx)); + let mut cancel_on_drop = CancelReadOnDrop:: { + handle: Some(me.handle.load(Relaxed)), + vtable: me.vtable, + }; + Box::pin(async move { + let result = + rx.map(|v| v.ok().map(|v| *v.downcast().unwrap())).await; + cancel_on_drop.handle = None; + drop(cancel_on_drop); + result + }) + } + Handle::LocalClosed => Box::pin(future::ready(None)), + Handle::LocalReady(..) => { + let Handle::LocalReady(v, waker) = entry.insert(Handle::LocalOpen) + else { + unreachable!() + }; + waker.wake(); + Box::pin(future::ready(Some(*v.downcast().unwrap()))) + } + }, + }, + )); + } + + match me.future.as_mut().unwrap().as_mut().poll(cx) { + Poll::Ready(v) => { + me.future = None; + Poll::Ready(v) + } + Poll::Pending => Poll::Pending, + } + } +} + +impl Drop for StreamReader { + fn drop(&mut self) { + self.future = None; + + match self.handle.load(Relaxed) { + u32::MAX => {} + handle => { + super::with_entry(handle, |entry| match entry { + Entry::Vacant(_) => unreachable!(), + Entry::Occupied(mut entry) => match entry.get_mut() { + Handle::LocalReady(..) => { + let Handle::LocalReady(_, waker) = entry.insert(Handle::LocalClosed) + else { + unreachable!() + }; + waker.wake(); + } + Handle::LocalOpen | Handle::LocalWaiting(_) => { + entry.insert(Handle::LocalClosed); + } + Handle::Read | Handle::LocalClosed => { + entry.remove(); + (self.vtable.close_readable)(handle); + } + Handle::Write => unreachable!(), + }, + }); + } + } + } +} diff --git a/third_party/rust/wit-bindgen-rt/src/cabi_realloc.c b/third_party/rust/wit-bindgen-rt/src/cabi_realloc.c index 4c566e5b40b9..46e59ec8f113 100644 --- a/third_party/rust/wit-bindgen-rt/src/cabi_realloc.c +++ b/third_party/rust/wit-bindgen-rt/src/cabi_realloc.c @@ -2,9 +2,9 @@ #include -extern void *cabi_realloc_wit_bindgen_0_21_0(void *ptr, size_t old_size, size_t align, size_t new_size); +extern void *cabi_realloc_wit_bindgen_0_39_0(void *ptr, size_t old_size, size_t align, size_t new_size); __attribute__((__weak__, __export_name__("cabi_realloc"))) void *cabi_realloc(void *ptr, size_t old_size, size_t align, size_t new_size) { - return cabi_realloc_wit_bindgen_0_21_0(ptr, old_size, align, new_size); + return cabi_realloc_wit_bindgen_0_39_0(ptr, old_size, align, new_size); } diff --git a/third_party/rust/wit-bindgen-rt/src/cabi_realloc.o b/third_party/rust/wit-bindgen-rt/src/cabi_realloc.o index 34c267f112bc660a19f28245632dc51fb33dba7c..ea5f3988dc7cf7197fe595a30d5c93e794405a2f 100644 GIT binary patch delta 12 TcmZo=YGs<>%Vcah(SI8N7c&F! delta 12 TcmZo=YGs<>%VcCY(SI8N7Y+mG diff --git a/third_party/rust/wit-bindgen-rt/src/cabi_realloc.rs b/third_party/rust/wit-bindgen-rt/src/cabi_realloc.rs index b30b4cd0c344..5a2fd72f6864 100644 --- a/third_party/rust/wit-bindgen-rt/src/cabi_realloc.rs +++ b/third_party/rust/wit-bindgen-rt/src/cabi_realloc.rs @@ -1,7 +1,7 @@ // This file is generated by ./ci/rebuild-libcabi-realloc.sh -#[no_mangle] -pub unsafe extern "C" fn cabi_realloc_wit_bindgen_0_21_0( +#[unsafe(no_mangle)] +pub unsafe extern "C" fn cabi_realloc_wit_bindgen_0_39_0( old_ptr: *mut u8, old_len: usize, align: usize, diff --git a/third_party/rust/wit-bindgen-rt/src/lib.rs b/third_party/rust/wit-bindgen-rt/src/lib.rs index e84934ed883d..0f2858362712 100644 --- a/third_party/rust/wit-bindgen-rt/src/lib.rs +++ b/third_party/rust/wit-bindgen-rt/src/lib.rs @@ -2,7 +2,13 @@ extern crate alloc; +// Re-export `bitflags` so that we can reference it from macros. +#[cfg(feature = "bitflags")] +#[doc(hidden)] +pub use bitflags; + /// For more information about this see `./ci/rebuild-libcabi-realloc.sh`. +#[cfg(not(target_env = "p2"))] mod cabi_realloc; /// This function is called from generated bindings and will be deleted by @@ -13,7 +19,7 @@ mod cabi_realloc; /// /// For more information about this see `./ci/rebuild-libcabi-realloc.sh`. pub fn maybe_link_cabi_realloc() { - #[cfg(target_family = "wasm")] + #[cfg(all(target_family = "wasm", not(target_env = "p2")))] { extern "C" { fn cabi_realloc( @@ -44,6 +50,7 @@ pub fn maybe_link_cabi_realloc() { /// `cabi_realloc` module above. It's otherwise never explicitly called. /// /// For more information about this see `./ci/rebuild-libcabi-realloc.sh`. +#[cfg(not(target_env = "p2"))] pub unsafe fn cabi_realloc( old_ptr: *mut u8, old_len: usize, @@ -79,3 +86,33 @@ pub unsafe fn cabi_realloc( } return ptr; } + +/// Provide a hook for generated export functions to run static constructors at +/// most once. +/// +/// wit-bindgen-rust generates a call to this function at the start of all +/// component export functions. Importantly, it is not called as part of +/// `cabi_realloc`, which is a *core* export func, but should not execute ctors. +#[cfg(target_arch = "wasm32")] +pub fn run_ctors_once() { + static mut RUN: bool = false; + unsafe { + if !RUN { + // This function is synthesized by `wasm-ld` to run all static + // constructors. wasm-ld will either provide an implementation + // of this symbol, or synthesize a wrapper around each + // exported function to (unconditionally) run ctors. By using + // this function, the linked module is opting into "manually" + // running ctors. + extern "C" { + fn __wasm_call_ctors(); + } + __wasm_call_ctors(); + RUN = true; + } + } +} + +/// Support for using the Component Model Async ABI +#[cfg(feature = "async")] +pub mod async_support; diff --git a/third_party/rust/wit-bindgen-rt/src/libwit_bindgen_cabi_realloc.a b/third_party/rust/wit-bindgen-rt/src/libwit_bindgen_cabi_realloc.a index d6c8eb09e8e48db2e644c74e9bde5cbd2ee73854..709cea4605308d35b1481eab25579673ba75fcee 100644 GIT binary patch delta 12 UcmbQkJcoJ0V