diff --git a/.gitattributes b/.gitattributes index 7703608..9a11b44 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,7 @@ -# This is generated by `wit-bindgen` +# These are generated by `wit-bindgen` src/bindings.rs linguist-generated=true +src/proxy.rs linguist-generated=true +src/command.rs linguist-generated=true # This is copied from other repos so diffs aren't super interesting by default wit/deps linguist-generated=true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8e043ad..1b7fb0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,6 +17,7 @@ jobs: - run: cargo build --no-default-features - run: cargo build --target wasm32-wasi - run: cargo build --target wasm32-wasi --no-default-features + - run: cargo test --doc - name: Install Wasmtime uses: bytecodealliance/actions/wasmtime/setup@v1 with: @@ -29,7 +30,7 @@ jobs: - run: curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/v17.0.0/wasi_snapshot_preview1.command.wasm - run: wasm-tools component new ./target/wasm32-wasi/debug/examples/hello-world.wasm --adapt ./wasi_snapshot_preview1.command.wasm -o component.wasm - run: wasmtime run component.wasm - - run: cargo build --examples --target wasm32-unknown-unknown --features macros + - run: cargo build --examples --target wasm32-unknown-unknown - run: wasm-tools component new ./target/wasm32-unknown-unknown/debug/examples/cli_command.wasm -o component.wasm - run: wasmtime run component.wasm - run: wasm-tools component new ./target/wasm32-unknown-unknown/debug/examples/http_proxy.wasm -o component.wasm @@ -52,6 +53,6 @@ jobs: - uses: actions/checkout@v4 - name: Install Rust run: rustup update stable && rustup default stable - - run: cargo install wit-bindgen-cli@0.19.2 --locked + - run: cargo install wit-bindgen-cli@0.20.0 --locked - run: ./ci/regenerate.sh - run: git diff --exit-code diff --git a/Cargo.toml b/Cargo.toml index 038edc3..6ffc90c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,35 +12,26 @@ readme = "README.md" documentation = "https://docs.rs/wasi" [dependencies] -wit-bindgen = { version = "0.19.1", default-features = false, features = ['realloc'] } +wit-bindgen = { version = "0.20.0", default-features = false, features = ['realloc'] } # When built as part of libstd compiler_builtins = { version = "0.1", optional = true } core = { version = "1.0", optional = true, package = "rustc-std-workspace-core" } rustc-std-workspace-alloc = { version = "1.0", optional = true } -[build-dependencies] -quote = { version = "1.0", optional = true } - [features] default = ["std"] std = [] -macros = ["quote", "wit-bindgen/macros"] # Unstable feature to support being a libstd dependency rustc-dep-of-std = ["compiler_builtins", "core", "rustc-std-workspace-alloc"] -[package.metadata.docs.rs] -features = ["macros"] - [[example]] name = "cli-command" crate-type = ["cdylib"] -required-features = ["macros"] [[example]] name = "http-proxy" crate-type = ["cdylib"] -required-features = ["macros"] [badges] -maintenance = { status = "experimental" } \ No newline at end of file +maintenance = { status = "experimental" } diff --git a/build.rs b/build.rs deleted file mode 100644 index 0b3c941..0000000 --- a/build.rs +++ /dev/null @@ -1,105 +0,0 @@ -fn main() { - #[cfg(feature = "macros")] - generate_macros(); -} - -#[cfg(feature = "macros")] -fn generate_macros() { - use std::path::Path; - - let crate_root = std::env::var_os("CARGO_MANIFEST_DIR").unwrap(); - let wit_path = Path::new(&crate_root) - .join("wit") - .to_str() - .expect("project path must be valid UTF-8") - .to_string(); - - fn write_macro(filename: &str, contents: impl ToString) { - let out_dir = std::env::var_os("OUT_DIR").unwrap(); - let dest_path = Path::new(&out_dir).join(filename); - std::fs::write(dest_path, contents.to_string()).unwrap(); - } - - write_macro( - "cli_run_export.rs", - quote::quote! { - #[doc(hidden)] - #[macro_export] - macro_rules! cli_run_export { - ($export_impl:path) => { - ::wasi::macros::wit_bindgen::generate!({ - path: #wit_path, - world: "wasi:cli/command", - exports: { - "wasi:cli/run": $export_impl, - }, - with: { - "wasi:cli/environment@0.2.0": ::wasi::cli::environment, - "wasi:cli/exit@0.2.0": ::wasi::cli::exit, - "wasi:cli/stderr@0.2.0": ::wasi::cli::stderr, - "wasi:cli/stdin@0.2.0": ::wasi::cli::stdin, - "wasi:cli/stdout@0.2.0": ::wasi::cli::stdout, - "wasi:cli/terminal-input@0.2.0": ::wasi::cli::terminal_input, - "wasi:cli/terminal-output@0.2.0": ::wasi::cli::terminal_output, - "wasi:cli/terminal-stderr@0.2.0": ::wasi::cli::terminal_stderr, - "wasi:cli/terminal-stdin@0.2.0": ::wasi::cli::terminal_stdin, - "wasi:cli/terminal-stdout@0.2.0": ::wasi::cli::terminal_stdout, - "wasi:clocks/monotonic-clock@0.2.0": ::wasi::clocks::monotonic_clock, - "wasi:clocks/wall-clock@0.2.0": ::wasi::clocks::wall_clock, - "wasi:filesystem/preopens@0.2.0": ::wasi::filesystem::preopens, - "wasi:filesystem/types@0.2.0": ::wasi::filesystem::types, - "wasi:io/error@0.2.0": ::wasi::io::error, - "wasi:io/poll@0.2.0": ::wasi::io::poll, - "wasi:io/streams@0.2.0": ::wasi::io::streams, - "wasi:random/insecure-seed@0.2.0": ::wasi::random::insecure_seed, - "wasi:random/insecure@0.2.0": ::wasi::random::insecure, - "wasi:random/random@0.2.0": ::wasi::random::random, - "wasi:sockets/instance-network@0.2.0": ::wasi::sockets::instance_network, - "wasi:sockets/ip-name-lookup@0.2.0": ::wasi::sockets::ip_name_lookup, - "wasi:sockets/network@0.2.0": ::wasi::sockets::network, - "wasi:sockets/tcp-create-socket@0.2.0": ::wasi::sockets::tcp_create_socket, - "wasi:sockets/tcp@0.2.0": ::wasi::sockets::tcp, - "wasi:sockets/udp-create-socket@0.2.0": ::wasi::sockets::udp_create_socket, - "wasi:sockets/udp@0.2.0": ::wasi::sockets::udp, - }, - runtime_path: "::wasi::macros::wit_bindgen::rt", - }); - } - } - }, - ); - - write_macro( - "http_incoming_handler_export.rs", - quote::quote! { - #[doc(hidden)] - #[macro_export] - macro_rules! http_incoming_handler_export { - ($export_impl:path) => { - ::wasi::macros::wit_bindgen::generate!({ - path: #wit_path, - world: "wasi:http/proxy", - exports: { - "wasi:http/incoming-handler": $export_impl, - }, - with: { - "wasi:cli/stderr@0.2.0": ::wasi::cli::stderr, - "wasi:cli/stdin@0.2.0": ::wasi::cli::stdin, - "wasi:cli/stdout@0.2.0": ::wasi::cli::stdout, - "wasi:clocks/monotonic-clock@0.2.0": ::wasi::clocks::monotonic_clock, - "wasi:clocks/wall-clock@0.2.0": ::wasi::clocks::wall_clock, - "wasi:http/outgoing-handler@0.2.0": ::wasi::http::outgoing_handler, - "wasi:http/types@0.2.0": ::wasi::http::types, - "wasi:io/error@0.2.0": ::wasi::io::error, - "wasi:io/poll@0.2.0": ::wasi::io::poll, - "wasi:io/streams@0.2.0": ::wasi::io::streams, - "wasi:random/random@0.2.0": ::wasi::random::random, - }, - runtime_path: "::wasi::macros::wit_bindgen::rt", - }); - } - } - }, - ); - println!("cargo:rerun-if-changed=build.rs"); -} diff --git a/ci/regenerate.sh b/ci/regenerate.sh index 63ead79..14ef09d 100755 --- a/ci/regenerate.sh +++ b/ci/regenerate.sh @@ -2,14 +2,81 @@ set -ex -wit-bindgen rust wit --out-dir src --std-feature --type-section-suffix rust-wasi-from-crates-io +generate() { + file="$1" + shift + wit-bindgen rust wit --out-dir src --std-feature "$@" -# rustfmt chokes on the raw output of wit-bindgen right now due to trailling -# whitespace (unsure as to why), so format it with some options first to get it -# into a better state before applying the final format with default options -# which gets this to succeed. + # rustfmt chokes on the raw output of wit-bindgen right now due to trailling + # whitespace (unsure as to why), so format it with some options first to get it + # into a better state before applying the final format with default options + # which gets this to succeed. + # + # NB: this should be considered a bug in wit-bindgen that this is required to do + # twice. Passing `--rustfmt` to `wit-bindgen` should work. + rustfmt $file --edition 2021 --config-path ./ci/rustfmt-bindings.toml + rustfmt $file --edition 2021 +} + +# 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 bindings for the `wasi:cli/command` world specifically, namely the +# macro `export_command`. # -# NB: this should be considered a bug in wit-bindgen that this is required to do -# twice. Passing `--rustfmt` to `wit-bindgen` should work. -rustfmt src/bindings.rs --edition 2021 --config-path ./ci/rustfmt-bindings.toml -rustfmt src/bindings.rs --edition 2021 +# 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" +generate src/command.rs \ + --world wasi:cli/command \ + --with "$with" \ + --type-section-suffix rust-wasi-from-crates-io-command-world \ + --default-bindings-module wasi \ + --pub-export-macro \ + --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" +generate src/proxy.rs \ + --world wasi:http/proxy \ + --with "$with" \ + --type-section-suffix rust-wasi-from-crates-io-proxy-world \ + --default-bindings-module wasi \ + --pub-export-macro \ + --export-macro-name _export_proxy diff --git a/examples/cli-command.rs b/examples/cli-command.rs index 7136530..809d15a 100644 --- a/examples/cli-command.rs +++ b/examples/cli-command.rs @@ -1,8 +1,8 @@ -wasi::cli::run::export!(Example); +wasi::cli::command::export!(Example); struct Example; -impl exports::wasi::cli::run::Guest for 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(); diff --git a/examples/http-proxy.rs b/examples/http-proxy.rs index 26a220a..9a2e54a 100644 --- a/examples/http-proxy.rs +++ b/examples/http-proxy.rs @@ -2,11 +2,11 @@ use wasi::http::types::{ Fields, IncomingRequest, OutgoingBody, OutgoingResponse, ResponseOutparam, }; -wasi::http::incoming_handler::export!(Example); +wasi::http::proxy::export!(Example); struct Example; -impl exports::wasi::http::incoming_handler::Guest for 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(); diff --git a/src/bindings.rs b/src/bindings.rs index 09bb881..86f8877 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -1,4 +1,4 @@ -// Generated by `wit-bindgen` 0.19.2. DO NOT EDIT! +// Generated by `wit-bindgen` 0.20.0. DO NOT EDIT! // Options used: // * std_feature pub mod wasi { @@ -9,7 +9,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. /// @@ -19,138 +21,126 @@ pub mod wasi { /// 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. - pub fn get_environment() -> wit_bindgen::rt::vec::Vec<( - wit_bindgen::rt::string::String, - wit_bindgen::rt::string::String, - )> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn get_environment() -> _rt::Vec<(_rt::String, _rt::String)> { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:cli/environment@0.2.0")] extern "C" { #[link_name = "get-environment"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(4).cast::(); let base9 = l1; let len9 = l2; - let mut result9 = Vec::with_capacity(len9 as usize); + let mut result9 = _rt::Vec::with_capacity(len9); for i in 0..len9 { - let base = base9 + i * 16; + let base = base9.add(i * 16); let e9 = { - let l3 = *((base + 0) as *const i32); - let l4 = *((base + 4) as *const i32); - let len5 = l4 as usize; - let bytes5 = Vec::from_raw_parts(l3 as *mut _, len5, len5); - let l6 = *((base + 8) as *const i32); - let l7 = *((base + 12) as *const i32); - let len8 = l7 as usize; - let bytes8 = Vec::from_raw_parts(l6 as *mut _, len8, len8); - - ( - wit_bindgen::rt::string_lift(bytes5), - wit_bindgen::rt::string_lift(bytes8), - ) + 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)) }; result9.push(e9); } - wit_bindgen::rt::dealloc(base9, (len9 as usize) * 16, 4); + _rt::cabi_dealloc(base9, len9 * 16, 4); result9 } } #[allow(unused_unsafe, clippy::all)] /// Get the POSIX-style arguments to the program. - pub fn get_arguments() -> wit_bindgen::rt::vec::Vec { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn get_arguments() -> _rt::Vec<_rt::String> { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:cli/environment@0.2.0")] extern "C" { #[link_name = "get-arguments"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(4).cast::(); let base6 = l1; let len6 = l2; - let mut result6 = Vec::with_capacity(len6 as usize); + let mut result6 = _rt::Vec::with_capacity(len6); for i in 0..len6 { - let base = base6 + i * 8; + let base = base6.add(i * 8); let e6 = { - let l3 = *((base + 0) as *const i32); - let l4 = *((base + 4) as *const i32); - let len5 = l4 as usize; - let bytes5 = Vec::from_raw_parts(l3 as *mut _, len5, len5); + 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); - wit_bindgen::rt::string_lift(bytes5) + _rt::string_lift(bytes5) }; result6.push(e6); } - wit_bindgen::rt::dealloc(base6, (len6 as usize) * 8, 4); + _rt::cabi_dealloc(base6, len6 * 8, 4); result6 } } #[allow(unused_unsafe, clippy::all)] /// Return a path that programs should use as their initial current working /// directory, interpreting `.` as shorthand for this. - pub fn initial_cwd() -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn initial_cwd() -> Option<_rt::String> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:cli/environment@0.2.0")] extern "C" { #[link_name = "initial-cwd"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -161,12 +151,11 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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<(), ()>) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let result0 = match status { Ok(_) => 0i32, @@ -193,12 +182,11 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/stdin@0.2.0")] @@ -222,12 +210,11 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/stdout@0.2.0")] @@ -251,12 +238,11 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:cli/stderr@0.2.0")] @@ -280,35 +266,37 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl TerminalInput { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for TerminalInput { + unsafe impl _rt::WasmResource for TerminalInput { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -333,35 +321,37 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl TerminalOutput { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for TerminalOutput { + unsafe impl _rt::WasmResource for TerminalOutput { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -386,37 +376,37 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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)] /// If stdin is connected to a terminal, return a `terminal-input` handle /// allowing further interaction with it. pub fn get_terminal_stdin() -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:cli/terminal-stdin@0.2.0")] extern "C" { #[link_name = "get-terminal-stdin"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::cli::terminal_input::TerminalInput::from_handle( l2 as u32, @@ -424,7 +414,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -435,38 +425,38 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; #[allow(unused_unsafe, clippy::all)] /// If stdout is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. pub fn get_terminal_stdout() -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:cli/terminal-stdout@0.2.0")] extern "C" { #[link_name = "get-terminal-stdout"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( l2 as u32, @@ -474,7 +464,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -485,38 +475,38 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; #[allow(unused_unsafe, clippy::all)] /// If stderr is connected to a terminal, return a `terminal-output` handle /// allowing further interaction with it. pub fn get_terminal_stderr() -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:cli/terminal-stderr@0.2.0")] extern "C" { #[link_name = "get-terminal-stderr"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( l2 as u32, @@ -524,7 +514,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -537,7 +527,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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 /// unspecified initial value, and can only be compared to instances from @@ -551,8 +543,6 @@ pub mod wasi { /// The clock is monotonic, therefore calling this function repeatedly will /// produce a sequence of non-decreasing values. pub fn now() -> Instant { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] @@ -573,8 +563,6 @@ pub mod wasi { /// Query the resolution of the clock. Returns the duration of time /// corresponding to a clock tick. pub fn resolution() -> Duration { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] @@ -595,8 +583,6 @@ pub mod wasi { /// Create a `pollable` which will resolve once the specified instant /// occured. pub fn subscribe_instant(when: Instant) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] @@ -609,7 +595,7 @@ pub mod wasi { fn wit_import(_: i64) -> i32 { unreachable!() } - let ret = wit_import(wit_bindgen::rt::as_i64(when)); + let ret = wit_import(_rt::as_i64(when)); super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) } } @@ -618,8 +604,6 @@ pub mod wasi { /// elapsed, starting at the time at which this function was called. /// occured. pub fn subscribe_duration(when: Duration) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] @@ -632,7 +616,7 @@ pub mod wasi { fn wit_import(_: i64) -> i32 { unreachable!() } - let ret = wit_import(wit_bindgen::rt::as_i64(when)); + let ret = wit_import(_rt::as_i64(when)); super::super::super::wasi::io::poll::Pollable::from_handle(ret as u32) } } @@ -643,7 +627,8 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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)] @@ -674,27 +659,25 @@ pub mod wasi { /// [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 pub fn now() -> Datetime { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")] extern "C" { #[link_name = "now"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i64); - let l2 = *((ptr0 + 8) as *const i32); + let l1 = *ptr0.add(0).cast::(); + let l2 = *ptr0.add(8).cast::(); Datetime { seconds: l1 as u64, nanoseconds: l2 as u32, @@ -706,27 +689,25 @@ pub mod wasi { /// /// The nanoseconds field of the output is always less than 1000000000. pub fn resolution() -> Datetime { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")] extern "C" { #[link_name = "resolution"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i64); - let l2 = *((ptr0 + 8) as *const i32); + let l1 = *ptr0.add(0).cast::(); + let l2 = *ptr0.add(8).cast::(); Datetime { seconds: l1 as u64, nanoseconds: l2 as u32, @@ -742,7 +723,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; pub type Error = super::super::super::wasi::io::streams::Error; @@ -963,7 +946,7 @@ pub mod wasi { /// The type of the file referred to by this directory entry. pub type_: DescriptorType, /// The name of the object. - pub name: wit_bindgen::rt::string::String, + pub name: _rt::String, } impl ::core::fmt::Debug for DirectoryEntry { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { @@ -1287,29 +1270,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct Descriptor { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl Descriptor { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for Descriptor { + unsafe impl _rt::WasmResource for Descriptor { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -1333,29 +1316,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct DirectoryEntryStream { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl DirectoryEntryStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for DirectoryEntryStream { + unsafe impl _rt::WasmResource for DirectoryEntryStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -1385,34 +1368,28 @@ pub mod wasi { /// /// Note: This allows using `read-stream`, which is similar to `read` in POSIX. pub fn read_via_stream(&self, offset: Filesize) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]descriptor.read-via-stream"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(offset), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::InputStream::from_handle( l2 as u32, @@ -1422,13 +1399,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1445,34 +1422,28 @@ pub mod wasi { &self, offset: Filesize, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]descriptor.write-via-stream"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(offset), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::OutputStream::from_handle(l2 as u32) }; @@ -1480,13 +1451,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1500,30 +1471,28 @@ pub mod wasi { /// Note: This allows using `write-stream`, which is similar to `write` with /// `O_APPEND` in in POSIX. pub fn append_via_stream(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]descriptor.append-via-stream"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::OutputStream::from_handle(l2 as u32) }; @@ -1531,13 +1500,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1553,32 +1522,30 @@ pub mod wasi { length: Filesize, advice: Advice, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.advise"] - fn wit_import(_: i32, _: i64, _: i64, _: i32, _: i32); + fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i64, _: i32, _: i32) { + fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, - wit_bindgen::rt::as_i64(offset), - wit_bindgen::rt::as_i64(length), + _rt::as_i64(offset), + _rt::as_i64(length), advice.clone() as i32, ptr0, ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -1586,13 +1553,13 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l2 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1606,26 +1573,24 @@ pub mod wasi { /// /// Note: This is similar to `fdatasync` in POSIX. pub fn sync_data(&self) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.sync-data"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -1633,13 +1598,13 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l2 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1653,30 +1618,28 @@ pub mod wasi { /// Note: This returns the value that was the `fs_flags` value returned /// from `fdstat_get` in earlier versions of WASI. pub fn get_flags(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.get-flags"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); DescriptorFlags::empty() | DescriptorFlags::from_bits_retain(((l2 as u8) << 0) as _) @@ -1685,13 +1648,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 1) as *const u8)); + let l3 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1709,30 +1672,28 @@ pub mod wasi { /// Note: This returns the value that was the `fs_filetype` value returned /// from `fdstat_get` in earlier versions of WASI. pub fn get_type(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.get-type"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); DescriptorType::_lift(l2 as u8) }; @@ -1740,13 +1701,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 1) as *const u8)); + let l3 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1758,26 +1719,24 @@ pub mod wasi { /// /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. pub fn set_size(&self, size: Filesize) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.set-size"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(size), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(size), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -1785,13 +1744,13 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l2 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1808,12 +1767,10 @@ pub mod wasi { data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 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), @@ -1823,11 +1780,7 @@ pub mod wasi { nanoseconds: nanoseconds0, } = e; - ( - 2i32, - wit_bindgen::rt::as_i64(seconds0), - wit_bindgen::rt::as_i32(nanoseconds0), - ) + (2i32, _rt::as_i64(seconds0), _rt::as_i32(nanoseconds0)) } }; let (result3_0, result3_1, result3_2) = match data_modification_timestamp { @@ -1839,14 +1792,10 @@ pub mod wasi { nanoseconds: nanoseconds2, } = e; - ( - 2i32, - wit_bindgen::rt::as_i64(seconds2), - wit_bindgen::rt::as_i32(nanoseconds2), - ) + (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) } }; - let ptr4 = ret_area.as_mut_ptr() as i32; + let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { @@ -1859,7 +1808,7 @@ pub mod wasi { _: i32, _: i64, _: i32, - _: i32, + _: *mut u8, ); } @@ -1872,7 +1821,7 @@ pub mod wasi { _: i32, _: i64, _: i32, - _: i32, + _: *mut u8, ) { unreachable!() } @@ -1886,7 +1835,7 @@ pub mod wasi { result3_2, ptr4, ); - let l5 = i32::from(*((ptr4 + 0) as *const u8)); + let l5 = i32::from(*ptr4.add(0).cast::()); match l5 { 0 => { let e = (); @@ -1894,13 +1843,13 @@ pub mod wasi { } 1 => { let e = { - let l6 = i32::from(*((ptr4 + 1) as *const u8)); + let l6 = i32::from(*ptr4.add(1).cast::()); ErrorCode::_lift(l6 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1922,56 +1871,54 @@ pub mod wasi { &self, length: Filesize, offset: Filesize, - ) -> Result<(wit_bindgen::rt::vec::Vec, bool), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + ) -> Result<(_rt::Vec, bool), ErrorCode> { unsafe { #[repr(align(4))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.read"] - fn wit_import(_: i32, _: i64, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: i64, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, - wit_bindgen::rt::as_i64(length), - wit_bindgen::rt::as_i64(offset), + _rt::as_i64(length), + _rt::as_i64(offset), ptr0, ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let l5 = i32::from(*((ptr0 + 12) as *const u8)); + 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::()); ( - Vec::from_raw_parts(l2 as *mut _, len4, len4), - wit_bindgen::rt::bool_lift(l5 as u8), + _rt::Vec::from_raw_parts(l2.cast(), len4, len4), + _rt::bool_lift(l5 as u8), ) }; Ok(e) } 1 => { let e = { - let l6 = i32::from(*((ptr0 + 4) as *const u8)); + let l6 = i32::from(*ptr0.add(4).cast::()); ErrorCode::_lift(l6 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -1992,39 +1939,37 @@ pub mod wasi { buffer: &[u8], offset: Filesize, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); let vec0 = buffer; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.write"] - fn wit_import(_: i32, _: i32, _: i32, _: i64, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, - ptr0, + ptr0.cast_mut(), len0, - wit_bindgen::rt::as_i64(offset), + _rt::as_i64(offset), ptr1, ); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = { - let l3 = *((ptr1 + 8) as *const i64); + let l3 = *ptr1.add(8).cast::(); l3 as u64 }; @@ -2032,13 +1977,13 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr1 + 8) as *const u8)); + let l4 = i32::from(*ptr1.add(8).cast::()); ErrorCode::_lift(l4 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2055,30 +2000,28 @@ pub mod wasi { /// directory. Multiple streams may be active on the same directory, and they /// do not interfere with each other. pub fn read_directory(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]descriptor.read-directory"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); DirectoryEntryStream::from_handle(l2 as u32) }; @@ -2086,13 +2029,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2106,26 +2049,24 @@ pub mod wasi { /// /// Note: This is similar to `fsync` in POSIX. pub fn sync(&self) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.sync"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -2133,13 +2074,13 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l2 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2150,29 +2091,27 @@ pub mod wasi { /// /// Note: This is similar to `mkdirat` in POSIX. pub fn create_directory_at(&self, path: &str) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = path; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.create-directory-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -2180,13 +2119,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 1) as *const u8)); + let l3 = i32::from(*ptr1.add(1).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2203,35 +2142,33 @@ pub mod wasi { /// /// Note: This was called `fd_filestat_get` in earlier versions of WASI. pub fn stat(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 104]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]descriptor.stat"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 8) as *const u8)); - let l3 = *((ptr0 + 16) as *const i64); - let l4 = *((ptr0 + 24) as *const i64); - let l5 = i32::from(*((ptr0 + 32) as *const u8)); - let l8 = i32::from(*((ptr0 + 56) as *const u8)); - let l11 = i32::from(*((ptr0 + 80) as *const u8)); + 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::()); DescriptorStat { type_: DescriptorType::_lift(l2 as u8), @@ -2241,8 +2178,8 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l6 = *((ptr0 + 40) as *const i64); - let l7 = *((ptr0 + 48) as *const i32); + let l6 = *ptr0.add(40).cast::(); + let l7 = *ptr0.add(48).cast::(); super::super::super::wasi::clocks::wall_clock::Datetime { seconds: l6 as u64, @@ -2251,14 +2188,14 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, data_modification_timestamp: match l8 { 0 => None, 1 => { let e = { - let l9 = *((ptr0 + 64) as *const i64); - let l10 = *((ptr0 + 72) as *const i32); + let l9 = *ptr0.add(64).cast::(); + let l10 = *ptr0.add(72).cast::(); super::super::super::wasi::clocks::wall_clock::Datetime { seconds: l9 as u64, @@ -2267,14 +2204,14 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, status_change_timestamp: match l11 { 0 => None, 1 => { let e = { - let l12 = *((ptr0 + 88) as *const i64); - let l13 = *((ptr0 + 96) as *const i32); + let l12 = *ptr0.add(88).cast::(); + let l13 = *ptr0.add(96).cast::(); super::super::super::wasi::clocks::wall_clock::Datetime { seconds: l12 as u64, @@ -2283,7 +2220,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -2291,13 +2228,13 @@ pub mod wasi { } 1 => { let e = { - let l14 = i32::from(*((ptr0 + 8) as *const u8)); + let l14 = i32::from(*ptr0.add(8).cast::()); ErrorCode::_lift(l14 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2316,45 +2253,43 @@ pub mod wasi { path_flags: PathFlags, path: &str, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 104]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 104]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 104]); let flags0 = path_flags; let vec1 = path; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let ptr2 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.stat-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, (flags0.bits() >> 0) as i32, - ptr1, + ptr1.cast_mut(), len1, ptr2, ); - let l3 = i32::from(*((ptr2 + 0) as *const u8)); + let l3 = i32::from(*ptr2.add(0).cast::()); match l3 { 0 => { let e = { - let l4 = i32::from(*((ptr2 + 8) as *const u8)); - let l5 = *((ptr2 + 16) as *const i64); - let l6 = *((ptr2 + 24) as *const i64); - let l7 = i32::from(*((ptr2 + 32) as *const u8)); - let l10 = i32::from(*((ptr2 + 56) as *const u8)); - let l13 = i32::from(*((ptr2 + 80) as *const u8)); + 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::()); DescriptorStat { type_: DescriptorType::_lift(l4 as u8), @@ -2364,8 +2299,8 @@ pub mod wasi { 0 => None, 1 => { let e = { - let l8 = *((ptr2 + 40) as *const i64); - let l9 = *((ptr2 + 48) as *const i32); + let l8 = *ptr2.add(40).cast::(); + let l9 = *ptr2.add(48).cast::(); super::super::super::wasi::clocks::wall_clock::Datetime { seconds: l8 as u64, @@ -2374,14 +2309,14 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, data_modification_timestamp: match l10 { 0 => None, 1 => { let e = { - let l11 = *((ptr2 + 64) as *const i64); - let l12 = *((ptr2 + 72) as *const i32); + let l11 = *ptr2.add(64).cast::(); + let l12 = *ptr2.add(72).cast::(); super::super::super::wasi::clocks::wall_clock::Datetime { seconds: l11 as u64, @@ -2390,14 +2325,14 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, status_change_timestamp: match l13 { 0 => None, 1 => { let e = { - let l14 = *((ptr2 + 88) as *const i64); - let l15 = *((ptr2 + 96) as *const i32); + let l14 = *ptr2.add(88).cast::(); + let l15 = *ptr2.add(96).cast::(); super::super::super::wasi::clocks::wall_clock::Datetime { seconds: l14 as u64, @@ -2406,7 +2341,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -2414,13 +2349,13 @@ pub mod wasi { } 1 => { let e = { - let l16 = i32::from(*((ptr2 + 8) as *const u8)); + let l16 = i32::from(*ptr2.add(8).cast::()); ErrorCode::_lift(l16 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2440,16 +2375,14 @@ pub mod wasi { data_access_timestamp: NewTimestamp, data_modification_timestamp: NewTimestamp, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let flags0 = path_flags; let vec1 = path; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); let (result3_0, result3_1, result3_2) = match data_access_timestamp { NewTimestamp::NoChange => (0i32, 0i64, 0i32), NewTimestamp::Now => (1i32, 0i64, 0i32), @@ -2459,11 +2392,7 @@ pub mod wasi { nanoseconds: nanoseconds2, } = e; - ( - 2i32, - wit_bindgen::rt::as_i64(seconds2), - wit_bindgen::rt::as_i32(nanoseconds2), - ) + (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) } }; let (result5_0, result5_1, result5_2) = match data_modification_timestamp { @@ -2475,14 +2404,10 @@ pub mod wasi { nanoseconds: nanoseconds4, } = e; - ( - 2i32, - wit_bindgen::rt::as_i64(seconds4), - wit_bindgen::rt::as_i32(nanoseconds4), - ) + (2i32, _rt::as_i64(seconds4), _rt::as_i32(nanoseconds4)) } }; - let ptr6 = ret_area.as_mut_ptr() as i32; + let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { @@ -2490,15 +2415,15 @@ pub mod wasi { fn wit_import( _: i32, _: i32, - _: i32, - _: i32, + _: *mut u8, + _: usize, _: i32, _: i64, _: i32, _: i32, _: i64, _: i32, - _: i32, + _: *mut u8, ); } @@ -2506,22 +2431,22 @@ pub mod wasi { fn wit_import( _: i32, _: i32, - _: i32, - _: i32, + _: *mut u8, + _: usize, _: i32, _: i64, _: i32, _: i32, _: i64, _: i32, - _: i32, + _: *mut u8, ) { unreachable!() } wit_import( (self).handle() as i32, (flags0.bits() >> 0) as i32, - ptr1, + ptr1.cast_mut(), len1, result3_0, result3_1, @@ -2531,7 +2456,7 @@ pub mod wasi { result5_2, ptr6, ); - let l7 = i32::from(*((ptr6 + 0) as *const u8)); + let l7 = i32::from(*ptr6.add(0).cast::()); match l7 { 0 => { let e = (); @@ -2539,13 +2464,13 @@ pub mod wasi { } 1 => { let e = { - let l8 = i32::from(*((ptr6 + 1) as *const u8)); + let l8 = i32::from(*ptr6.add(1).cast::()); ErrorCode::_lift(l8 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2562,20 +2487,18 @@ pub mod wasi { new_descriptor: &Descriptor, new_path: &str, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 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() as i32; - let len1 = vec1.len() as i32; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); let vec2 = new_path; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - let ptr3 = ret_area.as_mut_ptr() as i32; + let ptr2 = vec2.as_ptr().cast::(); + 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")] extern "C" { @@ -2583,12 +2506,12 @@ pub mod wasi { fn wit_import( _: i32, _: i32, + _: *mut u8, + _: usize, _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, + _: *mut u8, + _: usize, + _: *mut u8, ); } @@ -2596,26 +2519,26 @@ pub mod wasi { fn wit_import( _: i32, _: i32, + _: *mut u8, + _: usize, _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, + _: *mut u8, + _: usize, + _: *mut u8, ) { unreachable!() } wit_import( (self).handle() as i32, (flags0.bits() >> 0) as i32, - ptr1, + ptr1.cast_mut(), len1, (new_descriptor).handle() as i32, - ptr2, + ptr2.cast_mut(), len2, ptr3, ); - let l4 = i32::from(*((ptr3 + 0) as *const u8)); + let l4 = i32::from(*ptr3.add(0).cast::()); match l4 { 0 => { let e = (); @@ -2623,13 +2546,13 @@ pub mod wasi { } 1 => { let e = { - let l5 = i32::from(*((ptr3 + 1) as *const u8)); + let l5 = i32::from(*ptr3.add(1).cast::()); ErrorCode::_lift(l5 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2661,44 +2584,58 @@ pub mod wasi { open_flags: OpenFlags, flags: DescriptorFlags, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let flags0 = path_flags; let vec1 = path; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); let flags2 = open_flags; let flags3 = flags; - let ptr4 = ret_area.as_mut_ptr() as i32; + let ptr4 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] extern "C" { #[link_name = "[method]descriptor.open-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: i32, + _: *mut u8, + ); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: i32, + _: *mut u8, + ) { unreachable!() } wit_import( (self).handle() as i32, (flags0.bits() >> 0) as i32, - ptr1, + ptr1.cast_mut(), len1, (flags2.bits() >> 0) as i32, (flags3.bits() >> 0) as i32, ptr4, ); - let l5 = i32::from(*((ptr4 + 0) as *const u8)); + let l5 = i32::from(*ptr4.add(0).cast::()); match l5 { 0 => { let e = { - let l6 = *((ptr4 + 4) as *const i32); + let l6 = *ptr4.add(4).cast::(); Descriptor::from_handle(l6 as u32) }; @@ -2706,13 +2643,13 @@ pub mod wasi { } 1 => { let e = { - let l7 = i32::from(*((ptr4 + 4) as *const u8)); + let l7 = i32::from(*ptr4.add(4).cast::()); ErrorCode::_lift(l7 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2725,54 +2662,49 @@ pub mod wasi { /// filesystem, this function fails with `error-code::not-permitted`. /// /// Note: This is similar to `readlinkat` in POSIX. - pub fn readlink_at( - &self, - path: &str, - ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); let vec0 = path; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.readlink-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = { - let l3 = *((ptr1 + 4) as *const i32); - let l4 = *((ptr1 + 8) as *const i32); - let len5 = l4 as usize; - let bytes5 = Vec::from_raw_parts(l3 as *mut _, len5, len5); + 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); - wit_bindgen::rt::string_lift(bytes5) + _rt::string_lift(bytes5) }; Ok(e) } 1 => { let e = { - let l6 = i32::from(*((ptr1 + 4) as *const u8)); + let l6 = i32::from(*ptr1.add(4).cast::()); ErrorCode::_lift(l6 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2785,29 +2717,27 @@ pub mod wasi { /// /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. pub fn remove_directory_at(&self, path: &str) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = path; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.remove-directory-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -2815,13 +2745,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 1) as *const u8)); + let l3 = i32::from(*ptr1.add(1).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2837,40 +2767,54 @@ pub mod wasi { new_descriptor: &Descriptor, new_path: &str, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = old_path; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); let vec1 = new_path; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let ptr2 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.rename-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } wit_import( (self).handle() as i32, - ptr0, + ptr0.cast_mut(), len0, (new_descriptor).handle() as i32, - ptr1, + ptr1.cast_mut(), len1, ptr2, ); - let l3 = i32::from(*((ptr2 + 0) as *const u8)); + let l3 = i32::from(*ptr2.add(0).cast::()); match l3 { 0 => { let e = (); @@ -2878,13 +2822,13 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr2 + 1) as *const u8)); + let l4 = i32::from(*ptr2.add(1).cast::()); ErrorCode::_lift(l4 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2898,32 +2842,51 @@ pub mod wasi { /// /// Note: This is similar to `symlinkat` in POSIX. pub fn symlink_at(&self, old_path: &str, new_path: &str) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = old_path; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); let vec1 = new_path; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let ptr2 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.symlink-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1, len1, ptr2); - let l3 = i32::from(*((ptr2 + 0) as *const u8)); + 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 { 0 => { let e = (); @@ -2931,13 +2894,13 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr2 + 1) as *const u8)); + let l4 = i32::from(*ptr2.add(1).cast::()); ErrorCode::_lift(l4 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2949,29 +2912,27 @@ pub mod wasi { /// Return `error-code::is-directory` if the path refers to a directory. /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. pub fn unlink_file_at(&self, path: &str) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = path; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.unlink-file-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -2979,13 +2940,13 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 1) as *const u8)); + let l3 = i32::from(*ptr1.add(1).cast::()); ErrorCode::_lift(l3 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -2999,8 +2960,6 @@ pub mod wasi { /// wasi-filesystem does not expose device and inode numbers, so this function /// may be used instead. pub fn is_same_object(&self, other: &Descriptor) -> bool { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] @@ -3014,7 +2973,7 @@ pub mod wasi { unreachable!() } let ret = wit_import((self).handle() as i32, (other).handle() as i32); - wit_bindgen::rt::bool_lift(ret as u8) + _rt::bool_lift(ret as u8) } } } @@ -3040,31 +2999,29 @@ pub mod wasi { /// /// However, none of these is required. pub fn metadata_hash(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 24]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]descriptor.metadata-hash"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); - let l3 = *((ptr0 + 16) as *const i64); + let l2 = *ptr0.add(8).cast::(); + let l3 = *ptr0.add(16).cast::(); MetadataHashValue { lower: l2 as u64, @@ -3075,13 +3032,13 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr0 + 8) as *const u8)); + let l4 = i32::from(*ptr0.add(8).cast::()); ErrorCode::_lift(l4 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -3097,41 +3054,39 @@ pub mod wasi { path_flags: PathFlags, path: &str, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 24]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 24]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]); let flags0 = path_flags; let vec1 = path; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let ptr2 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]descriptor.metadata-hash-at"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, (flags0.bits() >> 0) as i32, - ptr1, + ptr1.cast_mut(), len1, ptr2, ); - let l3 = i32::from(*((ptr2 + 0) as *const u8)); + let l3 = i32::from(*ptr2.add(0).cast::()); match l3 { 0 => { let e = { - let l4 = *((ptr2 + 8) as *const i64); - let l5 = *((ptr2 + 16) as *const i64); + let l4 = *ptr2.add(8).cast::(); + let l5 = *ptr2.add(16).cast::(); MetadataHashValue { lower: l4 as u64, @@ -3142,13 +3097,13 @@ pub mod wasi { } 1 => { let e = { - let l6 = i32::from(*((ptr2 + 8) as *const u8)); + let l6 = i32::from(*ptr2.add(8).cast::()); ErrorCode::_lift(l6 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -3157,63 +3112,61 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Read a single directory entry from a `directory-entry-stream`. pub fn read_directory_entry(&self) -> Result, ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 20]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]directory-entry-stream.read-directory-entry"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); match l2 { 0 => None, 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); - let l4 = *((ptr0 + 12) as *const i32); - let l5 = *((ptr0 + 16) as *const i32); - let len6 = l5 as usize; + 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 = - Vec::from_raw_parts(l4 as *mut _, len6, len6); + _rt::Vec::from_raw_parts(l4.cast(), len6, len6); DirectoryEntry { type_: DescriptorType::_lift(l3 as u8), - name: wit_bindgen::rt::string_lift(bytes6), + name: _rt::string_lift(bytes6), } }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; Ok(e) } 1 => { let e = { - let l7 = i32::from(*((ptr0 + 4) as *const u8)); + let l7 = i32::from(*ptr0.add(4).cast::()); ErrorCode::_lift(l7 as u8) }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -3230,37 +3183,35 @@ pub mod wasi { /// Note that this function is fallible because not all stream-related /// errors are filesystem-related errors. pub fn filesystem_error_code(err: &Error) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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:filesystem/types@0.2.0")] extern "C" { #[link_name = "filesystem-error-code"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((err).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); ErrorCode::_lift(l2 as u8) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -3271,54 +3222,52 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. - pub fn get_directories( - ) -> wit_bindgen::rt::vec::Vec<(Descriptor, wit_bindgen::rt::string::String)> - { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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/preopens@0.2.0")] extern "C" { #[link_name = "get-directories"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(4).cast::(); let base7 = l1; let len7 = l2; - let mut result7 = Vec::with_capacity(len7 as usize); + let mut result7 = _rt::Vec::with_capacity(len7); for i in 0..len7 { - let base = base7 + i * 12; + let base = base7.add(i * 12); let e7 = { - let l3 = *((base + 0) as *const i32); - let l4 = *((base + 4) as *const i32); - let l5 = *((base + 8) as *const i32); - let len6 = l5 as usize; - let bytes6 = Vec::from_raw_parts(l4 as *mut _, len6, len6); + 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), - wit_bindgen::rt::string_lift(bytes6), + _rt::string_lift(bytes6), ) }; result7.push(e7); } - wit_bindgen::rt::dealloc(base7, (len7 as usize) * 12, 4); + _rt::cabi_dealloc(base7, len7 * 12, 4); result7 } } @@ -3331,7 +3280,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; @@ -3349,7 +3300,7 @@ pub mod wasi { Options, Trace, Patch, - Other(wit_bindgen::rt::string::String), + Other(_rt::String), } impl ::core::fmt::Debug for Method { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { @@ -3372,7 +3323,7 @@ pub mod wasi { pub enum Scheme { Http, Https, - Other(wit_bindgen::rt::string::String), + Other(_rt::String), } impl ::core::fmt::Debug for Scheme { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { @@ -3386,7 +3337,7 @@ pub mod wasi { /// Defines the case payload type for `DNS-error` above: #[derive(Clone)] pub struct DnsErrorPayload { - pub rcode: Option, + pub rcode: Option<_rt::String>, pub info_code: Option, } impl ::core::fmt::Debug for DnsErrorPayload { @@ -3401,7 +3352,7 @@ pub mod wasi { #[derive(Clone)] pub struct TlsAlertReceivedPayload { pub alert_id: Option, - pub alert_message: Option, + pub alert_message: Option<_rt::String>, } impl ::core::fmt::Debug for TlsAlertReceivedPayload { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { @@ -3414,7 +3365,7 @@ pub mod wasi { /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: #[derive(Clone)] pub struct FieldSizePayload { - pub field_name: Option, + pub field_name: Option<_rt::String>, pub field_size: Option, } impl ::core::fmt::Debug for FieldSizePayload { @@ -3460,8 +3411,8 @@ pub mod wasi { HttpResponseBodySize(Option), HttpResponseTrailerSectionSize(Option), HttpResponseTrailerSize(FieldSizePayload), - HttpResponseTransferCoding(Option), - HttpResponseContentCoding(Option), + HttpResponseTransferCoding(Option<_rt::String>), + HttpResponseContentCoding(Option<_rt::String>), HttpResponseTimeout, HttpUpgradeFailed, HttpProtocolError, @@ -3472,7 +3423,7 @@ pub mod wasi { /// unstructured description of the error. Users should not depend on the /// string for diagnosing errors, as it's not required to be consistent /// between implementations. - InternalError(Option), + InternalError(Option<_rt::String>), } impl ::core::fmt::Debug for ErrorCode { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { @@ -3651,11 +3602,11 @@ pub mod wasi { #[cfg(feature = "std")] impl std::error::Error for HeaderError {} /// Field keys are always strings. - pub type FieldKey = wit_bindgen::rt::string::String; + pub type FieldKey = _rt::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. - pub type FieldValue = wit_bindgen::rt::vec::Vec; + pub type FieldValue = _rt::Vec; /// This following block defines the `fields` resource which corresponds to /// HTTP standard Fields. Fields are a common representation used for both /// Headers and Trailers. @@ -3670,29 +3621,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct Fields { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl Fields { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for Fields { + unsafe impl _rt::WasmResource for Fields { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -3720,29 +3671,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct IncomingRequest { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl IncomingRequest { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for IncomingRequest { + unsafe impl _rt::WasmResource for IncomingRequest { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -3766,29 +3717,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct OutgoingRequest { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl OutgoingRequest { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for OutgoingRequest { + unsafe impl _rt::WasmResource for OutgoingRequest { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -3817,29 +3768,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct RequestOptions { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl RequestOptions { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for RequestOptions { + unsafe impl _rt::WasmResource for RequestOptions { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -3867,29 +3818,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct ResponseOutparam { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl ResponseOutparam { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for ResponseOutparam { + unsafe impl _rt::WasmResource for ResponseOutparam { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -3915,29 +3866,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct IncomingResponse { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl IncomingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for IncomingResponse { + unsafe impl _rt::WasmResource for IncomingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -3968,29 +3919,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct IncomingBody { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl IncomingBody { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for IncomingBody { + unsafe impl _rt::WasmResource for IncomingBody { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -4018,29 +3969,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct FutureTrailers { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl FutureTrailers { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for FutureTrailers { + unsafe impl _rt::WasmResource for FutureTrailers { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -4064,29 +4015,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct OutgoingResponse { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl OutgoingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for OutgoingResponse { + unsafe impl _rt::WasmResource for OutgoingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -4125,29 +4076,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct OutgoingBody { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl OutgoingBody { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for OutgoingBody { + unsafe impl _rt::WasmResource for OutgoingBody { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -4175,29 +4126,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct FutureIncomingResponse { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl FutureIncomingResponse { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for FutureIncomingResponse { + unsafe impl _rt::WasmResource for FutureIncomingResponse { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -4229,69 +4180,73 @@ pub mod wasi { /// Note that this function is fallible because not all io-errors are /// http-related errors. pub fn http_error_code(err: &IoError) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 40]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 40]); + 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")] extern "C" { #[link_name = "http-error-code"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((err).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = i32::from(*((ptr0 + 8) as *const u8)); + let l2 = i32::from(*ptr0.add(8).cast::()); let v64 = match l2 { 0 => ErrorCode::DnsTimeout, 1 => { - let e64 = - { - let l3 = i32::from(*((ptr0 + 16) as *const u8)); - let l7 = i32::from(*((ptr0 + 28) as *const u8)); + let e64 = { + let l3 = i32::from(*ptr0.add(16).cast::()); + let l7 = i32::from(*ptr0.add(28).cast::()); - DnsErrorPayload { - rcode: match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *((ptr0 + 20) as *const i32); - let l5 = *((ptr0 + 24) as *const i32); - let len6 = l5 as usize; - let bytes6 = Vec::from_raw_parts(l4 as *mut _, len6, len6); + DnsErrorPayload { + rcode: match l3 { + 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, + ); - wit_bindgen::rt::string_lift(bytes6) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - info_code: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = i32::from(*((ptr0 + 30) as *const u16)); + _rt::string_lift(bytes6) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l7 { + 0 => None, + 1 => { + let e = { + let l8 = i32::from( + *ptr0.add(30).cast::(), + ); - l8 as u16 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; + l8 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; ErrorCode::DnsError(e64) } 2 => ErrorCode::DestinationNotFound, @@ -4307,60 +4262,66 @@ pub mod wasi { 12 => ErrorCode::TlsProtocolError, 13 => ErrorCode::TlsCertificateError, 14 => { - let e64 = - { - let l9 = i32::from(*((ptr0 + 16) as *const u8)); - let l11 = i32::from(*((ptr0 + 20) as *const u8)); + let e64 = { + let l9 = i32::from(*ptr0.add(16).cast::()); + let l11 = i32::from(*ptr0.add(20).cast::()); - TlsAlertReceivedPayload { - alert_id: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = i32::from(*((ptr0 + 17) as *const u8)); + TlsAlertReceivedPayload { + alert_id: match l9 { + 0 => None, + 1 => { + let e = { + let l10 = i32::from( + *ptr0.add(17).cast::(), + ); - l10 as u8 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - alert_message: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *((ptr0 + 24) as *const i32); - let l13 = *((ptr0 + 28) as *const i32); - let len14 = l13 as usize; - let bytes14 = Vec::from_raw_parts(l12 as *mut _, len14, len14); + l10 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l11 { + 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, + ); - wit_bindgen::rt::string_lift(bytes14) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; + _rt::string_lift(bytes14) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; ErrorCode::TlsAlertReceived(e64) } 15 => ErrorCode::HttpRequestDenied, 16 => ErrorCode::HttpRequestLengthRequired, 17 => { let e64 = { - let l15 = i32::from(*((ptr0 + 16) as *const u8)); + let l15 = i32::from(*ptr0.add(16).cast::()); match l15 { 0 => None, 1 => { let e = { - let l16 = *((ptr0 + 24) as *const i64); + let l16 = *ptr0.add(24).cast::(); l16 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestBodySize(e64) @@ -4370,312 +4331,328 @@ pub mod wasi { 20 => ErrorCode::HttpRequestUriTooLong, 21 => { let e64 = { - let l17 = i32::from(*((ptr0 + 16) as *const u8)); + let l17 = i32::from(*ptr0.add(16).cast::()); match l17 { 0 => None, 1 => { let e = { - let l18 = *((ptr0 + 20) as *const i32); + let l18 = *ptr0.add(20).cast::(); l18 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSectionSize(e64) } 22 => { let e64 = { - let l19 = i32::from(*((ptr0 + 16) as *const u8)); + let l19 = i32::from(*ptr0.add(16).cast::()); match l19 { 0 => None, 1 => { - let e = { - let l20 = - i32::from(*((ptr0 + 20) as *const u8)); - let l24 = - i32::from(*((ptr0 + 32) as *const u8)); + let e = + { + let l20 = i32::from( + *ptr0.add(20).cast::(), + ); + let l24 = i32::from( + *ptr0.add(32).cast::(), + ); - FieldSizePayload { + FieldSizePayload { field_name: match l20 { 0 => None, 1 => { let e = { - let l21 = *((ptr0 + 24) as *const i32); - let l22 = *((ptr0 + 28) as *const i32); - let len23 = l22 as usize; - let bytes23 = Vec::from_raw_parts(l21 as *mut _, len23, len23); + let l21 = *ptr0.add(24).cast::<*mut u8>(); + let l22 = *ptr0.add(28).cast::(); + let len23 = l22; + let bytes23 = + _rt::Vec::from_raw_parts(l21.cast(), len23, len23); - wit_bindgen::rt::string_lift(bytes23) + _rt::string_lift(bytes23) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l24 { 0 => None, 1 => { let e = { - let l25 = *((ptr0 + 36) as *const i32); + let l25 = *ptr0.add(36).cast::(); l25 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } - }; + }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSize(e64) } 23 => { let e64 = { - let l26 = i32::from(*((ptr0 + 16) as *const u8)); + let l26 = i32::from(*ptr0.add(16).cast::()); match l26 { 0 => None, 1 => { let e = { - let l27 = *((ptr0 + 20) as *const i32); + let l27 = *ptr0.add(20).cast::(); l27 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestTrailerSectionSize(e64) } 24 => { - let e64 = - { - let l28 = i32::from(*((ptr0 + 16) as *const u8)); - let l32 = i32::from(*((ptr0 + 28) as *const u8)); + let e64 = { + let l28 = i32::from(*ptr0.add(16).cast::()); + let l32 = i32::from(*ptr0.add(28).cast::()); - FieldSizePayload { - field_name: match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *((ptr0 + 20) as *const i32); - let l30 = *((ptr0 + 24) as *const i32); - let len31 = l30 as usize; - let bytes31 = Vec::from_raw_parts(l29 as *mut _, len31, len31); + FieldSizePayload { + field_name: match l28 { + 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, + ); - wit_bindgen::rt::string_lift(bytes31) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - field_size: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *((ptr0 + 32) as *const i32); + _rt::string_lift(bytes31) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l32 { + 0 => None, + 1 => { + let e = { + let l33 = *ptr0.add(32).cast::(); - l33 as u32 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; + l33 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; ErrorCode::HttpRequestTrailerSize(e64) } 25 => ErrorCode::HttpResponseIncomplete, 26 => { let e64 = { - let l34 = i32::from(*((ptr0 + 16) as *const u8)); + let l34 = i32::from(*ptr0.add(16).cast::()); match l34 { 0 => None, 1 => { let e = { - let l35 = *((ptr0 + 20) as *const i32); + let l35 = *ptr0.add(20).cast::(); l35 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseHeaderSectionSize(e64) } 27 => { - let e64 = - { - let l36 = i32::from(*((ptr0 + 16) as *const u8)); - let l40 = i32::from(*((ptr0 + 28) as *const u8)); + let e64 = { + let l36 = i32::from(*ptr0.add(16).cast::()); + let l40 = i32::from(*ptr0.add(28).cast::()); - FieldSizePayload { - field_name: match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *((ptr0 + 20) as *const i32); - let l38 = *((ptr0 + 24) as *const i32); - let len39 = l38 as usize; - let bytes39 = Vec::from_raw_parts(l37 as *mut _, len39, len39); + FieldSizePayload { + field_name: match l36 { + 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, + ); - wit_bindgen::rt::string_lift(bytes39) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - field_size: match l40 { - 0 => None, - 1 => { - let e = { - let l41 = *((ptr0 + 32) as *const i32); + _rt::string_lift(bytes39) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l40 { + 0 => None, + 1 => { + let e = { + let l41 = *ptr0.add(32).cast::(); - l41 as u32 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; + l41 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; ErrorCode::HttpResponseHeaderSize(e64) } 28 => { let e64 = { - let l42 = i32::from(*((ptr0 + 16) as *const u8)); + let l42 = i32::from(*ptr0.add(16).cast::()); match l42 { 0 => None, 1 => { let e = { - let l43 = *((ptr0 + 24) as *const i64); + let l43 = *ptr0.add(24).cast::(); l43 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseBodySize(e64) } 29 => { let e64 = { - let l44 = i32::from(*((ptr0 + 16) as *const u8)); + let l44 = i32::from(*ptr0.add(16).cast::()); match l44 { 0 => None, 1 => { let e = { - let l45 = *((ptr0 + 20) as *const i32); + let l45 = *ptr0.add(20).cast::(); l45 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTrailerSectionSize(e64) } 30 => { - let e64 = - { - let l46 = i32::from(*((ptr0 + 16) as *const u8)); - let l50 = i32::from(*((ptr0 + 28) as *const u8)); + let e64 = { + let l46 = i32::from(*ptr0.add(16).cast::()); + let l50 = i32::from(*ptr0.add(28).cast::()); - FieldSizePayload { - field_name: match l46 { - 0 => None, - 1 => { - let e = { - let l47 = *((ptr0 + 20) as *const i32); - let l48 = *((ptr0 + 24) as *const i32); - let len49 = l48 as usize; - let bytes49 = Vec::from_raw_parts(l47 as *mut _, len49, len49); + FieldSizePayload { + field_name: match l46 { + 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, + ); - wit_bindgen::rt::string_lift(bytes49) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - field_size: match l50 { - 0 => None, - 1 => { - let e = { - let l51 = *((ptr0 + 32) as *const i32); + _rt::string_lift(bytes49) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l50 { + 0 => None, + 1 => { + let e = { + let l51 = *ptr0.add(32).cast::(); - l51 as u32 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } - }; + l51 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; ErrorCode::HttpResponseTrailerSize(e64) } 31 => { let e64 = { - let l52 = i32::from(*((ptr0 + 16) as *const u8)); + let l52 = i32::from(*ptr0.add(16).cast::()); match l52 { 0 => None, 1 => { let e = { - let l53 = *((ptr0 + 20) as *const i32); - let l54 = *((ptr0 + 24) as *const i32); - let len55 = l54 as usize; - let bytes55 = Vec::from_raw_parts( - l53 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes55) + _rt::string_lift(bytes55) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTransferCoding(e64) } 32 => { let e64 = { - let l56 = i32::from(*((ptr0 + 16) as *const u8)); + let l56 = i32::from(*ptr0.add(16).cast::()); match l56 { 0 => None, 1 => { let e = { - let l57 = *((ptr0 + 20) as *const i32); - let l58 = *((ptr0 + 24) as *const i32); - let len59 = l58 as usize; - let bytes59 = Vec::from_raw_parts( - l57 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes59) + _rt::string_lift(bytes59) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseContentCoding(e64) @@ -4688,26 +4665,26 @@ pub mod wasi { n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); let e64 = { - let l60 = i32::from(*((ptr0 + 16) as *const u8)); + let l60 = i32::from(*ptr0.add(16).cast::()); match l60 { 0 => None, 1 => { let e = { - let l61 = *((ptr0 + 20) as *const i32); - let l62 = *((ptr0 + 24) as *const i32); - let len63 = l62 as usize; - let bytes63 = Vec::from_raw_parts( - l61 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes63) + _rt::string_lift(bytes63) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::InternalError(e64) @@ -4718,7 +4695,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -4728,8 +4705,6 @@ pub mod wasi { /// /// The resulting `fields` is mutable. pub fn new() -> Self { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -4767,19 +4742,18 @@ pub mod wasi { pub fn from_list( entries: &[(FieldKey, FieldValue)], ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let vec3 = entries; - let len3 = vec3.len() as i32; - let layout3 = alloc::Layout::from_size_align_unchecked(vec3.len() * 16, 4); + let len3 = vec3.len(); + let layout3 = + _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 16, 4); let result3 = if layout3.size() != 0 { - let ptr = alloc::alloc(layout3); + let ptr = _rt::alloc::alloc(layout3).cast::(); if ptr.is_null() { - alloc::handle_alloc_error(layout3); + _rt::alloc::handle_alloc_error(layout3); } ptr } else { @@ -4788,42 +4762,42 @@ pub mod wasi { } }; for (i, e) in vec3.into_iter().enumerate() { - let base = result3 as i32 + (i as i32) * 16; + let base = result3.add(i * 16); { let (t0_0, t0_1) = e; let vec1 = t0_0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - *((base + 4) as *mut i32) = len1; - *((base + 0) as *mut i32) = ptr1; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + *base.add(4).cast::() = len1; + *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); let vec2 = t0_1; - let ptr2 = vec2.as_ptr() as i32; - let len2 = vec2.len() as i32; - *((base + 12) as *mut i32) = len2; - *((base + 8) as *mut i32) = ptr2; + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + *base.add(12).cast::() = len2; + *base.add(8).cast::<*mut u8>() = ptr2.cast_mut(); } } - let ptr4 = ret_area.as_mut_ptr() as i32; + let ptr4 = 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 = "[static]fields.from-list"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import(result3 as i32, len3, ptr4); - let l5 = i32::from(*((ptr4 + 0) as *const u8)); + wit_import(result3, len3, ptr4); + let l5 = i32::from(*ptr4.add(0).cast::()); if layout3.size() != 0 { - alloc::dealloc(result3, layout3); + _rt::alloc::dealloc(result3.cast(), layout3); } match l5 { 0 => { let e = { - let l6 = *((ptr4 + 4) as *const i32); + let l6 = *ptr4.add(4).cast::(); Fields::from_handle(l6 as u32) }; @@ -4831,7 +4805,7 @@ pub mod wasi { } 1 => { let e = { - let l7 = i32::from(*((ptr4 + 4) as *const u8)); + let l7 = i32::from(*ptr4.add(4).cast::()); let v8 = match l7 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, @@ -4845,7 +4819,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -4856,46 +4830,44 @@ pub mod wasi { /// 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) -> wit_bindgen::rt::vec::Vec { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn get(&self, name: &FieldKey) -> _rt::Vec { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let vec0 = name; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]fields.get"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = *((ptr1 + 0) as *const i32); - let l3 = *((ptr1 + 4) as *const i32); + 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 = Vec::with_capacity(len7 as usize); + let mut result7 = _rt::Vec::with_capacity(len7); for i in 0..len7 { - let base = base7 + i * 8; + let base = base7.add(i * 8); let e7 = { - let l4 = *((base + 0) as *const i32); - let l5 = *((base + 4) as *const i32); - let len6 = l5 as usize; + let l4 = *base.add(0).cast::<*mut u8>(); + let l5 = *base.add(4).cast::(); + let len6 = l5; - Vec::from_raw_parts(l4 as *mut _, len6, len6) + _rt::Vec::from_raw_parts(l4.cast(), len6, len6) }; result7.push(e7); } - wit_bindgen::rt::dealloc(base7, (len7 as usize) * 8, 4); + _rt::cabi_dealloc(base7, len7 * 8, 4); result7 } } @@ -4905,26 +4877,24 @@ pub mod wasi { /// Returns `true` when the key is present in this `fields`. If the key is /// syntactically invalid, `false` is returned. pub fn has(&self, name: &FieldKey) -> bool { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let vec0 = name; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]fields.has"] - fn wit_import(_: i32, _: i32, _: i32) -> i32; + fn wit_import(_: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) -> i32 { + fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } - let ret = wit_import((self).handle() as i32, ptr0, len0); - wit_bindgen::rt::bool_lift(ret as u8) + let ret = wit_import((self).handle() as i32, ptr0.cast_mut(), len0); + _rt::bool_lift(ret as u8) } } } @@ -4939,22 +4909,21 @@ pub mod wasi { name: &FieldKey, value: &[FieldValue], ) -> Result<(), HeaderError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = name; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); let vec2 = value; - let len2 = vec2.len() as i32; - let layout2 = alloc::Layout::from_size_align_unchecked(vec2.len() * 8, 4); + let len2 = vec2.len(); + let layout2 = + _rt::alloc::Layout::from_size_align_unchecked(vec2.len() * 8, 4); let result2 = if layout2.size() != 0 { - let ptr = alloc::alloc(layout2); + let ptr = _rt::alloc::alloc(layout2).cast::(); if ptr.is_null() { - alloc::handle_alloc_error(layout2); + _rt::alloc::handle_alloc_error(layout2); } ptr } else { @@ -4963,38 +4932,52 @@ pub mod wasi { } }; for (i, e) in vec2.into_iter().enumerate() { - let base = result2 as i32 + (i as i32) * 8; + let base = result2.add(i * 8); { let vec1 = e; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - *((base + 4) as *mut i32) = len1; - *((base + 0) as *mut i32) = ptr1; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + *base.add(4).cast::() = len1; + *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); } } - let ptr3 = ret_area.as_mut_ptr() as i32; + let ptr3 = 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.set"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } wit_import( (self).handle() as i32, - ptr0, + ptr0.cast_mut(), len0, - result2 as i32, + result2, len2, ptr3, ); - let l4 = i32::from(*((ptr3 + 0) as *const u8)); + let l4 = i32::from(*ptr3.add(0).cast::()); if layout2.size() != 0 { - alloc::dealloc(result2, layout2); + _rt::alloc::dealloc(result2.cast(), layout2); } match l4 { 0 => { @@ -5003,7 +4986,7 @@ pub mod wasi { } 1 => { let e = { - let l5 = i32::from(*((ptr3 + 1) as *const u8)); + let l5 = i32::from(*ptr3.add(1).cast::()); let v6 = match l5 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, @@ -5017,7 +5000,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5029,29 +5012,27 @@ pub mod wasi { /// /// Fails with `header-error.immutable` if the `fields` are immutable. pub fn delete(&self, name: &FieldKey) -> Result<(), HeaderError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = name; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]fields.delete"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -5059,7 +5040,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 1) as *const u8)); + let l3 = i32::from(*ptr1.add(1).cast::()); let v4 = match l3 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, @@ -5073,7 +5054,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5089,32 +5070,51 @@ pub mod wasi { name: &FieldKey, value: &FieldValue, ) -> Result<(), HeaderError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); let vec0 = name; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); let vec1 = value; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - let ptr2 = ret_area.as_mut_ptr() as i32; + 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, _: i32, _: i32, _: i32, _: i32, _: i32); + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32, _: i32) { + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1, len1, ptr2); - let l3 = i32::from(*((ptr2 + 0) as *const u8)); + 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 { 0 => { let e = (); @@ -5122,7 +5122,7 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr2 + 1) as *const u8)); + let l4 = i32::from(*ptr2.add(1).cast::()); let v5 = match l4 { 0 => HeaderError::InvalidSyntax, 1 => HeaderError::Forbidden, @@ -5136,7 +5136,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5149,50 +5149,48 @@ pub mod wasi { /// 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. - pub fn entries(&self) -> wit_bindgen::rt::vec::Vec<(FieldKey, FieldValue)> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]fields.entries"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(4).cast::(); let base9 = l1; let len9 = l2; - let mut result9 = Vec::with_capacity(len9 as usize); + let mut result9 = _rt::Vec::with_capacity(len9); for i in 0..len9 { - let base = base9 + i * 16; + let base = base9.add(i * 16); let e9 = { - let l3 = *((base + 0) as *const i32); - let l4 = *((base + 4) as *const i32); - let len5 = l4 as usize; - let bytes5 = Vec::from_raw_parts(l3 as *mut _, len5, len5); - let l6 = *((base + 8) as *const i32); - let l7 = *((base + 12) as *const i32); - let len8 = l7 as usize; + 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_bindgen::rt::string_lift(bytes5), - Vec::from_raw_parts(l6 as *mut _, len8, len8), + _rt::string_lift(bytes5), + _rt::Vec::from_raw_parts(l6.cast(), len8, len8), ) }; result9.push(e9); } - wit_bindgen::rt::dealloc(base9, (len9 as usize) * 16, 4); + _rt::cabi_dealloc(base9, len9 * 16, 4); result9 } } @@ -5203,8 +5201,6 @@ pub mod wasi { /// `fields` constructor on the return value of `entries`. The resulting /// `fields` is mutable. pub fn clone(&self) -> Fields { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5226,26 +5222,24 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Returns the method of the incoming request. pub fn method(&self) -> Method { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-request.method"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); let v5 = match l1 { 0 => Method::Get, 1 => Method::Head, @@ -5259,12 +5253,12 @@ pub mod wasi { n => { debug_assert_eq!(n, 9, "invalid enum discriminant"); let e5 = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Method::Other(e5) } @@ -5276,41 +5270,39 @@ pub mod wasi { impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] /// Returns the path with query parameters from the request, as a string. - pub fn path_with_query(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn path_with_query(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-request.path-with-query"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5319,44 +5311,42 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Returns the protocol scheme from the request. pub fn scheme(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]incoming-request.scheme"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); let v6 = match l2 { 0 => Scheme::Http, 1 => Scheme::Https, n => { debug_assert_eq!(n, 2, "invalid enum discriminant"); let e6 = { - let l3 = *((ptr0 + 8) as *const i32); - let l4 = *((ptr0 + 12) as *const i32); - let len5 = l4 as usize; + let l3 = *ptr0.add(8).cast::<*mut u8>(); + let l4 = *ptr0.add(12).cast::(); + let len5 = l4; let bytes5 = - Vec::from_raw_parts(l3 as *mut _, len5, len5); + _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - wit_bindgen::rt::string_lift(bytes5) + _rt::string_lift(bytes5) }; Scheme::Other(e6) } @@ -5366,7 +5356,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5374,41 +5364,39 @@ pub mod wasi { impl IncomingRequest { #[allow(unused_unsafe, clippy::all)] /// Returns the authority from the request, if it was present. - pub fn authority(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn authority(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-request.authority"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5424,8 +5412,6 @@ pub mod wasi { /// the parent `incoming-request` is dropped. Dropping this /// `incoming-request` before all children are dropped will trap. pub fn headers(&self) -> Headers { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5448,30 +5434,28 @@ pub mod wasi { /// Gives the `incoming-body` associated with this request. Will only /// return success at most once, and subsequent calls will return error. pub fn consume(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-request.consume"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); IncomingBody::from_handle(l2 as u32) }; @@ -5481,7 +5465,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5499,8 +5483,6 @@ pub mod wasi { /// It is the obligation of the `outgoing-handler.handle` implementation /// to reject invalid constructions of `outgoing-request`. pub fn new(headers: Headers) -> Self { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -5527,30 +5509,28 @@ pub mod wasi { /// this `outgoing-request` can be retrieved at most once. Subsequent /// calls will return error. pub fn body(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]outgoing-request.body"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); OutgoingBody::from_handle(l2 as u32) }; @@ -5560,7 +5540,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5569,26 +5549,24 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Get the Method for the Request. pub fn method(&self) -> Method { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]outgoing-request.method"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); let v5 = match l1 { 0 => Method::Get, 1 => Method::Head, @@ -5602,12 +5580,12 @@ pub mod wasi { n => { debug_assert_eq!(n, 9, "invalid enum discriminant"); let e5 = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Method::Other(e5) } @@ -5621,25 +5599,23 @@ pub mod wasi { /// Set the Method for the Request. Fails if the string present in a /// `method.other` argument is not a syntactically valid method. pub fn set_method(&self, method: &Method) -> Result<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result1_0, result1_1, result1_2) = match method { - Method::Get => (0i32, 0i32, 0i32), - Method::Head => (1i32, 0i32, 0i32), - Method::Post => (2i32, 0i32, 0i32), - Method::Put => (3i32, 0i32, 0i32), - Method::Delete => (4i32, 0i32, 0i32), - Method::Connect => (5i32, 0i32, 0i32), - Method::Options => (6i32, 0i32, 0i32), - Method::Trace => (7i32, 0i32, 0i32), - Method::Patch => (8i32, 0i32, 0i32), + Method::Get => (0i32, ::core::ptr::null_mut(), 0usize), + Method::Head => (1i32, ::core::ptr::null_mut(), 0usize), + Method::Post => (2i32, ::core::ptr::null_mut(), 0usize), + Method::Put => (3i32, ::core::ptr::null_mut(), 0usize), + Method::Delete => (4i32, ::core::ptr::null_mut(), 0usize), + Method::Connect => (5i32, ::core::ptr::null_mut(), 0usize), + Method::Options => (6i32, ::core::ptr::null_mut(), 0usize), + Method::Trace => (7i32, ::core::ptr::null_mut(), 0usize), + Method::Patch => (8i32, ::core::ptr::null_mut(), 0usize), Method::Other(e) => { let vec0 = e; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); - (9i32, ptr0, len0) + (9i32, ptr0.cast_mut(), len0) } }; @@ -5647,11 +5623,11 @@ pub mod wasi { #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.set-method"] - fn wit_import(_: i32, _: i32, _: i32, _: i32) -> i32; + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) -> i32 { + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } let ret = @@ -5665,7 +5641,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5674,41 +5650,39 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Get the combination of the HTTP Path and Query for the Request. /// When `none`, this represents an empty Path and empty Query. - pub fn path_with_query(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn path_with_query(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]outgoing-request.path-with-query"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5719,28 +5693,26 @@ pub mod wasi { /// 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<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result1_0, result1_1, result1_2) = match path_with_query { Some(e) => { let vec0 = e; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); - (1i32, ptr0, len0) + (1i32, ptr0.cast_mut(), len0) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.set-path-with-query"] - fn wit_import(_: i32, _: i32, _: i32, _: i32) -> i32; + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) -> i32 { + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } let ret = @@ -5754,7 +5726,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5764,44 +5736,42 @@ pub mod wasi { /// Get the HTTP Related Scheme for the Request. When `none`, the /// implementation may choose an appropriate default scheme. pub fn scheme(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.scheme"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); let v6 = match l2 { 0 => Scheme::Http, 1 => Scheme::Https, n => { debug_assert_eq!(n, 2, "invalid enum discriminant"); let e6 = { - let l3 = *((ptr0 + 8) as *const i32); - let l4 = *((ptr0 + 12) as *const i32); - let len5 = l4 as usize; + let l3 = *ptr0.add(8).cast::<*mut u8>(); + let l4 = *ptr0.add(12).cast::(); + let len5 = l4; let bytes5 = - Vec::from_raw_parts(l3 as *mut _, len5, len5); + _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - wit_bindgen::rt::string_lift(bytes5) + _rt::string_lift(bytes5) }; Scheme::Other(e6) } @@ -5811,7 +5781,7 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5822,36 +5792,34 @@ pub mod wasi { /// implementation may choose an appropriate default scheme. Fails if the /// string given is not a syntactically valid uri scheme. pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result2_0, result2_1, result2_2, result2_3) = match scheme { Some(e) => { let (result1_0, result1_1, result1_2) = match e { - Scheme::Http => (0i32, 0i32, 0i32), - Scheme::Https => (1i32, 0i32, 0i32), + Scheme::Http => (0i32, ::core::ptr::null_mut(), 0usize), + Scheme::Https => (1i32, ::core::ptr::null_mut(), 0usize), Scheme::Other(e) => { let vec0 = e; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); - (2i32, ptr0, len0) + (2i32, ptr0.cast_mut(), len0) } }; (1i32, result1_0, result1_1, result1_2) } - None => (0i32, 0i32, 0i32, 0i32), + None => (0i32, 0i32, ::core::ptr::null_mut(), 0usize), }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.set-scheme"] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32) -> i32; + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32, _: i32) -> i32 { + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } let ret = wit_import( @@ -5870,7 +5838,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5880,41 +5848,39 @@ pub mod wasi { /// 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 /// HTTPS schemes always require an authority. - pub fn authority(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn authority(&self) -> Option<_rt::String> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]outgoing-request.authority"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; - let bytes4 = Vec::from_raw_parts(l2 as *mut _, len4, len4); + 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); - wit_bindgen::rt::string_lift(bytes4) + _rt::string_lift(bytes4) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5926,28 +5892,26 @@ pub mod wasi { /// HTTPS schemes always require an authority. Fails if the string given is /// not a syntactically valid uri authority. pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result1_0, result1_1, result1_2) = match authority { Some(e) => { let vec0 = e; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); - (1i32, ptr0, len0) + (1i32, ptr0.cast_mut(), len0) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]outgoing-request.set-authority"] - fn wit_import(_: i32, _: i32, _: i32, _: i32) -> i32; + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) -> i32 { + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { unreachable!() } let ret = @@ -5961,7 +5925,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -5977,8 +5941,6 @@ pub mod wasi { /// `outgoing-request` is dropped, or its ownership is transfered to /// another component by e.g. `outgoing-handler.handle`. pub fn headers(&self) -> Headers { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6000,8 +5962,6 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Construct a default `request-options` value. pub fn new() -> Self { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6023,37 +5983,35 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// The timeout for the initial connect to the HTTP Server. pub fn connect_timeout(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]request-options.connect-timeout"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6063,11 +6021,9 @@ pub mod wasi { /// 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<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result0_0, result0_1) = match duration { - Some(e) => (1i32, wit_bindgen::rt::as_i64(e)), + Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; #[cfg(target_arch = "wasm32")] @@ -6091,7 +6047,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6100,37 +6056,35 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// The timeout for receiving the first byte of the Response body. pub fn first_byte_timeout(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]request-options.first-byte-timeout"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6140,11 +6094,9 @@ pub mod wasi { /// 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<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result0_0, result0_1) = match duration { - Some(e) => (1i32, wit_bindgen::rt::as_i64(e)), + Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; #[cfg(target_arch = "wasm32")] @@ -6168,7 +6120,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6178,37 +6130,35 @@ pub mod wasi { /// The timeout for receiving subsequent chunks of bytes in the Response /// body stream. pub fn between_bytes_timeout(&self) -> Option { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] extern "C" { #[link_name = "[method]request-options.between-bytes-timeout"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6222,11 +6172,9 @@ pub mod wasi { &self, duration: Option, ) -> Result<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let (result0_0, result0_1) = match duration { - Some(e) => (1i32, wit_bindgen::rt::as_i64(e)), + Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; #[cfg(target_arch = "wasm32")] @@ -6250,7 +6198,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6267,8 +6215,6 @@ 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) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { let ( result38_0, @@ -6284,10 +6230,10 @@ pub mod wasi { 0i32, (e).take_handle() as i32, 0i32, - 0i64, - 0i32, - 0i32, - 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, 0i32, ), Err(e) => { @@ -6300,9 +6246,15 @@ pub mod wasi { result37_5, result37_6, ) = match e { - ErrorCode::DnsTimeout => { - (0i32, 0i32, 0i64, 0i32, 0i32, 0i32, 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, @@ -6311,127 +6263,246 @@ pub mod wasi { let (result2_0, result2_1, result2_2) = match rcode0 { Some(e) => { let vec1 = e; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); - (1i32, ptr1, len1) + (1i32, ptr1.cast_mut(), len1) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; let (result3_0, result3_1) = match info_code0 { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 1i32, result2_0, - i64::from(result2_1), - result2_2, - result3_0, - result3_1, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result2_1); + t + }, + result2_2 as *mut u8, + result3_0 as *mut u8, + result3_1 as usize, 0i32, ) } - ErrorCode::DestinationNotFound => { - (2i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::DestinationUnavailable => { - (3i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::DestinationIpProhibited => { - (4i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::DestinationIpUnroutable => { - (5i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConnectionRefused => { - (6i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConnectionTerminated => { - (7i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConnectionTimeout => { - (8i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConnectionReadTimeout => { - (9i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConnectionWriteTimeout => { - (10i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConnectionLimitReached => { - (11i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::TlsProtocolError => { - (12i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::TlsCertificateError => { - (13i32, 0i32, 0i64, 0i32, 0i32, 0i32, 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, alert_message: alert_message4, } = e; let (result5_0, result5_1) = match alert_id4 { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; let (result7_0, result7_1, result7_2) = match alert_message4 { Some(e) => { let vec6 = e; - let ptr6 = vec6.as_ptr() as i32; - let len6 = vec6.len() as i32; + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); - (1i32, ptr6, len6) + (1i32, ptr6.cast_mut(), len6) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; ( 14i32, result5_0, - i64::from(result5_1), - result7_0, + ::core::mem::MaybeUninit::new( + i64::from(result5_1) as u64 + ), + result7_0 as *mut u8, result7_1, result7_2, 0i32, ) } - ErrorCode::HttpRequestDenied => { - (15i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::HttpRequestLengthRequired => { - (16i32, 0i32, 0i64, 0i32, 0i32, 0i32, 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, wit_bindgen::rt::as_i64(e)), + Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; - (17i32, result8_0, result8_1, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::HttpRequestMethodInvalid => { - (18i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::HttpRequestUriInvalid => { - (19i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::HttpRequestUriTooLong => { - (20i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) + ( + 17i32, + result8_0, + ::core::mem::MaybeUninit::new(result8_1 as u64), + ::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, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 21i32, result9_0, - i64::from(result9_1), - 0i32, - 0i32, - 0i32, + ::core::mem::MaybeUninit::new( + i64::from(result9_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, 0i32, ) } @@ -6453,15 +6524,17 @@ pub mod wasi { match field_name10 { Some(e) => { let vec11 = e; - let ptr11 = vec11.as_ptr() as i32; - let len11 = vec11.len() as i32; + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); - (1i32, ptr11, len11) + (1i32, ptr11.cast_mut(), len11) + } + None => { + (0i32, ::core::ptr::null_mut(), 0usize) } - None => (0i32, 0i32, 0i32), }; let (result13_0, result13_1) = match field_size10 { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( @@ -6469,30 +6542,41 @@ pub mod wasi { result13_0, result13_1, ) } - None => (0i32, 0i32, 0i32, 0i32, 0i32, 0i32), + None => ( + 0i32, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + 0i32, + ), }; ( 22i32, result14_0, - i64::from(result14_1), + ::core::mem::MaybeUninit::new( + i64::from(result14_1) as u64 + ), result14_2, - result14_3, - result14_4, + result14_3 as *mut u8, + result14_4 as usize, result14_5, ) } ErrorCode::HttpRequestTrailerSectionSize(e) => { let (result15_0, result15_1) = match e { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 23i32, result15_0, - i64::from(result15_1), - 0i32, - 0i32, - 0i32, + ::core::mem::MaybeUninit::new( + i64::from(result15_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, 0i32, ) } @@ -6505,42 +6589,55 @@ pub mod wasi { match field_name16 { Some(e) => { let vec17 = e; - let ptr17 = vec17.as_ptr() as i32; - let len17 = vec17.len() as i32; + let ptr17 = vec17.as_ptr().cast::(); + let len17 = vec17.len(); - (1i32, ptr17, len17) + (1i32, ptr17.cast_mut(), len17) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; let (result19_0, result19_1) = match field_size16 { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 24i32, result18_0, - i64::from(result18_1), - result18_2, - result19_0, - result19_1, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result18_1); + t + }, + result18_2 as *mut u8, + result19_0 as *mut u8, + result19_1 as usize, 0i32, ) } - ErrorCode::HttpResponseIncomplete => { - (25i32, 0i32, 0i64, 0i32, 0i32, 0i32, 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, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 26i32, result20_0, - i64::from(result20_1), - 0i32, - 0i32, - 0i32, + ::core::mem::MaybeUninit::new( + i64::from(result20_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, 0i32, ) } @@ -6553,46 +6650,61 @@ pub mod wasi { match field_name21 { Some(e) => { let vec22 = e; - let ptr22 = vec22.as_ptr() as i32; - let len22 = vec22.len() as i32; + let ptr22 = vec22.as_ptr().cast::(); + let len22 = vec22.len(); - (1i32, ptr22, len22) + (1i32, ptr22.cast_mut(), len22) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; let (result24_0, result24_1) = match field_size21 { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 27i32, result23_0, - i64::from(result23_1), - result23_2, - result24_0, - result24_1, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result23_1); + t + }, + result23_2 as *mut u8, + result24_0 as *mut u8, + result24_1 as usize, 0i32, ) } ErrorCode::HttpResponseBodySize(e) => { let (result25_0, result25_1) = match e { - Some(e) => (1i32, wit_bindgen::rt::as_i64(e)), + Some(e) => (1i32, _rt::as_i64(e)), None => (0i32, 0i64), }; - (28i32, result25_0, result25_1, 0i32, 0i32, 0i32, 0i32) + ( + 28i32, + result25_0, + ::core::mem::MaybeUninit::new(result25_1 as u64), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) } ErrorCode::HttpResponseTrailerSectionSize(e) => { let (result26_0, result26_1) = match e { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 29i32, result26_0, - i64::from(result26_1), - 0i32, - 0i32, - 0i32, + ::core::mem::MaybeUninit::new( + i64::from(result26_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, 0i32, ) } @@ -6605,24 +6717,29 @@ pub mod wasi { match field_name27 { Some(e) => { let vec28 = e; - let ptr28 = vec28.as_ptr() as i32; - let len28 = vec28.len() as i32; + let ptr28 = vec28.as_ptr().cast::(); + let len28 = vec28.len(); - (1i32, ptr28, len28) + (1i32, ptr28.cast_mut(), len28) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; let (result30_0, result30_1) = match field_size27 { - Some(e) => (1i32, wit_bindgen::rt::as_i32(e)), + Some(e) => (1i32, _rt::as_i32(e)), None => (0i32, 0i32), }; ( 30i32, result29_0, - i64::from(result29_1), - result29_2, - result30_0, - result30_1, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result29_1); + t + }, + result29_2 as *mut u8, + result30_0 as *mut u8, + result30_1 as usize, 0i32, ) } @@ -6630,20 +6747,25 @@ pub mod wasi { let (result32_0, result32_1, result32_2) = match e { Some(e) => { let vec31 = e; - let ptr31 = vec31.as_ptr() as i32; - let len31 = vec31.len() as i32; + let ptr31 = vec31.as_ptr().cast::(); + let len31 = vec31.len(); - (1i32, ptr31, len31) + (1i32, ptr31.cast_mut(), len31) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; ( 31i32, result32_0, - i64::from(result32_1), - result32_2, - 0i32, - 0i32, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result32_1); + t + }, + result32_2 as *mut u8, + ::core::ptr::null_mut(), + 0usize, 0i32, ) } @@ -6651,56 +6773,96 @@ pub mod wasi { let (result34_0, result34_1, result34_2) = match e { Some(e) => { let vec33 = e; - let ptr33 = vec33.as_ptr() as i32; - let len33 = vec33.len() as i32; + let ptr33 = vec33.as_ptr().cast::(); + let len33 = vec33.len(); - (1i32, ptr33, len33) + (1i32, ptr33.cast_mut(), len33) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; ( 32i32, result34_0, - i64::from(result34_1), - result34_2, - 0i32, - 0i32, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result34_1); + t + }, + result34_2 as *mut u8, + ::core::ptr::null_mut(), + 0usize, 0i32, ) } - ErrorCode::HttpResponseTimeout => { - (33i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::HttpUpgradeFailed => { - (34i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::HttpProtocolError => { - (35i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::LoopDetected => { - (36i32, 0i32, 0i64, 0i32, 0i32, 0i32, 0i32) - } - ErrorCode::ConfigurationError => { - (37i32, 0i32, 0i64, 0i32, 0i32, 0i32, 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() as i32; - let len35 = vec35.len() as i32; + let ptr35 = vec35.as_ptr().cast::(); + let len35 = vec35.len(); - (1i32, ptr35, len35) + (1i32, ptr35.cast_mut(), len35) } - None => (0i32, 0i32, 0i32), + None => (0i32, ::core::ptr::null_mut(), 0usize), }; ( 38i32, result36_0, - i64::from(result36_1), - result36_2, - 0i32, - 0i32, + { + let mut t = + ::core::mem::MaybeUninit::::uninit(); + t.as_mut_ptr().cast::<*mut u8>().write(result36_1); + t + }, + result36_2 as *mut u8, + ::core::ptr::null_mut(), + 0usize, 0i32, ) } @@ -6721,10 +6883,10 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i64, - _: i32, - _: i32, - _: i32, + _: ::core::mem::MaybeUninit, + _: *mut u8, + _: *mut u8, + _: usize, _: i32, ); } @@ -6735,10 +6897,10 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i64, - _: i32, - _: i32, - _: i32, + _: ::core::mem::MaybeUninit, + _: *mut u8, + _: *mut u8, + _: usize, _: i32, ) { unreachable!() @@ -6761,8 +6923,6 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Returns the status code from the incoming response. pub fn status(&self) -> StatusCode { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6790,8 +6950,6 @@ pub mod wasi { /// This headers resource is a child: it must be dropped before the parent /// `incoming-response` is dropped. pub fn headers(&self) -> Headers { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6814,30 +6972,28 @@ pub mod wasi { /// Returns the incoming body. May be called at most once. Returns error /// if called additional times. pub fn consume(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-response.consume"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); IncomingBody::from_handle(l2 as u32) }; @@ -6847,7 +7003,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6870,30 +7026,28 @@ pub mod wasi { /// and for that backpressure to not inhibit delivery of the trailers if /// the user does not read the entire body. pub fn stream(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-body.stream"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::InputStream::from_handle( l2 as u32, @@ -6905,7 +7059,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -6915,8 +7069,6 @@ pub mod wasi { /// Takes ownership of `incoming-body`, and returns a `future-trailers`. /// This function will trap if the `input-stream` child is still alive. pub fn finish(this: IncomingBody) -> FutureTrailers { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6940,8 +7092,6 @@ pub mod wasi { /// been received, or an error has occured. When this pollable is ready, /// the `get` method will return `some`. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -6981,96 +7131,98 @@ pub mod wasi { /// `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>, ()>> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 56]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]future-trailers.get"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = i32::from(*((ptr0 + 8) as *const u8)); + let l2 = i32::from(*ptr0.add(8).cast::()); match l2 { 0 => { - let e = - { - let l3 = i32::from(*((ptr0 + 16) as *const u8)); + let e = { + let l3 = i32::from(*ptr0.add(16).cast::()); - match l3 { - 0 => { - let e = { - let l4 = i32::from(*((ptr0 + 24) as *const u8)); + match l3 { + 0 => { + let e = + { + let l4 = i32::from( + *ptr0.add(24).cast::(), + ); - match l4 { + match l4 { 0 => None, 1 => { let e = { - let l5 = *((ptr0 + 28) as *const i32); + let l5 = *ptr0.add(28).cast::(); Fields::from_handle(l5 as u32) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*((ptr0 + 24) as *const u8)); - let v68 = match l6 { + }; + 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 + 32) as *const u8)); - let l11 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l9 = *((ptr0 + 40) as *const i32); - let len10 = l9 as usize; + let l8 = *ptr0.add(36).cast::<*mut u8>(); + let l9 = *ptr0.add(40).cast::(); + let len10 = l9; let bytes10 = - Vec::from_raw_parts(l8 as *mut _, len10, len10); + _rt::Vec::from_raw_parts(l8.cast(), len10, len10); - wit_bindgen::rt::string_lift(bytes10) + _rt::string_lift(bytes10) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, info_code: match l11 { 0 => None, 1 => { let e = { - let l12 = i32::from(*((ptr0 + 46) as *const u16)); + let l12 = i32::from(*ptr0.add(46).cast::()); l12 as u16 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -7090,37 +7242,37 @@ pub mod wasi { 13 => ErrorCode::TlsCertificateError, 14 => { let e68 = { - let l13 = i32::from(*((ptr0 + 32) as *const u8)); - let l15 = i32::from(*((ptr0 + 36) as *const u8)); + 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 + 33) as *const u8)); + let l14 = i32::from(*ptr0.add(33).cast::()); l14 as u8 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, alert_message: match l15 { 0 => None, 1 => { let e = { - let l16 = *((ptr0 + 40) as *const i32); - let l17 = *((ptr0 + 44) as *const i32); - let len18 = l17 as usize; + let l16 = *ptr0.add(40).cast::<*mut u8>(); + let l17 = *ptr0.add(44).cast::(); + let len18 = l17; let bytes18 = - Vec::from_raw_parts(l16 as *mut _, len18, len18); + _rt::Vec::from_raw_parts(l16.cast(), len18, len18); - wit_bindgen::rt::string_lift(bytes18) + _rt::string_lift(bytes18) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -7130,19 +7282,19 @@ pub mod wasi { 16 => ErrorCode::HttpRequestLengthRequired, 17 => { let e68 = { - let l19 = i32::from(*((ptr0 + 32) as *const u8)); + let l19 = i32::from(*ptr0.add(32).cast::()); match l19 { 0 => None, 1 => { let e = { - let l20 = *((ptr0 + 40) as *const i64); + let l20 = *ptr0.add(40).cast::(); l20 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestBodySize(e68) @@ -7152,127 +7304,127 @@ pub mod wasi { 20 => ErrorCode::HttpRequestUriTooLong, 21 => { let e68 = { - let l21 = i32::from(*((ptr0 + 32) as *const u8)); + let l21 = i32::from(*ptr0.add(32).cast::()); match l21 { 0 => None, 1 => { let e = { - let l22 = *((ptr0 + 36) as *const i32); + let l22 = *ptr0.add(36).cast::(); l22 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSectionSize(e68) } 22 => { let e68 = { - let l23 = i32::from(*((ptr0 + 32) as *const u8)); + let l23 = i32::from(*ptr0.add(32).cast::()); match l23 { 0 => None, 1 => { let e = { - let l24 = i32::from(*((ptr0 + 36) as *const u8)); - let l28 = i32::from(*((ptr0 + 48) as *const u8)); + 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 + 40) as *const i32); - let l26 = *((ptr0 + 44) as *const i32); - let len27 = l26 as usize; - let bytes27 = Vec::from_raw_parts( - l25 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes27) + _rt::string_lift(bytes27) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l28 { 0 => None, 1 => { let e = { - let l29 = *((ptr0 + 52) as *const i32); + let l29 = *ptr0.add(52).cast::(); l29 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSize(e68) } 23 => { let e68 = { - let l30 = i32::from(*((ptr0 + 32) as *const u8)); + let l30 = i32::from(*ptr0.add(32).cast::()); match l30 { 0 => None, 1 => { let e = { - let l31 = *((ptr0 + 36) as *const i32); + let l31 = *ptr0.add(36).cast::(); l31 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestTrailerSectionSize(e68) } 24 => { let e68 = { - let l32 = i32::from(*((ptr0 + 32) as *const u8)); - let l36 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l34 = *((ptr0 + 40) as *const i32); - let len35 = l34 as usize; + let l33 = *ptr0.add(36).cast::<*mut u8>(); + let l34 = *ptr0.add(40).cast::(); + let len35 = l34; let bytes35 = - Vec::from_raw_parts(l33 as *mut _, len35, len35); + _rt::Vec::from_raw_parts(l33.cast(), len35, len35); - wit_bindgen::rt::string_lift(bytes35) + _rt::string_lift(bytes35) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l36 { 0 => None, 1 => { let e = { - let l37 = *((ptr0 + 48) as *const i32); + let l37 = *ptr0.add(48).cast::(); l37 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -7281,56 +7433,56 @@ pub mod wasi { 25 => ErrorCode::HttpResponseIncomplete, 26 => { let e68 = { - let l38 = i32::from(*((ptr0 + 32) as *const u8)); + let l38 = i32::from(*ptr0.add(32).cast::()); match l38 { 0 => None, 1 => { let e = { - let l39 = *((ptr0 + 36) as *const i32); + let l39 = *ptr0.add(36).cast::(); l39 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseHeaderSectionSize(e68) } 27 => { let e68 = { - let l40 = i32::from(*((ptr0 + 32) as *const u8)); - let l44 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l42 = *((ptr0 + 40) as *const i32); - let len43 = l42 as usize; + let l41 = *ptr0.add(36).cast::<*mut u8>(); + let l42 = *ptr0.add(40).cast::(); + let len43 = l42; let bytes43 = - Vec::from_raw_parts(l41 as *mut _, len43, len43); + _rt::Vec::from_raw_parts(l41.cast(), len43, len43); - wit_bindgen::rt::string_lift(bytes43) + _rt::string_lift(bytes43) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l44 { 0 => None, 1 => { let e = { - let l45 = *((ptr0 + 48) as *const i32); + let l45 = *ptr0.add(48).cast::(); l45 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -7338,75 +7490,75 @@ pub mod wasi { } 28 => { let e68 = { - let l46 = i32::from(*((ptr0 + 32) as *const u8)); + let l46 = i32::from(*ptr0.add(32).cast::()); match l46 { 0 => None, 1 => { let e = { - let l47 = *((ptr0 + 40) as *const i64); + let l47 = *ptr0.add(40).cast::(); l47 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseBodySize(e68) } 29 => { let e68 = { - let l48 = i32::from(*((ptr0 + 32) as *const u8)); + let l48 = i32::from(*ptr0.add(32).cast::()); match l48 { 0 => None, 1 => { let e = { - let l49 = *((ptr0 + 36) as *const i32); + let l49 = *ptr0.add(36).cast::(); l49 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTrailerSectionSize(e68) } 30 => { let e68 = { - let l50 = i32::from(*((ptr0 + 32) as *const u8)); - let l54 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l52 = *((ptr0 + 40) as *const i32); - let len53 = l52 as usize; + let l51 = *ptr0.add(36).cast::<*mut u8>(); + let l52 = *ptr0.add(40).cast::(); + let len53 = l52; let bytes53 = - Vec::from_raw_parts(l51 as *mut _, len53, len53); + _rt::Vec::from_raw_parts(l51.cast(), len53, len53); - wit_bindgen::rt::string_lift(bytes53) + _rt::string_lift(bytes53) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l54 { 0 => None, 1 => { let e = { - let l55 = *((ptr0 + 48) as *const i32); + let l55 = *ptr0.add(48).cast::(); l55 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -7414,46 +7566,46 @@ pub mod wasi { } 31 => { let e68 = { - let l56 = i32::from(*((ptr0 + 32) as *const u8)); + let l56 = i32::from(*ptr0.add(32).cast::()); match l56 { 0 => None, 1 => { let e = { - let l57 = *((ptr0 + 36) as *const i32); - let l58 = *((ptr0 + 40) as *const i32); - let len59 = l58 as usize; + let l57 = *ptr0.add(36).cast::<*mut u8>(); + let l58 = *ptr0.add(40).cast::(); + let len59 = l58; let bytes59 = - Vec::from_raw_parts(l57 as *mut _, len59, len59); + _rt::Vec::from_raw_parts(l57.cast(), len59, len59); - wit_bindgen::rt::string_lift(bytes59) + _rt::string_lift(bytes59) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTransferCoding(e68) } 32 => { let e68 = { - let l60 = i32::from(*((ptr0 + 32) as *const u8)); + let l60 = i32::from(*ptr0.add(32).cast::()); match l60 { 0 => None, 1 => { let e = { - let l61 = *((ptr0 + 36) as *const i32); - let l62 = *((ptr0 + 40) as *const i32); - let len63 = l62 as usize; + let l61 = *ptr0.add(36).cast::<*mut u8>(); + let l62 = *ptr0.add(40).cast::(); + let len63 = l62; let bytes63 = - Vec::from_raw_parts(l61 as *mut _, len63, len63); + _rt::Vec::from_raw_parts(l61.cast(), len63, len63); - wit_bindgen::rt::string_lift(bytes63) + _rt::string_lift(bytes63) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseContentCoding(e68) @@ -7466,48 +7618,48 @@ pub mod wasi { n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); let e68 = { - let l64 = i32::from(*((ptr0 + 32) as *const u8)); + let l64 = i32::from(*ptr0.add(32).cast::()); match l64 { 0 => None, 1 => { let e = { - let l65 = *((ptr0 + 36) as *const i32); - let l66 = *((ptr0 + 40) as *const i32); - let len67 = l66 as usize; + let l65 = *ptr0.add(36).cast::<*mut u8>(); + let l66 = *ptr0.add(40).cast::(); + let len67 = l66; let bytes67 = - Vec::from_raw_parts(l65 as *mut _, len67, len67); + _rt::Vec::from_raw_parts(l65.cast(), len67, len67); - wit_bindgen::rt::string_lift(bytes67) + _rt::string_lift(bytes67) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::InternalError(e68) } }; - v68 - }; - Err(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - }; + v68 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; Ok(e) } 1 => { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -7520,8 +7672,6 @@ pub mod wasi { /// /// * `headers` is the HTTP Headers for the Response. pub fn new(headers: Headers) -> Self { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -7543,8 +7693,6 @@ pub mod wasi { #[allow(unused_unsafe, clippy::all)] /// Get the HTTP Status Code for the Response. pub fn status_code(&self) -> StatusCode { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -7567,8 +7715,6 @@ pub mod wasi { /// 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<(), ()> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -7581,10 +7727,7 @@ pub mod wasi { fn wit_import(_: i32, _: i32) -> i32 { unreachable!() } - let ret = wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i32(status_code), - ); + let ret = wit_import((self).handle() as i32, _rt::as_i32(status_code)); match ret { 0 => { let e = (); @@ -7594,7 +7737,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -7610,8 +7753,6 @@ pub mod wasi { /// `outgoing-request` is dropped, or its ownership is transfered to /// another component by e.g. `outgoing-handler.handle`. pub fn headers(&self) -> Headers { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -7637,30 +7778,28 @@ pub mod wasi { /// this `outgoing-response` can be retrieved at most once. Subsequent /// calls will return error. pub fn body(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]outgoing-response.body"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); OutgoingBody::from_handle(l2 as u32) }; @@ -7670,7 +7809,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -7687,30 +7826,28 @@ pub mod wasi { /// this `outgoing-body` may be retrieved at most once. Subsequent calls /// will return error. pub fn write(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]outgoing-body.write"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::io::streams::OutputStream::from_handle(l2 as u32) }; @@ -7720,7 +7857,7 @@ pub mod wasi { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -7740,30 +7877,28 @@ pub mod wasi { this: OutgoingBody, trailers: Option, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 40]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 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.as_mut_ptr() as i32; + let ptr1 = 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 = "[static]outgoing-body.finish"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) { unreachable!() } wit_import((&this).take_handle() as i32, result0_0, result0_1, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -7771,43 +7906,52 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 8) as *const u8)); + let l3 = i32::from(*ptr1.add(8).cast::()); let v65 = match l3 { 0 => ErrorCode::DnsTimeout, 1 => { let e65 = { - let l4 = i32::from(*((ptr1 + 16) as *const u8)); - let l8 = i32::from(*((ptr1 + 28) as *const u8)); + let l4 = i32::from(*ptr1.add(16).cast::()); + let l8 = i32::from(*ptr1.add(28).cast::()); DnsErrorPayload { - rcode: match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *((ptr1 + 20) as *const i32); - let l6 = *((ptr1 + 24) as *const i32); - let len7 = l6 as usize; - let bytes7 = Vec::from_raw_parts(l5 as *mut _, len7, len7); - - wit_bindgen::rt::string_lift(bytes7) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - info_code: match l8 { - 0 => None, - 1 => { - let e = { - let l9 = i32::from(*((ptr1 + 30) as *const u16)); - - l9 as u16 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } + rcode: match l4 { + 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) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l8 { + 0 => None, + 1 => { + let e = { + let l9 = i32::from( + *ptr1.add(30).cast::(), + ); + + l9 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; ErrorCode::DnsError(e65) } @@ -7825,38 +7969,47 @@ pub mod wasi { 13 => ErrorCode::TlsCertificateError, 14 => { let e65 = { - let l10 = i32::from(*((ptr1 + 16) as *const u8)); - let l12 = i32::from(*((ptr1 + 20) as *const u8)); + let l10 = i32::from(*ptr1.add(16).cast::()); + let l12 = i32::from(*ptr1.add(20).cast::()); TlsAlertReceivedPayload { - alert_id: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from(*((ptr1 + 17) as *const u8)); - - l11 as u8 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - alert_message: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = *((ptr1 + 24) as *const i32); - let l14 = *((ptr1 + 28) as *const i32); - let len15 = l14 as usize; - let bytes15 = Vec::from_raw_parts(l13 as *mut _, len15, len15); - - wit_bindgen::rt::string_lift(bytes15) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } + alert_id: match l10 { + 0 => None, + 1 => { + let e = { + let l11 = i32::from( + *ptr1.add(17).cast::(), + ); + + l11 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l12 { + 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) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; ErrorCode::TlsAlertReceived(e65) } @@ -7864,21 +8017,19 @@ pub mod wasi { 16 => ErrorCode::HttpRequestLengthRequired, 17 => { let e65 = { - let l16 = i32::from(*((ptr1 + 16) as *const u8)); + let l16 = i32::from(*ptr1.add(16).cast::()); match l16 { 0 => None, 1 => { let e = { - let l17 = *((ptr1 + 24) as *const i64); + let l17 = *ptr1.add(24).cast::(); l17 as u64 }; Some(e) } - _ => { - wit_bindgen::rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestBodySize(e65) @@ -7888,318 +8039,340 @@ pub mod wasi { 20 => ErrorCode::HttpRequestUriTooLong, 21 => { let e65 = { - let l18 = i32::from(*((ptr1 + 16) as *const u8)); + let l18 = i32::from(*ptr1.add(16).cast::()); match l18 { 0 => None, 1 => { let e = { - let l19 = *((ptr1 + 20) as *const i32); + let l19 = *ptr1.add(20).cast::(); l19 as u32 }; Some(e) } - _ => { - wit_bindgen::rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSectionSize(e65) } 22 => { - let e65 = - { - let l20 = - i32::from(*((ptr1 + 16) as *const u8)); + let e65 = { + let l20 = i32::from(*ptr1.add(16).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = i32::from(*((ptr1 + 20) as *const u8)); - let l25 = i32::from(*((ptr1 + 32) as *const u8)); + match l20 { + 0 => None, + 1 => { + let e = { + let l21 = i32::from( + *ptr1.add(20).cast::(), + ); + let l25 = i32::from( + *ptr1.add(32).cast::(), + ); - FieldSizePayload { + FieldSizePayload { field_name: match l21 { 0 => None, 1 => { let e = { - let l22 = *((ptr1 + 24) as *const i32); - let l23 = *((ptr1 + 28) as *const i32); - let len24 = l23 as usize; + let l22 = *ptr1.add(24).cast::<*mut u8>(); + let l23 = *ptr1.add(28).cast::(); + let len24 = l23; let bytes24 = - Vec::from_raw_parts(l22 as *mut _, len24, len24); + _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - wit_bindgen::rt::string_lift(bytes24) + _rt::string_lift(bytes24) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l25 { 0 => None, 1 => { let e = { - let l26 = *((ptr1 + 36) as *const i32); + let l26 = *ptr1.add(36).cast::(); l26 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - }; + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; ErrorCode::HttpRequestHeaderSize(e65) } 23 => { let e65 = { - let l27 = i32::from(*((ptr1 + 16) as *const u8)); + let l27 = i32::from(*ptr1.add(16).cast::()); match l27 { 0 => None, 1 => { let e = { - let l28 = *((ptr1 + 20) as *const i32); + let l28 = *ptr1.add(20).cast::(); l28 as u32 }; Some(e) } - _ => { - wit_bindgen::rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestTrailerSectionSize(e65) } 24 => { let e65 = { - let l29 = i32::from(*((ptr1 + 16) as *const u8)); - let l33 = i32::from(*((ptr1 + 28) as *const u8)); + let l29 = i32::from(*ptr1.add(16).cast::()); + let l33 = i32::from(*ptr1.add(28).cast::()); FieldSizePayload { - field_name: match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *((ptr1 + 20) as *const i32); - let l31 = *((ptr1 + 24) as *const i32); - let len32 = l31 as usize; - let bytes32 = Vec::from_raw_parts(l30 as *mut _, len32, len32); - - wit_bindgen::rt::string_lift(bytes32) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - field_size: match l33 { - 0 => None, - 1 => { - let e = { - let l34 = *((ptr1 + 32) as *const i32); - - l34 as u32 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } + field_name: match l29 { + 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) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l33 { + 0 => None, + 1 => { + let e = { + let l34 = + *ptr1.add(32).cast::(); + + l34 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; ErrorCode::HttpRequestTrailerSize(e65) } 25 => ErrorCode::HttpResponseIncomplete, 26 => { let e65 = { - let l35 = i32::from(*((ptr1 + 16) as *const u8)); + let l35 = i32::from(*ptr1.add(16).cast::()); match l35 { 0 => None, 1 => { let e = { - let l36 = *((ptr1 + 20) as *const i32); + let l36 = *ptr1.add(20).cast::(); l36 as u32 }; Some(e) } - _ => { - wit_bindgen::rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseHeaderSectionSize(e65) } 27 => { let e65 = { - let l37 = i32::from(*((ptr1 + 16) as *const u8)); - let l41 = i32::from(*((ptr1 + 28) as *const u8)); + let l37 = i32::from(*ptr1.add(16).cast::()); + let l41 = i32::from(*ptr1.add(28).cast::()); FieldSizePayload { - field_name: match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *((ptr1 + 20) as *const i32); - let l39 = *((ptr1 + 24) as *const i32); - let len40 = l39 as usize; - let bytes40 = Vec::from_raw_parts(l38 as *mut _, len40, len40); - - wit_bindgen::rt::string_lift(bytes40) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - field_size: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *((ptr1 + 32) as *const i32); - - l42 as u32 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } + field_name: match l37 { + 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) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l41 { + 0 => None, + 1 => { + let e = { + let l42 = + *ptr1.add(32).cast::(); + + l42 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; ErrorCode::HttpResponseHeaderSize(e65) } 28 => { let e65 = { - let l43 = i32::from(*((ptr1 + 16) as *const u8)); + let l43 = i32::from(*ptr1.add(16).cast::()); match l43 { 0 => None, 1 => { let e = { - let l44 = *((ptr1 + 24) as *const i64); + let l44 = *ptr1.add(24).cast::(); l44 as u64 }; Some(e) } - _ => { - wit_bindgen::rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseBodySize(e65) } 29 => { let e65 = { - let l45 = i32::from(*((ptr1 + 16) as *const u8)); + let l45 = i32::from(*ptr1.add(16).cast::()); match l45 { 0 => None, 1 => { let e = { - let l46 = *((ptr1 + 20) as *const i32); + let l46 = *ptr1.add(20).cast::(); l46 as u32 }; Some(e) } - _ => { - wit_bindgen::rt::invalid_enum_discriminant() - } + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTrailerSectionSize(e65) } 30 => { let e65 = { - let l47 = i32::from(*((ptr1 + 16) as *const u8)); - let l51 = i32::from(*((ptr1 + 28) as *const u8)); + let l47 = i32::from(*ptr1.add(16).cast::()); + let l51 = i32::from(*ptr1.add(28).cast::()); FieldSizePayload { - field_name: match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *((ptr1 + 20) as *const i32); - let l49 = *((ptr1 + 24) as *const i32); - let len50 = l49 as usize; - let bytes50 = Vec::from_raw_parts(l48 as *mut _, len50, len50); - - wit_bindgen::rt::string_lift(bytes50) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - field_size: match l51 { - 0 => None, - 1 => { - let e = { - let l52 = *((ptr1 + 32) as *const i32); - - l52 as u32 - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - }, - } + field_name: match l47 { + 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) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l51 { + 0 => None, + 1 => { + let e = { + let l52 = + *ptr1.add(32).cast::(); + + l52 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } }; ErrorCode::HttpResponseTrailerSize(e65) } 31 => { - let e65 = - { - let l53 = - i32::from(*((ptr1 + 16) as *const u8)); + let e65 = { + let l53 = i32::from(*ptr1.add(16).cast::()); - match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *((ptr1 + 20) as *const i32); - let l55 = *((ptr1 + 24) as *const i32); - let len56 = l55 as usize; - let bytes56 = Vec::from_raw_parts(l54 as *mut _, len56, len56); + match l53 { + 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, + ); - wit_bindgen::rt::string_lift(bytes56) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - }; + _rt::string_lift(bytes56) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; ErrorCode::HttpResponseTransferCoding(e65) } 32 => { - let e65 = - { - let l57 = - i32::from(*((ptr1 + 16) as *const u8)); + let e65 = { + let l57 = i32::from(*ptr1.add(16).cast::()); - match l57 { - 0 => None, - 1 => { - let e = { - let l58 = *((ptr1 + 20) as *const i32); - let l59 = *((ptr1 + 24) as *const i32); - let len60 = l59 as usize; - let bytes60 = Vec::from_raw_parts(l58 as *mut _, len60, len60); + match l57 { + 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, + ); - wit_bindgen::rt::string_lift(bytes60) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - }; + _rt::string_lift(bytes60) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; ErrorCode::HttpResponseContentCoding(e65) } 33 => ErrorCode::HttpResponseTimeout, @@ -8209,27 +8382,30 @@ pub mod wasi { 37 => ErrorCode::ConfigurationError, n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e65 = - { - let l61 = - i32::from(*((ptr1 + 16) as *const u8)); + let e65 = { + let l61 = i32::from(*ptr1.add(16).cast::()); - match l61 { - 0 => None, - 1 => { - let e = { - let l62 = *((ptr1 + 20) as *const i32); - let l63 = *((ptr1 + 24) as *const i32); - let len64 = l63 as usize; - let bytes64 = Vec::from_raw_parts(l62 as *mut _, len64, len64); + match l61 { + 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, + ); - wit_bindgen::rt::string_lift(bytes64) - }; - Some(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - }; + _rt::string_lift(bytes64) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; ErrorCode::InternalError(e65) } }; @@ -8238,7 +8414,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -8249,8 +8425,6 @@ pub mod wasi { /// been received, or an error has occured. When this pollable is ready, /// the `get` method will return `some`. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/types@0.2.0")] @@ -8285,85 +8459,84 @@ pub mod wasi { /// but those will be reported by the `incoming-body` and its /// `output-stream` child. pub fn get(&self) -> Option, ()>> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 56]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]future-incoming-response.get"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => None, 1 => { let e = { - let l2 = i32::from(*((ptr0 + 8) as *const u8)); + let l2 = i32::from(*ptr0.add(8).cast::()); match l2 { 0 => { - let e = - { - let l3 = i32::from(*((ptr0 + 16) as *const u8)); + let e = { + let l3 = i32::from(*ptr0.add(16).cast::()); - match l3 { - 0 => { - let e = { - let l4 = *((ptr0 + 24) as *const i32); + match l3 { + 0 => { + let e = { + let l4 = *ptr0.add(24).cast::(); - IncomingResponse::from_handle(l4 as u32) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*((ptr0 + 24) as *const u8)); - let v67 = match l5 { + IncomingResponse::from_handle(l4 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 + 32) as *const u8)); - let l10 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l8 = *((ptr0 + 40) as *const i32); - let len9 = l8 as usize; + let l7 = *ptr0.add(36).cast::<*mut u8>(); + let l8 = *ptr0.add(40).cast::(); + let len9 = l8; let bytes9 = - Vec::from_raw_parts(l7 as *mut _, len9, len9); + _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - wit_bindgen::rt::string_lift(bytes9) + _rt::string_lift(bytes9) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, info_code: match l10 { 0 => None, 1 => { let e = { - let l11 = i32::from(*((ptr0 + 46) as *const u16)); + let l11 = i32::from(*ptr0.add(46).cast::()); l11 as u16 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8383,37 +8556,37 @@ pub mod wasi { 13 => ErrorCode::TlsCertificateError, 14 => { let e67 = { - let l12 = i32::from(*((ptr0 + 32) as *const u8)); - let l14 = i32::from(*((ptr0 + 36) as *const u8)); + 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 + 33) as *const u8)); + let l13 = i32::from(*ptr0.add(33).cast::()); l13 as u8 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, alert_message: match l14 { 0 => None, 1 => { let e = { - let l15 = *((ptr0 + 40) as *const i32); - let l16 = *((ptr0 + 44) as *const i32); - let len17 = l16 as usize; + let l15 = *ptr0.add(40).cast::<*mut u8>(); + let l16 = *ptr0.add(44).cast::(); + let len17 = l16; let bytes17 = - Vec::from_raw_parts(l15 as *mut _, len17, len17); + _rt::Vec::from_raw_parts(l15.cast(), len17, len17); - wit_bindgen::rt::string_lift(bytes17) + _rt::string_lift(bytes17) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8423,19 +8596,19 @@ pub mod wasi { 16 => ErrorCode::HttpRequestLengthRequired, 17 => { let e67 = { - let l18 = i32::from(*((ptr0 + 32) as *const u8)); + let l18 = i32::from(*ptr0.add(32).cast::()); match l18 { 0 => None, 1 => { let e = { - let l19 = *((ptr0 + 40) as *const i64); + let l19 = *ptr0.add(40).cast::(); l19 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestBodySize(e67) @@ -8445,127 +8618,127 @@ pub mod wasi { 20 => ErrorCode::HttpRequestUriTooLong, 21 => { let e67 = { - let l20 = i32::from(*((ptr0 + 32) as *const u8)); + let l20 = i32::from(*ptr0.add(32).cast::()); match l20 { 0 => None, 1 => { let e = { - let l21 = *((ptr0 + 36) as *const i32); + let l21 = *ptr0.add(36).cast::(); l21 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSectionSize(e67) } 22 => { let e67 = { - let l22 = i32::from(*((ptr0 + 32) as *const u8)); + let l22 = i32::from(*ptr0.add(32).cast::()); match l22 { 0 => None, 1 => { let e = { - let l23 = i32::from(*((ptr0 + 36) as *const u8)); - let l27 = i32::from(*((ptr0 + 48) as *const u8)); + 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 + 40) as *const i32); - let l25 = *((ptr0 + 44) as *const i32); - let len26 = l25 as usize; - let bytes26 = Vec::from_raw_parts( - l24 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes26) + _rt::string_lift(bytes26) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l27 { 0 => None, 1 => { let e = { - let l28 = *((ptr0 + 52) as *const i32); + let l28 = *ptr0.add(52).cast::(); l28 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestHeaderSize(e67) } 23 => { let e67 = { - let l29 = i32::from(*((ptr0 + 32) as *const u8)); + let l29 = i32::from(*ptr0.add(32).cast::()); match l29 { 0 => None, 1 => { let e = { - let l30 = *((ptr0 + 36) as *const i32); + let l30 = *ptr0.add(36).cast::(); l30 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpRequestTrailerSectionSize(e67) } 24 => { let e67 = { - let l31 = i32::from(*((ptr0 + 32) as *const u8)); - let l35 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l33 = *((ptr0 + 40) as *const i32); - let len34 = l33 as usize; + let l32 = *ptr0.add(36).cast::<*mut u8>(); + let l33 = *ptr0.add(40).cast::(); + let len34 = l33; let bytes34 = - Vec::from_raw_parts(l32 as *mut _, len34, len34); + _rt::Vec::from_raw_parts(l32.cast(), len34, len34); - wit_bindgen::rt::string_lift(bytes34) + _rt::string_lift(bytes34) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l35 { 0 => None, 1 => { let e = { - let l36 = *((ptr0 + 48) as *const i32); + let l36 = *ptr0.add(48).cast::(); l36 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8574,56 +8747,56 @@ pub mod wasi { 25 => ErrorCode::HttpResponseIncomplete, 26 => { let e67 = { - let l37 = i32::from(*((ptr0 + 32) as *const u8)); + let l37 = i32::from(*ptr0.add(32).cast::()); match l37 { 0 => None, 1 => { let e = { - let l38 = *((ptr0 + 36) as *const i32); + let l38 = *ptr0.add(36).cast::(); l38 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseHeaderSectionSize(e67) } 27 => { let e67 = { - let l39 = i32::from(*((ptr0 + 32) as *const u8)); - let l43 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l41 = *((ptr0 + 40) as *const i32); - let len42 = l41 as usize; + let l40 = *ptr0.add(36).cast::<*mut u8>(); + let l41 = *ptr0.add(40).cast::(); + let len42 = l41; let bytes42 = - Vec::from_raw_parts(l40 as *mut _, len42, len42); + _rt::Vec::from_raw_parts(l40.cast(), len42, len42); - wit_bindgen::rt::string_lift(bytes42) + _rt::string_lift(bytes42) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l43 { 0 => None, 1 => { let e = { - let l44 = *((ptr0 + 48) as *const i32); + let l44 = *ptr0.add(48).cast::(); l44 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8631,75 +8804,75 @@ pub mod wasi { } 28 => { let e67 = { - let l45 = i32::from(*((ptr0 + 32) as *const u8)); + let l45 = i32::from(*ptr0.add(32).cast::()); match l45 { 0 => None, 1 => { let e = { - let l46 = *((ptr0 + 40) as *const i64); + let l46 = *ptr0.add(40).cast::(); l46 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseBodySize(e67) } 29 => { let e67 = { - let l47 = i32::from(*((ptr0 + 32) as *const u8)); + let l47 = i32::from(*ptr0.add(32).cast::()); match l47 { 0 => None, 1 => { let e = { - let l48 = *((ptr0 + 36) as *const i32); + let l48 = *ptr0.add(36).cast::(); l48 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTrailerSectionSize(e67) } 30 => { let e67 = { - let l49 = i32::from(*((ptr0 + 32) as *const u8)); - let l53 = i32::from(*((ptr0 + 44) as *const u8)); + 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 + 36) as *const i32); - let l51 = *((ptr0 + 40) as *const i32); - let len52 = l51 as usize; + let l50 = *ptr0.add(36).cast::<*mut u8>(); + let l51 = *ptr0.add(40).cast::(); + let len52 = l51; let bytes52 = - Vec::from_raw_parts(l50 as *mut _, len52, len52); + _rt::Vec::from_raw_parts(l50.cast(), len52, len52); - wit_bindgen::rt::string_lift(bytes52) + _rt::string_lift(bytes52) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l53 { 0 => None, 1 => { let e = { - let l54 = *((ptr0 + 48) as *const i32); + let l54 = *ptr0.add(48).cast::(); l54 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8707,46 +8880,46 @@ pub mod wasi { } 31 => { let e67 = { - let l55 = i32::from(*((ptr0 + 32) as *const u8)); + let l55 = i32::from(*ptr0.add(32).cast::()); match l55 { 0 => None, 1 => { let e = { - let l56 = *((ptr0 + 36) as *const i32); - let l57 = *((ptr0 + 40) as *const i32); - let len58 = l57 as usize; + let l56 = *ptr0.add(36).cast::<*mut u8>(); + let l57 = *ptr0.add(40).cast::(); + let len58 = l57; let bytes58 = - Vec::from_raw_parts(l56 as *mut _, len58, len58); + _rt::Vec::from_raw_parts(l56.cast(), len58, len58); - wit_bindgen::rt::string_lift(bytes58) + _rt::string_lift(bytes58) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseTransferCoding(e67) } 32 => { let e67 = { - let l59 = i32::from(*((ptr0 + 32) as *const u8)); + let l59 = i32::from(*ptr0.add(32).cast::()); match l59 { 0 => None, 1 => { let e = { - let l60 = *((ptr0 + 36) as *const i32); - let l61 = *((ptr0 + 40) as *const i32); - let len62 = l61 as usize; + let l60 = *ptr0.add(36).cast::<*mut u8>(); + let l61 = *ptr0.add(40).cast::(); + let len62 = l61; let bytes62 = - Vec::from_raw_parts(l60 as *mut _, len62, len62); + _rt::Vec::from_raw_parts(l60.cast(), len62, len62); - wit_bindgen::rt::string_lift(bytes62) + _rt::string_lift(bytes62) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::HttpResponseContentCoding(e67) @@ -8759,48 +8932,48 @@ pub mod wasi { n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); let e67 = { - let l63 = i32::from(*((ptr0 + 32) as *const u8)); + let l63 = i32::from(*ptr0.add(32).cast::()); match l63 { 0 => None, 1 => { let e = { - let l64 = *((ptr0 + 36) as *const i32); - let l65 = *((ptr0 + 40) as *const i32); - let len66 = l65 as usize; + let l64 = *ptr0.add(36).cast::<*mut u8>(); + let l65 = *ptr0.add(40).cast::(); + let len66 = l65; let bytes66 = - Vec::from_raw_parts(l64 as *mut _, len66, len66); + _rt::Vec::from_raw_parts(l64.cast(), len66, len66); - wit_bindgen::rt::string_lift(bytes66) + _rt::string_lift(bytes66) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; ErrorCode::InternalError(e67) } }; - v67 - }; - Err(e) - } - _ => wit_bindgen::rt::invalid_enum_discriminant(), - } - }; + v67 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; Ok(e) } 1 => { let e = (); Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -8812,7 +8985,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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 = @@ -8833,34 +9008,32 @@ pub mod wasi { request: OutgoingRequest, options: Option, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 40]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 40]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 40]); let (result0_0, result0_1) = match &options { Some(e) => (1i32, (e).take_handle() as i32), None => (0i32, 0i32), }; - let ptr1 = ret_area.as_mut_ptr() as i32; + let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:http/outgoing-handler@0.2.0")] extern "C" { #[link_name = "handle"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8) { unreachable!() } wit_import((&request).take_handle() as i32, result0_0, result0_1, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = { - let l3 = *((ptr1 + 8) as *const i32); + let l3 = *ptr1.add(8).cast::(); super::super::super::wasi::http::types::FutureIncomingResponse::from_handle( l3 as u32, @@ -8870,42 +9043,42 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr1 + 8) as *const u8)); + 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, 1 => { let e66 = { - let l5 = i32::from(*((ptr1 + 16) as *const u8)); - let l9 = i32::from(*((ptr1 + 28) as *const u8)); + 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 + 20) as *const i32); - let l7 = *((ptr1 + 24) as *const i32); - let len8 = l7 as usize; - let bytes8 = Vec::from_raw_parts(l6 as *mut _, len8, len8); + 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); - wit_bindgen::rt::string_lift(bytes8) + _rt::string_lift(bytes8) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, info_code: match l9 { 0 => None, 1 => { let e = { - let l10 = i32::from(*((ptr1 + 30) as *const u16)); + let l10 = i32::from(*ptr1.add(30).cast::()); l10 as u16 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8925,36 +9098,36 @@ pub mod wasi { 13 => V66::TlsCertificateError, 14 => { let e66 = { - let l11 = i32::from(*((ptr1 + 16) as *const u8)); - let l13 = i32::from(*((ptr1 + 20) as *const u8)); + 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 + 17) as *const u8)); + let l12 = i32::from(*ptr1.add(17).cast::()); l12 as u8 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, alert_message: match l13 { 0 => None, 1 => { let e = { - let l14 = *((ptr1 + 24) as *const i32); - let l15 = *((ptr1 + 28) as *const i32); - let len16 = l15 as usize; - let bytes16 = Vec::from_raw_parts(l14 as *mut _, len16, len16); + 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); - wit_bindgen::rt::string_lift(bytes16) + _rt::string_lift(bytes16) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -8964,19 +9137,19 @@ pub mod wasi { 16 => V66::HttpRequestLengthRequired, 17 => { let e66 = { - let l17 = i32::from(*((ptr1 + 16) as *const u8)); + let l17 = i32::from(*ptr1.add(16).cast::()); match l17 { 0 => None, 1 => { let e = { - let l18 = *((ptr1 + 24) as *const i64); + let l18 = *ptr1.add(24).cast::(); l18 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpRequestBodySize(e66) @@ -8986,124 +9159,125 @@ pub mod wasi { 20 => V66::HttpRequestUriTooLong, 21 => { let e66 = { - let l19 = i32::from(*((ptr1 + 16) as *const u8)); + let l19 = i32::from(*ptr1.add(16).cast::()); match l19 { 0 => None, 1 => { let e = { - let l20 = *((ptr1 + 20) as *const i32); + let l20 = *ptr1.add(20).cast::(); l20 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpRequestHeaderSectionSize(e66) } 22 => { let e66 = { - let l21 = i32::from(*((ptr1 + 16) as *const u8)); + let l21 = i32::from(*ptr1.add(16).cast::()); match l21 { 0 => None, 1 => { let e = { let l22 = - i32::from(*((ptr1 + 20) as *const u8)); + i32::from(*ptr1.add(20).cast::()); let l26 = - i32::from(*((ptr1 + 32) as *const u8)); + 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 + 24) as *const i32); - let l24 = *((ptr1 + 28) as *const i32); - let len25 = l24 as usize; - let bytes25 = Vec::from_raw_parts(l23 as *mut _, len25, len25); + 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); - wit_bindgen::rt::string_lift(bytes25) + _rt::string_lift(bytes25) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l26 { 0 => None, 1 => { let e = { - let l27 = *((ptr1 + 36) as *const i32); + let l27 = *ptr1.add(36).cast::(); l27 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpRequestHeaderSize(e66) } 23 => { let e66 = { - let l28 = i32::from(*((ptr1 + 16) as *const u8)); + let l28 = i32::from(*ptr1.add(16).cast::()); match l28 { 0 => None, 1 => { let e = { - let l29 = *((ptr1 + 20) as *const i32); + let l29 = *ptr1.add(20).cast::(); l29 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpRequestTrailerSectionSize(e66) } 24 => { let e66 = { - let l30 = i32::from(*((ptr1 + 16) as *const u8)); - let l34 = i32::from(*((ptr1 + 28) as *const u8)); + 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 + 20) as *const i32); - let l32 = *((ptr1 + 24) as *const i32); - let len33 = l32 as usize; - let bytes33 = Vec::from_raw_parts(l31 as *mut _, len33, len33); + 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); - wit_bindgen::rt::string_lift(bytes33) + _rt::string_lift(bytes33) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l34 { 0 => None, 1 => { let e = { - let l35 = *((ptr1 + 32) as *const i32); + let l35 = *ptr1.add(32).cast::(); l35 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -9112,55 +9286,55 @@ pub mod wasi { 25 => V66::HttpResponseIncomplete, 26 => { let e66 = { - let l36 = i32::from(*((ptr1 + 16) as *const u8)); + let l36 = i32::from(*ptr1.add(16).cast::()); match l36 { 0 => None, 1 => { let e = { - let l37 = *((ptr1 + 20) as *const i32); + let l37 = *ptr1.add(20).cast::(); l37 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpResponseHeaderSectionSize(e66) } 27 => { let e66 = { - let l38 = i32::from(*((ptr1 + 16) as *const u8)); - let l42 = i32::from(*((ptr1 + 28) as *const u8)); + 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 + 20) as *const i32); - let l40 = *((ptr1 + 24) as *const i32); - let len41 = l40 as usize; - let bytes41 = Vec::from_raw_parts(l39 as *mut _, len41, len41); + 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); - wit_bindgen::rt::string_lift(bytes41) + _rt::string_lift(bytes41) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l42 { 0 => None, 1 => { let e = { - let l43 = *((ptr1 + 32) as *const i32); + let l43 = *ptr1.add(32).cast::(); l43 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -9168,74 +9342,74 @@ pub mod wasi { } 28 => { let e66 = { - let l44 = i32::from(*((ptr1 + 16) as *const u8)); + let l44 = i32::from(*ptr1.add(16).cast::()); match l44 { 0 => None, 1 => { let e = { - let l45 = *((ptr1 + 24) as *const i64); + let l45 = *ptr1.add(24).cast::(); l45 as u64 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpResponseBodySize(e66) } 29 => { let e66 = { - let l46 = i32::from(*((ptr1 + 16) as *const u8)); + let l46 = i32::from(*ptr1.add(16).cast::()); match l46 { 0 => None, 1 => { let e = { - let l47 = *((ptr1 + 20) as *const i32); + let l47 = *ptr1.add(20).cast::(); l47 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpResponseTrailerSectionSize(e66) } 30 => { let e66 = { - let l48 = i32::from(*((ptr1 + 16) as *const u8)); - let l52 = i32::from(*((ptr1 + 28) as *const u8)); + 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 + 20) as *const i32); - let l50 = *((ptr1 + 24) as *const i32); - let len51 = l50 as usize; - let bytes51 = Vec::from_raw_parts(l49 as *mut _, len51, len51); + 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); - wit_bindgen::rt::string_lift(bytes51) + _rt::string_lift(bytes51) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, field_size: match l52 { 0 => None, 1 => { let e = { - let l53 = *((ptr1 + 32) as *const i32); + let l53 = *ptr1.add(32).cast::(); l53 as u32 }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), }, } }; @@ -9243,52 +9417,52 @@ pub mod wasi { } 31 => { let e66 = { - let l54 = i32::from(*((ptr1 + 16) as *const u8)); + let l54 = i32::from(*ptr1.add(16).cast::()); match l54 { 0 => None, 1 => { let e = { - let l55 = *((ptr1 + 20) as *const i32); - let l56 = *((ptr1 + 24) as *const i32); - let len57 = l56 as usize; - let bytes57 = Vec::from_raw_parts( - l55 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes57) + _rt::string_lift(bytes57) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpResponseTransferCoding(e66) } 32 => { let e66 = { - let l58 = i32::from(*((ptr1 + 16) as *const u8)); + let l58 = i32::from(*ptr1.add(16).cast::()); match l58 { 0 => None, 1 => { let e = { - let l59 = *((ptr1 + 20) as *const i32); - let l60 = *((ptr1 + 24) as *const i32); - let len61 = l60 as usize; - let bytes61 = Vec::from_raw_parts( - l59 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes61) + _rt::string_lift(bytes61) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::HttpResponseContentCoding(e66) @@ -9301,26 +9475,26 @@ pub mod wasi { n => { debug_assert_eq!(n, 38, "invalid enum discriminant"); let e66 = { - let l62 = i32::from(*((ptr1 + 16) as *const u8)); + let l62 = i32::from(*ptr1.add(16).cast::()); match l62 { 0 => None, 1 => { let e = { - let l63 = *((ptr1 + 20) as *const i32); - let l64 = *((ptr1 + 24) as *const i32); - let len65 = l64 as usize; - let bytes65 = Vec::from_raw_parts( - l63 as *mut _, + 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, ); - wit_bindgen::rt::string_lift(bytes65) + _rt::string_lift(bytes65) }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; V66::InternalError(e66) @@ -9331,7 +9505,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -9344,35 +9518,37 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl Pollable { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for Pollable { + unsafe impl _rt::WasmResource for Pollable { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -9397,8 +9573,6 @@ pub mod wasi { /// /// Returns `true` when the pollable is ready, and `false` otherwise. pub fn ready(&self) -> bool { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/poll@0.2.0")] @@ -9412,7 +9586,7 @@ pub mod wasi { unreachable!() } let ret = wit_import((self).handle() as i32); - wit_bindgen::rt::bool_lift(ret as u8) + _rt::bool_lift(ret as u8) } } } @@ -9424,8 +9598,6 @@ pub mod wasi { /// This function is equivalent to calling `poll.poll` on a list /// containing only this pollable. pub fn block(&self) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/poll@0.2.0")] @@ -9461,20 +9633,18 @@ pub mod wasi { /// 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. - pub fn poll(in_: &[&Pollable]) -> wit_bindgen::rt::vec::Vec { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn poll(in_: &[&Pollable]) -> _rt::Vec { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let vec0 = in_; - let len0 = vec0.len() as i32; - let layout0 = alloc::Layout::from_size_align_unchecked(vec0.len() * 4, 4); + let len0 = vec0.len(); + let layout0 = _rt::alloc::Layout::from_size_align_unchecked(vec0.len() * 4, 4); let result0 = if layout0.size() != 0 { - let ptr = alloc::alloc(layout0); + let ptr = _rt::alloc::alloc(layout0).cast::(); if ptr.is_null() { - alloc::handle_alloc_error(layout0); + _rt::alloc::handle_alloc_error(layout0); } ptr } else { @@ -9483,31 +9653,31 @@ pub mod wasi { } }; for (i, e) in vec0.into_iter().enumerate() { - let base = result0 as i32 + (i as i32) * 4; + let base = result0.add(i * 4); { - *((base + 0) as *mut i32) = (e).handle() as i32; + *base.add(0).cast::() = (e).handle() as i32; } } - let ptr1 = ret_area.as_mut_ptr() as i32; + let ptr1 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/poll@0.2.0")] extern "C" { #[link_name = "poll"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import(result0 as i32, len0, ptr1); - let l2 = *((ptr1 + 0) as *const i32); - let l3 = *((ptr1 + 4) as *const i32); - let len4 = l3 as usize; + wit_import(result0, len0, ptr1); + let l2 = *ptr1.add(0).cast::<*mut u8>(); + let l3 = *ptr1.add(4).cast::(); + let len4 = l3; if layout0.size() != 0 { - alloc::dealloc(result0, layout0); + _rt::alloc::dealloc(result0.cast(), layout0); } - Vec::from_raw_parts(l2 as *mut _, len4, len4) + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) } } } @@ -9517,7 +9687,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. /// /// The only method provided by this resource is `to-debug-string`, @@ -9541,29 +9713,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct Error { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl Error { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for Error { + unsafe impl _rt::WasmResource for Error { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -9591,31 +9763,29 @@ pub mod wasi { /// It may change across platforms, hosts, or other implementation /// details. Parsing this string is a major platform-compatibility /// hazard. - pub fn to_debug_string(&self) -> wit_bindgen::rt::string::String { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn to_debug_string(&self) -> _rt::String { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]error.to-debug-string"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); - let len3 = l2 as usize; - let bytes3 = Vec::from_raw_parts(l1 as *mut _, len3, len3); - wit_bindgen::rt::string_lift(bytes3) + 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) } } } @@ -9626,7 +9796,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; /// An error for input-stream and output-stream operations. @@ -9671,29 +9843,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct InputStream { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl InputStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for InputStream { + unsafe impl _rt::WasmResource for InputStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -9724,29 +9896,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct OutputStream { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl OutputStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for OutputStream { + unsafe impl _rt::WasmResource for OutputStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -9793,45 +9965,43 @@ pub mod wasi { /// 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. - pub fn read(&self, len: u64) -> Result, StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn read(&self, len: u64) -> Result<_rt::Vec, StreamError> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]input-stream.read"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; - Vec::from_raw_parts(l2 as *mut _, len4, len4) + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) }; Ok(e) } 1 => { let e = { - let l5 = i32::from(*((ptr0 + 4) as *const u8)); + let l5 = i32::from(*ptr0.add(4).cast::()); let v7 = match l5 { 0 => { let e7 = { - let l6 = *((ptr0 + 8) as *const i32); + let l6 = *ptr0.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l6 as u32) }; @@ -9847,7 +10017,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -9856,48 +10026,43 @@ 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, StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn blocking_read(&self, len: u64) -> Result<_rt::Vec, StreamError> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]input-stream.blocking-read"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let len4 = l3 as usize; + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; - Vec::from_raw_parts(l2 as *mut _, len4, len4) + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) }; Ok(e) } 1 => { let e = { - let l5 = i32::from(*((ptr0 + 4) as *const u8)); + let l5 = i32::from(*ptr0.add(4).cast::()); let v7 = match l5 { 0 => { let e7 = { - let l6 = *((ptr0 + 8) as *const i32); + let l6 = *ptr0.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l6 as u32) }; @@ -9913,7 +10078,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -9925,30 +10090,28 @@ pub mod wasi { /// Behaves identical to `read`, except instead of returning a list /// of bytes, returns the number of bytes consumed from the stream. pub fn skip(&self, len: u64) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] extern "C" { #[link_name = "[method]input-stream.skip"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -9956,11 +10119,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr0 + 12) as *const i32); + let l4 = *ptr0.add(12).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -9976,7 +10139,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -9986,30 +10149,28 @@ pub mod wasi { /// Skip bytes from a stream, after blocking until at least one byte /// can be skipped. Except for blocking behavior, identical to `skip`. pub fn blocking_skip(&self, len: u64) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] extern "C" { #[link_name = "[method]input-stream.blocking-skip"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -10017,11 +10178,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr0 + 12) as *const i32); + let l4 = *ptr0.add(12).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -10037,7 +10198,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10051,8 +10212,6 @@ pub mod wasi { /// Implementations may trap if the `input-stream` is dropped before /// all derived `pollable`s created with this function are dropped. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -10082,30 +10241,28 @@ pub mod wasi { /// become ready when this function will report at least 1 byte, or an /// error. pub fn check_write(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] extern "C" { #[link_name = "[method]output-stream.check-write"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -10113,11 +10270,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr0 + 12) as *const i32); + let l4 = *ptr0.add(12).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -10133,7 +10290,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10154,29 +10311,27 @@ pub mod wasi { /// returns Err(closed) without writing if the stream has closed since /// the last call to check-write provided a permit. pub fn write(&self, contents: &[u8]) -> Result<(), StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); let vec0 = contents; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]output-stream.write"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -10184,11 +10339,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 4) as *const u8)); + let l3 = i32::from(*ptr1.add(4).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr1 + 8) as *const i32); + let l4 = *ptr1.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -10204,7 +10359,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10236,29 +10391,27 @@ pub mod wasi { /// let _ = this.check-write(); // eliding error handling /// ``` pub fn blocking_write_and_flush(&self, contents: &[u8]) -> Result<(), StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); let vec0 = contents; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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")] extern "C" { #[link_name = "[method]output-stream.blocking-write-and-flush"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = (); @@ -10266,11 +10419,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr1 + 4) as *const u8)); + let l3 = i32::from(*ptr1.add(4).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr1 + 8) as *const i32); + let l4 = *ptr1.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -10286,7 +10439,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10304,26 +10457,24 @@ pub mod wasi { /// completed. The `subscribe` pollable will become ready when the /// flush has completed and the stream can accept more writes. pub fn flush(&self) -> Result<(), StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]output-stream.flush"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -10331,11 +10482,11 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); let v4 = match l2 { 0 => { let e4 = { - let l3 = *((ptr0 + 8) as *const i32); + let l3 = *ptr0.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l3 as u32) }; @@ -10351,7 +10502,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10361,26 +10512,24 @@ pub mod wasi { /// Request to flush buffered output, and block until flush completes /// and stream is ready for writing again. pub fn blocking_flush(&self) -> Result<(), StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]output-stream.blocking-flush"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -10388,11 +10537,11 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); let v4 = match l2 { 0 => { let e4 = { - let l3 = *((ptr0 + 8) as *const i32); + let l3 = *ptr0.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l3 as u32) }; @@ -10408,7 +10557,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10426,8 +10575,6 @@ pub mod wasi { /// Implementations may trap if the `output-stream` is dropped before /// all derived `pollable`s created with this function are dropped. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] @@ -10454,26 +10601,24 @@ pub mod wasi { /// passing a list of bytes, you simply pass the number of zero-bytes /// that should be written. pub fn write_zeroes(&self, len: u64) -> Result<(), StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]output-stream.write-zeroes"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -10481,11 +10626,11 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); let v4 = match l2 { 0 => { let e4 = { - let l3 = *((ptr0 + 8) as *const i32); + let l3 = *ptr0.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l3 as u32) }; @@ -10501,7 +10646,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10533,26 +10678,24 @@ pub mod wasi { /// let _ = this.check-write(); // eliding error handling /// ``` pub fn blocking_write_zeroes_and_flush(&self, len: u64) -> Result<(), StreamError> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -10560,11 +10703,11 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); let v4 = match l2 { 0 => { let e4 = { - let l3 = *((ptr0 + 8) as *const i32); + let l3 = *ptr0.add(8).cast::(); super::super::super::wasi::io::error::Error::from_handle(l3 as u32) }; @@ -10580,7 +10723,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10601,35 +10744,33 @@ 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 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] extern "C" { #[link_name = "[method]output-stream.splice"] - fn wit_import(_: i32, _: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, (src).handle() as i32, - wit_bindgen::rt::as_i64(&len), + _rt::as_i64(&len), ptr0, ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -10637,11 +10778,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr0 + 12) as *const i32); + let l4 = *ptr0.add(12).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -10657,7 +10798,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10674,35 +10815,33 @@ pub mod wasi { src: &InputStream, len: u64, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:io/streams@0.2.0")] extern "C" { #[link_name = "[method]output-stream.blocking-splice"] - fn wit_import(_: i32, _: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { unreachable!() } wit_import( (self).handle() as i32, (src).handle() as i32, - wit_bindgen::rt::as_i64(&len), + _rt::as_i64(&len), ptr0, ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -10710,11 +10849,11 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); let v5 = match l3 { 0 => { let e5 = { - let l4 = *((ptr0 + 12) as *const i32); + let l4 = *ptr0.add(12).cast::(); super::super::super::wasi::io::error::Error::from_handle(l4 as u32) }; @@ -10730,7 +10869,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -10744,7 +10883,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. /// @@ -10758,30 +10899,28 @@ pub mod wasi { /// This function must always return fresh data. Deterministic environments /// must omit this function, rather than implementing it with deterministic /// data. - pub fn get_random_bytes(len: u64) -> wit_bindgen::rt::vec::Vec { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn get_random_bytes(len: u64) -> _rt::Vec { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:random/random@0.2.0")] extern "C" { #[link_name = "get-random-bytes"] - fn wit_import(_: i64, _: i32); + fn wit_import(_: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i64, _: i32) { + fn wit_import(_: i64, _: *mut u8) { unreachable!() } - wit_import(wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); - let len3 = l2 as usize; - Vec::from_raw_parts(l1 as *mut _, len3, len3) + 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) } } #[allow(unused_unsafe, clippy::all)] @@ -10790,8 +10929,6 @@ pub mod wasi { /// This function returns the same type of data as `get-random-bytes`, /// represented as a `u64`. pub fn get_random_u64() -> u64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/random@0.2.0")] @@ -10815,7 +10952,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. /// @@ -10825,30 +10964,28 @@ pub mod wasi { /// There are no requirements on the values of the returned bytes, however /// implementations are encouraged to return evenly distributed values with /// a long period. - pub fn get_insecure_random_bytes(len: u64) -> wit_bindgen::rt::vec::Vec { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + pub fn get_insecure_random_bytes(len: u64) -> _rt::Vec { unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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:random/insecure@0.2.0")] extern "C" { #[link_name = "get-insecure-random-bytes"] - fn wit_import(_: i64, _: i32); + fn wit_import(_: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i64, _: i32) { + fn wit_import(_: i64, _: *mut u8) { unreachable!() } - wit_import(wit_bindgen::rt::as_i64(&len), ptr0); - let l1 = *((ptr0 + 0) as *const i32); - let l2 = *((ptr0 + 4) as *const i32); - let len3 = l2 as usize; - Vec::from_raw_parts(l1 as *mut _, len3, len3) + 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) } } #[allow(unused_unsafe, clippy::all)] @@ -10857,8 +10994,6 @@ pub mod wasi { /// This function returns the same type of pseudo-random data as /// `get-insecure-random-bytes`, represented as a `u64`. pub fn get_insecure_random_u64() -> u64 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] @@ -10882,7 +11017,8 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. /// @@ -10902,27 +11038,25 @@ pub mod wasi { /// called multiple times and potentially used for purposes other than DoS /// protection. pub fn insecure_seed() -> (u64, u64) { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:random/insecure-seed@0.2.0")] extern "C" { #[link_name = "insecure-seed"] - fn wit_import(_: i32); + fn wit_import(_: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32) { + fn wit_import(_: *mut u8) { unreachable!() } wit_import(ptr0); - let l1 = *((ptr0 + 0) as *const i64); - let l2 = *((ptr0 + 8) as *const i64); + let l1 = *ptr0.add(0).cast::(); + let l2 = *ptr0.add(8).cast::(); (l1 as u64, l2 as u64) } } @@ -10935,7 +11069,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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. @@ -10943,29 +11079,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct Network { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl Network { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for Network { + unsafe impl _rt::WasmResource for Network { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -11289,13 +11425,12 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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 { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.0")] @@ -11319,7 +11454,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; @@ -11331,7 +11468,7 @@ pub mod wasi { /// The payload. /// /// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes. - pub data: wit_bindgen::rt::vec::Vec, + pub data: _rt::Vec, /// The source address. /// /// This field is guaranteed to match the remote address the stream was initialized with, if any. @@ -11351,7 +11488,7 @@ pub mod wasi { #[derive(Clone)] pub struct OutgoingDatagram { /// The payload. - pub data: wit_bindgen::rt::vec::Vec, + pub data: _rt::Vec, /// The destination address. /// /// The requirements on this field depend on how the stream was initialized: @@ -11374,29 +11511,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct UdpSocket { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl UdpSocket { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for UdpSocket { + unsafe impl _rt::WasmResource for UdpSocket { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -11418,29 +11555,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct IncomingDatagramStream { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl IncomingDatagramStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for IncomingDatagramStream { + unsafe impl _rt::WasmResource for IncomingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -11462,29 +11599,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct OutgoingDatagramStream { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl OutgoingDatagramStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for OutgoingDatagramStream { + unsafe impl _rt::WasmResource for OutgoingDatagramStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -11536,12 +11673,10 @@ pub mod wasi { network: &Network, local_address: IpSocketAddress, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); use super::super::super::wasi::sockets::network::IpSocketAddress as V4; let ( result5_0, @@ -11566,11 +11701,11 @@ pub mod wasi { ( 0i32, - wit_bindgen::rt::as_i32(port0), - wit_bindgen::rt::as_i32(t1_0), - wit_bindgen::rt::as_i32(t1_1), - wit_bindgen::rt::as_i32(t1_2), - wit_bindgen::rt::as_i32(t1_3), + _rt::as_i32(port0), + _rt::as_i32(t1_0), + _rt::as_i32(t1_1), + _rt::as_i32(t1_2), + _rt::as_i32(t1_3), 0i32, 0i32, 0i32, @@ -11590,21 +11725,21 @@ pub mod wasi { ( 1i32, - wit_bindgen::rt::as_i32(port2), - wit_bindgen::rt::as_i32(flow_info2), - wit_bindgen::rt::as_i32(t3_0), - wit_bindgen::rt::as_i32(t3_1), - wit_bindgen::rt::as_i32(t3_2), - wit_bindgen::rt::as_i32(t3_3), - wit_bindgen::rt::as_i32(t3_4), - wit_bindgen::rt::as_i32(t3_5), - wit_bindgen::rt::as_i32(t3_6), - wit_bindgen::rt::as_i32(t3_7), - wit_bindgen::rt::as_i32(scope_id2), + _rt::as_i32(port2), + _rt::as_i32(flow_info2), + _rt::as_i32(t3_0), + _rt::as_i32(t3_1), + _rt::as_i32(t3_2), + _rt::as_i32(t3_3), + _rt::as_i32(t3_4), + _rt::as_i32(t3_5), + _rt::as_i32(t3_6), + _rt::as_i32(t3_7), + _rt::as_i32(scope_id2), ) } }; - let ptr6 = ret_area.as_mut_ptr() as i32; + let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] extern "C" { @@ -11624,7 +11759,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ); } @@ -11644,7 +11779,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ) { unreachable!() } @@ -11665,7 +11800,7 @@ pub mod wasi { result5_11, ptr6, ); - let l7 = i32::from(*((ptr6 + 0) as *const u8)); + let l7 = i32::from(*ptr6.add(0).cast::()); match l7 { 0 => { let e = (); @@ -11673,7 +11808,7 @@ pub mod wasi { } 1 => { let e = { - let l8 = i32::from(*((ptr6 + 1) as *const u8)); + let l8 = i32::from(*ptr6.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l8 as u8, @@ -11681,7 +11816,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -11689,26 +11824,24 @@ pub mod wasi { impl UdpSocket { #[allow(unused_unsafe, clippy::all)] pub fn finish_bind(&self) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.finish-bind"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -11716,7 +11849,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -11724,7 +11857,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -11776,12 +11909,10 @@ pub mod wasi { remote_address: Option, ) -> Result<(IncomingDatagramStream, OutgoingDatagramStream), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); let ( result6_0, result6_1, @@ -11822,11 +11953,11 @@ pub mod wasi { ( 0i32, - wit_bindgen::rt::as_i32(port0), - wit_bindgen::rt::as_i32(t1_0), - wit_bindgen::rt::as_i32(t1_1), - wit_bindgen::rt::as_i32(t1_2), - wit_bindgen::rt::as_i32(t1_3), + _rt::as_i32(port0), + _rt::as_i32(t1_0), + _rt::as_i32(t1_1), + _rt::as_i32(t1_2), + _rt::as_i32(t1_3), 0i32, 0i32, 0i32, @@ -11847,17 +11978,17 @@ pub mod wasi { ( 1i32, - wit_bindgen::rt::as_i32(port2), - wit_bindgen::rt::as_i32(flow_info2), - wit_bindgen::rt::as_i32(t3_0), - wit_bindgen::rt::as_i32(t3_1), - wit_bindgen::rt::as_i32(t3_2), - wit_bindgen::rt::as_i32(t3_3), - wit_bindgen::rt::as_i32(t3_4), - wit_bindgen::rt::as_i32(t3_5), - wit_bindgen::rt::as_i32(t3_6), - wit_bindgen::rt::as_i32(t3_7), - wit_bindgen::rt::as_i32(scope_id2), + _rt::as_i32(port2), + _rt::as_i32(flow_info2), + _rt::as_i32(t3_0), + _rt::as_i32(t3_1), + _rt::as_i32(t3_2), + _rt::as_i32(t3_3), + _rt::as_i32(t3_4), + _rt::as_i32(t3_5), + _rt::as_i32(t3_6), + _rt::as_i32(t3_7), + _rt::as_i32(scope_id2), ) } }; @@ -11873,7 +12004,7 @@ pub mod wasi { 0i32, 0i32, ), }; - let ptr7 = ret_area.as_mut_ptr() as i32; + let ptr7 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] extern "C" { @@ -11893,7 +12024,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ); } @@ -11913,7 +12044,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ) { unreachable!() } @@ -11934,12 +12065,12 @@ pub mod wasi { result6_12, ptr7, ); - let l8 = i32::from(*((ptr7 + 0) as *const u8)); + let l8 = i32::from(*ptr7.add(0).cast::()); match l8 { 0 => { let e = { - let l9 = *((ptr7 + 4) as *const i32); - let l10 = *((ptr7 + 8) as *const i32); + let l9 = *ptr7.add(4).cast::(); + let l10 = *ptr7.add(8).cast::(); ( IncomingDatagramStream::from_handle(l9 as u32), @@ -11950,7 +12081,7 @@ pub mod wasi { } 1 => { let e = { - let l11 = i32::from(*((ptr7 + 4) as *const u8)); + let l11 = i32::from(*ptr7.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l11 as u8, @@ -11958,7 +12089,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -11982,39 +12113,37 @@ pub mod wasi { /// - /// - pub fn local_address(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 36]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]udp-socket.local-address"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); use super::super::super::wasi::sockets::network::IpSocketAddress as V19; let v19 = match l2 { 0 => { let e19 = { - let l3 = i32::from(*((ptr0 + 8) as *const u16)); - let l4 = i32::from(*((ptr0 + 10) as *const u8)); - let l5 = i32::from(*((ptr0 + 11) as *const u8)); - let l6 = i32::from(*((ptr0 + 12) as *const u8)); - let l7 = i32::from(*((ptr0 + 13) as *const u8)); + 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, @@ -12026,17 +12155,17 @@ pub mod wasi { n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); let e19 = { - let l8 = i32::from(*((ptr0 + 8) as *const u16)); - let l9 = *((ptr0 + 12) as *const i32); - let l10 = i32::from(*((ptr0 + 16) as *const u16)); - let l11 = i32::from(*((ptr0 + 18) as *const u16)); - let l12 = i32::from(*((ptr0 + 20) as *const u16)); - let l13 = i32::from(*((ptr0 + 22) as *const u16)); - let l14 = i32::from(*((ptr0 + 24) as *const u16)); - let l15 = i32::from(*((ptr0 + 26) as *const u16)); - let l16 = i32::from(*((ptr0 + 28) as *const u16)); - let l17 = i32::from(*((ptr0 + 30) as *const u16)); - let l18 = *((ptr0 + 32) as *const i32); + 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, @@ -12058,7 +12187,7 @@ pub mod wasi { } 1 => { let e = { - let l20 = i32::from(*((ptr0 + 4) as *const u8)); + let l20 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l20 as u8, @@ -12066,7 +12195,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12084,39 +12213,37 @@ pub mod wasi { /// - /// - pub fn remote_address(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 36]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]udp-socket.remote-address"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); use super::super::super::wasi::sockets::network::IpSocketAddress as V19; let v19 = match l2 { 0 => { let e19 = { - let l3 = i32::from(*((ptr0 + 8) as *const u16)); - let l4 = i32::from(*((ptr0 + 10) as *const u8)); - let l5 = i32::from(*((ptr0 + 11) as *const u8)); - let l6 = i32::from(*((ptr0 + 12) as *const u8)); - let l7 = i32::from(*((ptr0 + 13) as *const u8)); + 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, @@ -12128,17 +12255,17 @@ pub mod wasi { n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); let e19 = { - let l8 = i32::from(*((ptr0 + 8) as *const u16)); - let l9 = *((ptr0 + 12) as *const i32); - let l10 = i32::from(*((ptr0 + 16) as *const u16)); - let l11 = i32::from(*((ptr0 + 18) as *const u16)); - let l12 = i32::from(*((ptr0 + 20) as *const u16)); - let l13 = i32::from(*((ptr0 + 22) as *const u16)); - let l14 = i32::from(*((ptr0 + 24) as *const u16)); - let l15 = i32::from(*((ptr0 + 26) as *const u16)); - let l16 = i32::from(*((ptr0 + 28) as *const u16)); - let l17 = i32::from(*((ptr0 + 30) as *const u16)); - let l18 = *((ptr0 + 32) as *const i32); + 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, @@ -12160,7 +12287,7 @@ pub mod wasi { } 1 => { let e = { - let l20 = i32::from(*((ptr0 + 4) as *const u8)); + let l20 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l20 as u8, @@ -12168,7 +12295,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12179,8 +12306,6 @@ pub mod wasi { /// /// Equivalent to the SO_DOMAIN socket option. pub fn address_family(&self) -> IpAddressFamily { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] @@ -12209,30 +12334,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. pub fn unicast_hop_limit(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.unicast-hop-limit"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); l2 as u8 }; @@ -12240,7 +12363,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 1) as *const u8)); + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -12248,7 +12371,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12256,30 +12379,24 @@ pub mod wasi { impl UdpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-unicast-hop-limit"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i32(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i32(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -12287,7 +12404,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -12295,7 +12412,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12313,30 +12430,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. pub fn receive_buffer_size(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] extern "C" { #[link_name = "[method]udp-socket.receive-buffer-size"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -12344,7 +12459,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -12352,7 +12467,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12360,30 +12475,24 @@ pub mod wasi { impl UdpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -12391,7 +12500,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -12399,7 +12508,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12407,30 +12516,28 @@ pub mod wasi { impl UdpSocket { #[allow(unused_unsafe, clippy::all)] pub fn send_buffer_size(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] extern "C" { #[link_name = "[method]udp-socket.send-buffer-size"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -12438,7 +12545,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -12446,7 +12553,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12454,30 +12561,24 @@ pub mod wasi { impl UdpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-send-buffer-size"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -12485,7 +12586,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -12493,7 +12594,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12505,8 +12606,6 @@ pub mod wasi { /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] @@ -12552,61 +12651,54 @@ pub mod wasi { pub fn receive( &self, max_results: u64, - ) -> Result, ErrorCode> - { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; + ) -> Result<_rt::Vec, ErrorCode> { unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]incoming-datagram-stream.receive"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(&max_results), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&max_results), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); let base25 = l2; let len25 = l3; - let mut result25 = Vec::with_capacity(len25 as usize); + let mut result25 = _rt::Vec::with_capacity(len25); for i in 0..len25 { - let base = base25 + i * 40; + let base = base25.add(i * 40); let e25 = { - let l4 = *((base + 0) as *const i32); - let l5 = *((base + 4) as *const i32); - let len6 = l5 as usize; - let l7 = i32::from(*((base + 8) as *const u8)); + 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 { 0 => { let e24 = { let l8 = - i32::from(*((base + 12) as *const u16)); + i32::from(*base.add(12).cast::()); let l9 = - i32::from(*((base + 14) as *const u8)); + i32::from(*base.add(14).cast::()); let l10 = - i32::from(*((base + 15) as *const u8)); + i32::from(*base.add(15).cast::()); let l11 = - i32::from(*((base + 16) as *const u8)); + i32::from(*base.add(16).cast::()); let l12 = - i32::from(*((base + 17) as *const u8)); + i32::from(*base.add(17).cast::()); super::super::super::wasi::sockets::network::Ipv4SocketAddress { port: l8 as u16, @@ -12622,25 +12714,25 @@ pub mod wasi { ); let e24 = { let l13 = - i32::from(*((base + 12) as *const u16)); - let l14 = *((base + 16) as *const i32); + i32::from(*base.add(12).cast::()); + let l14 = *base.add(16).cast::(); let l15 = - i32::from(*((base + 20) as *const u16)); + i32::from(*base.add(20).cast::()); let l16 = - i32::from(*((base + 22) as *const u16)); + i32::from(*base.add(22).cast::()); let l17 = - i32::from(*((base + 24) as *const u16)); + i32::from(*base.add(24).cast::()); let l18 = - i32::from(*((base + 26) as *const u16)); + i32::from(*base.add(26).cast::()); let l19 = - i32::from(*((base + 28) as *const u16)); + i32::from(*base.add(28).cast::()); let l20 = - i32::from(*((base + 30) as *const u16)); + i32::from(*base.add(30).cast::()); let l21 = - i32::from(*((base + 32) as *const u16)); + i32::from(*base.add(32).cast::()); let l22 = - i32::from(*((base + 34) as *const u16)); - let l23 = *((base + 36) as *const i32); + i32::from(*base.add(34).cast::()); + let l23 = *base.add(36).cast::(); super::super::super::wasi::sockets::network::Ipv6SocketAddress { port: l13 as u16, @@ -12657,13 +12749,17 @@ pub mod wasi { }; IncomingDatagram { - data: Vec::from_raw_parts(l4 as *mut _, len6, len6), + data: _rt::Vec::from_raw_parts( + l4.cast(), + len6, + len6, + ), remote_address: v24, } }; result25.push(e25); } - wit_bindgen::rt::dealloc(base25, (len25 as usize) * 40, 4); + _rt::cabi_dealloc(base25, len25 * 40, 4); result25 }; @@ -12671,7 +12767,7 @@ pub mod wasi { } 1 => { let e = { - let l26 = i32::from(*((ptr0 + 4) as *const u8)); + let l26 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l26 as u8, @@ -12679,7 +12775,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12691,8 +12787,6 @@ pub mod wasi { /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] @@ -12724,30 +12818,28 @@ pub mod wasi { /// /// Never returns `would-block`. pub fn check_send(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] extern "C" { #[link_name = "[method]outgoing-datagram-stream.check-send"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -12755,7 +12847,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -12763,7 +12855,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12805,19 +12897,18 @@ pub mod wasi { /// - /// - pub fn send(&self, datagrams: &[OutgoingDatagram]) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); let vec7 = datagrams; - let len7 = vec7.len() as i32; - let layout7 = alloc::Layout::from_size_align_unchecked(vec7.len() * 44, 4); + let len7 = vec7.len(); + let layout7 = + _rt::alloc::Layout::from_size_align_unchecked(vec7.len() * 44, 4); let result7 = if layout7.size() != 0 { - let ptr = alloc::alloc(layout7); + let ptr = _rt::alloc::alloc(layout7).cast::(); if ptr.is_null() { - alloc::handle_alloc_error(layout7); + _rt::alloc::handle_alloc_error(layout7); } ptr } else { @@ -12826,52 +12917,52 @@ pub mod wasi { } }; for (i, e) in vec7.into_iter().enumerate() { - let base = result7 as i32 + (i as i32) * 44; + let base = result7.add(i * 44); { let OutgoingDatagram { data: data0, remote_address: remote_address0, } = e; let vec1 = data0; - let ptr1 = vec1.as_ptr() as i32; - let len1 = vec1.len() as i32; - *((base + 4) as *mut i32) = len1; - *((base + 0) as *mut i32) = ptr1; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + *base.add(4).cast::() = len1; + *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); match remote_address0 { Some(e) => { - *((base + 8) as *mut u8) = (1i32) as u8; + *base.add(8).cast::() = (1i32) as u8; use super::super::super::wasi::sockets::network::IpSocketAddress as V6; match e { V6::Ipv4(e) => { - *((base + 12) as *mut u8) = (0i32) as u8; + *base.add(12).cast::() = (0i32) as u8; let super::super::super::wasi::sockets::network::Ipv4SocketAddress { port: port2, address: address2, } = e; - *((base + 16) as *mut u16) = - (wit_bindgen::rt::as_i32(port2)) as u16; + *base.add(16).cast::() = + (_rt::as_i32(port2)) as u16; let (t3_0, t3_1, t3_2, t3_3) = address2; - *((base + 18) as *mut u8) = - (wit_bindgen::rt::as_i32(t3_0)) as u8; - *((base + 19) as *mut u8) = - (wit_bindgen::rt::as_i32(t3_1)) as u8; - *((base + 20) as *mut u8) = - (wit_bindgen::rt::as_i32(t3_2)) as u8; - *((base + 21) as *mut u8) = - (wit_bindgen::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 + 12) as *mut u8) = (1i32) as u8; + *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 + 16) as *mut u16) = - (wit_bindgen::rt::as_i32(port4)) as u16; - *((base + 20) as *mut i32) = - wit_bindgen::rt::as_i32(flow_info4); + *base.add(16).cast::() = + (_rt::as_i32(port4)) as u16; + *base.add(20).cast::() = + _rt::as_i32(flow_info4); let ( t5_0, t5_1, @@ -12882,54 +12973,54 @@ pub mod wasi { t5_6, t5_7, ) = address4; - *((base + 24) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_0)) as u16; - *((base + 26) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_1)) as u16; - *((base + 28) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_2)) as u16; - *((base + 30) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_3)) as u16; - *((base + 32) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_4)) as u16; - *((base + 34) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_5)) as u16; - *((base + 36) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_6)) as u16; - *((base + 38) as *mut u16) = - (wit_bindgen::rt::as_i32(t5_7)) as u16; - *((base + 40) as *mut i32) = - wit_bindgen::rt::as_i32(scope_id4); + *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); } } } None => { - *((base + 8) as *mut u8) = (0i32) as u8; + *base.add(8).cast::() = (0i32) as u8; } }; } } - let ptr8 = ret_area.as_mut_ptr() as i32; + let ptr8 = 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]outgoing-datagram-stream.send"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, result7 as i32, len7, ptr8); - let l9 = i32::from(*((ptr8 + 0) as *const u8)); + wit_import((self).handle() as i32, result7, len7, ptr8); + let l9 = i32::from(*ptr8.add(0).cast::()); if layout7.size() != 0 { - alloc::dealloc(result7, layout7); + _rt::alloc::dealloc(result7.cast(), layout7); } match l9 { 0 => { let e = { - let l10 = *((ptr8 + 8) as *const i64); + let l10 = *ptr8.add(8).cast::(); l10 as u64 }; @@ -12937,7 +13028,7 @@ pub mod wasi { } 1 => { let e = { - let l11 = i32::from(*((ptr8 + 8) as *const u8)); + let l11 = i32::from(*ptr8.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l11 as u8, @@ -12945,7 +13036,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -12957,8 +13048,6 @@ pub mod wasi { /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] @@ -12983,7 +13072,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; pub type UdpSocket = super::super::super::wasi::sockets::udp::UdpSocket; @@ -13011,30 +13102,28 @@ pub mod wasi { pub fn create_udp_socket( address_family: IpAddressFamily, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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/udp-create-socket@0.2.0")] extern "C" { #[link_name = "create-udp-socket"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import(address_family.clone() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::sockets::udp::UdpSocket::from_handle( l2 as u32, @@ -13044,7 +13133,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -13052,7 +13141,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13063,7 +13152,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; pub type Pollable = super::super::super::wasi::io::poll::Pollable; @@ -13133,29 +13224,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct TcpSocket { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl TcpSocket { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for TcpSocket { + unsafe impl _rt::WasmResource for TcpSocket { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -13219,12 +13310,10 @@ pub mod wasi { network: &Network, local_address: IpSocketAddress, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); use super::super::super::wasi::sockets::network::IpSocketAddress as V4; let ( result5_0, @@ -13249,11 +13338,11 @@ pub mod wasi { ( 0i32, - wit_bindgen::rt::as_i32(port0), - wit_bindgen::rt::as_i32(t1_0), - wit_bindgen::rt::as_i32(t1_1), - wit_bindgen::rt::as_i32(t1_2), - wit_bindgen::rt::as_i32(t1_3), + _rt::as_i32(port0), + _rt::as_i32(t1_0), + _rt::as_i32(t1_1), + _rt::as_i32(t1_2), + _rt::as_i32(t1_3), 0i32, 0i32, 0i32, @@ -13273,21 +13362,21 @@ pub mod wasi { ( 1i32, - wit_bindgen::rt::as_i32(port2), - wit_bindgen::rt::as_i32(flow_info2), - wit_bindgen::rt::as_i32(t3_0), - wit_bindgen::rt::as_i32(t3_1), - wit_bindgen::rt::as_i32(t3_2), - wit_bindgen::rt::as_i32(t3_3), - wit_bindgen::rt::as_i32(t3_4), - wit_bindgen::rt::as_i32(t3_5), - wit_bindgen::rt::as_i32(t3_6), - wit_bindgen::rt::as_i32(t3_7), - wit_bindgen::rt::as_i32(scope_id2), + _rt::as_i32(port2), + _rt::as_i32(flow_info2), + _rt::as_i32(t3_0), + _rt::as_i32(t3_1), + _rt::as_i32(t3_2), + _rt::as_i32(t3_3), + _rt::as_i32(t3_4), + _rt::as_i32(t3_5), + _rt::as_i32(t3_6), + _rt::as_i32(t3_7), + _rt::as_i32(scope_id2), ) } }; - let ptr6 = ret_area.as_mut_ptr() as i32; + let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { @@ -13307,7 +13396,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ); } @@ -13327,7 +13416,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ) { unreachable!() } @@ -13348,7 +13437,7 @@ pub mod wasi { result5_11, ptr6, ); - let l7 = i32::from(*((ptr6 + 0) as *const u8)); + let l7 = i32::from(*ptr6.add(0).cast::()); match l7 { 0 => { let e = (); @@ -13356,7 +13445,7 @@ pub mod wasi { } 1 => { let e = { - let l8 = i32::from(*((ptr6 + 1) as *const u8)); + let l8 = i32::from(*ptr6.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l8 as u8, @@ -13364,7 +13453,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13372,26 +13461,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn finish_bind(&self) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.finish-bind"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -13399,7 +13486,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -13407,7 +13494,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13461,12 +13548,10 @@ pub mod wasi { network: &Network, remote_address: IpSocketAddress, ) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); use super::super::super::wasi::sockets::network::IpSocketAddress as V4; let ( result5_0, @@ -13491,11 +13576,11 @@ pub mod wasi { ( 0i32, - wit_bindgen::rt::as_i32(port0), - wit_bindgen::rt::as_i32(t1_0), - wit_bindgen::rt::as_i32(t1_1), - wit_bindgen::rt::as_i32(t1_2), - wit_bindgen::rt::as_i32(t1_3), + _rt::as_i32(port0), + _rt::as_i32(t1_0), + _rt::as_i32(t1_1), + _rt::as_i32(t1_2), + _rt::as_i32(t1_3), 0i32, 0i32, 0i32, @@ -13515,21 +13600,21 @@ pub mod wasi { ( 1i32, - wit_bindgen::rt::as_i32(port2), - wit_bindgen::rt::as_i32(flow_info2), - wit_bindgen::rt::as_i32(t3_0), - wit_bindgen::rt::as_i32(t3_1), - wit_bindgen::rt::as_i32(t3_2), - wit_bindgen::rt::as_i32(t3_3), - wit_bindgen::rt::as_i32(t3_4), - wit_bindgen::rt::as_i32(t3_5), - wit_bindgen::rt::as_i32(t3_6), - wit_bindgen::rt::as_i32(t3_7), - wit_bindgen::rt::as_i32(scope_id2), + _rt::as_i32(port2), + _rt::as_i32(flow_info2), + _rt::as_i32(t3_0), + _rt::as_i32(t3_1), + _rt::as_i32(t3_2), + _rt::as_i32(t3_3), + _rt::as_i32(t3_4), + _rt::as_i32(t3_5), + _rt::as_i32(t3_6), + _rt::as_i32(t3_7), + _rt::as_i32(scope_id2), ) } }; - let ptr6 = ret_area.as_mut_ptr() as i32; + let ptr6 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { @@ -13549,7 +13634,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ); } @@ -13569,7 +13654,7 @@ pub mod wasi { _: i32, _: i32, _: i32, - _: i32, + _: *mut u8, ) { unreachable!() } @@ -13590,7 +13675,7 @@ pub mod wasi { result5_11, ptr6, ); - let l7 = i32::from(*((ptr6 + 0) as *const u8)); + let l7 = i32::from(*ptr6.add(0).cast::()); match l7 { 0 => { let e = (); @@ -13598,7 +13683,7 @@ pub mod wasi { } 1 => { let e = { - let l8 = i32::from(*((ptr6 + 1) as *const u8)); + let l8 = i32::from(*ptr6.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l8 as u8, @@ -13606,7 +13691,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13614,31 +13699,29 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn finish_connect(&self) -> Result<(InputStream, OutputStream), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 12]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]tcp-socket.finish-connect"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); + let l2 = *ptr0.add(4).cast::(); + let l3 = *ptr0.add(8).cast::(); ( super::super::super::wasi::io::streams::InputStream::from_handle(l2 as u32), @@ -13649,7 +13732,7 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr0 + 4) as *const u8)); + let l4 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l4 as u8, @@ -13657,7 +13740,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13690,26 +13773,24 @@ pub mod wasi { /// - /// - pub fn start_listen(&self) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.start-listen"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -13717,7 +13798,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -13725,7 +13806,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13733,26 +13814,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn finish_listen(&self) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.finish-listen"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -13760,7 +13839,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -13768,7 +13847,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13802,32 +13881,30 @@ pub mod wasi { /// - /// - pub fn accept(&self) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { #[link_name = "[method]tcp-socket.accept"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); - let l3 = *((ptr0 + 8) as *const i32); - let l4 = *((ptr0 + 12) as *const i32); + let l2 = *ptr0.add(4).cast::(); + let l3 = *ptr0.add(8).cast::(); + let l4 = *ptr0.add(12).cast::(); ( TcpSocket::from_handle(l2 as u32), @@ -13839,7 +13916,7 @@ pub mod wasi { } 1 => { let e = { - let l5 = i32::from(*((ptr0 + 4) as *const u8)); + let l5 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l5 as u8, @@ -13847,7 +13924,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13871,39 +13948,37 @@ pub mod wasi { /// - /// - pub fn local_address(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 36]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]tcp-socket.local-address"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); use super::super::super::wasi::sockets::network::IpSocketAddress as V19; let v19 = match l2 { 0 => { let e19 = { - let l3 = i32::from(*((ptr0 + 8) as *const u16)); - let l4 = i32::from(*((ptr0 + 10) as *const u8)); - let l5 = i32::from(*((ptr0 + 11) as *const u8)); - let l6 = i32::from(*((ptr0 + 12) as *const u8)); - let l7 = i32::from(*((ptr0 + 13) as *const u8)); + 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, @@ -13915,17 +13990,17 @@ pub mod wasi { n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); let e19 = { - let l8 = i32::from(*((ptr0 + 8) as *const u16)); - let l9 = *((ptr0 + 12) as *const i32); - let l10 = i32::from(*((ptr0 + 16) as *const u16)); - let l11 = i32::from(*((ptr0 + 18) as *const u16)); - let l12 = i32::from(*((ptr0 + 20) as *const u16)); - let l13 = i32::from(*((ptr0 + 22) as *const u16)); - let l14 = i32::from(*((ptr0 + 24) as *const u16)); - let l15 = i32::from(*((ptr0 + 26) as *const u16)); - let l16 = i32::from(*((ptr0 + 28) as *const u16)); - let l17 = i32::from(*((ptr0 + 30) as *const u16)); - let l18 = *((ptr0 + 32) as *const i32); + 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, @@ -13947,7 +14022,7 @@ pub mod wasi { } 1 => { let e = { - let l20 = i32::from(*((ptr0 + 4) as *const u8)); + let l20 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l20 as u8, @@ -13955,7 +14030,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -13973,39 +14048,37 @@ pub mod wasi { /// - /// - pub fn remote_address(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 36]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]tcp-socket.remote-address"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 4) as *const u8)); + let l2 = i32::from(*ptr0.add(4).cast::()); use super::super::super::wasi::sockets::network::IpSocketAddress as V19; let v19 = match l2 { 0 => { let e19 = { - let l3 = i32::from(*((ptr0 + 8) as *const u16)); - let l4 = i32::from(*((ptr0 + 10) as *const u8)); - let l5 = i32::from(*((ptr0 + 11) as *const u8)); - let l6 = i32::from(*((ptr0 + 12) as *const u8)); - let l7 = i32::from(*((ptr0 + 13) as *const u8)); + 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, @@ -14017,17 +14090,17 @@ pub mod wasi { n => { debug_assert_eq!(n, 1, "invalid enum discriminant"); let e19 = { - let l8 = i32::from(*((ptr0 + 8) as *const u16)); - let l9 = *((ptr0 + 12) as *const i32); - let l10 = i32::from(*((ptr0 + 16) as *const u16)); - let l11 = i32::from(*((ptr0 + 18) as *const u16)); - let l12 = i32::from(*((ptr0 + 20) as *const u16)); - let l13 = i32::from(*((ptr0 + 22) as *const u16)); - let l14 = i32::from(*((ptr0 + 24) as *const u16)); - let l15 = i32::from(*((ptr0 + 26) as *const u16)); - let l16 = i32::from(*((ptr0 + 28) as *const u16)); - let l17 = i32::from(*((ptr0 + 30) as *const u16)); - let l18 = *((ptr0 + 32) as *const i32); + 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, @@ -14049,7 +14122,7 @@ pub mod wasi { } 1 => { let e = { - let l20 = i32::from(*((ptr0 + 4) as *const u8)); + let l20 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l20 as u8, @@ -14057,7 +14130,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14068,8 +14141,6 @@ pub mod wasi { /// /// Equivalent to the SO_ACCEPTCONN socket option. pub fn is_listening(&self) -> bool { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] @@ -14083,7 +14154,7 @@ pub mod wasi { unreachable!() } let ret = wit_import((self).handle() as i32); - wit_bindgen::rt::bool_lift(ret as u8) + _rt::bool_lift(ret as u8) } } } @@ -14093,8 +14164,6 @@ pub mod wasi { /// /// Equivalent to the SO_DOMAIN socket option. pub fn address_family(&self) -> IpAddressFamily { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] @@ -14126,30 +14195,24 @@ pub mod wasi { /// - `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> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-listen-backlog-size"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14157,7 +14220,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14165,7 +14228,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14182,38 +14245,36 @@ pub mod wasi { /// /// Equivalent to the SO_KEEPALIVE socket option. pub fn keep_alive_enabled(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.keep-alive-enabled"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); - wit_bindgen::rt::bool_lift(l2 as u8) + _rt::bool_lift(l2 as u8) }; Ok(e) } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 1) as *const u8)); + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14221,7 +14282,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14229,22 +14290,20 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_keep_alive_enabled(&self, value: bool) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-enabled"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import( @@ -14255,7 +14314,7 @@ pub mod wasi { }, ptr0, ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14263,7 +14322,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14271,7 +14330,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14289,30 +14348,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. pub fn keep_alive_idle_time(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-idle-time"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -14320,7 +14377,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14328,7 +14385,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14336,26 +14393,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_keep_alive_idle_time(&self, value: Duration) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(value), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14363,7 +14418,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14371,7 +14426,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14389,30 +14444,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. pub fn keep_alive_interval(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-interval"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -14420,7 +14473,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14428,7 +14481,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14436,26 +14489,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_keep_alive_interval(&self, value: Duration) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import((self).handle() as i32, wit_bindgen::rt::as_i64(value), ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14463,7 +14514,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14471,7 +14522,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14489,30 +14540,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. pub fn keep_alive_count(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]tcp-socket.keep-alive-count"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); l2 as u32 }; @@ -14520,7 +14569,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14528,7 +14577,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14536,30 +14585,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-count"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i32(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i32(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14567,7 +14610,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14575,7 +14618,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14589,30 +14632,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The TTL value must be 1 or higher. pub fn hop_limit(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.hop-limit"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); l2 as u8 }; @@ -14620,7 +14661,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 1) as *const u8)); + let l3 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14628,7 +14669,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14636,30 +14677,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-hop-limit"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i32(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i32(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14667,7 +14702,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14675,7 +14710,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14693,30 +14728,28 @@ pub mod wasi { /// # Typical errors /// - `invalid-argument`: (set) The provided value was 0. pub fn receive_buffer_size(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { #[link_name = "[method]tcp-socket.receive-buffer-size"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -14724,7 +14757,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14732,7 +14765,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14740,30 +14773,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14771,7 +14798,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14779,7 +14806,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14787,30 +14814,28 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn send_buffer_size(&self) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(8))] - struct RetArea([u8; 16]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] extern "C" { #[link_name = "[method]tcp-socket.send-buffer-size"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 8) as *const i64); + let l2 = *ptr0.add(8).cast::(); l2 as u64 }; @@ -14818,7 +14843,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 8) as *const u8)); + let l3 = i32::from(*ptr0.add(8).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -14826,7 +14851,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14834,30 +14859,24 @@ pub mod wasi { impl TcpSocket { #[allow(unused_unsafe, clippy::all)] pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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-send-buffer-size"] - fn wit_import(_: i32, _: i64, _: i32); + fn wit_import(_: i32, _: i64, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i64, _: i32) { + fn wit_import(_: i32, _: i64, _: *mut u8) { unreachable!() } - wit_import( - (self).handle() as i32, - wit_bindgen::rt::as_i64(&value), - ptr0, - ); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + wit_import((self).handle() as i32, _rt::as_i64(&value), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14865,7 +14884,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14873,7 +14892,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14898,8 +14917,6 @@ pub mod wasi { /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] @@ -14943,26 +14960,24 @@ pub mod wasi { /// - /// - pub fn shutdown(&self, shutdown_type: ShutdownType) -> Result<(), ErrorCode> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(1))] - struct RetArea([u8; 2]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + 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.shutdown"] - fn wit_import(_: i32, _: i32, _: i32); + fn wit_import(_: i32, _: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, shutdown_type.clone() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = (); @@ -14970,7 +14985,7 @@ pub mod wasi { } 1 => { let e = { - let l2 = i32::from(*((ptr0 + 1) as *const u8)); + let l2 = i32::from(*ptr0.add(1).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l2 as u8, @@ -14978,7 +14993,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -14990,7 +15005,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; pub type TcpSocket = super::super::super::wasi::sockets::tcp::TcpSocket; @@ -15018,30 +15035,28 @@ pub mod wasi { pub fn create_tcp_socket( address_family: IpAddressFamily, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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-create-socket@0.2.0")] extern "C" { #[link_name = "create-tcp-socket"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import(address_family.clone() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = *((ptr0 + 4) as *const i32); + let l2 = *ptr0.add(4).cast::(); super::super::super::wasi::sockets::tcp::TcpSocket::from_handle( l2 as u32, @@ -15051,7 +15066,7 @@ pub mod wasi { } 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l3 as u8, @@ -15059,7 +15074,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -15070,7 +15085,9 @@ pub mod wasi { #[used] #[doc(hidden)] #[cfg(target_arch = "wasm32")] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_section; + 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; @@ -15079,29 +15096,29 @@ pub mod wasi { #[derive(Debug)] #[repr(transparent)] pub struct ResolveAddressStream { - handle: wit_bindgen::rt::Resource, + handle: _rt::Resource, } impl ResolveAddressStream { #[doc(hidden)] pub unsafe fn from_handle(handle: u32) -> Self { Self { - handle: wit_bindgen::rt::Resource::from_handle(handle), + handle: _rt::Resource::from_handle(handle), } } #[doc(hidden)] pub fn take_handle(&self) -> u32 { - wit_bindgen::rt::Resource::take_handle(&self.handle) + _rt::Resource::take_handle(&self.handle) } #[doc(hidden)] pub fn handle(&self) -> u32 { - wit_bindgen::rt::Resource::handle(&self.handle) + _rt::Resource::handle(&self.handle) } } - unsafe impl wit_bindgen::rt::WasmResource for ResolveAddressStream { + unsafe impl _rt::WasmResource for ResolveAddressStream { #[inline] unsafe fn drop(_handle: u32) { #[cfg(not(target_arch = "wasm32"))] @@ -15145,33 +15162,31 @@ pub mod wasi { network: &Network, name: &str, ) -> Result { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(4))] - struct RetArea([u8; 8]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); let vec0 = name; - let ptr0 = vec0.as_ptr() as i32; - let len0 = vec0.len() as i32; - let ptr1 = ret_area.as_mut_ptr() as i32; + 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:sockets/ip-name-lookup@0.2.0")] extern "C" { #[link_name = "resolve-addresses"] - fn wit_import(_: i32, _: i32, _: i32, _: i32); + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32, _: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { unreachable!() } - wit_import((network).handle() as i32, ptr0, len0, ptr1); - let l2 = i32::from(*((ptr1 + 0) as *const u8)); + wit_import((network).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); match l2 { 0 => { let e = { - let l3 = *((ptr1 + 4) as *const i32); + let l3 = *ptr1.add(4).cast::(); ResolveAddressStream::from_handle(l3 as u32) }; @@ -15179,7 +15194,7 @@ pub mod wasi { } 1 => { let e = { - let l4 = i32::from(*((ptr1 + 4) as *const u8)); + let l4 = i32::from(*ptr1.add(4).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l4 as u8, @@ -15187,7 +15202,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -15207,51 +15222,49 @@ pub mod wasi { /// - `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> { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[repr(align(2))] - struct RetArea([u8; 22]); - let mut ret_area = ::core::mem::MaybeUninit::::uninit(); - let ptr0 = ret_area.as_mut_ptr() as i32; + struct RetArea([::core::mem::MaybeUninit; 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")] extern "C" { #[link_name = "[method]resolve-address-stream.resolve-next-address"] - fn wit_import(_: i32, _: i32); + fn wit_import(_: i32, _: *mut u8); } #[cfg(not(target_arch = "wasm32"))] - fn wit_import(_: i32, _: i32) { + fn wit_import(_: i32, _: *mut u8) { unreachable!() } wit_import((self).handle() as i32, ptr0); - let l1 = i32::from(*((ptr0 + 0) as *const u8)); + let l1 = i32::from(*ptr0.add(0).cast::()); match l1 { 0 => { let e = { - let l2 = i32::from(*((ptr0 + 2) as *const u8)); + let l2 = i32::from(*ptr0.add(2).cast::()); match l2 { 0 => None, 1 => { let e = { - let l3 = i32::from(*((ptr0 + 4) as *const u8)); + let l3 = i32::from(*ptr0.add(4).cast::()); use super::super::super::wasi::sockets::network::IpAddress as V16; let v16 = match l3 { 0 => { let e16 = { let l4 = i32::from( - *((ptr0 + 6) as *const u8), + *ptr0.add(6).cast::(), ); let l5 = i32::from( - *((ptr0 + 7) as *const u8), + *ptr0.add(7).cast::(), ); let l6 = i32::from( - *((ptr0 + 8) as *const u8), + *ptr0.add(8).cast::(), ); let l7 = i32::from( - *((ptr0 + 9) as *const u8), + *ptr0.add(9).cast::(), ); (l4 as u8, l5 as u8, l6 as u8, l7 as u8) @@ -15265,28 +15278,28 @@ pub mod wasi { ); let e16 = { let l8 = i32::from( - *((ptr0 + 6) as *const u16), + *ptr0.add(6).cast::(), ); let l9 = i32::from( - *((ptr0 + 8) as *const u16), + *ptr0.add(8).cast::(), ); let l10 = i32::from( - *((ptr0 + 10) as *const u16), + *ptr0.add(10).cast::(), ); let l11 = i32::from( - *((ptr0 + 12) as *const u16), + *ptr0.add(12).cast::(), ); let l12 = i32::from( - *((ptr0 + 14) as *const u16), + *ptr0.add(14).cast::(), ); let l13 = i32::from( - *((ptr0 + 16) as *const u16), + *ptr0.add(16).cast::(), ); let l14 = i32::from( - *((ptr0 + 18) as *const u16), + *ptr0.add(18).cast::(), ); let l15 = i32::from( - *((ptr0 + 20) as *const u16), + *ptr0.add(20).cast::(), ); ( @@ -15303,14 +15316,14 @@ pub mod wasi { }; Some(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } }; Ok(e) } 1 => { let e = { - let l17 = i32::from(*((ptr0 + 2) as *const u8)); + let l17 = i32::from(*ptr0.add(2).cast::()); super::super::super::wasi::sockets::network::ErrorCode::_lift( l17 as u8, @@ -15318,7 +15331,7 @@ pub mod wasi { }; Err(e) } - _ => wit_bindgen::rt::invalid_enum_discriminant(), + _ => _rt::invalid_enum_discriminant(), } } } @@ -15330,8 +15343,6 @@ pub mod wasi { /// Note: this function is here for WASI Preview2 only. /// It's planned to be removed when `future` is natively supported in Preview3. pub fn subscribe(&self) -> Pollable { - #[allow(unused_imports)] - use wit_bindgen::rt::{alloc, string::String, vec::Vec}; unsafe { #[cfg(target_arch = "wasm32")] #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] @@ -15352,9 +15363,239 @@ pub mod wasi { } } } +mod _rt { + + use core::fmt; + use core::marker; + use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; + + /// A type which represents a component model resource, either imported or + /// exported into this component. + /// + /// This is a low-level wrapper which handles the lifetime of the resource + /// (namely this has a destructor). The `T` provided defines the component model + /// intrinsics that this wrapper uses. + /// + /// One of the chief purposes of this type is to provide `Deref` implementations + /// to access the underlying data when it is owned. + /// + /// This type is primarily used in generated code for exported and imported + /// resources. + #[repr(transparent)] + pub struct Resource { + // NB: This would ideally be `u32` but it is not. The fact that this has + // interior mutability is not exposed in the API of this type except for the + // `take_handle` method which is supposed to in theory be private. + // + // This represents, almost all the time, a valid handle value. When it's + // invalid it's stored as `u32::MAX`. + handle: AtomicU32, + _marker: marker::PhantomData, + } + + /// A trait which all wasm resources implement, namely providing the ability to + /// drop a resource. + /// + /// This generally is implemented by generated code, not user-facing code. + pub unsafe trait WasmResource { + /// Invokes the `[resource-drop]...` intrinsic. + unsafe fn drop(handle: u32); + } + + impl Resource { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + debug_assert!(handle != u32::MAX); + Self { + handle: AtomicU32::new(handle), + _marker: marker::PhantomData, + } + } + + /// Takes ownership of the handle owned by `resource`. + /// + /// Note that this ideally would be `into_handle` taking `Resource` by + /// ownership. The code generator does not enable that in all situations, + /// unfortunately, so this is provided instead. + /// + /// Also note that `take_handle` is in theory only ever called on values + /// owned by a generated function. For example a generated function might + /// take `Resource` as an argument but then call `take_handle` on a + /// reference to that argument. In that sense the dynamic nature of + /// `take_handle` should only be exposed internally to generated code, not + /// to user code. + #[doc(hidden)] + pub fn take_handle(resource: &Resource) -> u32 { + resource.handle.swap(u32::MAX, Relaxed) + } + + #[doc(hidden)] + pub fn handle(resource: &Resource) -> u32 { + resource.handle.load(Relaxed) + } + } + + impl fmt::Debug for Resource { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Resource") + .field("handle", &self.handle) + .finish() + } + } + + impl Drop for Resource { + fn drop(&mut self) { + unsafe { + match self.handle.load(Relaxed) { + // If this handle was "taken" then don't do anything in the + // destructor. + u32::MAX => {} + + // ... but otherwise do actually destroy it with the imported + // component model intrinsic as defined through `T`. + other => T::drop(other), + } + } + } + } + pub unsafe fn bool_lift(val: u8) -> bool { + if cfg!(debug_assertions) { + match val { + 0 => false, + 1 => true, + _ => panic!("invalid bool discriminant"), + } + } else { + ::core::mem::transmute::(val) + } + } + pub use alloc_crate::alloc; + pub use alloc_crate::vec::Vec; + + 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 { + self as i64 + } + } + pub use alloc_crate::string::String; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { + if size == 0 { + return; + } + let layout = alloc::Layout::from_size_align_unchecked(size, align); + alloc::dealloc(ptr as *mut u8, layout); + } + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + extern crate alloc as alloc_crate; +} #[cfg(target_arch = "wasm32")] -#[link_section = "component-type:bindingsrust-wasi-from-crates-io"] +#[link_section = "component-type:wit-bindgen:0.20.0: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\ @@ -15667,12 +15908,12 @@ 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.200.0\x10wit-bi\ -ndgen-rust\x060.19.2"; +\0\0G\x09producers\x01\x0cprocessed-by\x02\x0dwit-component\x070.201.0\x10wit-bi\ +ndgen-rust\x060.20.0"; #[inline(never)] #[doc(hidden)] #[cfg(target_arch = "wasm32")] -pub fn __link_section() { +pub fn __link_custom_section_describing_imports() { wit_bindgen::rt::maybe_link_cabi_realloc(); } diff --git a/src/command.rs b/src/command.rs new file mode 100644 index 0000000..97689cd --- /dev/null +++ b/src/command.rs @@ -0,0 +1,561 @@ +// Generated by `wit-bindgen` 0.20.0. DO NOT EDIT! +// Options used: +// * std_feature +// * with [("wasi:cli/environment@0.2.0", "crate::cli::environment"), ("wasi:cli/exit@0.2.0", "crate::cli::exit"), ("wasi:cli/stderr@0.2.0", "crate::cli::stderr"), ("wasi:cli/stdin@0.2.0", "crate::cli::stdin"), ("wasi:cli/stdout@0.2.0", "crate::cli::stdout"), ("wasi:cli/terminal-input@0.2.0", "crate::cli::terminal_input"), ("wasi:cli/terminal-output@0.2.0", "crate::cli::terminal_output"), ("wasi:cli/terminal-stderr@0.2.0", "crate::cli::terminal_stderr"), ("wasi:cli/terminal-stdin@0.2.0", "crate::cli::terminal_stdin"), ("wasi:cli/terminal-stdout@0.2.0", "crate::cli::terminal_stdout"), ("wasi:clocks/monotonic-clock@0.2.0", "crate::clocks::monotonic_clock"), ("wasi:clocks/wall-clock@0.2.0", "crate::clocks::wall_clock"), ("wasi:filesystem/preopens@0.2.0", "crate::filesystem::preopens"), ("wasi:filesystem/types@0.2.0", "crate::filesystem::types"), ("wasi:io/error@0.2.0", "crate::io::error"), ("wasi:io/poll@0.2.0", "crate::io::poll"), ("wasi:io/streams@0.2.0", "crate::io::streams"), ("wasi:random/insecure-seed@0.2.0", "crate::random::insecure_seed"), ("wasi:random/insecure@0.2.0", "crate::random::insecure"), ("wasi:random/random@0.2.0", "crate::random::random"), ("wasi:sockets/instance-network@0.2.0", "crate::sockets::instance_network"), ("wasi:sockets/ip-name-lookup@0.2.0", "crate::sockets::ip_name_lookup"), ("wasi:sockets/network@0.2.0", "crate::sockets::network"), ("wasi:sockets/tcp-create-socket@0.2.0", "crate::sockets::tcp_create_socket"), ("wasi:sockets/tcp@0.2.0", "crate::sockets::tcp"), ("wasi:sockets/udp-create-socket@0.2.0", "crate::sockets::udp_create_socket"), ("wasi:sockets/udp@0.2.0", "crate::sockets::udp")] +// * 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::sockets::network as __with_name17; +use crate::sockets::tcp as __with_name21; +use crate::sockets::tcp_create_socket as __with_name22; +use crate::sockets::udp as __with_name19; +use crate::sockets::udp_create_socket as __with_name20; +pub mod exports { + pub mod wasi { + pub mod cli { + + #[allow(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; + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_run_cabi() -> i32 { + let result0 = T::run(); + let result1 = match result0 { + Ok(_) => 0i32, + Err(_) => 1i32, + }; + result1 + } + pub trait Guest { + /// Run the program. + fn run() -> Result<(), ()>; + } + #[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>() + } + };); + } + #[doc(hidden)] + pub use __export_wasi_cli_run_0_2_0_cabi; + } + } + } +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! _export_command{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// _export_command!(MyType); +/// ``` +#[allow(unused_macros)] +#[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.20.0:command:imports and exportsrust-wasi-from-crates-io-command-world"] + #[doc(hidden)] + 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.20.0"; + }; + ) +} +#[doc(inline)] +pub use __export_command_impl as _export_command; + +#[cfg(target_arch = "wasm32")] +#[link_section = "component-type:wit-bindgen:0.20.0:command-with-all-of-its-exports-removed:encoded worldrust-wasi-from-crates-io-command-world"] +#[doc(hidden)] +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.20.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/src/lib.rs b/src/lib.rs index 467650c..63df4ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -149,11 +149,12 @@ //! //! ## Export Macros //! -//! With the `macros` feature enabled, this crate provides macros to aid in -//! implementing WASI exports. See their documentation for details: +//! In addition to providing bindings for imports this crate also provides +//! macros to export the `wasi:cli/run` and `wasi:http/proxy` worlds, see their +//! respective documentation for more information: //! -//! - [`wasi::cli::run::export!`](crate::cli::run::export) -//! - [`wasi::http::inbound_handler::export!`](crate::cli::run::export) +//! - [`wasi::cli::command::export!`](crate::cli::command::export) +//! - [`wasi::http::proxy::export!`](crate::http::proxy::export) //! //! [worlds]: https://component-model.bytecodealliance.org/design/worlds.html //! [`wasi:cli/command`]: https://github.com/WebAssembly/wasi-cli/ @@ -178,76 +179,115 @@ #[cfg(feature = "std")] extern crate std; +// These modules are all auto-generated by `./ci/regenerate.sh` mod bindings; +#[allow(unused_imports)] +mod command; +#[allow(unused_imports)] +mod proxy; +// generated bindings start with the package namespace, which in this case is +// `wasi`, but the crate is already called wasi, so lift everything up one level +// to the root of this crate. pub use bindings::wasi::*; -#[cfg(feature = "macros")] -#[doc(hidden)] -pub mod macros { - pub use wit_bindgen; -} - +// Expand the `cli` and `http` modules with `export!` macros for the +// command/proxy worlds, but also retain all the contents defined in the +// `bindings` module as well. pub mod cli { pub use super::bindings::wasi::cli::*; - #[cfg(feature = "macros")] - pub mod run { - include!(concat!(env!("OUT_DIR"), "/cli_run_export.rs")); - - /// Generate export bindings for the `wasi:cli/run` interface. + pub mod command { + /// Generate an exported instance of the `wasi:cli/command` world. /// - /// This macro will generate a trait `exports::wasi::cli::run::Guest` - /// which must be implemented by the type passed to the macro: + /// This macro generate the `#[no_mangle]` functions necessary to + /// export this interface. It takes an argument which is a type that + /// must implement the + /// [`exports::cli::run::Guest`](crate::exports::cli::run::Guest) + /// trait. /// /// ``` - /// wasi::cli::run::export!(MyCliRunner); - /// /// struct MyCliRunner; /// - /// impl exports::wasi::cli::run::Guest for MyCliRunner { + /// impl wasi::exports::cli::run::Guest for MyCliRunner { /// fn run() -> Result<(), ()> { - /// ... + /// // ... + /// # panic!(); /// } /// } + /// + /// wasi::cli::command::export!(MyCliRunner); /// ``` /// /// ## Compatibility with `wasm32-wasi` targets /// /// This macro is not compatible with `wasm32-wasi` `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. + /// instead use a `fn main()` with the + /// `wasi_snapshot_preview1.command.wasm` adapter. This macro _can_ be + /// used with the `reactor` or `proxy` adapters. + /// + ///