From 3ee065c8378a697b678e42bb1c1696a46ae9b3f5 Mon Sep 17 00:00:00 2001 From: Brian H Date: Thu, 20 Jun 2024 14:16:37 -0600 Subject: [PATCH] WIP Signed-off-by: Brian H --- Cargo.lock | 120 +- crates/app/Cargo.toml | 2 +- crates/app/src/lib.rs | 12 +- crates/common/Cargo.toml | 6 +- crates/common/src/dependencies.rs | 173 + crates/common/src/lib.rs | 2 + .../{serde/src/lib.rs => common/src/serde.rs} | 2 - .../{serde/src => common/src/serde}/base64.rs | 0 crates/{serde/src => common/src/serde}/id.rs | 2 +- .../src => common/src/serde}/version.rs | 0 crates/compose/Cargo.toml | 24 + crates/compose/deny-all/Cargo.toml | 34 + crates/compose/deny-all/README.md | 6 + crates/compose/deny-all/src/bindings.rs | 20239 ++++++++++++++++ crates/compose/deny-all/src/fermyon.rs | 217 + crates/compose/deny-all/src/lib.rs | 10 + crates/compose/deny-all/src/wasi.rs | 341 + .../deny-all/wit/deps/fermyon/spin.wasm | Bin 0 -> 88674 bytes .../compose/deny-all/wit/deps/wasi/cli.wasm | Bin 0 -> 25083 bytes .../deny-all/wit/deps/wasi/clocks.wasm | Bin 0 -> 3631 bytes .../deny-all/wit/deps/wasi/filesystem.wasm | Bin 0 -> 28760 bytes .../compose/deny-all/wit/deps/wasi/http.wasm | Bin 0 -> 44797 bytes crates/compose/deny-all/wit/deps/wasi/io.wasm | Bin 0 -> 13985 bytes .../deny-all/wit/deps/wasi/sockets.wasm | Bin 0 -> 52111 bytes crates/compose/deny-all/wit/world.wit | 20 + crates/compose/deny_all.wasm | Bin 0 -> 124495 bytes crates/compose/src/lib.rs | 318 + crates/loader/src/local.rs | 112 +- crates/locked-app/Cargo.toml | 4 +- crates/locked-app/src/locked.rs | 31 +- crates/manifest/Cargo.toml | 2 +- crates/manifest/src/compat.rs | 4 +- crates/manifest/src/schema/v1.rs | 2 +- crates/manifest/src/schema/v2.rs | 249 +- crates/manifest/tests/ui/maximal.json | 26 + crates/manifest/tests/ui/maximal.toml | 8 + crates/serde/Cargo.toml | 9 - crates/testing/src/lib.rs | 7 +- crates/trigger/Cargo.toml | 2 +- crates/trigger/src/loader.rs | 81 +- crates/trigger/src/runtime_config.rs | 5 +- .../trigger/src/runtime_config/client_tls.rs | 3 +- examples/spin-timer/Cargo.lock | 209 +- 43 files changed, 22138 insertions(+), 144 deletions(-) create mode 100644 crates/common/src/dependencies.rs rename crates/{serde/src/lib.rs => common/src/serde.rs} (94%) rename crates/{serde/src => common/src/serde}/base64.rs (100%) rename crates/{serde/src => common/src/serde}/id.rs (96%) rename crates/{serde/src => common/src/serde}/version.rs (100%) create mode 100644 crates/compose/Cargo.toml create mode 100644 crates/compose/deny-all/Cargo.toml create mode 100644 crates/compose/deny-all/README.md create mode 100644 crates/compose/deny-all/src/bindings.rs create mode 100644 crates/compose/deny-all/src/fermyon.rs create mode 100644 crates/compose/deny-all/src/lib.rs create mode 100644 crates/compose/deny-all/src/wasi.rs create mode 100644 crates/compose/deny-all/wit/deps/fermyon/spin.wasm create mode 100644 crates/compose/deny-all/wit/deps/wasi/cli.wasm create mode 100644 crates/compose/deny-all/wit/deps/wasi/clocks.wasm create mode 100644 crates/compose/deny-all/wit/deps/wasi/filesystem.wasm create mode 100644 crates/compose/deny-all/wit/deps/wasi/http.wasm create mode 100644 crates/compose/deny-all/wit/deps/wasi/io.wasm create mode 100644 crates/compose/deny-all/wit/deps/wasi/sockets.wasm create mode 100644 crates/compose/deny-all/wit/world.wit create mode 100644 crates/compose/deny_all.wasm create mode 100644 crates/compose/src/lib.rs delete mode 100644 crates/serde/Cargo.toml diff --git a/Cargo.lock b/Cargo.lock index 18066f89d5..b4aadb38b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -601,7 +601,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ce3de4b65b1ee2667c81d1fc692949049502a4cf9c38118d811d6d79a7eaef" dependencies = [ "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bytes", "dyn-clone", "futures", @@ -712,9 +712,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -6371,7 +6371,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "bytes", "encoding_rs", "futures-channel", @@ -6662,7 +6662,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "rustls-pki-types", ] @@ -6992,7 +6992,7 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", @@ -7293,9 +7293,9 @@ dependencies = [ "ouroboros", "serde 1.0.197", "serde_json", + "spin-common", "spin-core", "spin-locked-app", - "spin-serde", "thiserror", ] @@ -7403,11 +7403,15 @@ name = "spin-common" version = "2.7.0-pre0" dependencies = [ "anyhow", - "dirs 4.0.0", + "base64 0.22.1", + "dirs 5.0.1", + "semver", + "serde 1.0.197", "sha2", "tempfile", "tokio", "url", + "wasm-pkg-common", ] [[package]] @@ -7436,6 +7440,21 @@ dependencies = [ "wit-parser 0.200.0", ] +[[package]] +name = "spin-compose" +version = "2.7.0-pre0" +dependencies = [ + "anyhow", + "async-trait", + "indexmap 2.2.6", + "semver", + "spin-app", + "spin-common", + "spin-componentize", + "tokio", + "wac-graph", +] + [[package]] name = "spin-core" version = "2.7.0-pre0" @@ -7676,7 +7695,7 @@ dependencies = [ "ouroboros", "serde 1.0.197", "serde_json", - "spin-serde", + "spin-common", "thiserror", ] @@ -7690,7 +7709,7 @@ dependencies = [ "semver", "serde 1.0.197", "serde_json", - "spin-serde", + "spin-common", "terminal", "thiserror", "toml 0.8.14", @@ -7769,14 +7788,6 @@ dependencies = [ "url", ] -[[package]] -name = "spin-serde" -version = "2.7.0-pre0" -dependencies = [ - "base64 0.21.7", - "serde 1.0.197", -] - [[package]] name = "spin-sqlite" version = "2.7.0-pre0" @@ -7918,6 +7929,7 @@ dependencies = [ "spin-app", "spin-common", "spin-componentize", + "spin-compose", "spin-core", "spin-expressions", "spin-key-value", @@ -7930,7 +7942,6 @@ dependencies = [ "spin-loader", "spin-manifest", "spin-outbound-networking", - "spin-serde", "spin-sqlite", "spin-sqlite-inproc", "spin-sqlite-libsql", @@ -9177,6 +9188,39 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wac-graph" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d62ffef518aba9d62dc1532960702a67a62ca1b0ffb3cf152391d477bc7e11" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "log", + "petgraph", + "semver", + "thiserror", + "wac-types", + "wasm-encoder 0.202.0", + "wasm-metadata 0.202.0", + "wasmparser 0.202.0", +] + +[[package]] +name = "wac-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fe3e5531080631b8d14f355119f4b3bac92bdacaad6786599cf474958eee01f" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "semver", + "wasm-encoder 0.202.0", + "wasmparser 0.202.0", +] + [[package]] name = "waker-fn" version = "1.1.1" @@ -9500,6 +9544,15 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.202.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd106365a7f5f7aa3c1916a98cbb3ad477f5ff96ddb130285a91c6e7429e67a" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-encoder" version = "0.209.1" @@ -9541,6 +9594,22 @@ dependencies = [ "wasmparser 0.200.0", ] +[[package]] +name = "wasm-metadata" +version = "0.202.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "094aea3cb90e09f16ee25a4c0e324b3e8c934e7fd838bfa039aef5352f44a917" +dependencies = [ + "anyhow", + "indexmap 2.2.6", + "serde 1.0.197", + "serde_derive", + "serde_json", + "spdx", + "wasm-encoder 0.202.0", + "wasmparser 0.202.0", +] + [[package]] name = "wasm-metadata" version = "0.209.1" @@ -9583,7 +9652,7 @@ checksum = "11338b173351bc505bc752c00068a7d1da5106a9d351753f0d01267dcc4747b2" dependencies = [ "anyhow", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bytes", "dirs 5.0.1", "docker_credential", @@ -9652,6 +9721,17 @@ dependencies = [ "semver", ] +[[package]] +name = "wasmparser" +version = "0.202.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413" +dependencies = [ + "bitflags 2.5.0", + "indexmap 2.2.6", + "semver", +] + [[package]] name = "wasmparser" version = "0.209.1" diff --git a/crates/app/Cargo.toml b/crates/app/Cargo.toml index fadb5e3500..559db823f4 100644 --- a/crates/app/Cargo.toml +++ b/crates/app/Cargo.toml @@ -10,7 +10,7 @@ async-trait = "0.1" ouroboros = "0.18.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" +spin-common = { path = "../common" } spin-core = { path = "../core" } spin-locked-app = { path = "../locked-app" } -spin-serde = { path = "../serde" } thiserror = "1.0" diff --git a/crates/app/src/lib.rs b/crates/app/src/lib.rs index 70d6a59b6b..660edbc021 100644 --- a/crates/app/src/lib.rs +++ b/crates/app/src/lib.rs @@ -41,12 +41,13 @@ pub trait Loader { /// representation of a [`LockedApp`], which will be loaded. async fn load_app(&self, uri: &str) -> anyhow::Result; - /// Called with a [`LockedComponentSource`] pointing to a Wasm component - /// binary, which will be loaded. + /// Called with an [`AppComponent`] the Wasm component binary specified + /// by source will be componentized and composed with each of its + /// dependencies. async fn load_component( &self, engine: &wasmtime::Engine, - source: &LockedComponentSource, + component: &AppComponent, ) -> anyhow::Result; /// Called with a [`LockedComponentSource`] pointing to a Wasm module @@ -282,7 +283,8 @@ impl App<'static, InertLoader> { pub struct AppComponent<'a, L = AppLoader> { /// The app this component belongs to. pub app: &'a App<'a, L>, - locked: &'a LockedComponent, + /// The locked component. + pub locked: &'a LockedComponent, } impl<'a, L> AppComponent<'a, L> { @@ -337,7 +339,7 @@ impl<'a> AppComponent<'a> { self.app .loader .inner - .load_component(engine.as_ref(), &self.locked.source) + .load_component(engine.as_ref(), self) .await .map_err(Error::LoaderError) } diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index ef2b9a84e9..c612187a46 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -6,8 +6,12 @@ edition = { workspace = true } [dependencies] anyhow = "1.0" -dirs = "4.0" +base64 = "0.22.1" +dirs = "5.0.1" +serde = "1.0.189" sha2 = "0.10" +semver = { version = "1.0", features = ["serde"] } tempfile = "3.5" tokio = { version = "1", features = ["rt", "time"] } url = "2" +wasm-pkg-common = "0.4.1" \ No newline at end of file diff --git a/crates/common/src/dependencies.rs b/crates/common/src/dependencies.rs new file mode 100644 index 0000000000..d6bcd4b1a6 --- /dev/null +++ b/crates/common/src/dependencies.rs @@ -0,0 +1,173 @@ +//! Types for working with component dependencies. + +use crate::serde::KebabId; +use serde::{Deserialize, Serialize}; +use std::str::FromStr; +use wasm_pkg_common::package::PackageRef; + +/// Name of an import dependency. +/// +/// For example: `foo:bar/baz@0.1.0`, `foo:bar/baz`, `foo:bar@0.1.0`, `foo:bar` +#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq, Hash)] +#[serde(into = "String", try_from = "String")] +pub struct DependencyName { + /// The package spec, `foo:bar`, `foo:bar@0.1.0`. + pub package: PackageRef, + /// Package version + pub version: Option, + /// Optional interface name. + pub interface: Option, +} + +// TODO: replace with derive once wasm-pkg-common is released +impl PartialOrd for DependencyName { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +// TODO: replace with derive once wasm-pkg-common is released +impl Ord for DependencyName { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + let big_ole_tup = ( + self.package.namespace().as_ref(), + self.package.name().as_ref(), + self.interface.as_ref(), + self.version.as_ref(), + ); + let other_big_ole_tup = ( + other.package.namespace().as_ref(), + other.package.name().as_ref(), + other.interface.as_ref(), + other.version.as_ref(), + ); + big_ole_tup.cmp(&other_big_ole_tup) + } +} + +impl std::fmt::Display for DependencyName { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{}", self.package)?; + if let Some(interface) = &self.interface { + write!(f, "/{interface}")?; + } + if let Some(version) = &self.version { + write!(f, "@{version}")?; + } + Ok(()) + } +} + +impl TryFrom for DependencyName { + type Error = anyhow::Error; + + fn try_from(s: String) -> Result { + s.parse() + } +} + +impl From for String { + fn from(value: DependencyName) -> Self { + value.to_string() + } +} + +impl FromStr for DependencyName { + type Err = anyhow::Error; + + fn from_str(s: &str) -> Result { + let (name, version) = match s.split_once('@') { + Some((name, version)) => (name, Some(version.parse()?)), + None => (s, None), + }; + + let (package, interface) = match name.split_once('/') { + Some((package, interface)) => ( + package.parse()?, + Some( + interface + .to_string() + .try_into() + .map_err(|e| anyhow::anyhow!("{e}"))?, + ), + ), + None => (name.parse()?, None), + }; + + Ok(Self { + package, + version, + interface, + }) + } +} + +impl DependencyName { + /// Returns true if the dependency name matches the provided import name string. + pub fn matches_import(&self, import_name: &str) -> bool { + // If the import name does not start with the package name, it cannot match. + if !import_name.starts_with(&self.package.to_string()) { + return false; + } + // Check for exact package/interface/version match. + if import_name == self.to_string() { + return true; + } + + if self.interface.is_none() { + // Package wildcard (i.e. interfaceless). + // If the dependency name has a version, it must match the version specified in the import name. + if let Some(version) = self.version.as_ref() { + import_name.ends_with(&version.to_string()) + } else { + // Otherwise, the dependency name has no version and matches any version. + true + } + } else { + // Interface wildcard (i.e. versionless). + if self.version.is_none() { + // We have an interface wildcard (i.e. versionless) where package/interface must match. + import_name.starts_with(&self.to_string()) + } else { + // If a version is present, the dependency name would have to match the import name exactly + // which would have been caught by the first check. + false + } + } + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_matches_import() { + for (dep_name, import_names) in [ + ("foo:bar/baz@0.1.0", vec!["foo:bar/baz@0.1.0"]), + ("foo:bar/baz", vec!["foo:bar/baz@0.1.0", "foo:bar/baz"]), + ( + "foo:bar", + vec!["foo:bar/baz@0.1.0", "foo:bar/baz", "foo:bar@0.1.0"], + ), + ("foo:bar@0.1.0", vec!["foo:bar/baz@0.1.0", "foo:bar@0.1.0"]), + ] { + let dep_name: DependencyName = dep_name.parse().unwrap(); + for import_name in import_names { + assert!(dep_name.matches_import(import_name)); + } + } + + for (dep_name, import_names) in [ + ("foo:bar/baz@0.1.0", vec!["foo:bar/baz"]), + ("foo:bar/baz", vec!["foo:bar/bub", "foo:bar/bub@0.1.0"]), + ("foo:bar", vec!["foo:bub/bib"]), + ("foo:bar@0.1.0", vec!["foo:bar/baz"]), + ] { + let dep_name: DependencyName = dep_name.parse().unwrap(); + for import_name in import_names { + assert!(!dep_name.matches_import(import_name)); + } + } + } +} diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs index f747d1544f..0c3f3ed377 100644 --- a/crates/common/src/lib.rs +++ b/crates/common/src/lib.rs @@ -10,7 +10,9 @@ pub mod arg_parser; pub mod data_dir; +pub mod dependencies; pub mod paths; +pub mod serde; pub mod sha256; pub mod sloth; pub mod ui; diff --git a/crates/serde/src/lib.rs b/crates/common/src/serde.rs similarity index 94% rename from crates/serde/src/lib.rs rename to crates/common/src/serde.rs index 5ea2131f33..d44b5dad18 100644 --- a/crates/serde/src/lib.rs +++ b/crates/common/src/serde.rs @@ -1,7 +1,5 @@ //! Serde serialization helpers -#![deny(missing_docs)] - pub mod base64; pub mod id; mod version; diff --git a/crates/serde/src/base64.rs b/crates/common/src/serde/base64.rs similarity index 100% rename from crates/serde/src/base64.rs rename to crates/common/src/serde/base64.rs diff --git a/crates/serde/src/id.rs b/crates/common/src/serde/id.rs similarity index 96% rename from crates/serde/src/id.rs rename to crates/common/src/serde/id.rs index b5a6f869a6..0e1cee45be 100644 --- a/crates/serde/src/id.rs +++ b/crates/common/src/serde/id.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; /// An ID is a non-empty string containing one or more component model /// `word`s separated by a delimiter char. -#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Serialize, Deserialize)] #[serde(into = "String", try_from = "String")] pub struct Id(String); diff --git a/crates/serde/src/version.rs b/crates/common/src/serde/version.rs similarity index 100% rename from crates/serde/src/version.rs rename to crates/common/src/serde/version.rs diff --git a/crates/compose/Cargo.toml b/crates/compose/Cargo.toml new file mode 100644 index 0000000000..ee3975dacf --- /dev/null +++ b/crates/compose/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "spin-compose" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true +rust-version.workspace = true + +[dependencies] +anyhow = { workspace = true } +async-trait = "0.1" + +indexmap = "2.2.6" +spin-app = { path = "../app" } +spin-common = { path = "../common" } +spin-componentize = { workspace = true } +semver = "1" +tokio = { version = "1.23", features = ["fs"] } +wac-graph = "0.5.0" + +[lints] +workspace = true diff --git a/crates/compose/deny-all/Cargo.toml b/crates/compose/deny-all/Cargo.toml new file mode 100644 index 0000000000..931bc4d5f0 --- /dev/null +++ b/crates/compose/deny-all/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "deny-all" +version = "0.1.0" +edition = "2021" + +[dependencies] +wit-bindgen-rt = { version = "0.28.0", features = ["bitflags"] } + +[lib] +crate-type = ["cdylib"] + +[profile.release] +codegen-units = 1 +opt-level = "s" +debug = false +strip = true +lto = true + +[package.metadata.component] +package = "fermyon:spin-virt" + +[package.metadata.component.target] +world = "deny-all" + +[package.metadata.component.target.dependencies] +"fermyon:spin" = { path = "wit/deps/fermyon/spin.wasm" } +"wasi:filesystem" = { path = "wit/deps/wasi/filesystem.wasm" } +"wasi:sockets" = { path = "wit/deps/wasi/sockets.wasm" } +"wasi:clocks" = { path = "wit/deps/wasi/clocks.wasm" } +"wasi:http" = { path = "wit/deps/wasi/http.wasm" } +"wasi:cli" = { path = "wit/deps/wasi/cli.wasm" } +"wasi:io" = { path = "wit/deps/wasi/io.wasm" } + +[workspace] \ No newline at end of file diff --git a/crates/compose/deny-all/README.md b/crates/compose/deny-all/README.md new file mode 100644 index 0000000000..2c5995146a --- /dev/null +++ b/crates/compose/deny-all/README.md @@ -0,0 +1,6 @@ +This directory contains the `deny-all` adapter used to enforce configuration isolation in dependencies when using the component dependencies feature of Spin. + +To build: +``` +cargo component build --release +``` \ No newline at end of file diff --git a/crates/compose/deny-all/src/bindings.rs b/crates/compose/deny-all/src/bindings.rs new file mode 100644 index 0000000000..3cd4216ccc --- /dev/null +++ b/crates/compose/deny-all/src/bindings.rs @@ -0,0 +1,20239 @@ +// Generated by `wit-bindgen` 0.25.0. DO NOT EDIT! +// Options used: +#[allow(dead_code)] +pub mod wasi { + #[allow(dead_code)] + pub mod clocks0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod wall_clock { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + #[repr(C)] + #[derive(Clone, Copy)] + pub struct Datetime { + pub seconds: u64, + pub nanoseconds: u32, + } + impl ::core::fmt::Debug for Datetime { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Datetime") + .field("seconds", &self.seconds) + .field("nanoseconds", &self.nanoseconds) + .finish() + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn now() -> Datetime { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")] + extern "C" { + #[link_name = "now"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = *ptr0.add(0).cast::(); + let l2 = *ptr0.add(8).cast::(); + Datetime { + seconds: l1 as u64, + nanoseconds: l2 as u32, + } + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn resolution() -> Datetime { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:clocks/wall-clock@0.2.0")] + extern "C" { + #[link_name = "resolution"] + fn wit_import(_: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8) { + unreachable!() + } + wit_import(ptr0); + let l1 = *ptr0.add(0).cast::(); + let l2 = *ptr0.add(8).cast::(); + Datetime { + seconds: l1 as u64, + nanoseconds: l2 as u32, + } + } + } + } + + #[allow(dead_code, clippy::all)] + pub mod monotonic_clock { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Pollable = super::super::super::wasi::io0_2_0::poll::Pollable; + pub type Instant = u64; + pub type Duration = u64; + #[allow(unused_unsafe, clippy::all)] + pub fn now() -> Instant { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + extern "C" { + #[link_name = "now"] + fn wit_import() -> i64; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import() -> i64 { + unreachable!() + } + let ret = wit_import(); + ret as u64 + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn resolution() -> Duration { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + extern "C" { + #[link_name = "resolution"] + fn wit_import() -> i64; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import() -> i64 { + unreachable!() + } + let ret = wit_import(); + ret as u64 + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn subscribe_instant(when: Instant) -> Pollable { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + extern "C" { + #[link_name = "subscribe-instant"] + fn wit_import(_: i64) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i64) -> i32 { + unreachable!() + } + let ret = wit_import(_rt::as_i64(when)); + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn subscribe_duration(when: Duration) -> Pollable { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:clocks/monotonic-clock@0.2.0")] + extern "C" { + #[link_name = "subscribe-duration"] + fn wit_import(_: i64) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i64) -> i32 { + unreachable!() + } + let ret = wit_import(_rt::as_i64(when)); + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + } + } + } + } + #[allow(dead_code)] + pub mod filesystem0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type InputStream = super::super::super::wasi::io0_2_0::streams::InputStream; + pub type OutputStream = super::super::super::wasi::io0_2_0::streams::OutputStream; + pub type Error = super::super::super::wasi::io0_2_0::streams::Error; + pub type Datetime = super::super::super::wasi::clocks0_2_0::wall_clock::Datetime; + pub type Filesize = u64; + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum DescriptorType { + Unknown, + BlockDevice, + CharacterDevice, + Directory, + Fifo, + SymbolicLink, + RegularFile, + Socket, + } + impl ::core::fmt::Debug for DescriptorType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + DescriptorType::Unknown => { + f.debug_tuple("DescriptorType::Unknown").finish() + } + DescriptorType::BlockDevice => { + f.debug_tuple("DescriptorType::BlockDevice").finish() + } + DescriptorType::CharacterDevice => { + f.debug_tuple("DescriptorType::CharacterDevice").finish() + } + DescriptorType::Directory => { + f.debug_tuple("DescriptorType::Directory").finish() + } + DescriptorType::Fifo => f.debug_tuple("DescriptorType::Fifo").finish(), + DescriptorType::SymbolicLink => { + f.debug_tuple("DescriptorType::SymbolicLink").finish() + } + DescriptorType::RegularFile => { + f.debug_tuple("DescriptorType::RegularFile").finish() + } + DescriptorType::Socket => f.debug_tuple("DescriptorType::Socket").finish(), + } + } + } + + impl DescriptorType { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> DescriptorType { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => DescriptorType::Unknown, + 1 => DescriptorType::BlockDevice, + 2 => DescriptorType::CharacterDevice, + 3 => DescriptorType::Directory, + 4 => DescriptorType::Fifo, + 5 => DescriptorType::SymbolicLink, + 6 => DescriptorType::RegularFile, + 7 => DescriptorType::Socket, + + _ => panic!("invalid enum discriminant"), + } + } + } + + wit_bindgen_rt::bitflags::bitflags! { + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] + pub struct DescriptorFlags: u8 { + const READ = 1 << 0; + const WRITE = 1 << 1; + const FILE_INTEGRITY_SYNC = 1 << 2; + const DATA_INTEGRITY_SYNC = 1 << 3; + const REQUESTED_WRITE_SYNC = 1 << 4; + const MUTATE_DIRECTORY = 1 << 5; + } + } + wit_bindgen_rt::bitflags::bitflags! { + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] + pub struct PathFlags: u8 { + const SYMLINK_FOLLOW = 1 << 0; + } + } + wit_bindgen_rt::bitflags::bitflags! { + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)] + pub struct OpenFlags: u8 { + const CREATE = 1 << 0; + const DIRECTORY = 1 << 1; + const EXCLUSIVE = 1 << 2; + const TRUNCATE = 1 << 3; + } + } + pub type LinkCount = u64; + #[repr(C)] + #[derive(Clone, Copy)] + pub struct DescriptorStat { + pub type_: DescriptorType, + pub link_count: LinkCount, + pub size: Filesize, + pub data_access_timestamp: Option, + pub data_modification_timestamp: Option, + pub status_change_timestamp: Option, + } + impl ::core::fmt::Debug for DescriptorStat { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("DescriptorStat") + .field("type", &self.type_) + .field("link-count", &self.link_count) + .field("size", &self.size) + .field("data-access-timestamp", &self.data_access_timestamp) + .field( + "data-modification-timestamp", + &self.data_modification_timestamp, + ) + .field("status-change-timestamp", &self.status_change_timestamp) + .finish() + } + } + #[derive(Clone, Copy)] + pub enum NewTimestamp { + NoChange, + Now, + Timestamp(Datetime), + } + impl ::core::fmt::Debug for NewTimestamp { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + NewTimestamp::NoChange => f.debug_tuple("NewTimestamp::NoChange").finish(), + NewTimestamp::Now => f.debug_tuple("NewTimestamp::Now").finish(), + NewTimestamp::Timestamp(e) => { + f.debug_tuple("NewTimestamp::Timestamp").field(e).finish() + } + } + } + } + #[derive(Clone)] + pub struct DirectoryEntry { + pub type_: DescriptorType, + pub name: _rt::String, + } + impl ::core::fmt::Debug for DirectoryEntry { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("DirectoryEntry") + .field("type", &self.type_) + .field("name", &self.name) + .finish() + } + } + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum ErrorCode { + Access, + WouldBlock, + Already, + BadDescriptor, + Busy, + Deadlock, + Quota, + Exist, + FileTooLarge, + IllegalByteSequence, + InProgress, + Interrupted, + Invalid, + Io, + IsDirectory, + Loop, + TooManyLinks, + MessageSize, + NameTooLong, + NoDevice, + NoEntry, + NoLock, + InsufficientMemory, + InsufficientSpace, + NotDirectory, + NotEmpty, + NotRecoverable, + Unsupported, + NoTty, + NoSuchDevice, + Overflow, + NotPermitted, + Pipe, + ReadOnly, + InvalidSeek, + TextFileBusy, + CrossDevice, + } + impl ErrorCode { + pub fn name(&self) -> &'static str { + match self { + ErrorCode::Access => "access", + ErrorCode::WouldBlock => "would-block", + ErrorCode::Already => "already", + ErrorCode::BadDescriptor => "bad-descriptor", + ErrorCode::Busy => "busy", + ErrorCode::Deadlock => "deadlock", + ErrorCode::Quota => "quota", + ErrorCode::Exist => "exist", + ErrorCode::FileTooLarge => "file-too-large", + ErrorCode::IllegalByteSequence => "illegal-byte-sequence", + ErrorCode::InProgress => "in-progress", + ErrorCode::Interrupted => "interrupted", + ErrorCode::Invalid => "invalid", + ErrorCode::Io => "io", + ErrorCode::IsDirectory => "is-directory", + ErrorCode::Loop => "loop", + ErrorCode::TooManyLinks => "too-many-links", + ErrorCode::MessageSize => "message-size", + ErrorCode::NameTooLong => "name-too-long", + ErrorCode::NoDevice => "no-device", + ErrorCode::NoEntry => "no-entry", + ErrorCode::NoLock => "no-lock", + ErrorCode::InsufficientMemory => "insufficient-memory", + ErrorCode::InsufficientSpace => "insufficient-space", + ErrorCode::NotDirectory => "not-directory", + ErrorCode::NotEmpty => "not-empty", + ErrorCode::NotRecoverable => "not-recoverable", + ErrorCode::Unsupported => "unsupported", + ErrorCode::NoTty => "no-tty", + ErrorCode::NoSuchDevice => "no-such-device", + ErrorCode::Overflow => "overflow", + ErrorCode::NotPermitted => "not-permitted", + ErrorCode::Pipe => "pipe", + ErrorCode::ReadOnly => "read-only", + ErrorCode::InvalidSeek => "invalid-seek", + ErrorCode::TextFileBusy => "text-file-busy", + ErrorCode::CrossDevice => "cross-device", + } + } + pub fn message(&self) -> &'static str { + match self { + ErrorCode::Access => "", + ErrorCode::WouldBlock => "", + ErrorCode::Already => "", + ErrorCode::BadDescriptor => "", + ErrorCode::Busy => "", + ErrorCode::Deadlock => "", + ErrorCode::Quota => "", + ErrorCode::Exist => "", + ErrorCode::FileTooLarge => "", + ErrorCode::IllegalByteSequence => "", + ErrorCode::InProgress => "", + ErrorCode::Interrupted => "", + ErrorCode::Invalid => "", + ErrorCode::Io => "", + ErrorCode::IsDirectory => "", + ErrorCode::Loop => "", + ErrorCode::TooManyLinks => "", + ErrorCode::MessageSize => "", + ErrorCode::NameTooLong => "", + ErrorCode::NoDevice => "", + ErrorCode::NoEntry => "", + ErrorCode::NoLock => "", + ErrorCode::InsufficientMemory => "", + ErrorCode::InsufficientSpace => "", + ErrorCode::NotDirectory => "", + ErrorCode::NotEmpty => "", + ErrorCode::NotRecoverable => "", + ErrorCode::Unsupported => "", + ErrorCode::NoTty => "", + ErrorCode::NoSuchDevice => "", + ErrorCode::Overflow => "", + ErrorCode::NotPermitted => "", + ErrorCode::Pipe => "", + ErrorCode::ReadOnly => "", + ErrorCode::InvalidSeek => "", + ErrorCode::TextFileBusy => "", + ErrorCode::CrossDevice => "", + } + } + } + impl ::core::fmt::Debug for ErrorCode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ErrorCode") + .field("code", &(*self as i32)) + .field("name", &self.name()) + .field("message", &self.message()) + .finish() + } + } + impl ::core::fmt::Display for ErrorCode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{} (error {})", self.name(), *self as i32) + } + } + + impl std::error::Error for ErrorCode {} + + impl ErrorCode { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> ErrorCode { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => ErrorCode::Access, + 1 => ErrorCode::WouldBlock, + 2 => ErrorCode::Already, + 3 => ErrorCode::BadDescriptor, + 4 => ErrorCode::Busy, + 5 => ErrorCode::Deadlock, + 6 => ErrorCode::Quota, + 7 => ErrorCode::Exist, + 8 => ErrorCode::FileTooLarge, + 9 => ErrorCode::IllegalByteSequence, + 10 => ErrorCode::InProgress, + 11 => ErrorCode::Interrupted, + 12 => ErrorCode::Invalid, + 13 => ErrorCode::Io, + 14 => ErrorCode::IsDirectory, + 15 => ErrorCode::Loop, + 16 => ErrorCode::TooManyLinks, + 17 => ErrorCode::MessageSize, + 18 => ErrorCode::NameTooLong, + 19 => ErrorCode::NoDevice, + 20 => ErrorCode::NoEntry, + 21 => ErrorCode::NoLock, + 22 => ErrorCode::InsufficientMemory, + 23 => ErrorCode::InsufficientSpace, + 24 => ErrorCode::NotDirectory, + 25 => ErrorCode::NotEmpty, + 26 => ErrorCode::NotRecoverable, + 27 => ErrorCode::Unsupported, + 28 => ErrorCode::NoTty, + 29 => ErrorCode::NoSuchDevice, + 30 => ErrorCode::Overflow, + 31 => ErrorCode::NotPermitted, + 32 => ErrorCode::Pipe, + 33 => ErrorCode::ReadOnly, + 34 => ErrorCode::InvalidSeek, + 35 => ErrorCode::TextFileBusy, + 36 => ErrorCode::CrossDevice, + + _ => panic!("invalid enum discriminant"), + } + } + } + + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum Advice { + Normal, + Sequential, + Random, + WillNeed, + DontNeed, + NoReuse, + } + impl ::core::fmt::Debug for Advice { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Advice::Normal => f.debug_tuple("Advice::Normal").finish(), + Advice::Sequential => f.debug_tuple("Advice::Sequential").finish(), + Advice::Random => f.debug_tuple("Advice::Random").finish(), + Advice::WillNeed => f.debug_tuple("Advice::WillNeed").finish(), + Advice::DontNeed => f.debug_tuple("Advice::DontNeed").finish(), + Advice::NoReuse => f.debug_tuple("Advice::NoReuse").finish(), + } + } + } + + impl Advice { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> Advice { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => Advice::Normal, + 1 => Advice::Sequential, + 2 => Advice::Random, + 3 => Advice::WillNeed, + 4 => Advice::DontNeed, + 5 => Advice::NoReuse, + + _ => panic!("invalid enum discriminant"), + } + } + } + + #[repr(C)] + #[derive(Clone, Copy)] + pub struct MetadataHashValue { + pub lower: u64, + pub upper: u64, + } + impl ::core::fmt::Debug for MetadataHashValue { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("MetadataHashValue") + .field("lower", &self.lower) + .field("upper", &self.upper) + .finish() + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct Descriptor { + handle: _rt::Resource, + } + + impl Descriptor { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for Descriptor { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]descriptor"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct DirectoryEntryStream { + handle: _rt::Resource, + } + + impl DirectoryEntryStream { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for DirectoryEntryStream { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]directory-entry-stream"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn read_via_stream(&self, offset: Filesize) -> Result { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + super::super::super::wasi::io0_2_0::streams::InputStream::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(4).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn write_via_stream( + &self, + offset: Filesize, + ) -> Result { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(offset), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(4).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn append_via_stream(&self) -> Result { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(4).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn advise( + &self, + offset: Filesize, + length: Filesize, + advice: Advice, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.advise"] + fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: i64, _: i32, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + _rt::as_i64(offset), + _rt::as_i64(length), + advice.clone() as i32, + ptr0, + ); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l2 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn sync_data(&self) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.sync-data"] + fn wit_import(_: i32, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l2 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn get_flags(&self) -> Result { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.get-flags"] + fn wit_import(_: i32, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + DescriptorFlags::empty() + | DescriptorFlags::from_bits_retain(((l2 as u8) << 0) as _) + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn get_type(&self) -> Result { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.get-type"] + fn wit_import(_: i32, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + DescriptorType::_lift(l2 as u8) + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn set_size(&self, size: Filesize) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.set-size"] + fn wit_import(_: i32, _: i64, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(size), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l2 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn set_times( + &self, + data_access_timestamp: NewTimestamp, + data_modification_timestamp: NewTimestamp, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + 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), + NewTimestamp::Timestamp(e) => { + let super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: seconds0, + nanoseconds: nanoseconds0, + } = e; + + (2i32, _rt::as_i64(seconds0), _rt::as_i32(nanoseconds0)) + } + }; + let (result3_0, result3_1, result3_2) = match data_modification_timestamp { + NewTimestamp::NoChange => (0i32, 0i64, 0i32), + NewTimestamp::Now => (1i32, 0i64, 0i32), + NewTimestamp::Timestamp(e) => { + let super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: seconds2, + nanoseconds: nanoseconds2, + } = e; + + (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) + } + }; + let ptr4 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.set-times"] + fn wit_import( + _: i32, + _: i32, + _: i64, + _: i32, + _: i32, + _: i64, + _: i32, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: i32, + _: i64, + _: i32, + _: i32, + _: i64, + _: i32, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + result1_0, + result1_1, + result1_2, + result3_0, + result3_1, + result3_2, + ptr4, + ); + let l5 = i32::from(*ptr4.add(0).cast::()); + match l5 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l6 = i32::from(*ptr4.add(1).cast::()); + + ErrorCode::_lift(l6 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn read( + &self, + length: Filesize, + offset: Filesize, + ) -> Result<(_rt::Vec, bool), ErrorCode> { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: i64, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + _rt::as_i64(length), + _rt::as_i64(offset), + ptr0, + ); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let l5 = i32::from(*ptr0.add(12).cast::()); + + ( + _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.add(4).cast::()); + + ErrorCode::_lift(l6 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn write( + &self, + buffer: &[u8], + offset: Filesize, + ) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let vec0 = buffer; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.write"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + _rt::as_i64(offset), + ptr1, + ); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = { + let l3 = *ptr1.add(8).cast::(); + + l3 as u64 + }; + Ok(e) + } + 1 => { + let e = { + let l4 = i32::from(*ptr1.add(8).cast::()); + + ErrorCode::_lift(l4 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn read_directory(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + DirectoryEntryStream::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(4).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn sync(&self) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.sync"] + fn wit_import(_: i32, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l2 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn create_directory_at(&self, path: &str) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = path; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.create-directory-at"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(1).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn stat(&self) -> Result { + unsafe { + #[repr(align(8))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = i32::from(*ptr0.add(8).cast::()); + let l3 = *ptr0.add(16).cast::(); + let l4 = *ptr0.add(24).cast::(); + let l5 = i32::from(*ptr0.add(32).cast::()); + let l8 = i32::from(*ptr0.add(56).cast::()); + let l11 = i32::from(*ptr0.add(80).cast::()); + + DescriptorStat { + type_: DescriptorType::_lift(l2 as u8), + link_count: l3 as u64, + size: l4 as u64, + data_access_timestamp: match l5 { + 0 => None, + 1 => { + let e = { + let l6 = *ptr0.add(40).cast::(); + let l7 = *ptr0.add(48).cast::(); + + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ + seconds: l6 as u64, + nanoseconds: l7 as u32, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + data_modification_timestamp: match l8 { + 0 => None, + 1 => { + let e = { + let l9 = *ptr0.add(64).cast::(); + let l10 = *ptr0.add(72).cast::(); + + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ + seconds: l9 as u64, + nanoseconds: l10 as u32, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + status_change_timestamp: match l11 { + 0 => None, + 1 => { + let e = { + let l12 = *ptr0.add(88).cast::(); + let l13 = *ptr0.add(96).cast::(); + + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ + seconds: l12 as u64, + nanoseconds: l13 as u32, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Ok(e) + } + 1 => { + let e = { + let l14 = i32::from(*ptr0.add(8).cast::()); + + ErrorCode::_lift(l14 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn stat_at( + &self, + path_flags: PathFlags, + path: &str, + ) -> Result { + unsafe { + #[repr(align(8))] + 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().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, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + (flags0.bits() >> 0) as i32, + ptr1.cast_mut(), + len1, + ptr2, + ); + let l3 = i32::from(*ptr2.add(0).cast::()); + match l3 { + 0 => { + let e = { + let l4 = i32::from(*ptr2.add(8).cast::()); + let l5 = *ptr2.add(16).cast::(); + let l6 = *ptr2.add(24).cast::(); + let l7 = i32::from(*ptr2.add(32).cast::()); + let l10 = i32::from(*ptr2.add(56).cast::()); + let l13 = i32::from(*ptr2.add(80).cast::()); + + DescriptorStat { + type_: DescriptorType::_lift(l4 as u8), + link_count: l5 as u64, + size: l6 as u64, + data_access_timestamp: match l7 { + 0 => None, + 1 => { + let e = { + let l8 = *ptr2.add(40).cast::(); + let l9 = *ptr2.add(48).cast::(); + + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ + seconds: l8 as u64, + nanoseconds: l9 as u32, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + data_modification_timestamp: match l10 { + 0 => None, + 1 => { + let e = { + let l11 = *ptr2.add(64).cast::(); + let l12 = *ptr2.add(72).cast::(); + + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ + seconds: l11 as u64, + nanoseconds: l12 as u32, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + status_change_timestamp: match l13 { + 0 => None, + 1 => { + let e = { + let l14 = *ptr2.add(88).cast::(); + let l15 = *ptr2.add(96).cast::(); + + super::super::super::wasi::clocks0_2_0::wall_clock::Datetime{ + seconds: l14 as u64, + nanoseconds: l15 as u32, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Ok(e) + } + 1 => { + let e = { + let l16 = i32::from(*ptr2.add(8).cast::()); + + ErrorCode::_lift(l16 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn set_times_at( + &self, + path_flags: PathFlags, + path: &str, + data_access_timestamp: NewTimestamp, + data_modification_timestamp: NewTimestamp, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + 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().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), + NewTimestamp::Timestamp(e) => { + let super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: seconds2, + nanoseconds: nanoseconds2, + } = e; + + (2i32, _rt::as_i64(seconds2), _rt::as_i32(nanoseconds2)) + } + }; + let (result5_0, result5_1, result5_2) = match data_modification_timestamp { + NewTimestamp::NoChange => (0i32, 0i64, 0i32), + NewTimestamp::Now => (1i32, 0i64, 0i32), + NewTimestamp::Timestamp(e) => { + let super::super::super::wasi::clocks0_2_0::wall_clock::Datetime { + seconds: seconds4, + nanoseconds: nanoseconds4, + } = e; + + (2i32, _rt::as_i64(seconds4), _rt::as_i32(nanoseconds4)) + } + }; + let ptr6 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.set-times-at"] + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: i64, + _: i32, + _: i32, + _: i64, + _: i32, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: i64, + _: i32, + _: i32, + _: i64, + _: i32, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + (flags0.bits() >> 0) as i32, + ptr1.cast_mut(), + len1, + result3_0, + result3_1, + result3_2, + result5_0, + result5_1, + result5_2, + ptr6, + ); + let l7 = i32::from(*ptr6.add(0).cast::()); + match l7 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l8 = i32::from(*ptr6.add(1).cast::()); + + ErrorCode::_lift(l8 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn link_at( + &self, + old_path_flags: PathFlags, + old_path: &str, + new_descriptor: &Descriptor, + new_path: &str, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let flags0 = old_path_flags; + let vec1 = old_path; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let vec2 = new_path; + 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" { + #[link_name = "[method]descriptor.link-at"] + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + (flags0.bits() >> 0) as i32, + ptr1.cast_mut(), + len1, + (new_descriptor).handle() as i32, + ptr2.cast_mut(), + len2, + ptr3, + ); + let l4 = i32::from(*ptr3.add(0).cast::()); + match l4 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l5 = i32::from(*ptr3.add(1).cast::()); + + ErrorCode::_lift(l5 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn open_at( + &self, + path_flags: PathFlags, + path: &str, + open_flags: OpenFlags, + flags: DescriptorFlags, + ) -> Result { + unsafe { + #[repr(align(4))] + 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().cast::(); + let len1 = vec1.len(); + let flags2 = open_flags; + let flags3 = flags; + let ptr4 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.open-at"] + fn wit_import( + _: i32, + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: i32, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + 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.cast_mut(), + len1, + (flags2.bits() >> 0) as i32, + (flags3.bits() >> 0) as i32, + ptr4, + ); + let l5 = i32::from(*ptr4.add(0).cast::()); + match l5 { + 0 => { + let e = { + let l6 = *ptr4.add(4).cast::(); + + Descriptor::from_handle(l6 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l7 = i32::from(*ptr4.add(4).cast::()); + + ErrorCode::_lift(l7 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let vec0 = path; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.readlink-at"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = { + let l3 = *ptr1.add(4).cast::<*mut u8>(); + let l4 = *ptr1.add(8).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + + _rt::string_lift(bytes5) + }; + Ok(e) + } + 1 => { + let e = { + let l6 = i32::from(*ptr1.add(4).cast::()); + + ErrorCode::_lift(l6 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn remove_directory_at(&self, path: &str) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = path; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.remove-directory-at"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(1).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn rename_at( + &self, + old_path: &str, + new_descriptor: &Descriptor, + new_path: &str, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = old_path; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = new_path; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let ptr2 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.rename-at"] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + (new_descriptor).handle() as i32, + ptr1.cast_mut(), + len1, + ptr2, + ); + let l3 = i32::from(*ptr2.add(0).cast::()); + match l3 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l4 = i32::from(*ptr2.add(1).cast::()); + + ErrorCode::_lift(l4 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn symlink_at(&self, old_path: &str, new_path: &str) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = old_path; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = new_path; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let ptr2 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.symlink-at"] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + ptr1.cast_mut(), + len1, + ptr2, + ); + let l3 = i32::from(*ptr2.add(0).cast::()); + match l3 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l4 = i32::from(*ptr2.add(1).cast::()); + + ErrorCode::_lift(l4 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn unlink_file_at(&self, path: &str) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = path; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.unlink-file-at"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(1).cast::()); + + ErrorCode::_lift(l3 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn is_same_object(&self, other: &Descriptor) -> bool { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "[method]descriptor.is-same-object"] + fn wit_import(_: i32, _: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32, (other).handle() as i32); + _rt::bool_lift(ret as u8) + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn metadata_hash(&self) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 24]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 24]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + let l3 = *ptr0.add(16).cast::(); + + MetadataHashValue { + lower: l2 as u64, + upper: l3 as u64, + } + }; + Ok(e) + } + 1 => { + let e = { + let l4 = i32::from(*ptr0.add(8).cast::()); + + ErrorCode::_lift(l4 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Descriptor { + #[allow(unused_unsafe, clippy::all)] + pub fn metadata_hash_at( + &self, + path_flags: PathFlags, + path: &str, + ) -> Result { + unsafe { + #[repr(align(8))] + 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().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, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + (flags0.bits() >> 0) as i32, + ptr1.cast_mut(), + len1, + ptr2, + ); + let l3 = i32::from(*ptr2.add(0).cast::()); + match l3 { + 0 => { + let e = { + let l4 = *ptr2.add(8).cast::(); + let l5 = *ptr2.add(16).cast::(); + + MetadataHashValue { + lower: l4 as u64, + upper: l5 as u64, + } + }; + Ok(e) + } + 1 => { + let e = { + let l6 = i32::from(*ptr2.add(8).cast::()); + + ErrorCode::_lift(l6 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl DirectoryEntryStream { + #[allow(unused_unsafe, clippy::all)] + pub fn read_directory_entry(&self) -> Result, ErrorCode> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 20]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 20]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = i32::from(*ptr0.add(4).cast::()); + + match l2 { + 0 => None, + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(8).cast::()); + let l4 = *ptr0.add(12).cast::<*mut u8>(); + let l5 = *ptr0.add(16).cast::(); + let len6 = l5; + let bytes6 = + _rt::Vec::from_raw_parts(l4.cast(), len6, len6); + + DirectoryEntry { + type_: DescriptorType::_lift(l3 as u8), + name: _rt::string_lift(bytes6), + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + Ok(e) + } + 1 => { + let e = { + let l7 = i32::from(*ptr0.add(4).cast::()); + + ErrorCode::_lift(l7 as u8) + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn filesystem_error_code(err: &Error) -> Option { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] + extern "C" { + #[link_name = "filesystem-error-code"] + fn wit_import(_: i32, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((err).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(1).cast::()); + + ErrorCode::_lift(l2 as u8) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + } + #[allow(dead_code)] + pub mod http0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Duration = super::super::super::wasi::clocks0_2_0::monotonic_clock::Duration; + pub type InputStream = super::super::super::wasi::io0_2_0::streams::InputStream; + pub type OutputStream = super::super::super::wasi::io0_2_0::streams::OutputStream; + pub type IoError = super::super::super::wasi::io0_2_0::error::Error; + pub type Pollable = super::super::super::wasi::io0_2_0::poll::Pollable; + #[derive(Clone)] + pub enum Method { + Get, + Head, + Post, + Put, + Delete, + Connect, + Options, + Trace, + Patch, + Other(_rt::String), + } + impl ::core::fmt::Debug for Method { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Method::Get => f.debug_tuple("Method::Get").finish(), + Method::Head => f.debug_tuple("Method::Head").finish(), + Method::Post => f.debug_tuple("Method::Post").finish(), + Method::Put => f.debug_tuple("Method::Put").finish(), + Method::Delete => f.debug_tuple("Method::Delete").finish(), + Method::Connect => f.debug_tuple("Method::Connect").finish(), + Method::Options => f.debug_tuple("Method::Options").finish(), + Method::Trace => f.debug_tuple("Method::Trace").finish(), + Method::Patch => f.debug_tuple("Method::Patch").finish(), + Method::Other(e) => f.debug_tuple("Method::Other").field(e).finish(), + } + } + } + #[derive(Clone)] + pub enum Scheme { + Http, + Https, + Other(_rt::String), + } + impl ::core::fmt::Debug for Scheme { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Scheme::Http => f.debug_tuple("Scheme::Http").finish(), + Scheme::Https => f.debug_tuple("Scheme::Https").finish(), + Scheme::Other(e) => f.debug_tuple("Scheme::Other").field(e).finish(), + } + } + } + #[derive(Clone)] + pub struct DnsErrorPayload { + pub rcode: Option<_rt::String>, + pub info_code: Option, + } + impl ::core::fmt::Debug for DnsErrorPayload { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("DnsErrorPayload") + .field("rcode", &self.rcode) + .field("info-code", &self.info_code) + .finish() + } + } + #[derive(Clone)] + pub struct TlsAlertReceivedPayload { + pub alert_id: Option, + pub alert_message: Option<_rt::String>, + } + impl ::core::fmt::Debug for TlsAlertReceivedPayload { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("TlsAlertReceivedPayload") + .field("alert-id", &self.alert_id) + .field("alert-message", &self.alert_message) + .finish() + } + } + #[derive(Clone)] + pub struct FieldSizePayload { + pub field_name: Option<_rt::String>, + pub field_size: Option, + } + impl ::core::fmt::Debug for FieldSizePayload { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("FieldSizePayload") + .field("field-name", &self.field_name) + .field("field-size", &self.field_size) + .finish() + } + } + #[derive(Clone)] + pub enum ErrorCode { + DnsTimeout, + DnsError(DnsErrorPayload), + DestinationNotFound, + DestinationUnavailable, + DestinationIpProhibited, + DestinationIpUnroutable, + ConnectionRefused, + ConnectionTerminated, + ConnectionTimeout, + ConnectionReadTimeout, + ConnectionWriteTimeout, + ConnectionLimitReached, + TlsProtocolError, + TlsCertificateError, + TlsAlertReceived(TlsAlertReceivedPayload), + HttpRequestDenied, + HttpRequestLengthRequired, + HttpRequestBodySize(Option), + HttpRequestMethodInvalid, + HttpRequestUriInvalid, + HttpRequestUriTooLong, + HttpRequestHeaderSectionSize(Option), + HttpRequestHeaderSize(Option), + HttpRequestTrailerSectionSize(Option), + HttpRequestTrailerSize(FieldSizePayload), + HttpResponseIncomplete, + HttpResponseHeaderSectionSize(Option), + HttpResponseHeaderSize(FieldSizePayload), + HttpResponseBodySize(Option), + HttpResponseTrailerSectionSize(Option), + HttpResponseTrailerSize(FieldSizePayload), + HttpResponseTransferCoding(Option<_rt::String>), + HttpResponseContentCoding(Option<_rt::String>), + HttpResponseTimeout, + HttpUpgradeFailed, + HttpProtocolError, + LoopDetected, + ConfigurationError, + InternalError(Option<_rt::String>), + } + impl ::core::fmt::Debug for ErrorCode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + ErrorCode::DnsTimeout => f.debug_tuple("ErrorCode::DnsTimeout").finish(), + ErrorCode::DnsError(e) => { + f.debug_tuple("ErrorCode::DnsError").field(e).finish() + } + ErrorCode::DestinationNotFound => { + f.debug_tuple("ErrorCode::DestinationNotFound").finish() + } + ErrorCode::DestinationUnavailable => { + f.debug_tuple("ErrorCode::DestinationUnavailable").finish() + } + ErrorCode::DestinationIpProhibited => { + f.debug_tuple("ErrorCode::DestinationIpProhibited").finish() + } + ErrorCode::DestinationIpUnroutable => { + f.debug_tuple("ErrorCode::DestinationIpUnroutable").finish() + } + ErrorCode::ConnectionRefused => { + f.debug_tuple("ErrorCode::ConnectionRefused").finish() + } + ErrorCode::ConnectionTerminated => { + f.debug_tuple("ErrorCode::ConnectionTerminated").finish() + } + ErrorCode::ConnectionTimeout => { + f.debug_tuple("ErrorCode::ConnectionTimeout").finish() + } + ErrorCode::ConnectionReadTimeout => { + f.debug_tuple("ErrorCode::ConnectionReadTimeout").finish() + } + ErrorCode::ConnectionWriteTimeout => { + f.debug_tuple("ErrorCode::ConnectionWriteTimeout").finish() + } + ErrorCode::ConnectionLimitReached => { + f.debug_tuple("ErrorCode::ConnectionLimitReached").finish() + } + ErrorCode::TlsProtocolError => { + f.debug_tuple("ErrorCode::TlsProtocolError").finish() + } + ErrorCode::TlsCertificateError => { + f.debug_tuple("ErrorCode::TlsCertificateError").finish() + } + ErrorCode::TlsAlertReceived(e) => f + .debug_tuple("ErrorCode::TlsAlertReceived") + .field(e) + .finish(), + ErrorCode::HttpRequestDenied => { + f.debug_tuple("ErrorCode::HttpRequestDenied").finish() + } + ErrorCode::HttpRequestLengthRequired => f + .debug_tuple("ErrorCode::HttpRequestLengthRequired") + .finish(), + ErrorCode::HttpRequestBodySize(e) => f + .debug_tuple("ErrorCode::HttpRequestBodySize") + .field(e) + .finish(), + ErrorCode::HttpRequestMethodInvalid => f + .debug_tuple("ErrorCode::HttpRequestMethodInvalid") + .finish(), + ErrorCode::HttpRequestUriInvalid => { + f.debug_tuple("ErrorCode::HttpRequestUriInvalid").finish() + } + ErrorCode::HttpRequestUriTooLong => { + f.debug_tuple("ErrorCode::HttpRequestUriTooLong").finish() + } + ErrorCode::HttpRequestHeaderSectionSize(e) => f + .debug_tuple("ErrorCode::HttpRequestHeaderSectionSize") + .field(e) + .finish(), + ErrorCode::HttpRequestHeaderSize(e) => f + .debug_tuple("ErrorCode::HttpRequestHeaderSize") + .field(e) + .finish(), + ErrorCode::HttpRequestTrailerSectionSize(e) => f + .debug_tuple("ErrorCode::HttpRequestTrailerSectionSize") + .field(e) + .finish(), + ErrorCode::HttpRequestTrailerSize(e) => f + .debug_tuple("ErrorCode::HttpRequestTrailerSize") + .field(e) + .finish(), + ErrorCode::HttpResponseIncomplete => { + f.debug_tuple("ErrorCode::HttpResponseIncomplete").finish() + } + ErrorCode::HttpResponseHeaderSectionSize(e) => f + .debug_tuple("ErrorCode::HttpResponseHeaderSectionSize") + .field(e) + .finish(), + ErrorCode::HttpResponseHeaderSize(e) => f + .debug_tuple("ErrorCode::HttpResponseHeaderSize") + .field(e) + .finish(), + ErrorCode::HttpResponseBodySize(e) => f + .debug_tuple("ErrorCode::HttpResponseBodySize") + .field(e) + .finish(), + ErrorCode::HttpResponseTrailerSectionSize(e) => f + .debug_tuple("ErrorCode::HttpResponseTrailerSectionSize") + .field(e) + .finish(), + ErrorCode::HttpResponseTrailerSize(e) => f + .debug_tuple("ErrorCode::HttpResponseTrailerSize") + .field(e) + .finish(), + ErrorCode::HttpResponseTransferCoding(e) => f + .debug_tuple("ErrorCode::HttpResponseTransferCoding") + .field(e) + .finish(), + ErrorCode::HttpResponseContentCoding(e) => f + .debug_tuple("ErrorCode::HttpResponseContentCoding") + .field(e) + .finish(), + ErrorCode::HttpResponseTimeout => { + f.debug_tuple("ErrorCode::HttpResponseTimeout").finish() + } + ErrorCode::HttpUpgradeFailed => { + f.debug_tuple("ErrorCode::HttpUpgradeFailed").finish() + } + ErrorCode::HttpProtocolError => { + f.debug_tuple("ErrorCode::HttpProtocolError").finish() + } + ErrorCode::LoopDetected => { + f.debug_tuple("ErrorCode::LoopDetected").finish() + } + ErrorCode::ConfigurationError => { + f.debug_tuple("ErrorCode::ConfigurationError").finish() + } + ErrorCode::InternalError(e) => { + f.debug_tuple("ErrorCode::InternalError").field(e).finish() + } + } + } + } + impl ::core::fmt::Display for ErrorCode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for ErrorCode {} + #[derive(Clone, Copy)] + pub enum HeaderError { + InvalidSyntax, + Forbidden, + Immutable, + } + impl ::core::fmt::Debug for HeaderError { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + HeaderError::InvalidSyntax => { + f.debug_tuple("HeaderError::InvalidSyntax").finish() + } + HeaderError::Forbidden => f.debug_tuple("HeaderError::Forbidden").finish(), + HeaderError::Immutable => f.debug_tuple("HeaderError::Immutable").finish(), + } + } + } + impl ::core::fmt::Display for HeaderError { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for HeaderError {} + pub type FieldKey = _rt::String; + pub type FieldValue = _rt::Vec; + + #[derive(Debug)] + #[repr(transparent)] + pub struct Fields { + handle: _rt::Resource, + } + + impl Fields { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for Fields { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]fields"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + pub type Headers = Fields; + pub type Trailers = Fields; + + #[derive(Debug)] + #[repr(transparent)] + pub struct IncomingRequest { + handle: _rt::Resource, + } + + impl IncomingRequest { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for IncomingRequest { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]incoming-request"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct OutgoingRequest { + handle: _rt::Resource, + } + + impl OutgoingRequest { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for OutgoingRequest { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]outgoing-request"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct RequestOptions { + handle: _rt::Resource, + } + + impl RequestOptions { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for RequestOptions { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]request-options"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct ResponseOutparam { + handle: _rt::Resource, + } + + impl ResponseOutparam { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for ResponseOutparam { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]response-outparam"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + pub type StatusCode = u16; + + #[derive(Debug)] + #[repr(transparent)] + pub struct IncomingResponse { + handle: _rt::Resource, + } + + impl IncomingResponse { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for IncomingResponse { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]incoming-response"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct IncomingBody { + handle: _rt::Resource, + } + + impl IncomingBody { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for IncomingBody { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]incoming-body"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct FutureTrailers { + handle: _rt::Resource, + } + + impl FutureTrailers { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for FutureTrailers { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]future-trailers"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct OutgoingResponse { + handle: _rt::Resource, + } + + impl OutgoingResponse { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for OutgoingResponse { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]outgoing-response"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct OutgoingBody { + handle: _rt::Resource, + } + + impl OutgoingBody { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for OutgoingBody { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]outgoing-body"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct FutureIncomingResponse { + handle: _rt::Resource, + } + + impl FutureIncomingResponse { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for FutureIncomingResponse { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]future-incoming-response"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn new() -> Self { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[constructor]fields"] + fn wit_import() -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import() -> i32 { + unreachable!() + } + let ret = wit_import(); + Fields::from_handle(ret as u32) + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn from_list( + entries: &[(FieldKey, FieldValue)], + ) -> Result { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let vec3 = entries; + let len3 = vec3.len(); + let layout3 = + _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 16, 4); + let result3 = if layout3.size() != 0 { + let ptr = _rt::alloc::alloc(layout3).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout3); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec3.into_iter().enumerate() { + let base = result3.add(i * 16); + { + let (t0_0, t0_1) = e; + let vec1 = t0_0; + 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().cast::(); + let len2 = vec2.len(); + *base.add(12).cast::() = len2; + *base.add(8).cast::<*mut u8>() = ptr2.cast_mut(); + } + } + 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(_: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import(result3, len3, ptr4); + let l5 = i32::from(*ptr4.add(0).cast::()); + if layout3.size() != 0 { + _rt::alloc::dealloc(result3.cast(), layout3); + } + match l5 { + 0 => { + let e = { + let l6 = *ptr4.add(4).cast::(); + + Fields::from_handle(l6 as u32) + }; + Ok(e) + } + 1 => { + let e = { + let l7 = i32::from(*ptr4.add(4).cast::()); + let v8 = match l7 { + 0 => HeaderError::InvalidSyntax, + 1 => HeaderError::Forbidden, + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + HeaderError::Immutable + } + }; + + v8 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn get(&self, name: &FieldKey) -> _rt::Vec { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let vec0 = name; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]fields.get"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = *ptr1.add(0).cast::<*mut u8>(); + let l3 = *ptr1.add(4).cast::(); + let base7 = l2; + let len7 = l3; + let mut result7 = _rt::Vec::with_capacity(len7); + for i in 0..len7 { + let base = base7.add(i * 8); + let e7 = { + let l4 = *base.add(0).cast::<*mut u8>(); + let l5 = *base.add(4).cast::(); + let len6 = l5; + + _rt::Vec::from_raw_parts(l4.cast(), len6, len6) + }; + result7.push(e7); + } + _rt::cabi_dealloc(base7, len7 * 8, 4); + result7 + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn has(&self, name: &FieldKey) -> bool { + unsafe { + let vec0 = name; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]fields.has"] + fn wit_import(_: i32, _: *mut u8, _: usize) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32, ptr0.cast_mut(), len0); + _rt::bool_lift(ret as u8) + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn set( + &self, + name: &FieldKey, + value: &[FieldValue], + ) -> Result<(), HeaderError> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = name; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec2 = value; + 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 = _rt::alloc::alloc(layout2).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout2); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec2.into_iter().enumerate() { + let base = result2.add(i * 8); + { + let vec1 = e; + 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.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, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + result2, + len2, + ptr3, + ); + let l4 = i32::from(*ptr3.add(0).cast::()); + if layout2.size() != 0 { + _rt::alloc::dealloc(result2.cast(), layout2); + } + match l4 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l5 = i32::from(*ptr3.add(1).cast::()); + let v6 = match l5 { + 0 => HeaderError::InvalidSyntax, + 1 => HeaderError::Forbidden, + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + HeaderError::Immutable + } + }; + + v6 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn delete(&self, name: &FieldKey) -> Result<(), HeaderError> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = name; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let 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, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(1).cast::()); + let v4 = match l3 { + 0 => HeaderError::InvalidSyntax, + 1 => HeaderError::Forbidden, + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + HeaderError::Immutable + } + }; + + v4 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn append( + &self, + name: &FieldKey, + value: &FieldValue, + ) -> Result<(), HeaderError> { + unsafe { + #[repr(align(1))] + struct RetArea([::core::mem::MaybeUninit; 2]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 2]); + let vec0 = name; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let vec1 = value; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + let ptr2 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]fields.append"] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: *mut u8, + _: usize, + _: *mut u8, + _: usize, + _: *mut u8, + ) { + unreachable!() + } + wit_import( + (self).handle() as i32, + ptr0.cast_mut(), + len0, + ptr1.cast_mut(), + len1, + ptr2, + ); + let l3 = i32::from(*ptr2.add(0).cast::()); + match l3 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l4 = i32::from(*ptr2.add(1).cast::()); + let v5 = match l4 { + 0 => HeaderError::InvalidSyntax, + 1 => HeaderError::Forbidden, + n => { + debug_assert_eq!(n, 2, "invalid enum discriminant"); + HeaderError::Immutable + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(4).cast::(); + let base9 = l1; + let len9 = l2; + let mut result9 = _rt::Vec::with_capacity(len9); + for i in 0..len9 { + let base = base9.add(i * 16); + let e9 = { + let l3 = *base.add(0).cast::<*mut u8>(); + let l4 = *base.add(4).cast::(); + let len5 = l4; + let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + let l6 = *base.add(8).cast::<*mut u8>(); + let l7 = *base.add(12).cast::(); + let len8 = l7; + + ( + _rt::string_lift(bytes5), + _rt::Vec::from_raw_parts(l6.cast(), len8, len8), + ) + }; + result9.push(e9); + } + _rt::cabi_dealloc(base9, len9 * 16, 4); + result9 + } + } + } + impl Fields { + #[allow(unused_unsafe, clippy::all)] + pub fn clone(&self) -> Fields { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]fields.clone"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + Fields::from_handle(ret as u32) + } + } + } + impl IncomingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn method(&self) -> Method { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + let v5 = match l1 { + 0 => Method::Get, + 1 => Method::Head, + 2 => Method::Post, + 3 => Method::Put, + 4 => Method::Delete, + 5 => Method::Connect, + 6 => Method::Options, + 7 => Method::Trace, + 8 => Method::Patch, + n => { + debug_assert_eq!(n, 9, "invalid enum discriminant"); + let e5 = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + Method::Other(e5) + } + }; + v5 + } + } + } + impl IncomingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn path_with_query(&self) -> Option<_rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl IncomingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn scheme(&self) -> Option { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + 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.add(8).cast::<*mut u8>(); + let l4 = *ptr0.add(12).cast::(); + let len5 = l4; + let bytes5 = + _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + + _rt::string_lift(bytes5) + }; + Scheme::Other(e6) + } + }; + + v6 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl IncomingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn authority(&self) -> Option<_rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl IncomingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn headers(&self) -> Headers { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]incoming-request.headers"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + Fields::from_handle(ret as u32) + } + } + } + impl IncomingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn consume(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + IncomingBody::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn new(headers: Headers) -> Self { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[constructor]outgoing-request"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((&headers).take_handle() as i32); + OutgoingRequest::from_handle(ret as u32) + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn body(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + OutgoingBody::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn method(&self) -> Method { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + let v5 = match l1 { + 0 => Method::Get, + 1 => Method::Head, + 2 => Method::Post, + 3 => Method::Put, + 4 => Method::Delete, + 5 => Method::Connect, + 6 => Method::Options, + 7 => Method::Trace, + 8 => Method::Patch, + n => { + debug_assert_eq!(n, 9, "invalid enum discriminant"); + let e5 = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + Method::Other(e5) + } + }; + v5 + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn set_method(&self, method: &Method) -> Result<(), ()> { + unsafe { + let (result1_0, result1_1, result1_2) = match method { + 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().cast::(); + let len0 = vec0.len(); + + (9i32, ptr0.cast_mut(), len0) + } + }; + + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-request.set-method"] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { + unreachable!() + } + let ret = + wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn path_with_query(&self) -> Option<_rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn set_path_with_query(&self, path_with_query: Option<&str>) -> Result<(), ()> { + unsafe { + let (result1_0, result1_1, result1_2) = match path_with_query { + Some(e) => { + let vec0 = e; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + + (1i32, ptr0.cast_mut(), len0) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-request.set-path-with-query"] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { + unreachable!() + } + let ret = + wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn scheme(&self) -> Option { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + 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.add(8).cast::<*mut u8>(); + let l4 = *ptr0.add(12).cast::(); + let len5 = l4; + let bytes5 = + _rt::Vec::from_raw_parts(l3.cast(), len5, len5); + + _rt::string_lift(bytes5) + }; + Scheme::Other(e6) + } + }; + + v6 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn set_scheme(&self, scheme: Option<&Scheme>) -> Result<(), ()> { + 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, ::core::ptr::null_mut(), 0usize), + Scheme::Https => (1i32, ::core::ptr::null_mut(), 0usize), + Scheme::Other(e) => { + let vec0 = e; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + + (2i32, ptr0.cast_mut(), len0) + } + }; + + (1i32, result1_0, result1_1, result1_2) + } + None => (0i32, 0i32, ::core::ptr::null_mut(), 0usize), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-request.set-scheme"] + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: i32, _: *mut u8, _: usize) -> i32 { + unreachable!() + } + let ret = wit_import( + (self).handle() as i32, + result2_0, + result2_1, + result2_2, + result2_3, + ); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn authority(&self) -> Option<_rt::String> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); + + _rt::string_lift(bytes4) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn set_authority(&self, authority: Option<&str>) -> Result<(), ()> { + unsafe { + let (result1_0, result1_1, result1_2) = match authority { + Some(e) => { + let vec0 = e; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + + (1i32, ptr0.cast_mut(), len0) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-request.set-authority"] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: *mut u8, _: usize) -> i32 { + unreachable!() + } + let ret = + wit_import((self).handle() as i32, result1_0, result1_1, result1_2); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingRequest { + #[allow(unused_unsafe, clippy::all)] + pub fn headers(&self) -> Headers { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-request.headers"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + Fields::from_handle(ret as u32) + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn new() -> Self { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[constructor]request-options"] + fn wit_import() -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import() -> i32 { + unreachable!() + } + let ret = wit_import(); + RequestOptions::from_handle(ret as u32) + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn connect_timeout(&self) -> Option { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn set_connect_timeout(&self, duration: Option) -> Result<(), ()> { + unsafe { + let (result0_0, result0_1) = match duration { + Some(e) => (1i32, _rt::as_i64(e)), + None => (0i32, 0i64), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]request-options.set-connect-timeout"] + fn wit_import(_: i32, _: i32, _: i64) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: i64) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32, result0_0, result0_1); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn first_byte_timeout(&self) -> Option { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn set_first_byte_timeout(&self, duration: Option) -> Result<(), ()> { + unsafe { + let (result0_0, result0_1) = match duration { + Some(e) => (1i32, _rt::as_i64(e)), + None => (0i32, 0i64), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]request-options.set-first-byte-timeout"] + fn wit_import(_: i32, _: i32, _: i64) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: i64) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32, result0_0, result0_1); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn between_bytes_timeout(&self) -> Option { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl RequestOptions { + #[allow(unused_unsafe, clippy::all)] + pub fn set_between_bytes_timeout( + &self, + duration: Option, + ) -> Result<(), ()> { + unsafe { + let (result0_0, result0_1) = match duration { + Some(e) => (1i32, _rt::as_i64(e)), + None => (0i32, 0i64), + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]request-options.set-between-bytes-timeout"] + fn wit_import(_: i32, _: i32, _: i64) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: i64) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32, result0_0, result0_1); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl ResponseOutparam { + #[allow(unused_unsafe, clippy::all)] + pub fn set(param: ResponseOutparam, response: Result) { + unsafe { + let ( + result38_0, + result38_1, + result38_2, + result38_3, + result38_4, + result38_5, + result38_6, + result38_7, + ) = match &response { + Ok(e) => ( + 0i32, + (e).take_handle() as i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + Err(e) => { + let ( + result37_0, + result37_1, + result37_2, + result37_3, + result37_4, + result37_5, + result37_6, + ) = match e { + ErrorCode::DnsTimeout => ( + 0i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::DnsError(e) => { + let DnsErrorPayload { + rcode: rcode0, + info_code: info_code0, + } = e; + let (result2_0, result2_1, result2_2) = match rcode0 { + Some(e) => { + let vec1 = e; + let ptr1 = vec1.as_ptr().cast::(); + let len1 = vec1.len(); + + (1i32, ptr1.cast_mut(), len1) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let (result3_0, result3_1) = match info_code0 { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 1i32, + result2_0, + { + 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, + ::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, _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().cast::(); + let len6 = vec6.len(); + + (1i32, ptr6.cast_mut(), len6) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + ( + 14i32, + result5_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, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::HttpRequestLengthRequired => ( + 16i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::HttpRequestBodySize(e) => { + let (result8_0, result8_1) = match e { + Some(e) => (1i32, _rt::as_i64(e)), + None => (0i32, 0i64), + }; + ( + 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, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 21i32, + result9_0, + ::core::mem::MaybeUninit::new( + i64::from(result9_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestHeaderSize(e) => { + let ( + result14_0, + result14_1, + result14_2, + result14_3, + result14_4, + result14_5, + ) = match e { + Some(e) => { + let FieldSizePayload { + field_name: field_name10, + field_size: field_size10, + } = e; + let (result12_0, result12_1, result12_2) = + match field_name10 { + Some(e) => { + let vec11 = e; + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + + (1i32, ptr11.cast_mut(), len11) + } + None => { + (0i32, ::core::ptr::null_mut(), 0usize) + } + }; + let (result13_0, result13_1) = match field_size10 { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 1i32, result12_0, result12_1, result12_2, + result13_0, result13_1, + ) + } + None => ( + 0i32, + 0i32, + ::core::ptr::null_mut(), + 0usize, + 0i32, + 0i32, + ), + }; + ( + 22i32, + result14_0, + ::core::mem::MaybeUninit::new( + i64::from(result14_1) as u64 + ), + result14_2, + result14_3 as *mut u8, + result14_4 as usize, + result14_5, + ) + } + ErrorCode::HttpRequestTrailerSectionSize(e) => { + let (result15_0, result15_1) = match e { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 23i32, + result15_0, + ::core::mem::MaybeUninit::new( + i64::from(result15_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpRequestTrailerSize(e) => { + let FieldSizePayload { + field_name: field_name16, + field_size: field_size16, + } = e; + let (result18_0, result18_1, result18_2) = + match field_name16 { + Some(e) => { + let vec17 = e; + let ptr17 = vec17.as_ptr().cast::(); + let len17 = vec17.len(); + + (1i32, ptr17.cast_mut(), len17) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let (result19_0, result19_1) = match field_size16 { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 24i32, + result18_0, + { + 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, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::HttpResponseHeaderSectionSize(e) => { + let (result20_0, result20_1) = match e { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 26i32, + result20_0, + ::core::mem::MaybeUninit::new( + i64::from(result20_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpResponseHeaderSize(e) => { + let FieldSizePayload { + field_name: field_name21, + field_size: field_size21, + } = e; + let (result23_0, result23_1, result23_2) = + match field_name21 { + Some(e) => { + let vec22 = e; + let ptr22 = vec22.as_ptr().cast::(); + let len22 = vec22.len(); + + (1i32, ptr22.cast_mut(), len22) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let (result24_0, result24_1) = match field_size21 { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 27i32, + result23_0, + { + 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, _rt::as_i64(e)), + None => (0i32, 0i64), + }; + ( + 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, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 29i32, + result26_0, + ::core::mem::MaybeUninit::new( + i64::from(result26_1) as u64 + ), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ) + } + ErrorCode::HttpResponseTrailerSize(e) => { + let FieldSizePayload { + field_name: field_name27, + field_size: field_size27, + } = e; + let (result29_0, result29_1, result29_2) = + match field_name27 { + Some(e) => { + let vec28 = e; + let ptr28 = vec28.as_ptr().cast::(); + let len28 = vec28.len(); + + (1i32, ptr28.cast_mut(), len28) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + let (result30_0, result30_1) = match field_size27 { + Some(e) => (1i32, _rt::as_i32(e)), + None => (0i32, 0i32), + }; + ( + 30i32, + result29_0, + { + 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, + ) + } + ErrorCode::HttpResponseTransferCoding(e) => { + let (result32_0, result32_1, result32_2) = match e { + Some(e) => { + let vec31 = e; + let ptr31 = vec31.as_ptr().cast::(); + let len31 = vec31.len(); + + (1i32, ptr31.cast_mut(), len31) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + ( + 31i32, + result32_0, + { + 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, + ) + } + ErrorCode::HttpResponseContentCoding(e) => { + let (result34_0, result34_1, result34_2) = match e { + Some(e) => { + let vec33 = e; + let ptr33 = vec33.as_ptr().cast::(); + let len33 = vec33.len(); + + (1i32, ptr33.cast_mut(), len33) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + ( + 32i32, + result34_0, + { + 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, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::HttpUpgradeFailed => ( + 34i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::HttpProtocolError => ( + 35i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::LoopDetected => ( + 36i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::ConfigurationError => ( + 37i32, + 0i32, + ::core::mem::MaybeUninit::::zeroed(), + ::core::ptr::null_mut(), + ::core::ptr::null_mut(), + 0usize, + 0i32, + ), + ErrorCode::InternalError(e) => { + let (result36_0, result36_1, result36_2) = match e { + Some(e) => { + let vec35 = e; + let ptr35 = vec35.as_ptr().cast::(); + let len35 = vec35.len(); + + (1i32, ptr35.cast_mut(), len35) + } + None => (0i32, ::core::ptr::null_mut(), 0usize), + }; + ( + 38i32, + result36_0, + { + 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, + ) + } + }; + + ( + 1i32, result37_0, result37_1, result37_2, result37_3, + result37_4, result37_5, result37_6, + ) + } + }; + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[static]response-outparam.set"] + fn wit_import( + _: i32, + _: i32, + _: i32, + _: i32, + _: ::core::mem::MaybeUninit, + _: *mut u8, + _: *mut u8, + _: usize, + _: i32, + ); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import( + _: i32, + _: i32, + _: i32, + _: i32, + _: ::core::mem::MaybeUninit, + _: *mut u8, + _: *mut u8, + _: usize, + _: i32, + ) { + unreachable!() + } + wit_import( + (¶m).take_handle() as i32, + result38_0, + result38_1, + result38_2, + result38_3, + result38_4, + result38_5, + result38_6, + result38_7, + ); + } + } + } + impl IncomingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn status(&self) -> StatusCode { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]incoming-response.status"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + ret as u16 + } + } + } + impl IncomingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn headers(&self) -> Headers { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]incoming-response.headers"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + Fields::from_handle(ret as u32) + } + } + } + impl IncomingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn consume(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + IncomingBody::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl IncomingBody { + #[allow(unused_unsafe, clippy::all)] + pub fn stream(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + super::super::super::wasi::io0_2_0::streams::InputStream::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl IncomingBody { + #[allow(unused_unsafe, clippy::all)] + pub fn finish(this: IncomingBody) -> FutureTrailers { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[static]incoming-body.finish"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((&this).take_handle() as i32); + FutureTrailers::from_handle(ret as u32) + } + } + } + impl FutureTrailers { + #[allow(unused_unsafe, clippy::all)] + pub fn subscribe(&self) -> Pollable { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]future-trailers.subscribe"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + } + } + } + impl FutureTrailers { + #[allow(unused_unsafe, clippy::all)] + pub fn get(&self) -> Option, ErrorCode>, ()>> { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 56]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 56]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(8).cast::()); + + match l2 { + 0 => { + let e = { + let l3 = i32::from(*ptr0.add(16).cast::()); + + match l3 { + 0 => { + let e = + { + let l4 = i32::from( + *ptr0.add(24).cast::(), + ); + + match l4 { + 0 => None, + 1 => { + let e = { + let l5 = *ptr0.add(28).cast::(); + + Fields::from_handle(l5 as u32) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + Ok(e) + } + 1 => { + let e = { + let l6 = i32::from( + *ptr0.add(24).cast::(), + ); + let v68 = match l6 { + 0 => { + ErrorCode::DnsTimeout + } + 1 => { + let e68 = { + let l7 = i32::from(*ptr0.add(32).cast::()); + let l11 = i32::from(*ptr0.add(44).cast::()); + + DnsErrorPayload{ + rcode: match l7 { + 0 => None, + 1 => { + let e = { + let l8 = *ptr0.add(36).cast::<*mut u8>(); + let l9 = *ptr0.add(40).cast::(); + let len10 = l9; + let bytes10 = _rt::Vec::from_raw_parts(l8.cast(), len10, len10); + + _rt::string_lift(bytes10) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l11 { + 0 => None, + 1 => { + let e = { + let l12 = i32::from(*ptr0.add(46).cast::()); + + l12 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e68) + } + 2 => { + ErrorCode::DestinationNotFound + } + 3 => { + ErrorCode::DestinationUnavailable + } + 4 => { + ErrorCode::DestinationIpProhibited + } + 5 => { + ErrorCode::DestinationIpUnroutable + } + 6 => { + ErrorCode::ConnectionRefused + } + 7 => { + ErrorCode::ConnectionTerminated + } + 8 => { + ErrorCode::ConnectionTimeout + } + 9 => { + ErrorCode::ConnectionReadTimeout + } + 10 => { + ErrorCode::ConnectionWriteTimeout + } + 11 => { + ErrorCode::ConnectionLimitReached + } + 12 => { + ErrorCode::TlsProtocolError + } + 13 => { + ErrorCode::TlsCertificateError + } + 14 => { + let e68 = { + let l13 = i32::from(*ptr0.add(32).cast::()); + let l15 = i32::from(*ptr0.add(36).cast::()); + + TlsAlertReceivedPayload{ + alert_id: match l13 { + 0 => None, + 1 => { + let e = { + let l14 = i32::from(*ptr0.add(33).cast::()); + + l14 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l15 { + 0 => None, + 1 => { + let e = { + let l16 = *ptr0.add(40).cast::<*mut u8>(); + let l17 = *ptr0.add(44).cast::(); + let len18 = l17; + let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); + + _rt::string_lift(bytes18) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::TlsAlertReceived(e68) + } + 15 => { + ErrorCode::HttpRequestDenied + } + 16 => { + ErrorCode::HttpRequestLengthRequired + } + 17 => { + let e68 = { + let l19 = i32::from(*ptr0.add(32).cast::()); + + match l19 { + 0 => None, + 1 => { + let e = { + let l20 = *ptr0.add(40).cast::(); + + l20 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e68) + } + 18 => { + ErrorCode::HttpRequestMethodInvalid + } + 19 => { + ErrorCode::HttpRequestUriInvalid + } + 20 => { + ErrorCode::HttpRequestUriTooLong + } + 21 => { + let e68 = { + let l21 = i32::from(*ptr0.add(32).cast::()); + + match l21 { + 0 => None, + 1 => { + let e = { + let l22 = *ptr0.add(36).cast::(); + + l22 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e68) + } + 22 => { + let e68 = { + let l23 = i32::from(*ptr0.add(32).cast::()); + + match l23 { + 0 => None, + 1 => { + let e = { + let l24 = i32::from(*ptr0.add(36).cast::()); + let l28 = i32::from(*ptr0.add(48).cast::()); + + FieldSizePayload{ + field_name: match l24 { + 0 => None, + 1 => { + let e = { + let l25 = *ptr0.add(40).cast::<*mut u8>(); + let l26 = *ptr0.add(44).cast::(); + let len27 = l26; + let bytes27 = _rt::Vec::from_raw_parts(l25.cast(), len27, len27); + + _rt::string_lift(bytes27) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l28 { + 0 => None, + 1 => { + let e = { + let l29 = *ptr0.add(52).cast::(); + + l29 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e68) + } + 23 => { + let e68 = { + let l30 = i32::from(*ptr0.add(32).cast::()); + + match l30 { + 0 => None, + 1 => { + let e = { + let l31 = *ptr0.add(36).cast::(); + + l31 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e68) + } + 24 => { + let e68 = { + let l32 = i32::from(*ptr0.add(32).cast::()); + let l36 = i32::from(*ptr0.add(44).cast::()); + + FieldSizePayload{ + field_name: match l32 { + 0 => None, + 1 => { + let e = { + let l33 = *ptr0.add(36).cast::<*mut u8>(); + let l34 = *ptr0.add(40).cast::(); + let len35 = l34; + let bytes35 = _rt::Vec::from_raw_parts(l33.cast(), len35, len35); + + _rt::string_lift(bytes35) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l36 { + 0 => None, + 1 => { + let e = { + let l37 = *ptr0.add(48).cast::(); + + l37 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e68) + } + 25 => { + ErrorCode::HttpResponseIncomplete + } + 26 => { + let e68 = { + let l38 = i32::from(*ptr0.add(32).cast::()); + + match l38 { + 0 => None, + 1 => { + let e = { + let l39 = *ptr0.add(36).cast::(); + + l39 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e68) + } + 27 => { + let e68 = { + let l40 = i32::from(*ptr0.add(32).cast::()); + let l44 = i32::from(*ptr0.add(44).cast::()); + + FieldSizePayload{ + field_name: match l40 { + 0 => None, + 1 => { + let e = { + let l41 = *ptr0.add(36).cast::<*mut u8>(); + let l42 = *ptr0.add(40).cast::(); + let len43 = l42; + let bytes43 = _rt::Vec::from_raw_parts(l41.cast(), len43, len43); + + _rt::string_lift(bytes43) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l44 { + 0 => None, + 1 => { + let e = { + let l45 = *ptr0.add(48).cast::(); + + l45 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e68) + } + 28 => { + let e68 = { + let l46 = i32::from(*ptr0.add(32).cast::()); + + match l46 { + 0 => None, + 1 => { + let e = { + let l47 = *ptr0.add(40).cast::(); + + l47 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e68) + } + 29 => { + let e68 = { + let l48 = i32::from(*ptr0.add(32).cast::()); + + match l48 { + 0 => None, + 1 => { + let e = { + let l49 = *ptr0.add(36).cast::(); + + l49 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e68) + } + 30 => { + let e68 = { + let l50 = i32::from(*ptr0.add(32).cast::()); + let l54 = i32::from(*ptr0.add(44).cast::()); + + FieldSizePayload{ + field_name: match l50 { + 0 => None, + 1 => { + let e = { + let l51 = *ptr0.add(36).cast::<*mut u8>(); + let l52 = *ptr0.add(40).cast::(); + let len53 = l52; + let bytes53 = _rt::Vec::from_raw_parts(l51.cast(), len53, len53); + + _rt::string_lift(bytes53) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l54 { + 0 => None, + 1 => { + let e = { + let l55 = *ptr0.add(48).cast::(); + + l55 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e68) + } + 31 => { + let e68 = { + let l56 = i32::from(*ptr0.add(32).cast::()); + + match l56 { + 0 => None, + 1 => { + let e = { + let l57 = *ptr0.add(36).cast::<*mut u8>(); + let l58 = *ptr0.add(40).cast::(); + let len59 = l58; + let bytes59 = _rt::Vec::from_raw_parts(l57.cast(), len59, len59); + + _rt::string_lift(bytes59) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e68) + } + 32 => { + let e68 = { + let l60 = i32::from(*ptr0.add(32).cast::()); + + match l60 { + 0 => None, + 1 => { + let e = { + let l61 = *ptr0.add(36).cast::<*mut u8>(); + let l62 = *ptr0.add(40).cast::(); + let len63 = l62; + let bytes63 = _rt::Vec::from_raw_parts(l61.cast(), len63, len63); + + _rt::string_lift(bytes63) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e68) + } + 33 => { + ErrorCode::HttpResponseTimeout + } + 34 => { + ErrorCode::HttpUpgradeFailed + } + 35 => { + ErrorCode::HttpProtocolError + } + 36 => { + ErrorCode::LoopDetected + } + 37 => { + ErrorCode::ConfigurationError + } + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e68 = { + let l64 = i32::from(*ptr0.add(32).cast::()); + + match l64 { + 0 => None, + 1 => { + let e = { + let l65 = *ptr0.add(36).cast::<*mut u8>(); + let l66 = *ptr0.add(40).cast::(); + let len67 = l66; + let bytes67 = _rt::Vec::from_raw_parts(l65.cast(), len67, len67); + + _rt::string_lift(bytes67) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e68) + } + }; + + v68 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn new(headers: Headers) -> Self { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[constructor]outgoing-response"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((&headers).take_handle() as i32); + OutgoingResponse::from_handle(ret as u32) + } + } + } + impl OutgoingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn status_code(&self) -> StatusCode { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-response.status-code"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + ret as u16 + } + } + } + impl OutgoingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn set_status_code(&self, status_code: StatusCode) -> Result<(), ()> { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-response.set-status-code"] + fn wit_import(_: i32, _: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32, _rt::as_i32(status_code)); + match ret { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn headers(&self) -> Headers { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]outgoing-response.headers"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + Fields::from_handle(ret as u32) + } + } + } + impl OutgoingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn body(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + OutgoingBody::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingBody { + #[allow(unused_unsafe, clippy::all)] + pub fn write(&self) -> Result { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::(); + + super::super::super::wasi::io0_2_0::streams::OutputStream::from_handle(l2 as u32) + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutgoingBody { + #[allow(unused_unsafe, clippy::all)] + pub fn finish( + this: OutgoingBody, + trailers: Option, + ) -> Result<(), ErrorCode> { + unsafe { + #[repr(align(8))] + 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.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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + 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.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(8).cast::()); + let v65 = match l3 { + 0 => ErrorCode::DnsTimeout, + 1 => { + let e65 = { + 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.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) + } + 2 => ErrorCode::DestinationNotFound, + 3 => ErrorCode::DestinationUnavailable, + 4 => ErrorCode::DestinationIpProhibited, + 5 => ErrorCode::DestinationIpUnroutable, + 6 => ErrorCode::ConnectionRefused, + 7 => ErrorCode::ConnectionTerminated, + 8 => ErrorCode::ConnectionTimeout, + 9 => ErrorCode::ConnectionReadTimeout, + 10 => ErrorCode::ConnectionWriteTimeout, + 11 => ErrorCode::ConnectionLimitReached, + 12 => ErrorCode::TlsProtocolError, + 13 => ErrorCode::TlsCertificateError, + 14 => { + let e65 = { + 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.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) + } + 15 => ErrorCode::HttpRequestDenied, + 16 => ErrorCode::HttpRequestLengthRequired, + 17 => { + let e65 = { + let l16 = i32::from(*ptr1.add(16).cast::()); + + match l16 { + 0 => None, + 1 => { + let e = { + let l17 = *ptr1.add(24).cast::(); + + l17 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e65) + } + 18 => ErrorCode::HttpRequestMethodInvalid, + 19 => ErrorCode::HttpRequestUriInvalid, + 20 => ErrorCode::HttpRequestUriTooLong, + 21 => { + let e65 = { + let l18 = i32::from(*ptr1.add(16).cast::()); + + match l18 { + 0 => None, + 1 => { + let e = { + let l19 = *ptr1.add(20).cast::(); + + l19 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e65) + } + 22 => { + let e65 = { + let l20 = i32::from(*ptr1.add(16).cast::()); + + match l20 { + 0 => None, + 1 => { + let e = { + let l21 = i32::from( + *ptr1.add(20).cast::(), + ); + let l25 = i32::from( + *ptr1.add(32).cast::(), + ); + + FieldSizePayload{ + field_name: match l21 { + 0 => None, + 1 => { + let e = { + let l22 = *ptr1.add(24).cast::<*mut u8>(); + let l23 = *ptr1.add(28).cast::(); + let len24 = l23; + let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); + + _rt::string_lift(bytes24) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l25 { + 0 => None, + 1 => { + let e = { + let l26 = *ptr1.add(36).cast::(); + + l26 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e65) + } + 23 => { + let e65 = { + let l27 = i32::from(*ptr1.add(16).cast::()); + + match l27 { + 0 => None, + 1 => { + let e = { + let l28 = *ptr1.add(20).cast::(); + + l28 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e65) + } + 24 => { + let e65 = { + 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.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.add(16).cast::()); + + match l35 { + 0 => None, + 1 => { + let e = { + let l36 = *ptr1.add(20).cast::(); + + l36 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e65) + } + 27 => { + let e65 = { + 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.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.add(16).cast::()); + + match l43 { + 0 => None, + 1 => { + let e = { + let l44 = *ptr1.add(24).cast::(); + + l44 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e65) + } + 29 => { + let e65 = { + let l45 = i32::from(*ptr1.add(16).cast::()); + + match l45 { + 0 => None, + 1 => { + let e = { + let l46 = *ptr1.add(20).cast::(); + + l46 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e65) + } + 30 => { + let e65 = { + 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.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.add(16).cast::()); + + 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, + ); + + _rt::string_lift(bytes56) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e65) + } + 32 => { + let e65 = { + let l57 = i32::from(*ptr1.add(16).cast::()); + + 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, + ); + + _rt::string_lift(bytes60) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e65) + } + 33 => ErrorCode::HttpResponseTimeout, + 34 => ErrorCode::HttpUpgradeFailed, + 35 => ErrorCode::HttpProtocolError, + 36 => ErrorCode::LoopDetected, + 37 => ErrorCode::ConfigurationError, + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e65 = { + let l61 = i32::from(*ptr1.add(16).cast::()); + + 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, + ); + + _rt::string_lift(bytes64) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e65) + } + }; + + v65 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl FutureIncomingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn subscribe(&self) -> Pollable { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:http/types@0.2.0")] + extern "C" { + #[link_name = "[method]future-incoming-response.subscribe"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + } + } + } + impl FutureIncomingResponse { + #[allow(unused_unsafe, clippy::all)] + pub fn get(&self) -> Option, ()>> { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 56]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 56]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(8).cast::()); + + match l2 { + 0 => { + let e = { + let l3 = i32::from(*ptr0.add(16).cast::()); + + 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.add(24).cast::(), + ); + let v67 = match l5 { + 0 => { + ErrorCode::DnsTimeout + } + 1 => { + let e67 = { + let l6 = i32::from(*ptr0.add(32).cast::()); + let l10 = i32::from(*ptr0.add(44).cast::()); + + DnsErrorPayload{ + rcode: match l6 { + 0 => None, + 1 => { + let e = { + let l7 = *ptr0.add(36).cast::<*mut u8>(); + let l8 = *ptr0.add(40).cast::(); + let len9 = l8; + let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); + + _rt::string_lift(bytes9) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + info_code: match l10 { + 0 => None, + 1 => { + let e = { + let l11 = i32::from(*ptr0.add(46).cast::()); + + l11 as u16 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e67) + } + 2 => { + ErrorCode::DestinationNotFound + } + 3 => { + ErrorCode::DestinationUnavailable + } + 4 => { + ErrorCode::DestinationIpProhibited + } + 5 => { + ErrorCode::DestinationIpUnroutable + } + 6 => { + ErrorCode::ConnectionRefused + } + 7 => { + ErrorCode::ConnectionTerminated + } + 8 => { + ErrorCode::ConnectionTimeout + } + 9 => { + ErrorCode::ConnectionReadTimeout + } + 10 => { + ErrorCode::ConnectionWriteTimeout + } + 11 => { + ErrorCode::ConnectionLimitReached + } + 12 => { + ErrorCode::TlsProtocolError + } + 13 => { + ErrorCode::TlsCertificateError + } + 14 => { + let e67 = { + let l12 = i32::from(*ptr0.add(32).cast::()); + let l14 = i32::from(*ptr0.add(36).cast::()); + + TlsAlertReceivedPayload{ + alert_id: match l12 { + 0 => None, + 1 => { + let e = { + let l13 = i32::from(*ptr0.add(33).cast::()); + + l13 as u8 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + alert_message: match l14 { + 0 => None, + 1 => { + let e = { + let l15 = *ptr0.add(40).cast::<*mut u8>(); + let l16 = *ptr0.add(44).cast::(); + let len17 = l16; + let bytes17 = _rt::Vec::from_raw_parts(l15.cast(), len17, len17); + + _rt::string_lift(bytes17) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::TlsAlertReceived(e67) + } + 15 => { + ErrorCode::HttpRequestDenied + } + 16 => { + ErrorCode::HttpRequestLengthRequired + } + 17 => { + let e67 = { + let l18 = i32::from(*ptr0.add(32).cast::()); + + match l18 { + 0 => None, + 1 => { + let e = { + let l19 = *ptr0.add(40).cast::(); + + l19 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e67) + } + 18 => { + ErrorCode::HttpRequestMethodInvalid + } + 19 => { + ErrorCode::HttpRequestUriInvalid + } + 20 => { + ErrorCode::HttpRequestUriTooLong + } + 21 => { + let e67 = { + let l20 = i32::from(*ptr0.add(32).cast::()); + + match l20 { + 0 => None, + 1 => { + let e = { + let l21 = *ptr0.add(36).cast::(); + + l21 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e67) + } + 22 => { + let e67 = { + let l22 = i32::from(*ptr0.add(32).cast::()); + + match l22 { + 0 => None, + 1 => { + let e = { + let l23 = i32::from(*ptr0.add(36).cast::()); + let l27 = i32::from(*ptr0.add(48).cast::()); + + FieldSizePayload{ + field_name: match l23 { + 0 => None, + 1 => { + let e = { + let l24 = *ptr0.add(40).cast::<*mut u8>(); + let l25 = *ptr0.add(44).cast::(); + let len26 = l25; + let bytes26 = _rt::Vec::from_raw_parts(l24.cast(), len26, len26); + + _rt::string_lift(bytes26) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l27 { + 0 => None, + 1 => { + let e = { + let l28 = *ptr0.add(52).cast::(); + + l28 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e67) + } + 23 => { + let e67 = { + let l29 = i32::from(*ptr0.add(32).cast::()); + + match l29 { + 0 => None, + 1 => { + let e = { + let l30 = *ptr0.add(36).cast::(); + + l30 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e67) + } + 24 => { + let e67 = { + let l31 = i32::from(*ptr0.add(32).cast::()); + let l35 = i32::from(*ptr0.add(44).cast::()); + + FieldSizePayload{ + field_name: match l31 { + 0 => None, + 1 => { + let e = { + let l32 = *ptr0.add(36).cast::<*mut u8>(); + let l33 = *ptr0.add(40).cast::(); + let len34 = l33; + let bytes34 = _rt::Vec::from_raw_parts(l32.cast(), len34, len34); + + _rt::string_lift(bytes34) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l35 { + 0 => None, + 1 => { + let e = { + let l36 = *ptr0.add(48).cast::(); + + l36 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e67) + } + 25 => { + ErrorCode::HttpResponseIncomplete + } + 26 => { + let e67 = { + let l37 = i32::from(*ptr0.add(32).cast::()); + + match l37 { + 0 => None, + 1 => { + let e = { + let l38 = *ptr0.add(36).cast::(); + + l38 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e67) + } + 27 => { + let e67 = { + let l39 = i32::from(*ptr0.add(32).cast::()); + let l43 = i32::from(*ptr0.add(44).cast::()); + + FieldSizePayload{ + field_name: match l39 { + 0 => None, + 1 => { + let e = { + let l40 = *ptr0.add(36).cast::<*mut u8>(); + let l41 = *ptr0.add(40).cast::(); + let len42 = l41; + let bytes42 = _rt::Vec::from_raw_parts(l40.cast(), len42, len42); + + _rt::string_lift(bytes42) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l43 { + 0 => None, + 1 => { + let e = { + let l44 = *ptr0.add(48).cast::(); + + l44 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e67) + } + 28 => { + let e67 = { + let l45 = i32::from(*ptr0.add(32).cast::()); + + match l45 { + 0 => None, + 1 => { + let e = { + let l46 = *ptr0.add(40).cast::(); + + l46 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e67) + } + 29 => { + let e67 = { + let l47 = i32::from(*ptr0.add(32).cast::()); + + match l47 { + 0 => None, + 1 => { + let e = { + let l48 = *ptr0.add(36).cast::(); + + l48 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e67) + } + 30 => { + let e67 = { + let l49 = i32::from(*ptr0.add(32).cast::()); + let l53 = i32::from(*ptr0.add(44).cast::()); + + FieldSizePayload{ + field_name: match l49 { + 0 => None, + 1 => { + let e = { + let l50 = *ptr0.add(36).cast::<*mut u8>(); + let l51 = *ptr0.add(40).cast::(); + let len52 = l51; + let bytes52 = _rt::Vec::from_raw_parts(l50.cast(), len52, len52); + + _rt::string_lift(bytes52) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + field_size: match l53 { + 0 => None, + 1 => { + let e = { + let l54 = *ptr0.add(48).cast::(); + + l54 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e67) + } + 31 => { + let e67 = { + let l55 = i32::from(*ptr0.add(32).cast::()); + + match l55 { + 0 => None, + 1 => { + let e = { + let l56 = *ptr0.add(36).cast::<*mut u8>(); + let l57 = *ptr0.add(40).cast::(); + let len58 = l57; + let bytes58 = _rt::Vec::from_raw_parts(l56.cast(), len58, len58); + + _rt::string_lift(bytes58) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e67) + } + 32 => { + let e67 = { + let l59 = i32::from(*ptr0.add(32).cast::()); + + match l59 { + 0 => None, + 1 => { + let e = { + let l60 = *ptr0.add(36).cast::<*mut u8>(); + let l61 = *ptr0.add(40).cast::(); + let len62 = l61; + let bytes62 = _rt::Vec::from_raw_parts(l60.cast(), len62, len62); + + _rt::string_lift(bytes62) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e67) + } + 33 => { + ErrorCode::HttpResponseTimeout + } + 34 => { + ErrorCode::HttpUpgradeFailed + } + 35 => { + ErrorCode::HttpProtocolError + } + 36 => { + ErrorCode::LoopDetected + } + 37 => { + ErrorCode::ConfigurationError + } + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e67 = { + let l63 = i32::from(*ptr0.add(32).cast::()); + + match l63 { + 0 => None, + 1 => { + let e = { + let l64 = *ptr0.add(36).cast::<*mut u8>(); + let l65 = *ptr0.add(40).cast::(); + let len66 = l65; + let bytes66 = _rt::Vec::from_raw_parts(l64.cast(), len66, len66); + + _rt::string_lift(bytes66) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e67) + } + }; + + v67 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + Ok(e) + } + 1 => { + let e = (); + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn http_error_code(err: &IoError) -> Option { + unsafe { + #[repr(align(8))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((err).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => None, + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(8).cast::()); + let v64 = match l2 { + 0 => ErrorCode::DnsTimeout, + 1 => { + 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.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, + ); + + _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) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::DnsError(e64) + } + 2 => ErrorCode::DestinationNotFound, + 3 => ErrorCode::DestinationUnavailable, + 4 => ErrorCode::DestinationIpProhibited, + 5 => ErrorCode::DestinationIpUnroutable, + 6 => ErrorCode::ConnectionRefused, + 7 => ErrorCode::ConnectionTerminated, + 8 => ErrorCode::ConnectionTimeout, + 9 => ErrorCode::ConnectionReadTimeout, + 10 => ErrorCode::ConnectionWriteTimeout, + 11 => ErrorCode::ConnectionLimitReached, + 12 => ErrorCode::TlsProtocolError, + 13 => ErrorCode::TlsCertificateError, + 14 => { + let 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.add(17).cast::(), + ); + + 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, + ); + + _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.add(16).cast::()); + + match l15 { + 0 => None, + 1 => { + let e = { + let l16 = *ptr0.add(24).cast::(); + + l16 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestBodySize(e64) + } + 18 => ErrorCode::HttpRequestMethodInvalid, + 19 => ErrorCode::HttpRequestUriInvalid, + 20 => ErrorCode::HttpRequestUriTooLong, + 21 => { + let e64 = { + let l17 = i32::from(*ptr0.add(16).cast::()); + + match l17 { + 0 => None, + 1 => { + let e = { + let l18 = *ptr0.add(20).cast::(); + + l18 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSectionSize(e64) + } + 22 => { + let e64 = { + let l19 = i32::from(*ptr0.add(16).cast::()); + + match l19 { + 0 => None, + 1 => { + let e = { + let l20 = + i32::from(*ptr0.add(20).cast::()); + let l24 = + i32::from(*ptr0.add(32).cast::()); + + FieldSizePayload { + field_name: match l20 { + 0 => None, + 1 => { + let e = { + 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); + + _rt::string_lift(bytes23) + }; + Some(e) + } + _ => { + _rt::invalid_enum_discriminant() + } + }, + field_size: match l24 { + 0 => None, + 1 => { + let e = { + let l25 = *ptr0 + .add(36) + .cast::(); + + l25 as u32 + }; + Some(e) + } + _ => { + _rt::invalid_enum_discriminant() + } + }, + } + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestHeaderSize(e64) + } + 23 => { + let e64 = { + let l26 = i32::from(*ptr0.add(16).cast::()); + + match l26 { + 0 => None, + 1 => { + let e = { + let l27 = *ptr0.add(20).cast::(); + + l27 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpRequestTrailerSectionSize(e64) + } + 24 => { + 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.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, + ); + + _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) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpRequestTrailerSize(e64) + } + 25 => ErrorCode::HttpResponseIncomplete, + 26 => { + let e64 = { + let l34 = i32::from(*ptr0.add(16).cast::()); + + match l34 { + 0 => None, + 1 => { + let e = { + let l35 = *ptr0.add(20).cast::(); + + l35 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseHeaderSectionSize(e64) + } + 27 => { + 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.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, + ); + + _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) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseHeaderSize(e64) + } + 28 => { + let e64 = { + let l42 = i32::from(*ptr0.add(16).cast::()); + + match l42 { + 0 => None, + 1 => { + let e = { + let l43 = *ptr0.add(24).cast::(); + + l43 as u64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseBodySize(e64) + } + 29 => { + let e64 = { + let l44 = i32::from(*ptr0.add(16).cast::()); + + match l44 { + 0 => None, + 1 => { + let e = { + let l45 = *ptr0.add(20).cast::(); + + l45 as u32 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTrailerSectionSize(e64) + } + 30 => { + 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.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, + ); + + _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) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + ErrorCode::HttpResponseTrailerSize(e64) + } + 31 => { + let e64 = { + let l52 = i32::from(*ptr0.add(16).cast::()); + + match l52 { + 0 => None, + 1 => { + let e = { + let l53 = *ptr0.add(20).cast::<*mut u8>(); + let l54 = *ptr0.add(24).cast::(); + let len55 = l54; + let bytes55 = _rt::Vec::from_raw_parts( + l53.cast(), + len55, + len55, + ); + + _rt::string_lift(bytes55) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseTransferCoding(e64) + } + 32 => { + let e64 = { + let l56 = i32::from(*ptr0.add(16).cast::()); + + match l56 { + 0 => None, + 1 => { + let e = { + let l57 = *ptr0.add(20).cast::<*mut u8>(); + let l58 = *ptr0.add(24).cast::(); + let len59 = l58; + let bytes59 = _rt::Vec::from_raw_parts( + l57.cast(), + len59, + len59, + ); + + _rt::string_lift(bytes59) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::HttpResponseContentCoding(e64) + } + 33 => ErrorCode::HttpResponseTimeout, + 34 => ErrorCode::HttpUpgradeFailed, + 35 => ErrorCode::HttpProtocolError, + 36 => ErrorCode::LoopDetected, + 37 => ErrorCode::ConfigurationError, + n => { + debug_assert_eq!(n, 38, "invalid enum discriminant"); + let e64 = { + let l60 = i32::from(*ptr0.add(16).cast::()); + + match l60 { + 0 => None, + 1 => { + let e = { + let l61 = *ptr0.add(20).cast::<*mut u8>(); + let l62 = *ptr0.add(24).cast::(); + let len63 = l62; + let bytes63 = _rt::Vec::from_raw_parts( + l61.cast(), + len63, + len63, + ); + + _rt::string_lift(bytes63) + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + }; + ErrorCode::InternalError(e64) + } + }; + + v64 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + } + #[allow(dead_code)] + pub mod io0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod error { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + + #[derive(Debug)] + #[repr(transparent)] + pub struct Error { + handle: _rt::Resource, + } + + impl Error { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for Error { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:io/error@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]error"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + impl Error { + #[allow(unused_unsafe, clippy::all)] + pub fn to_debug_string(&self) -> _rt::String { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = *ptr0.add(0).cast::<*mut u8>(); + let l2 = *ptr0.add(4).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + _rt::string_lift(bytes3) + } + } + } + } + + #[allow(dead_code, clippy::all)] + pub mod poll { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + + #[derive(Debug)] + #[repr(transparent)] + pub struct Pollable { + handle: _rt::Resource, + } + + impl Pollable { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for Pollable { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]pollable"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + impl Pollable { + #[allow(unused_unsafe, clippy::all)] + pub fn ready(&self) -> bool { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + extern "C" { + #[link_name = "[method]pollable.ready"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + _rt::bool_lift(ret as u8) + } + } + } + impl Pollable { + #[allow(unused_unsafe, clippy::all)] + pub fn block(&self) { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:io/poll@0.2.0")] + extern "C" { + #[link_name = "[method]pollable.block"] + fn wit_import(_: i32); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) { + unreachable!() + } + wit_import((self).handle() as i32); + } + } + } + #[allow(unused_unsafe, clippy::all)] + pub fn poll(in_: &[&Pollable]) -> _rt::Vec { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 8]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 8]); + let vec0 = in_; + let len0 = vec0.len(); + let layout0 = _rt::alloc::Layout::from_size_align_unchecked(vec0.len() * 4, 4); + let result0 = if layout0.size() != 0 { + let ptr = _rt::alloc::alloc(layout0).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout0); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec0.into_iter().enumerate() { + let base = result0.add(i * 4); + { + *base.add(0).cast::() = (e).handle() 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(_: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import(result0, len0, ptr1); + let l2 = *ptr1.add(0).cast::<*mut u8>(); + let l3 = *ptr1.add(4).cast::(); + let len4 = l3; + if layout0.size() != 0 { + _rt::alloc::dealloc(result0.cast(), layout0); + } + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + } + } + } + + #[allow(dead_code, clippy::all)] + pub mod streams { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + pub type Error = super::super::super::wasi::io0_2_0::error::Error; + pub type Pollable = super::super::super::wasi::io0_2_0::poll::Pollable; + pub enum StreamError { + LastOperationFailed(Error), + Closed, + } + impl ::core::fmt::Debug for StreamError { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + StreamError::LastOperationFailed(e) => f + .debug_tuple("StreamError::LastOperationFailed") + .field(e) + .finish(), + StreamError::Closed => f.debug_tuple("StreamError::Closed").finish(), + } + } + } + impl ::core::fmt::Display for StreamError { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for StreamError {} + + #[derive(Debug)] + #[repr(transparent)] + pub struct InputStream { + handle: _rt::Resource, + } + + impl InputStream { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for InputStream { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]input-stream"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct OutputStream { + handle: _rt::Resource, + } + + impl OutputStream { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for OutputStream { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]output-stream"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + impl InputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn read(&self, len: u64) -> Result<_rt::Vec, StreamError> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = i32::from(*ptr0.add(4).cast::()); + let v7 = match l5 { + 0 => { + let e7 = { + let l6 = *ptr0.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l6 as u32) + }; + StreamError::LastOperationFailed(e7) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v7 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl InputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn blocking_read(&self, len: u64) -> Result<_rt::Vec, StreamError> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(4).cast::<*mut u8>(); + let l3 = *ptr0.add(8).cast::(); + let len4 = l3; + + _rt::Vec::from_raw_parts(l2.cast(), len4, len4) + }; + Ok(e) + } + 1 => { + let e = { + let l5 = i32::from(*ptr0.add(4).cast::()); + let v7 = match l5 { + 0 => { + let e7 = { + let l6 = *ptr0.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l6 as u32) + }; + StreamError::LastOperationFailed(e7) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v7 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl InputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn skip(&self, len: u64) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(8).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr0.add(12).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl InputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn blocking_skip(&self, len: u64) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(8).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr0.add(12).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl InputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn subscribe(&self) -> Pollable { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + extern "C" { + #[link_name = "[method]input-stream.subscribe"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn check_write(&self) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let ptr0 = ret_area.0.as_mut_ptr().cast::(); + #[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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(8).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr0.add(12).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn write(&self, contents: &[u8]) -> Result<(), StreamError> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let vec0 = contents; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + extern "C" { + #[link_name = "[method]output-stream.write"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(4).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr1.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn blocking_write_and_flush(&self, contents: &[u8]) -> Result<(), StreamError> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let vec0 = contents; + let ptr0 = vec0.as_ptr().cast::(); + let len0 = vec0.len(); + let ptr1 = ret_area.0.as_mut_ptr().cast::(); + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + extern "C" { + #[link_name = "[method]output-stream.blocking-write-and-flush"] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8, _: usize, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0.cast_mut(), len0, ptr1); + let l2 = i32::from(*ptr1.add(0).cast::()); + match l2 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr1.add(4).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr1.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn flush(&self) -> Result<(), StreamError> { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(4).cast::()); + let v4 = match l2 { + 0 => { + let e4 = { + let l3 = *ptr0.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + }; + StreamError::LastOperationFailed(e4) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v4 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn blocking_flush(&self) -> Result<(), StreamError> { + unsafe { + #[repr(align(4))] + 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(4).cast::()); + let v4 = match l2 { + 0 => { + let e4 = { + let l3 = *ptr0.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + }; + StreamError::LastOperationFailed(e4) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v4 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn subscribe(&self) -> Pollable { + unsafe { + #[cfg(target_arch = "wasm32")] + #[link(wasm_import_module = "wasi:io/streams@0.2.0")] + extern "C" { + #[link_name = "[method]output-stream.subscribe"] + fn wit_import(_: i32) -> i32; + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32) -> i32 { + unreachable!() + } + let ret = wit_import((self).handle() as i32); + super::super::super::wasi::io0_2_0::poll::Pollable::from_handle(ret as u32) + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn write_zeroes(&self, len: u64) -> Result<(), StreamError> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(4).cast::()); + let v4 = match l2 { + 0 => { + let e4 = { + let l3 = *ptr0.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + }; + StreamError::LastOperationFailed(e4) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v4 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn blocking_write_zeroes_and_flush(&self, len: u64) -> Result<(), StreamError> { + unsafe { + #[repr(align(4))] + struct RetArea([::core::mem::MaybeUninit; 12]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 12]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import((self).handle() as i32, _rt::as_i64(&len), ptr0); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = (); + Ok(e) + } + 1 => { + let e = { + let l2 = i32::from(*ptr0.add(4).cast::()); + let v4 = match l2 { + 0 => { + let e4 = { + let l3 = *ptr0.add(8).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l3 as u32) + }; + StreamError::LastOperationFailed(e4) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v4 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn splice(&self, src: &InputStream, len: u64) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + (src).handle() as i32, + _rt::as_i64(&len), + ptr0, + ); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(8).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr0.add(12).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + impl OutputStream { + #[allow(unused_unsafe, clippy::all)] + pub fn blocking_splice( + &self, + src: &InputStream, + len: u64, + ) -> Result { + unsafe { + #[repr(align(8))] + struct RetArea([::core::mem::MaybeUninit; 16]); + let mut ret_area = RetArea([::core::mem::MaybeUninit::uninit(); 16]); + let 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, _: *mut u8); + } + + #[cfg(not(target_arch = "wasm32"))] + fn wit_import(_: i32, _: i32, _: i64, _: *mut u8) { + unreachable!() + } + wit_import( + (self).handle() as i32, + (src).handle() as i32, + _rt::as_i64(&len), + ptr0, + ); + let l1 = i32::from(*ptr0.add(0).cast::()); + match l1 { + 0 => { + let e = { + let l2 = *ptr0.add(8).cast::(); + + l2 as u64 + }; + Ok(e) + } + 1 => { + let e = { + let l3 = i32::from(*ptr0.add(8).cast::()); + let v5 = match l3 { + 0 => { + let e5 = { + let l4 = *ptr0.add(12).cast::(); + + super::super::super::wasi::io0_2_0::error::Error::from_handle(l4 as u32) + }; + StreamError::LastOperationFailed(e5) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + StreamError::Closed + } + }; + + v5 + }; + Err(e) + } + _ => _rt::invalid_enum_discriminant(), + } + } + } + } + } + } + #[allow(dead_code)] + pub mod sockets0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod network { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::__link_custom_section_describing_imports; + use super::super::super::_rt; + + #[derive(Debug)] + #[repr(transparent)] + pub struct Network { + handle: _rt::Resource, + } + + impl Network { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + } + + unsafe impl _rt::WasmResource for Network { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "wasi:sockets/network@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]network"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum ErrorCode { + Unknown, + AccessDenied, + NotSupported, + InvalidArgument, + OutOfMemory, + Timeout, + ConcurrencyConflict, + NotInProgress, + WouldBlock, + InvalidState, + NewSocketLimit, + AddressNotBindable, + AddressInUse, + RemoteUnreachable, + ConnectionRefused, + ConnectionReset, + ConnectionAborted, + DatagramTooLarge, + NameUnresolvable, + TemporaryResolverFailure, + PermanentResolverFailure, + } + impl ErrorCode { + pub fn name(&self) -> &'static str { + match self { + ErrorCode::Unknown => "unknown", + ErrorCode::AccessDenied => "access-denied", + ErrorCode::NotSupported => "not-supported", + ErrorCode::InvalidArgument => "invalid-argument", + ErrorCode::OutOfMemory => "out-of-memory", + ErrorCode::Timeout => "timeout", + ErrorCode::ConcurrencyConflict => "concurrency-conflict", + ErrorCode::NotInProgress => "not-in-progress", + ErrorCode::WouldBlock => "would-block", + ErrorCode::InvalidState => "invalid-state", + ErrorCode::NewSocketLimit => "new-socket-limit", + ErrorCode::AddressNotBindable => "address-not-bindable", + ErrorCode::AddressInUse => "address-in-use", + ErrorCode::RemoteUnreachable => "remote-unreachable", + ErrorCode::ConnectionRefused => "connection-refused", + ErrorCode::ConnectionReset => "connection-reset", + ErrorCode::ConnectionAborted => "connection-aborted", + ErrorCode::DatagramTooLarge => "datagram-too-large", + ErrorCode::NameUnresolvable => "name-unresolvable", + ErrorCode::TemporaryResolverFailure => "temporary-resolver-failure", + ErrorCode::PermanentResolverFailure => "permanent-resolver-failure", + } + } + pub fn message(&self) -> &'static str { + match self { + ErrorCode::Unknown => "", + ErrorCode::AccessDenied => "", + ErrorCode::NotSupported => "", + ErrorCode::InvalidArgument => "", + ErrorCode::OutOfMemory => "", + ErrorCode::Timeout => "", + ErrorCode::ConcurrencyConflict => "", + ErrorCode::NotInProgress => "", + ErrorCode::WouldBlock => "", + ErrorCode::InvalidState => "", + ErrorCode::NewSocketLimit => "", + ErrorCode::AddressNotBindable => "", + ErrorCode::AddressInUse => "", + ErrorCode::RemoteUnreachable => "", + ErrorCode::ConnectionRefused => "", + ErrorCode::ConnectionReset => "", + ErrorCode::ConnectionAborted => "", + ErrorCode::DatagramTooLarge => "", + ErrorCode::NameUnresolvable => "", + ErrorCode::TemporaryResolverFailure => "", + ErrorCode::PermanentResolverFailure => "", + } + } + } + impl ::core::fmt::Debug for ErrorCode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("ErrorCode") + .field("code", &(*self as i32)) + .field("name", &self.name()) + .field("message", &self.message()) + .finish() + } + } + impl ::core::fmt::Display for ErrorCode { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{} (error {})", self.name(), *self as i32) + } + } + + impl std::error::Error for ErrorCode {} + + impl ErrorCode { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> ErrorCode { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => ErrorCode::Unknown, + 1 => ErrorCode::AccessDenied, + 2 => ErrorCode::NotSupported, + 3 => ErrorCode::InvalidArgument, + 4 => ErrorCode::OutOfMemory, + 5 => ErrorCode::Timeout, + 6 => ErrorCode::ConcurrencyConflict, + 7 => ErrorCode::NotInProgress, + 8 => ErrorCode::WouldBlock, + 9 => ErrorCode::InvalidState, + 10 => ErrorCode::NewSocketLimit, + 11 => ErrorCode::AddressNotBindable, + 12 => ErrorCode::AddressInUse, + 13 => ErrorCode::RemoteUnreachable, + 14 => ErrorCode::ConnectionRefused, + 15 => ErrorCode::ConnectionReset, + 16 => ErrorCode::ConnectionAborted, + 17 => ErrorCode::DatagramTooLarge, + 18 => ErrorCode::NameUnresolvable, + 19 => ErrorCode::TemporaryResolverFailure, + 20 => ErrorCode::PermanentResolverFailure, + + _ => panic!("invalid enum discriminant"), + } + } + } + + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum IpAddressFamily { + Ipv4, + Ipv6, + } + impl ::core::fmt::Debug for IpAddressFamily { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + IpAddressFamily::Ipv4 => f.debug_tuple("IpAddressFamily::Ipv4").finish(), + IpAddressFamily::Ipv6 => f.debug_tuple("IpAddressFamily::Ipv6").finish(), + } + } + } + + impl IpAddressFamily { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> IpAddressFamily { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => IpAddressFamily::Ipv4, + 1 => IpAddressFamily::Ipv6, + + _ => panic!("invalid enum discriminant"), + } + } + } + + pub type Ipv4Address = (u8, u8, u8, u8); + pub type Ipv6Address = (u16, u16, u16, u16, u16, u16, u16, u16); + #[derive(Clone, Copy)] + pub enum IpAddress { + Ipv4(Ipv4Address), + Ipv6(Ipv6Address), + } + impl ::core::fmt::Debug for IpAddress { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + IpAddress::Ipv4(e) => f.debug_tuple("IpAddress::Ipv4").field(e).finish(), + IpAddress::Ipv6(e) => f.debug_tuple("IpAddress::Ipv6").field(e).finish(), + } + } + } + #[repr(C)] + #[derive(Clone, Copy)] + pub struct Ipv4SocketAddress { + pub port: u16, + pub address: Ipv4Address, + } + impl ::core::fmt::Debug for Ipv4SocketAddress { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Ipv4SocketAddress") + .field("port", &self.port) + .field("address", &self.address) + .finish() + } + } + #[repr(C)] + #[derive(Clone, Copy)] + pub struct Ipv6SocketAddress { + pub port: u16, + pub flow_info: u32, + pub address: Ipv6Address, + pub scope_id: u32, + } + impl ::core::fmt::Debug for Ipv6SocketAddress { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Ipv6SocketAddress") + .field("port", &self.port) + .field("flow-info", &self.flow_info) + .field("address", &self.address) + .field("scope-id", &self.scope_id) + .finish() + } + } + #[derive(Clone, Copy)] + pub enum IpSocketAddress { + Ipv4(Ipv4SocketAddress), + Ipv6(Ipv6SocketAddress), + } + impl ::core::fmt::Debug for IpSocketAddress { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + IpSocketAddress::Ipv4(e) => { + f.debug_tuple("IpSocketAddress::Ipv4").field(e).finish() + } + IpSocketAddress::Ipv6(e) => { + f.debug_tuple("IpSocketAddress::Ipv6").field(e).finish() + } + } + } + } + } + } +} +#[allow(dead_code)] +pub mod exports { + #[allow(dead_code)] + pub mod fermyon { + #[allow(dead_code)] + pub mod spin { + #[allow(dead_code, clippy::all)] + pub mod llm { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// A Large Language Model. + pub type InferencingModel = _rt::String; + /// Inference request parameters + #[repr(C)] + #[derive(Clone, Copy)] + pub struct InferencingParams { + /// The maximum tokens that should be inferred. + /// + /// Note: the backing implementation may return less tokens. + pub max_tokens: u32, + /// The amount the model should avoid repeating tokens. + pub repeat_penalty: f32, + /// The number of tokens the model should apply the repeat penalty to. + pub repeat_penalty_last_n_token_count: u32, + /// The randomness with which the next token is selected. + pub temperature: f32, + /// The number of possible next tokens the model will choose from. + pub top_k: u32, + /// The probability total of next tokens the model will choose from. + pub top_p: f32, + } + impl ::core::fmt::Debug for InferencingParams { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("InferencingParams") + .field("max-tokens", &self.max_tokens) + .field("repeat-penalty", &self.repeat_penalty) + .field( + "repeat-penalty-last-n-token-count", + &self.repeat_penalty_last_n_token_count, + ) + .field("temperature", &self.temperature) + .field("top-k", &self.top_k) + .field("top-p", &self.top_p) + .finish() + } + } + /// The set of errors which may be raised by functions in this interface + #[derive(Clone)] + pub enum Error { + ModelNotSupported, + RuntimeError(_rt::String), + InvalidInput(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::ModelNotSupported => { + f.debug_tuple("Error::ModelNotSupported").finish() + } + Error::RuntimeError(e) => { + f.debug_tuple("Error::RuntimeError").field(e).finish() + } + Error::InvalidInput(e) => { + f.debug_tuple("Error::InvalidInput").field(e).finish() + } + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + /// Usage information related to the inferencing result + #[repr(C)] + #[derive(Clone, Copy)] + pub struct InferencingUsage { + /// Number of tokens in the prompt + pub prompt_token_count: u32, + /// Number of tokens generated by the inferencing operation + pub generated_token_count: u32, + } + impl ::core::fmt::Debug for InferencingUsage { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("InferencingUsage") + .field("prompt-token-count", &self.prompt_token_count) + .field("generated-token-count", &self.generated_token_count) + .finish() + } + } + /// An inferencing result + #[derive(Clone)] + pub struct InferencingResult { + /// The text generated by the model + /// TODO: this should be a stream + pub text: _rt::String, + /// Usage information about the inferencing request + pub usage: InferencingUsage, + } + impl ::core::fmt::Debug for InferencingResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("InferencingResult") + .field("text", &self.text) + .field("usage", &self.usage) + .finish() + } + } + /// The model used for generating embeddings + pub type EmbeddingModel = _rt::String; + /// Usage related to an embeddings generation request + #[repr(C)] + #[derive(Clone, Copy)] + pub struct EmbeddingsUsage { + /// Number of tokens in the prompt + pub prompt_token_count: u32, + } + impl ::core::fmt::Debug for EmbeddingsUsage { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("EmbeddingsUsage") + .field("prompt-token-count", &self.prompt_token_count) + .finish() + } + } + /// Result of generating embeddings + #[derive(Clone)] + pub struct EmbeddingsResult { + /// The embeddings generated by the request + pub embeddings: _rt::Vec<_rt::Vec>, + /// Usage related to the embeddings generation request + pub usage: EmbeddingsUsage, + } + impl ::core::fmt::Debug for EmbeddingsResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("EmbeddingsResult") + .field("embeddings", &self.embeddings) + .field("usage", &self.usage) + .finish() + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_infer_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, + arg4: i32, + arg5: i32, + arg6: f32, + arg7: i32, + arg8: f32, + arg9: i32, + arg10: f32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let len1 = arg3; + let bytes1 = _rt::Vec::from_raw_parts(arg2.cast(), len1, len1); + let result2 = T::infer( + _rt::string_lift(bytes0), + _rt::string_lift(bytes1), + match arg4 { + 0 => None, + 1 => { + let e = InferencingParams { + max_tokens: arg5 as u32, + repeat_penalty: arg6, + repeat_penalty_last_n_token_count: arg7 as u32, + temperature: arg8, + top_k: arg9 as u32, + top_p: arg10, + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(e) => { + *ptr3.add(0).cast::() = (0i32) as u8; + let InferencingResult { + text: text4, + usage: usage4, + } = e; + let vec5 = (text4.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr3.add(8).cast::() = len5; + *ptr3.add(4).cast::<*mut u8>() = ptr5.cast_mut(); + let InferencingUsage { + prompt_token_count: prompt_token_count6, + generated_token_count: generated_token_count6, + } = usage4; + *ptr3.add(12).cast::() = _rt::as_i32(prompt_token_count6); + *ptr3.add(16).cast::() = _rt::as_i32(generated_token_count6); + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + match e { + Error::ModelNotSupported => { + *ptr3.add(4).cast::() = (0i32) as u8; + } + Error::RuntimeError(e) => { + *ptr3.add(4).cast::() = (1i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr3.add(12).cast::() = len7; + *ptr3.add(8).cast::<*mut u8>() = ptr7.cast_mut(); + } + Error::InvalidInput(e) => { + *ptr3.add(4).cast::() = (2i32) as u8; + let vec8 = (e.into_bytes()).into_boxed_slice(); + let ptr8 = vec8.as_ptr().cast::(); + let len8 = vec8.len(); + ::core::mem::forget(vec8); + *ptr3.add(12).cast::() = len8; + *ptr3.add(8).cast::<*mut u8>() = ptr8.cast_mut(); + } + } + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_infer(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + _ => { + let l3 = i32::from(*arg0.add(4).cast::()); + match l3 { + 0 => (), + 1 => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + _ => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_generate_embeddings_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let base4 = arg2; + let len4 = arg3; + let mut result4 = _rt::Vec::with_capacity(len4); + for i in 0..len4 { + let base = base4.add(i * 8); + let e4 = { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + + _rt::string_lift(bytes3) + }; + result4.push(e4); + } + _rt::cabi_dealloc(base4, len4 * 8, 4); + let result5 = T::generate_embeddings(_rt::string_lift(bytes0), result4); + let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); + match result5 { + Ok(e) => { + *ptr6.add(0).cast::() = (0i32) as u8; + let EmbeddingsResult { + embeddings: embeddings7, + usage: usage7, + } = e; + let vec9 = embeddings7; + let len9 = vec9.len(); + let layout9 = + _rt::alloc::Layout::from_size_align_unchecked(vec9.len() * 8, 4); + let result9 = if layout9.size() != 0 { + let ptr = _rt::alloc::alloc(layout9).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout9); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec9.into_iter().enumerate() { + let base = result9.add(i * 8); + { + let vec8 = (e).into_boxed_slice(); + let ptr8 = vec8.as_ptr().cast::(); + let len8 = vec8.len(); + ::core::mem::forget(vec8); + *base.add(4).cast::() = len8; + *base.add(0).cast::<*mut u8>() = ptr8.cast_mut(); + } + } + *ptr6.add(8).cast::() = len9; + *ptr6.add(4).cast::<*mut u8>() = result9; + let EmbeddingsUsage { + prompt_token_count: prompt_token_count10, + } = usage7; + *ptr6.add(12).cast::() = _rt::as_i32(prompt_token_count10); + } + Err(e) => { + *ptr6.add(0).cast::() = (1i32) as u8; + match e { + Error::ModelNotSupported => { + *ptr6.add(4).cast::() = (0i32) as u8; + } + Error::RuntimeError(e) => { + *ptr6.add(4).cast::() = (1i32) as u8; + let vec11 = (e.into_bytes()).into_boxed_slice(); + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + ::core::mem::forget(vec11); + *ptr6.add(12).cast::() = len11; + *ptr6.add(8).cast::<*mut u8>() = ptr11.cast_mut(); + } + Error::InvalidInput(e) => { + *ptr6.add(4).cast::() = (2i32) as u8; + let vec12 = (e.into_bytes()).into_boxed_slice(); + let ptr12 = vec12.as_ptr().cast::(); + let len12 = vec12.len(); + ::core::mem::forget(vec12); + *ptr6.add(12).cast::() = len12; + *ptr6.add(8).cast::<*mut u8>() = ptr12.cast_mut(); + } + } + } + }; + ptr6 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_generate_embeddings(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l4 = *arg0.add(4).cast::<*mut u8>(); + let l5 = *arg0.add(8).cast::(); + let base6 = l4; + let len6 = l5; + for i in 0..len6 { + let base = base6.add(i * 8); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + let base3 = l1; + let len3 = l2; + _rt::cabi_dealloc(base3, len3 * 4, 4); + } + } + _rt::cabi_dealloc(base6, len6 * 8, 4); + } + _ => { + let l7 = i32::from(*arg0.add(4).cast::()); + match l7 { + 0 => (), + 1 => { + let l8 = *arg0.add(8).cast::<*mut u8>(); + let l9 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l8, l9, 1); + } + _ => { + let l10 = *arg0.add(8).cast::<*mut u8>(); + let l11 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + pub trait Guest { + /// Perform inferencing using the provided model and prompt with the given optional params + fn infer( + model: InferencingModel, + prompt: _rt::String, + params: Option, + ) -> Result; + /// Generate embeddings for the supplied list of text + fn generate_embeddings( + model: EmbeddingModel, + text: _rt::Vec<_rt::String>, + ) -> Result; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_llm_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/llm@2.0.0#infer"] + unsafe extern "C" fn export_infer(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,arg4: i32,arg5: i32,arg6: f32,arg7: i32,arg8: f32,arg9: i32,arg10: f32,) -> *mut u8 { + $($path_to_types)*::_export_infer_cabi::<$ty>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) + } + #[export_name = "cabi_post_fermyon:spin/llm@2.0.0#infer"] + unsafe extern "C" fn _post_return_infer(arg0: *mut u8,) { + $($path_to_types)*::__post_return_infer::<$ty>(arg0) + } + #[export_name = "fermyon:spin/llm@2.0.0#generate-embeddings"] + unsafe extern "C" fn export_generate_embeddings(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,) -> *mut u8 { + $($path_to_types)*::_export_generate_embeddings_cabi::<$ty>(arg0, arg1, arg2, arg3) + } + #[export_name = "cabi_post_fermyon:spin/llm@2.0.0#generate-embeddings"] + unsafe extern "C" fn _post_return_generate_embeddings(arg0: *mut u8,) { + $($path_to_types)*::__post_return_generate_embeddings::<$ty>(arg0) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_llm_2_0_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 20]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); + } + + #[allow(dead_code, clippy::all)] + pub mod redis { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// Errors related to interacting with Redis + #[derive(Clone)] + pub enum Error { + /// An invalid address string + InvalidAddress, + /// There are too many open connections + TooManyConnections, + /// A retrieved value was not of the correct type + TypeError, + /// Some other error occurred + Other(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::InvalidAddress => { + f.debug_tuple("Error::InvalidAddress").finish() + } + Error::TooManyConnections => { + f.debug_tuple("Error::TooManyConnections").finish() + } + Error::TypeError => f.debug_tuple("Error::TypeError").finish(), + Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + + #[derive(Debug)] + #[repr(transparent)] + pub struct Connection { + handle: _rt::Resource, + } + + type _ConnectionRep = Option; + + impl Connection { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `Connection`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _ConnectionRep = Some(val); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestConnection` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); + } + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`Connection`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct ConnectionBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a Connection>, + } + + impl<'a> ConnectionBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for Connection { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/redis@2.0.0")] + extern "C" { + #[link_name = "[resource-drop]connection"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + /// The message payload. + pub type Payload = _rt::Vec; + /// A parameter type for the general-purpose `execute` function. + #[derive(Clone)] + pub enum RedisParameter { + Int64(i64), + Binary(Payload), + } + impl ::core::fmt::Debug for RedisParameter { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + RedisParameter::Int64(e) => { + f.debug_tuple("RedisParameter::Int64").field(e).finish() + } + RedisParameter::Binary(e) => { + f.debug_tuple("RedisParameter::Binary").field(e).finish() + } + } + } + } + /// A return type for the general-purpose `execute` function. + #[derive(Clone)] + pub enum RedisResult { + Nil, + Status(_rt::String), + Int64(i64), + Binary(Payload), + } + impl ::core::fmt::Debug for RedisResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + RedisResult::Nil => f.debug_tuple("RedisResult::Nil").finish(), + RedisResult::Status(e) => { + f.debug_tuple("RedisResult::Status").field(e).finish() + } + RedisResult::Int64(e) => { + f.debug_tuple("RedisResult::Int64").field(e).finish() + } + RedisResult::Binary(e) => { + f.debug_tuple("RedisResult::Binary").field(e).finish() + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_static_connection_open_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::open(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_static_connection_open( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_publish_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let len1 = arg4; + let result2 = T::publish( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + _rt::Vec::from_raw_parts(arg3.cast(), len1, len1), + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr3.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr3.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr3.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr3.add(4).cast::() = (3i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr3.add(12).cast::() = len4; + *ptr3.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_publish( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_get_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let result1 = T::get( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + match e { + Some(e) => { + *ptr2.add(4).cast::() = (1i32) as u8; + let vec3 = (e).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + None => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + }; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(12).cast::() = len4; + *ptr2.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_get( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + let base4 = l2; + let len4 = l3; + _rt::cabi_dealloc(base4, len4 * 1, 1); + } + } + } + _ => { + let l5 = i32::from(*arg0.add(4).cast::()); + match l5 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_set_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let len1 = arg4; + let result2 = T::set( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + _rt::Vec::from_raw_parts(arg3.cast(), len1, len1), + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr3.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr3.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr3.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr3.add(4).cast::() = (3i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr3.add(12).cast::() = len4; + *ptr3.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_set( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_incr_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let result1 = T::incr( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr2.add(8).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr2.add(8).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr2.add(8).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(8).cast::() = (3i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(16).cast::() = len3; + *ptr2.add(12).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_incr( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(8).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(12).cast::<*mut u8>(); + let l3 = *arg0.add(16).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_del_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let base3 = arg1; + let len3 = arg2; + let mut result3 = _rt::Vec::with_capacity(len3); + for i in 0..len3 { + let base = base3.add(i * 8); + let e3 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); + + _rt::string_lift(bytes2) + }; + result3.push(e3); + } + _rt::cabi_dealloc(base3, len3 * 8, 4); + let result4 = + T::del(ConnectionBorrow::lift(arg0 as u32 as usize).get(), result3); + let ptr5 = _RET_AREA.0.as_mut_ptr().cast::(); + match result4 { + Ok(e) => { + *ptr5.add(0).cast::() = (0i32) as u8; + *ptr5.add(4).cast::() = _rt::as_i32(e); + } + Err(e) => { + *ptr5.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr5.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr5.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr5.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr5.add(4).cast::() = (3i32) as u8; + let vec6 = (e.into_bytes()).into_boxed_slice(); + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + ::core::mem::forget(vec6); + *ptr5.add(12).cast::() = len6; + *ptr5.add(8).cast::<*mut u8>() = ptr6.cast_mut(); + } + } + } + }; + ptr5 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_del( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_sadd_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base4 = arg3; + let len4 = arg4; + let mut result4 = _rt::Vec::with_capacity(len4); + for i in 0..len4 { + let base = base4.add(i * 8); + let e4 = { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + + _rt::string_lift(bytes3) + }; + result4.push(e4); + } + _rt::cabi_dealloc(base4, len4 * 8, 4); + let result5 = T::sadd( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result4, + ); + let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); + match result5 { + Ok(e) => { + *ptr6.add(0).cast::() = (0i32) as u8; + *ptr6.add(4).cast::() = _rt::as_i32(e); + } + Err(e) => { + *ptr6.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr6.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr6.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr6.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr6.add(4).cast::() = (3i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr6.add(12).cast::() = len7; + *ptr6.add(8).cast::<*mut u8>() = ptr7.cast_mut(); + } + } + } + }; + ptr6 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_sadd( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_smembers_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let result1 = T::smembers( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + let vec4 = e; + let len4 = vec4.len(); + let layout4 = + _rt::alloc::Layout::from_size_align_unchecked(vec4.len() * 8, 4); + let result4 = if layout4.size() != 0 { + let ptr = _rt::alloc::alloc(layout4).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout4); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec4.into_iter().enumerate() { + let base = result4.add(i * 8); + { + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *base.add(4).cast::() = len3; + *base.add(0).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + *ptr2.add(8).cast::() = len4; + *ptr2.add(4).cast::<*mut u8>() = result4; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr2.add(12).cast::() = len5; + *ptr2.add(8).cast::<*mut u8>() = ptr5.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_smembers( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + let base5 = l3; + let len5 = l4; + for i in 0..len5 { + let base = base5.add(i * 8); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + _rt::cabi_dealloc(base5, len5 * 8, 4); + } + _ => { + let l6 = i32::from(*arg0.add(4).cast::()); + match l6 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l7 = *arg0.add(8).cast::<*mut u8>(); + let l8 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l7, l8, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_srem_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base4 = arg3; + let len4 = arg4; + let mut result4 = _rt::Vec::with_capacity(len4); + for i in 0..len4 { + let base = base4.add(i * 8); + let e4 = { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + let len3 = l2; + let bytes3 = _rt::Vec::from_raw_parts(l1.cast(), len3, len3); + + _rt::string_lift(bytes3) + }; + result4.push(e4); + } + _rt::cabi_dealloc(base4, len4 * 8, 4); + let result5 = T::srem( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result4, + ); + let ptr6 = _RET_AREA.0.as_mut_ptr().cast::(); + match result5 { + Ok(e) => { + *ptr6.add(0).cast::() = (0i32) as u8; + *ptr6.add(4).cast::() = _rt::as_i32(e); + } + Err(e) => { + *ptr6.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr6.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr6.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr6.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr6.add(4).cast::() = (3i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr6.add(12).cast::() = len7; + *ptr6.add(8).cast::<*mut u8>() = ptr7.cast_mut(); + } + } + } + }; + ptr6 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_srem( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_execute_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base7 = arg3; + let len7 = arg4; + let mut result7 = _rt::Vec::with_capacity(len7); + for i in 0..len7 { + let base = base7.add(i * 16); + let e7 = { + let l1 = i32::from(*base.add(0).cast::()); + let v6 = match l1 { + 0 => { + let e6 = { + let l2 = *base.add(8).cast::(); + + l2 + }; + RedisParameter::Int64(e6) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e6 = { + let l3 = *base.add(8).cast::<*mut u8>(); + let l4 = *base.add(12).cast::(); + let len5 = l4; + + _rt::Vec::from_raw_parts(l3.cast(), len5, len5) + }; + RedisParameter::Binary(e6) + } + }; + + v6 + }; + result7.push(e7); + } + _rt::cabi_dealloc(base7, len7 * 16, 8); + let result8 = T::execute( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result7, + ); + let ptr9 = _RET_AREA.0.as_mut_ptr().cast::(); + match result8 { + Ok(e) => { + *ptr9.add(0).cast::() = (0i32) as u8; + let vec12 = e; + let len12 = vec12.len(); + let layout12 = + _rt::alloc::Layout::from_size_align_unchecked(vec12.len() * 16, 8); + let result12 = if layout12.size() != 0 { + let ptr = _rt::alloc::alloc(layout12).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout12); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec12.into_iter().enumerate() { + let base = result12.add(i * 16); + { + match e { + RedisResult::Nil => { + *base.add(0).cast::() = (0i32) as u8; + } + RedisResult::Status(e) => { + *base.add(0).cast::() = (1i32) as u8; + let vec10 = (e.into_bytes()).into_boxed_slice(); + let ptr10 = vec10.as_ptr().cast::(); + let len10 = vec10.len(); + ::core::mem::forget(vec10); + *base.add(12).cast::() = len10; + *base.add(8).cast::<*mut u8>() = ptr10.cast_mut(); + } + RedisResult::Int64(e) => { + *base.add(0).cast::() = (2i32) as u8; + *base.add(8).cast::() = _rt::as_i64(e); + } + RedisResult::Binary(e) => { + *base.add(0).cast::() = (3i32) as u8; + let vec11 = (e).into_boxed_slice(); + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + ::core::mem::forget(vec11); + *base.add(12).cast::() = len11; + *base.add(8).cast::<*mut u8>() = ptr11.cast_mut(); + } + } + } + } + *ptr9.add(8).cast::() = len12; + *ptr9.add(4).cast::<*mut u8>() = result12; + } + Err(e) => { + *ptr9.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr9.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr9.add(4).cast::() = (1i32) as u8; + } + Error::TypeError => { + *ptr9.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr9.add(4).cast::() = (3i32) as u8; + let vec13 = (e.into_bytes()).into_boxed_slice(); + let ptr13 = vec13.as_ptr().cast::(); + let len13 = vec13.len(); + ::core::mem::forget(vec13); + *ptr9.add(12).cast::() = len13; + *ptr9.add(8).cast::<*mut u8>() = ptr13.cast_mut(); + } + } + } + }; + ptr9 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_execute( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l7 = *arg0.add(4).cast::<*mut u8>(); + let l8 = *arg0.add(8).cast::(); + let base9 = l7; + let len9 = l8; + for i in 0..len9 { + let base = base9.add(i * 16); + { + let l1 = i32::from(*base.add(0).cast::()); + match l1 { + 0 => (), + 1 => { + let l2 = *base.add(8).cast::<*mut u8>(); + let l3 = *base.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + 2 => (), + _ => { + let l4 = *base.add(8).cast::<*mut u8>(); + let l5 = *base.add(12).cast::(); + let base6 = l4; + let len6 = l5; + _rt::cabi_dealloc(base6, len6 * 1, 1); + } + } + } + } + _rt::cabi_dealloc(base9, len9 * 16, 8); + } + _ => { + let l10 = i32::from(*arg0.add(4).cast::()); + match l10 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l11 = *arg0.add(8).cast::<*mut u8>(); + let l12 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l11, l12, 1); + } + } + } + } + } + pub trait Guest { + type Connection: GuestConnection; + } + pub trait GuestConnection: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/redis@2.0.0")] + extern "C" { + #[link_name = "[resource-new]connection"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/redis@2.0.0")] + extern "C" { + #[link_name = "[resource-rep]connection"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + /// Open a connection to the Redis instance at `address`. + fn open(address: _rt::String) -> Result; + /// Publish a Redis message to the specified channel. + fn publish(&self, channel: _rt::String, payload: Payload) -> Result<(), Error>; + /// Get the value of a key. + fn get(&self, key: _rt::String) -> Result, Error>; + /// Set key to value. + /// + /// If key already holds a value, it is overwritten. + fn set(&self, key: _rt::String, value: Payload) -> Result<(), Error>; + /// Increments the number stored at key by one. + /// + /// If the key does not exist, it is set to 0 before performing the operation. + /// An `error::type-error` is returned if the key contains a value of the wrong type + /// or contains a string that can not be represented as integer. + fn incr(&self, key: _rt::String) -> Result; + /// Removes the specified keys. + /// + /// A key is ignored if it does not exist. Returns the number of keys deleted. + fn del(&self, keys: _rt::Vec<_rt::String>) -> Result; + /// Add the specified `values` to the set named `key`, returning the number of newly-added values. + fn sadd( + &self, + key: _rt::String, + values: _rt::Vec<_rt::String>, + ) -> Result; + /// Retrieve the contents of the set named `key`. + fn smembers(&self, key: _rt::String) -> Result<_rt::Vec<_rt::String>, Error>; + /// Remove the specified `values` from the set named `key`, returning the number of newly-removed values. + fn srem( + &self, + key: _rt::String, + values: _rt::Vec<_rt::String>, + ) -> Result; + /// Execute an arbitrary Redis command and receive the result. + fn execute( + &self, + command: _rt::String, + arguments: _rt::Vec, + ) -> Result<_rt::Vec, Error>; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_redis_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/redis@2.0.0#[static]connection.open"] + unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { + $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.publish"] + unsafe extern "C" fn export_method_connection_publish(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_publish_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.publish"] + unsafe extern "C" fn _post_return_method_connection_publish(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_publish::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.get"] + unsafe extern "C" fn export_method_connection_get(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_get_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.get"] + unsafe extern "C" fn _post_return_method_connection_get(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_get::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.set"] + unsafe extern "C" fn export_method_connection_set(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_set_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.set"] + unsafe extern "C" fn _post_return_method_connection_set(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_set::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.incr"] + unsafe extern "C" fn export_method_connection_incr(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_incr_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.incr"] + unsafe extern "C" fn _post_return_method_connection_incr(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_incr::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.del"] + unsafe extern "C" fn export_method_connection_del(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_del_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.del"] + unsafe extern "C" fn _post_return_method_connection_del(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_del::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.sadd"] + unsafe extern "C" fn export_method_connection_sadd(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_sadd_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.sadd"] + unsafe extern "C" fn _post_return_method_connection_sadd(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_sadd::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.smembers"] + unsafe extern "C" fn export_method_connection_smembers(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_smembers_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.smembers"] + unsafe extern "C" fn _post_return_method_connection_smembers(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_smembers::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.srem"] + unsafe extern "C" fn export_method_connection_srem(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_srem_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.srem"] + unsafe extern "C" fn _post_return_method_connection_srem(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_srem::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/redis@2.0.0#[method]connection.execute"] + unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/redis@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "fermyon:spin/redis@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Connection::dtor::< + <$ty as $($path_to_types)*::Guest>::Connection + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_redis_2_0_0_cabi; + #[repr(align(8))] + struct _RetArea([::core::mem::MaybeUninit; 24]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 24]); + } + + #[allow(dead_code, clippy::all)] + pub mod mqtt { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// Errors related to interacting with Mqtt + #[derive(Clone)] + pub enum Error { + /// An invalid address string + InvalidAddress, + /// There are too many open connections + TooManyConnections, + /// Connection failure e.g. address not allowed. + ConnectionFailed(_rt::String), + /// Some other error occurred + Other(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::InvalidAddress => { + f.debug_tuple("Error::InvalidAddress").finish() + } + Error::TooManyConnections => { + f.debug_tuple("Error::TooManyConnections").finish() + } + Error::ConnectionFailed(e) => { + f.debug_tuple("Error::ConnectionFailed").field(e).finish() + } + Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + /// QoS for publishing Mqtt messages + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum Qos { + AtMostOnce, + AtLeastOnce, + ExactlyOnce, + } + impl ::core::fmt::Debug for Qos { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Qos::AtMostOnce => f.debug_tuple("Qos::AtMostOnce").finish(), + Qos::AtLeastOnce => f.debug_tuple("Qos::AtLeastOnce").finish(), + Qos::ExactlyOnce => f.debug_tuple("Qos::ExactlyOnce").finish(), + } + } + } + + impl Qos { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> Qos { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => Qos::AtMostOnce, + 1 => Qos::AtLeastOnce, + 2 => Qos::ExactlyOnce, + + _ => panic!("invalid enum discriminant"), + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct Connection { + handle: _rt::Resource, + } + + type _ConnectionRep = Option; + + impl Connection { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `Connection`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _ConnectionRep = Some(val); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestConnection` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); + } + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`Connection`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct ConnectionBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a Connection>, + } + + impl<'a> ConnectionBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for Connection { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0")] + extern "C" { + #[link_name = "[resource-drop]connection"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + /// The message payload. + pub type Payload = _rt::Vec; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_static_connection_open_cabi( + arg0: *mut u8, + arg1: usize, + arg2: *mut u8, + arg3: usize, + arg4: *mut u8, + arg5: usize, + arg6: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let len1 = arg3; + let bytes1 = _rt::Vec::from_raw_parts(arg2.cast(), len1, len1); + let len2 = arg5; + let bytes2 = _rt::Vec::from_raw_parts(arg4.cast(), len2, len2); + let result3 = T::open( + _rt::string_lift(bytes0), + _rt::string_lift(bytes1), + _rt::string_lift(bytes2), + arg6 as u64, + ); + let ptr4 = _RET_AREA.0.as_mut_ptr().cast::(); + match result3 { + Ok(e) => { + *ptr4.add(0).cast::() = (0i32) as u8; + *ptr4.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr4.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr4.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr4.add(4).cast::() = (1i32) as u8; + } + Error::ConnectionFailed(e) => { + *ptr4.add(4).cast::() = (2i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr4.add(12).cast::() = len5; + *ptr4.add(8).cast::<*mut u8>() = ptr5.cast_mut(); + } + Error::Other(e) => { + *ptr4.add(4).cast::() = (3i32) as u8; + let vec6 = (e.into_bytes()).into_boxed_slice(); + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + ::core::mem::forget(vec6); + *ptr4.add(12).cast::() = len6; + *ptr4.add(8).cast::<*mut u8>() = ptr6.cast_mut(); + } + } + } + }; + ptr4 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_static_connection_open( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + _ => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_publish_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + arg5: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let len1 = arg4; + let result2 = T::publish( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + _rt::Vec::from_raw_parts(arg3.cast(), len1, len1), + Qos::_lift(arg5 as u8), + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidAddress => { + *ptr3.add(4).cast::() = (0i32) as u8; + } + Error::TooManyConnections => { + *ptr3.add(4).cast::() = (1i32) as u8; + } + Error::ConnectionFailed(e) => { + *ptr3.add(4).cast::() = (2i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr3.add(12).cast::() = len4; + *ptr3.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + Error::Other(e) => { + *ptr3.add(4).cast::() = (3i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr3.add(12).cast::() = len5; + *ptr3.add(8).cast::<*mut u8>() = ptr5.cast_mut(); + } + } + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_publish( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + _ => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + } + } + } + } + pub trait Guest { + type Connection: GuestConnection; + } + pub trait GuestConnection: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0")] + extern "C" { + #[link_name = "[resource-new]connection"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/mqtt@2.0.0")] + extern "C" { + #[link_name = "[resource-rep]connection"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + /// Open a connection to the Mqtt instance at `address`. + fn open( + address: _rt::String, + username: _rt::String, + password: _rt::String, + keep_alive_interval_in_secs: u64, + ) -> Result; + /// Publish an Mqtt message to the specified `topic`. + fn publish( + &self, + topic: _rt::String, + payload: Payload, + qos: Qos, + ) -> Result<(), Error>; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_mqtt_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/mqtt@2.0.0#[static]connection.open"] + unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,arg2: *mut u8,arg3: usize,arg4: *mut u8,arg5: usize,arg6: i64,) -> *mut u8 { + $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4, arg5, arg6) + } + #[export_name = "cabi_post_fermyon:spin/mqtt@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { + $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/mqtt@2.0.0#[method]connection.publish"] + unsafe extern "C" fn export_method_connection_publish(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,arg5: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_publish_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4, arg5) + } + #[export_name = "cabi_post_fermyon:spin/mqtt@2.0.0#[method]connection.publish"] + unsafe extern "C" fn _post_return_method_connection_publish(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_publish::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "fermyon:spin/mqtt@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Connection::dtor::< + <$ty as $($path_to_types)*::Guest>::Connection + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_mqtt_2_0_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 16]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + } + + #[allow(dead_code, clippy::all)] + pub mod rdbms_types { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// Errors related to interacting with a database. + #[derive(Clone)] + pub enum Error { + ConnectionFailed(_rt::String), + BadParameter(_rt::String), + QueryFailed(_rt::String), + ValueConversionFailed(_rt::String), + Other(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::ConnectionFailed(e) => { + f.debug_tuple("Error::ConnectionFailed").field(e).finish() + } + Error::BadParameter(e) => { + f.debug_tuple("Error::BadParameter").field(e).finish() + } + Error::QueryFailed(e) => { + f.debug_tuple("Error::QueryFailed").field(e).finish() + } + Error::ValueConversionFailed(e) => f + .debug_tuple("Error::ValueConversionFailed") + .field(e) + .finish(), + Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + /// Data types for a database column + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum DbDataType { + Boolean, + Int8, + Int16, + Int32, + Int64, + Uint8, + Uint16, + Uint32, + Uint64, + Floating32, + Floating64, + Str, + Binary, + Other, + } + impl ::core::fmt::Debug for DbDataType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + DbDataType::Boolean => f.debug_tuple("DbDataType::Boolean").finish(), + DbDataType::Int8 => f.debug_tuple("DbDataType::Int8").finish(), + DbDataType::Int16 => f.debug_tuple("DbDataType::Int16").finish(), + DbDataType::Int32 => f.debug_tuple("DbDataType::Int32").finish(), + DbDataType::Int64 => f.debug_tuple("DbDataType::Int64").finish(), + DbDataType::Uint8 => f.debug_tuple("DbDataType::Uint8").finish(), + DbDataType::Uint16 => f.debug_tuple("DbDataType::Uint16").finish(), + DbDataType::Uint32 => f.debug_tuple("DbDataType::Uint32").finish(), + DbDataType::Uint64 => f.debug_tuple("DbDataType::Uint64").finish(), + DbDataType::Floating32 => { + f.debug_tuple("DbDataType::Floating32").finish() + } + DbDataType::Floating64 => { + f.debug_tuple("DbDataType::Floating64").finish() + } + DbDataType::Str => f.debug_tuple("DbDataType::Str").finish(), + DbDataType::Binary => f.debug_tuple("DbDataType::Binary").finish(), + DbDataType::Other => f.debug_tuple("DbDataType::Other").finish(), + } + } + } + + impl DbDataType { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> DbDataType { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => DbDataType::Boolean, + 1 => DbDataType::Int8, + 2 => DbDataType::Int16, + 3 => DbDataType::Int32, + 4 => DbDataType::Int64, + 5 => DbDataType::Uint8, + 6 => DbDataType::Uint16, + 7 => DbDataType::Uint32, + 8 => DbDataType::Uint64, + 9 => DbDataType::Floating32, + 10 => DbDataType::Floating64, + 11 => DbDataType::Str, + 12 => DbDataType::Binary, + 13 => DbDataType::Other, + + _ => panic!("invalid enum discriminant"), + } + } + } + + /// Database values + #[derive(Clone)] + pub enum DbValue { + Boolean(bool), + Int8(i8), + Int16(i16), + Int32(i32), + Int64(i64), + Uint8(u8), + Uint16(u16), + Uint32(u32), + Uint64(u64), + Floating32(f32), + Floating64(f64), + Str(_rt::String), + Binary(_rt::Vec), + DbNull, + Unsupported, + } + impl ::core::fmt::Debug for DbValue { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + DbValue::Boolean(e) => { + f.debug_tuple("DbValue::Boolean").field(e).finish() + } + DbValue::Int8(e) => f.debug_tuple("DbValue::Int8").field(e).finish(), + DbValue::Int16(e) => f.debug_tuple("DbValue::Int16").field(e).finish(), + DbValue::Int32(e) => f.debug_tuple("DbValue::Int32").field(e).finish(), + DbValue::Int64(e) => f.debug_tuple("DbValue::Int64").field(e).finish(), + DbValue::Uint8(e) => f.debug_tuple("DbValue::Uint8").field(e).finish(), + DbValue::Uint16(e) => { + f.debug_tuple("DbValue::Uint16").field(e).finish() + } + DbValue::Uint32(e) => { + f.debug_tuple("DbValue::Uint32").field(e).finish() + } + DbValue::Uint64(e) => { + f.debug_tuple("DbValue::Uint64").field(e).finish() + } + DbValue::Floating32(e) => { + f.debug_tuple("DbValue::Floating32").field(e).finish() + } + DbValue::Floating64(e) => { + f.debug_tuple("DbValue::Floating64").field(e).finish() + } + DbValue::Str(e) => f.debug_tuple("DbValue::Str").field(e).finish(), + DbValue::Binary(e) => { + f.debug_tuple("DbValue::Binary").field(e).finish() + } + DbValue::DbNull => f.debug_tuple("DbValue::DbNull").finish(), + DbValue::Unsupported => f.debug_tuple("DbValue::Unsupported").finish(), + } + } + } + /// Values used in parameterized queries + #[derive(Clone)] + pub enum ParameterValue { + Boolean(bool), + Int8(i8), + Int16(i16), + Int32(i32), + Int64(i64), + Uint8(u8), + Uint16(u16), + Uint32(u32), + Uint64(u64), + Floating32(f32), + Floating64(f64), + Str(_rt::String), + Binary(_rt::Vec), + DbNull, + } + impl ::core::fmt::Debug for ParameterValue { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + ParameterValue::Boolean(e) => { + f.debug_tuple("ParameterValue::Boolean").field(e).finish() + } + ParameterValue::Int8(e) => { + f.debug_tuple("ParameterValue::Int8").field(e).finish() + } + ParameterValue::Int16(e) => { + f.debug_tuple("ParameterValue::Int16").field(e).finish() + } + ParameterValue::Int32(e) => { + f.debug_tuple("ParameterValue::Int32").field(e).finish() + } + ParameterValue::Int64(e) => { + f.debug_tuple("ParameterValue::Int64").field(e).finish() + } + ParameterValue::Uint8(e) => { + f.debug_tuple("ParameterValue::Uint8").field(e).finish() + } + ParameterValue::Uint16(e) => { + f.debug_tuple("ParameterValue::Uint16").field(e).finish() + } + ParameterValue::Uint32(e) => { + f.debug_tuple("ParameterValue::Uint32").field(e).finish() + } + ParameterValue::Uint64(e) => { + f.debug_tuple("ParameterValue::Uint64").field(e).finish() + } + ParameterValue::Floating32(e) => f + .debug_tuple("ParameterValue::Floating32") + .field(e) + .finish(), + ParameterValue::Floating64(e) => f + .debug_tuple("ParameterValue::Floating64") + .field(e) + .finish(), + ParameterValue::Str(e) => { + f.debug_tuple("ParameterValue::Str").field(e).finish() + } + ParameterValue::Binary(e) => { + f.debug_tuple("ParameterValue::Binary").field(e).finish() + } + ParameterValue::DbNull => { + f.debug_tuple("ParameterValue::DbNull").finish() + } + } + } + } + /// A database column + #[derive(Clone)] + pub struct Column { + pub name: _rt::String, + pub data_type: DbDataType, + } + impl ::core::fmt::Debug for Column { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("Column") + .field("name", &self.name) + .field("data-type", &self.data_type) + .finish() + } + } + /// A database row + pub type Row = _rt::Vec; + /// A set of database rows + #[derive(Clone)] + pub struct RowSet { + pub columns: _rt::Vec, + pub rows: _rt::Vec, + } + impl ::core::fmt::Debug for RowSet { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("RowSet") + .field("columns", &self.columns) + .field("rows", &self.rows) + .finish() + } + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_rdbms_types_2_0_0_cabi { + ($ty:ident with_types_in $($path_to_types:tt)*) => { + const _: () = {}; + }; + } + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_rdbms_types_2_0_0_cabi; + } + + #[allow(dead_code, clippy::all)] + pub mod postgres { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type ParameterValue = + super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue; + pub type RowSet = + super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet; + pub type Error = + super::super::super::super::exports::fermyon::spin::rdbms_types::Error; + /// A connection to a postgres database. + + #[derive(Debug)] + #[repr(transparent)] + pub struct Connection { + handle: _rt::Resource, + } + + type _ConnectionRep = Option; + + impl Connection { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `Connection`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _ConnectionRep = Some(val); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestConnection` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); + } + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`Connection`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct ConnectionBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a Connection>, + } + + impl<'a> ConnectionBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for Connection { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/postgres@2.0.0")] + extern "C" { + #[link_name = "[resource-drop]connection"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_static_connection_open_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::open(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + use super::super::super::super::exports::fermyon::spin::rdbms_types::Error as V8; + match e { + V8::ConnectionFailed(e) => { + *ptr2.add(4).cast::() = (0i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + V8::BadParameter(e) => { + *ptr2.add(4).cast::() = (1i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(12).cast::() = len4; + *ptr2.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + V8::QueryFailed(e) => { + *ptr2.add(4).cast::() = (2i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr2.add(12).cast::() = len5; + *ptr2.add(8).cast::<*mut u8>() = ptr5.cast_mut(); + } + V8::ValueConversionFailed(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec6 = (e.into_bytes()).into_boxed_slice(); + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + ::core::mem::forget(vec6); + *ptr2.add(12).cast::() = len6; + *ptr2.add(8).cast::<*mut u8>() = ptr6.cast_mut(); + } + V8::Other(e) => { + *ptr2.add(4).cast::() = (4i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr2.add(12).cast::() = len7; + *ptr2.add(8).cast::<*mut u8>() = ptr7.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_static_connection_open( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + 1 => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + 2 => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + 3 => { + let l8 = *arg0.add(8).cast::<*mut u8>(); + let l9 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l8, l9, 1); + } + _ => { + let l10 = *arg0.add(8).cast::<*mut u8>(); + let l11 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_query_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base20 = arg3; + let len20 = arg4; + let mut result20 = _rt::Vec::with_capacity(len20); + for i in 0..len20 { + let base = base20.add(i * 16); + let e20 = { + let l1 = i32::from(*base.add(0).cast::()); + use super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue as V19; + let v19 = match l1 { + 0 => { + let e19 = { + let l2 = i32::from(*base.add(8).cast::()); + + _rt::bool_lift(l2 as u8) + }; + V19::Boolean(e19) + } + 1 => { + let e19 = { + let l3 = i32::from(*base.add(8).cast::()); + + l3 as i8 + }; + V19::Int8(e19) + } + 2 => { + let e19 = { + let l4 = i32::from(*base.add(8).cast::()); + + l4 as i16 + }; + V19::Int16(e19) + } + 3 => { + let e19 = { + let l5 = *base.add(8).cast::(); + + l5 + }; + V19::Int32(e19) + } + 4 => { + let e19 = { + let l6 = *base.add(8).cast::(); + + l6 + }; + V19::Int64(e19) + } + 5 => { + let e19 = { + let l7 = i32::from(*base.add(8).cast::()); + + l7 as u8 + }; + V19::Uint8(e19) + } + 6 => { + let e19 = { + let l8 = i32::from(*base.add(8).cast::()); + + l8 as u16 + }; + V19::Uint16(e19) + } + 7 => { + let e19 = { + let l9 = *base.add(8).cast::(); + + l9 as u32 + }; + V19::Uint32(e19) + } + 8 => { + let e19 = { + let l10 = *base.add(8).cast::(); + + l10 as u64 + }; + V19::Uint64(e19) + } + 9 => { + let e19 = { + let l11 = *base.add(8).cast::(); + + l11 + }; + V19::Floating32(e19) + } + 10 => { + let e19 = { + let l12 = *base.add(8).cast::(); + + l12 + }; + V19::Floating64(e19) + } + 11 => { + let e19 = { + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let len15 = l14; + let bytes15 = + _rt::Vec::from_raw_parts(l13.cast(), len15, len15); + + _rt::string_lift(bytes15) + }; + V19::Str(e19) + } + 12 => { + let e19 = { + let l16 = *base.add(8).cast::<*mut u8>(); + let l17 = *base.add(12).cast::(); + let len18 = l17; + + _rt::Vec::from_raw_parts(l16.cast(), len18, len18) + }; + V19::Binary(e19) + } + n => { + debug_assert_eq!(n, 13, "invalid enum discriminant"); + V19::DbNull + } + }; + + v19 + }; + result20.push(e20); + } + _rt::cabi_dealloc(base20, len20 * 16, 8); + let result21 = T::query( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result20, + ); + let ptr22 = _RET_AREA.0.as_mut_ptr().cast::(); + match result21 { + Ok(e) => { + *ptr22.add(0).cast::() = (0i32) as u8; + let super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet{ columns:columns23, rows:rows23, } = e; + let vec26 = columns23; + let len26 = vec26.len(); + let layout26 = + _rt::alloc::Layout::from_size_align_unchecked(vec26.len() * 12, 4); + let result26 = if layout26.size() != 0 { + let ptr = _rt::alloc::alloc(layout26).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout26); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec26.into_iter().enumerate() { + let base = result26.add(i * 12); + { + let super::super::super::super::exports::fermyon::spin::rdbms_types::Column{ name:name24, data_type:data_type24, } = e; + let vec25 = (name24.into_bytes()).into_boxed_slice(); + let ptr25 = vec25.as_ptr().cast::(); + let len25 = vec25.len(); + ::core::mem::forget(vec25); + *base.add(4).cast::() = len25; + *base.add(0).cast::<*mut u8>() = ptr25.cast_mut(); + *base.add(8).cast::() = (data_type24.clone() as i32) as u8; + } + } + *ptr22.add(8).cast::() = len26; + *ptr22.add(4).cast::<*mut u8>() = result26; + let vec31 = rows23; + let len31 = vec31.len(); + let layout31 = + _rt::alloc::Layout::from_size_align_unchecked(vec31.len() * 8, 4); + let result31 = if layout31.size() != 0 { + let ptr = _rt::alloc::alloc(layout31).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout31); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec31.into_iter().enumerate() { + let base = result31.add(i * 8); + { + let vec30 = e; + let len30 = vec30.len(); + let layout30 = _rt::alloc::Layout::from_size_align_unchecked( + vec30.len() * 16, + 8, + ); + let result30 = if layout30.size() != 0 { + let ptr = _rt::alloc::alloc(layout30).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout30); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec30.into_iter().enumerate() { + let base = result30.add(i * 16); + { + use super::super::super::super::exports::fermyon::spin::rdbms_types::DbValue as V29; + match e { + V29::Boolean(e) => { + *base.add(0).cast::() = (0i32) as u8; + *base.add(8).cast::() = (match e { + true => 1, + false => 0, + }) + as u8; + } + V29::Int8(e) => { + *base.add(0).cast::() = (1i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u8; + } + V29::Int16(e) => { + *base.add(0).cast::() = (2i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u16; + } + V29::Int32(e) => { + *base.add(0).cast::() = (3i32) as u8; + *base.add(8).cast::() = _rt::as_i32(e); + } + V29::Int64(e) => { + *base.add(0).cast::() = (4i32) as u8; + *base.add(8).cast::() = _rt::as_i64(e); + } + V29::Uint8(e) => { + *base.add(0).cast::() = (5i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u8; + } + V29::Uint16(e) => { + *base.add(0).cast::() = (6i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u16; + } + V29::Uint32(e) => { + *base.add(0).cast::() = (7i32) as u8; + *base.add(8).cast::() = _rt::as_i32(e); + } + V29::Uint64(e) => { + *base.add(0).cast::() = (8i32) as u8; + *base.add(8).cast::() = _rt::as_i64(e); + } + V29::Floating32(e) => { + *base.add(0).cast::() = (9i32) as u8; + *base.add(8).cast::() = _rt::as_f32(e); + } + V29::Floating64(e) => { + *base.add(0).cast::() = (10i32) as u8; + *base.add(8).cast::() = _rt::as_f64(e); + } + V29::Str(e) => { + *base.add(0).cast::() = (11i32) as u8; + let vec27 = (e.into_bytes()).into_boxed_slice(); + let ptr27 = vec27.as_ptr().cast::(); + let len27 = vec27.len(); + ::core::mem::forget(vec27); + *base.add(12).cast::() = len27; + *base.add(8).cast::<*mut u8>() = + ptr27.cast_mut(); + } + V29::Binary(e) => { + *base.add(0).cast::() = (12i32) as u8; + let vec28 = (e).into_boxed_slice(); + let ptr28 = vec28.as_ptr().cast::(); + let len28 = vec28.len(); + ::core::mem::forget(vec28); + *base.add(12).cast::() = len28; + *base.add(8).cast::<*mut u8>() = + ptr28.cast_mut(); + } + V29::DbNull => { + *base.add(0).cast::() = (13i32) as u8; + } + V29::Unsupported => { + *base.add(0).cast::() = (14i32) as u8; + } + } + } + } + *base.add(4).cast::() = len30; + *base.add(0).cast::<*mut u8>() = result30; + } + } + *ptr22.add(16).cast::() = len31; + *ptr22.add(12).cast::<*mut u8>() = result31; + } + Err(e) => { + *ptr22.add(0).cast::() = (1i32) as u8; + use super::super::super::super::exports::fermyon::spin::rdbms_types::Error as V37; + match e { + V37::ConnectionFailed(e) => { + *ptr22.add(4).cast::() = (0i32) as u8; + let vec32 = (e.into_bytes()).into_boxed_slice(); + let ptr32 = vec32.as_ptr().cast::(); + let len32 = vec32.len(); + ::core::mem::forget(vec32); + *ptr22.add(12).cast::() = len32; + *ptr22.add(8).cast::<*mut u8>() = ptr32.cast_mut(); + } + V37::BadParameter(e) => { + *ptr22.add(4).cast::() = (1i32) as u8; + let vec33 = (e.into_bytes()).into_boxed_slice(); + let ptr33 = vec33.as_ptr().cast::(); + let len33 = vec33.len(); + ::core::mem::forget(vec33); + *ptr22.add(12).cast::() = len33; + *ptr22.add(8).cast::<*mut u8>() = ptr33.cast_mut(); + } + V37::QueryFailed(e) => { + *ptr22.add(4).cast::() = (2i32) as u8; + let vec34 = (e.into_bytes()).into_boxed_slice(); + let ptr34 = vec34.as_ptr().cast::(); + let len34 = vec34.len(); + ::core::mem::forget(vec34); + *ptr22.add(12).cast::() = len34; + *ptr22.add(8).cast::<*mut u8>() = ptr34.cast_mut(); + } + V37::ValueConversionFailed(e) => { + *ptr22.add(4).cast::() = (3i32) as u8; + let vec35 = (e.into_bytes()).into_boxed_slice(); + let ptr35 = vec35.as_ptr().cast::(); + let len35 = vec35.len(); + ::core::mem::forget(vec35); + *ptr22.add(12).cast::() = len35; + *ptr22.add(8).cast::<*mut u8>() = ptr35.cast_mut(); + } + V37::Other(e) => { + *ptr22.add(4).cast::() = (4i32) as u8; + let vec36 = (e.into_bytes()).into_boxed_slice(); + let ptr36 = vec36.as_ptr().cast::(); + let len36 = vec36.len(); + ::core::mem::forget(vec36); + *ptr22.add(12).cast::() = len36; + *ptr22.add(8).cast::<*mut u8>() = ptr36.cast_mut(); + } + } + } + }; + ptr22 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_query( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + let base5 = l3; + let len5 = l4; + for i in 0..len5 { + let base = base5.add(i * 12); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + _rt::cabi_dealloc(base5, len5 * 12, 4); + let l15 = *arg0.add(12).cast::<*mut u8>(); + let l16 = *arg0.add(16).cast::(); + let base17 = l15; + let len17 = l16; + for i in 0..len17 { + let base = base17.add(i * 8); + { + let l12 = *base.add(0).cast::<*mut u8>(); + let l13 = *base.add(4).cast::(); + let base14 = l12; + let len14 = l13; + for i in 0..len14 { + let base = base14.add(i * 16); + { + let l6 = i32::from(*base.add(0).cast::()); + match l6 { + 0 => (), + 1 => (), + 2 => (), + 3 => (), + 4 => (), + 5 => (), + 6 => (), + 7 => (), + 8 => (), + 9 => (), + 10 => (), + 11 => { + let l7 = *base.add(8).cast::<*mut u8>(); + let l8 = *base.add(12).cast::(); + _rt::cabi_dealloc(l7, l8, 1); + } + 12 => { + let l9 = *base.add(8).cast::<*mut u8>(); + let l10 = *base.add(12).cast::(); + let base11 = l9; + let len11 = l10; + _rt::cabi_dealloc(base11, len11 * 1, 1); + } + 13 => (), + _ => (), + } + } + } + _rt::cabi_dealloc(base14, len14 * 16, 8); + } + } + _rt::cabi_dealloc(base17, len17 * 8, 4); + } + _ => { + let l18 = i32::from(*arg0.add(4).cast::()); + match l18 { + 0 => { + let l19 = *arg0.add(8).cast::<*mut u8>(); + let l20 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l19, l20, 1); + } + 1 => { + let l21 = *arg0.add(8).cast::<*mut u8>(); + let l22 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l21, l22, 1); + } + 2 => { + let l23 = *arg0.add(8).cast::<*mut u8>(); + let l24 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l23, l24, 1); + } + 3 => { + let l25 = *arg0.add(8).cast::<*mut u8>(); + let l26 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l25, l26, 1); + } + _ => { + let l27 = *arg0.add(8).cast::<*mut u8>(); + let l28 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l27, l28, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_execute_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base20 = arg3; + let len20 = arg4; + let mut result20 = _rt::Vec::with_capacity(len20); + for i in 0..len20 { + let base = base20.add(i * 16); + let e20 = { + let l1 = i32::from(*base.add(0).cast::()); + use super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue as V19; + let v19 = match l1 { + 0 => { + let e19 = { + let l2 = i32::from(*base.add(8).cast::()); + + _rt::bool_lift(l2 as u8) + }; + V19::Boolean(e19) + } + 1 => { + let e19 = { + let l3 = i32::from(*base.add(8).cast::()); + + l3 as i8 + }; + V19::Int8(e19) + } + 2 => { + let e19 = { + let l4 = i32::from(*base.add(8).cast::()); + + l4 as i16 + }; + V19::Int16(e19) + } + 3 => { + let e19 = { + let l5 = *base.add(8).cast::(); + + l5 + }; + V19::Int32(e19) + } + 4 => { + let e19 = { + let l6 = *base.add(8).cast::(); + + l6 + }; + V19::Int64(e19) + } + 5 => { + let e19 = { + let l7 = i32::from(*base.add(8).cast::()); + + l7 as u8 + }; + V19::Uint8(e19) + } + 6 => { + let e19 = { + let l8 = i32::from(*base.add(8).cast::()); + + l8 as u16 + }; + V19::Uint16(e19) + } + 7 => { + let e19 = { + let l9 = *base.add(8).cast::(); + + l9 as u32 + }; + V19::Uint32(e19) + } + 8 => { + let e19 = { + let l10 = *base.add(8).cast::(); + + l10 as u64 + }; + V19::Uint64(e19) + } + 9 => { + let e19 = { + let l11 = *base.add(8).cast::(); + + l11 + }; + V19::Floating32(e19) + } + 10 => { + let e19 = { + let l12 = *base.add(8).cast::(); + + l12 + }; + V19::Floating64(e19) + } + 11 => { + let e19 = { + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let len15 = l14; + let bytes15 = + _rt::Vec::from_raw_parts(l13.cast(), len15, len15); + + _rt::string_lift(bytes15) + }; + V19::Str(e19) + } + 12 => { + let e19 = { + let l16 = *base.add(8).cast::<*mut u8>(); + let l17 = *base.add(12).cast::(); + let len18 = l17; + + _rt::Vec::from_raw_parts(l16.cast(), len18, len18) + }; + V19::Binary(e19) + } + n => { + debug_assert_eq!(n, 13, "invalid enum discriminant"); + V19::DbNull + } + }; + + v19 + }; + result20.push(e20); + } + _rt::cabi_dealloc(base20, len20 * 16, 8); + let result21 = T::execute( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result20, + ); + let ptr22 = _RET_AREA.0.as_mut_ptr().cast::(); + match result21 { + Ok(e) => { + *ptr22.add(0).cast::() = (0i32) as u8; + *ptr22.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr22.add(0).cast::() = (1i32) as u8; + use super::super::super::super::exports::fermyon::spin::rdbms_types::Error as V28; + match e { + V28::ConnectionFailed(e) => { + *ptr22.add(8).cast::() = (0i32) as u8; + let vec23 = (e.into_bytes()).into_boxed_slice(); + let ptr23 = vec23.as_ptr().cast::(); + let len23 = vec23.len(); + ::core::mem::forget(vec23); + *ptr22.add(16).cast::() = len23; + *ptr22.add(12).cast::<*mut u8>() = ptr23.cast_mut(); + } + V28::BadParameter(e) => { + *ptr22.add(8).cast::() = (1i32) as u8; + let vec24 = (e.into_bytes()).into_boxed_slice(); + let ptr24 = vec24.as_ptr().cast::(); + let len24 = vec24.len(); + ::core::mem::forget(vec24); + *ptr22.add(16).cast::() = len24; + *ptr22.add(12).cast::<*mut u8>() = ptr24.cast_mut(); + } + V28::QueryFailed(e) => { + *ptr22.add(8).cast::() = (2i32) as u8; + let vec25 = (e.into_bytes()).into_boxed_slice(); + let ptr25 = vec25.as_ptr().cast::(); + let len25 = vec25.len(); + ::core::mem::forget(vec25); + *ptr22.add(16).cast::() = len25; + *ptr22.add(12).cast::<*mut u8>() = ptr25.cast_mut(); + } + V28::ValueConversionFailed(e) => { + *ptr22.add(8).cast::() = (3i32) as u8; + let vec26 = (e.into_bytes()).into_boxed_slice(); + let ptr26 = vec26.as_ptr().cast::(); + let len26 = vec26.len(); + ::core::mem::forget(vec26); + *ptr22.add(16).cast::() = len26; + *ptr22.add(12).cast::<*mut u8>() = ptr26.cast_mut(); + } + V28::Other(e) => { + *ptr22.add(8).cast::() = (4i32) as u8; + let vec27 = (e.into_bytes()).into_boxed_slice(); + let ptr27 = vec27.as_ptr().cast::(); + let len27 = vec27.len(); + ::core::mem::forget(vec27); + *ptr22.add(16).cast::() = len27; + *ptr22.add(12).cast::<*mut u8>() = ptr27.cast_mut(); + } + } + } + }; + ptr22 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_execute( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(8).cast::()); + match l1 { + 0 => { + let l2 = *arg0.add(12).cast::<*mut u8>(); + let l3 = *arg0.add(16).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + 1 => { + let l4 = *arg0.add(12).cast::<*mut u8>(); + let l5 = *arg0.add(16).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + 2 => { + let l6 = *arg0.add(12).cast::<*mut u8>(); + let l7 = *arg0.add(16).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + 3 => { + let l8 = *arg0.add(12).cast::<*mut u8>(); + let l9 = *arg0.add(16).cast::(); + _rt::cabi_dealloc(l8, l9, 1); + } + _ => { + let l10 = *arg0.add(12).cast::<*mut u8>(); + let l11 = *arg0.add(16).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + pub trait Guest { + type Connection: GuestConnection; + } + pub trait GuestConnection: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/postgres@2.0.0")] + extern "C" { + #[link_name = "[resource-new]connection"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/postgres@2.0.0")] + extern "C" { + #[link_name = "[resource-rep]connection"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + /// Open a connection to the Postgres instance at `address`. + fn open(address: _rt::String) -> Result; + /// Query the database. + fn query( + &self, + statement: _rt::String, + params: _rt::Vec, + ) -> Result; + /// Execute command to the database. + fn execute( + &self, + statement: _rt::String, + params: _rt::Vec, + ) -> Result; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_postgres_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/postgres@2.0.0#[static]connection.open"] + unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) + } + #[export_name = "cabi_post_fermyon:spin/postgres@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { + $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/postgres@2.0.0#[method]connection.query"] + unsafe extern "C" fn export_method_connection_query(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_query_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/postgres@2.0.0#[method]connection.query"] + unsafe extern "C" fn _post_return_method_connection_query(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_query::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/postgres@2.0.0#[method]connection.execute"] + unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/postgres@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "fermyon:spin/postgres@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Connection::dtor::< + <$ty as $($path_to_types)*::Guest>::Connection + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_postgres_2_0_0_cabi; + #[repr(align(8))] + struct _RetArea([::core::mem::MaybeUninit; 24]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 24]); + } + + #[allow(dead_code, clippy::all)] + pub mod mysql { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type ParameterValue = + super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue; + pub type RowSet = + super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet; + pub type Error = + super::super::super::super::exports::fermyon::spin::rdbms_types::Error; + /// A connection to a MySQL database. + + #[derive(Debug)] + #[repr(transparent)] + pub struct Connection { + handle: _rt::Resource, + } + + type _ConnectionRep = Option; + + impl Connection { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `Connection`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _ConnectionRep = Some(val); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestConnection` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); + } + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`Connection`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct ConnectionBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a Connection>, + } + + impl<'a> ConnectionBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for Connection { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/mysql@2.0.0")] + extern "C" { + #[link_name = "[resource-drop]connection"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_static_connection_open_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::open(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + use super::super::super::super::exports::fermyon::spin::rdbms_types::Error as V8; + match e { + V8::ConnectionFailed(e) => { + *ptr2.add(4).cast::() = (0i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + V8::BadParameter(e) => { + *ptr2.add(4).cast::() = (1i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(12).cast::() = len4; + *ptr2.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + V8::QueryFailed(e) => { + *ptr2.add(4).cast::() = (2i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr2.add(12).cast::() = len5; + *ptr2.add(8).cast::<*mut u8>() = ptr5.cast_mut(); + } + V8::ValueConversionFailed(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec6 = (e.into_bytes()).into_boxed_slice(); + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + ::core::mem::forget(vec6); + *ptr2.add(12).cast::() = len6; + *ptr2.add(8).cast::<*mut u8>() = ptr6.cast_mut(); + } + V8::Other(e) => { + *ptr2.add(4).cast::() = (4i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr2.add(12).cast::() = len7; + *ptr2.add(8).cast::<*mut u8>() = ptr7.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_static_connection_open( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + 1 => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + 2 => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + 3 => { + let l8 = *arg0.add(8).cast::<*mut u8>(); + let l9 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l8, l9, 1); + } + _ => { + let l10 = *arg0.add(8).cast::<*mut u8>(); + let l11 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_query_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base20 = arg3; + let len20 = arg4; + let mut result20 = _rt::Vec::with_capacity(len20); + for i in 0..len20 { + let base = base20.add(i * 16); + let e20 = { + let l1 = i32::from(*base.add(0).cast::()); + use super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue as V19; + let v19 = match l1 { + 0 => { + let e19 = { + let l2 = i32::from(*base.add(8).cast::()); + + _rt::bool_lift(l2 as u8) + }; + V19::Boolean(e19) + } + 1 => { + let e19 = { + let l3 = i32::from(*base.add(8).cast::()); + + l3 as i8 + }; + V19::Int8(e19) + } + 2 => { + let e19 = { + let l4 = i32::from(*base.add(8).cast::()); + + l4 as i16 + }; + V19::Int16(e19) + } + 3 => { + let e19 = { + let l5 = *base.add(8).cast::(); + + l5 + }; + V19::Int32(e19) + } + 4 => { + let e19 = { + let l6 = *base.add(8).cast::(); + + l6 + }; + V19::Int64(e19) + } + 5 => { + let e19 = { + let l7 = i32::from(*base.add(8).cast::()); + + l7 as u8 + }; + V19::Uint8(e19) + } + 6 => { + let e19 = { + let l8 = i32::from(*base.add(8).cast::()); + + l8 as u16 + }; + V19::Uint16(e19) + } + 7 => { + let e19 = { + let l9 = *base.add(8).cast::(); + + l9 as u32 + }; + V19::Uint32(e19) + } + 8 => { + let e19 = { + let l10 = *base.add(8).cast::(); + + l10 as u64 + }; + V19::Uint64(e19) + } + 9 => { + let e19 = { + let l11 = *base.add(8).cast::(); + + l11 + }; + V19::Floating32(e19) + } + 10 => { + let e19 = { + let l12 = *base.add(8).cast::(); + + l12 + }; + V19::Floating64(e19) + } + 11 => { + let e19 = { + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let len15 = l14; + let bytes15 = + _rt::Vec::from_raw_parts(l13.cast(), len15, len15); + + _rt::string_lift(bytes15) + }; + V19::Str(e19) + } + 12 => { + let e19 = { + let l16 = *base.add(8).cast::<*mut u8>(); + let l17 = *base.add(12).cast::(); + let len18 = l17; + + _rt::Vec::from_raw_parts(l16.cast(), len18, len18) + }; + V19::Binary(e19) + } + n => { + debug_assert_eq!(n, 13, "invalid enum discriminant"); + V19::DbNull + } + }; + + v19 + }; + result20.push(e20); + } + _rt::cabi_dealloc(base20, len20 * 16, 8); + let result21 = T::query( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result20, + ); + let ptr22 = _RET_AREA.0.as_mut_ptr().cast::(); + match result21 { + Ok(e) => { + *ptr22.add(0).cast::() = (0i32) as u8; + let super::super::super::super::exports::fermyon::spin::rdbms_types::RowSet{ columns:columns23, rows:rows23, } = e; + let vec26 = columns23; + let len26 = vec26.len(); + let layout26 = + _rt::alloc::Layout::from_size_align_unchecked(vec26.len() * 12, 4); + let result26 = if layout26.size() != 0 { + let ptr = _rt::alloc::alloc(layout26).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout26); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec26.into_iter().enumerate() { + let base = result26.add(i * 12); + { + let super::super::super::super::exports::fermyon::spin::rdbms_types::Column{ name:name24, data_type:data_type24, } = e; + let vec25 = (name24.into_bytes()).into_boxed_slice(); + let ptr25 = vec25.as_ptr().cast::(); + let len25 = vec25.len(); + ::core::mem::forget(vec25); + *base.add(4).cast::() = len25; + *base.add(0).cast::<*mut u8>() = ptr25.cast_mut(); + *base.add(8).cast::() = (data_type24.clone() as i32) as u8; + } + } + *ptr22.add(8).cast::() = len26; + *ptr22.add(4).cast::<*mut u8>() = result26; + let vec31 = rows23; + let len31 = vec31.len(); + let layout31 = + _rt::alloc::Layout::from_size_align_unchecked(vec31.len() * 8, 4); + let result31 = if layout31.size() != 0 { + let ptr = _rt::alloc::alloc(layout31).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout31); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec31.into_iter().enumerate() { + let base = result31.add(i * 8); + { + let vec30 = e; + let len30 = vec30.len(); + let layout30 = _rt::alloc::Layout::from_size_align_unchecked( + vec30.len() * 16, + 8, + ); + let result30 = if layout30.size() != 0 { + let ptr = _rt::alloc::alloc(layout30).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout30); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec30.into_iter().enumerate() { + let base = result30.add(i * 16); + { + use super::super::super::super::exports::fermyon::spin::rdbms_types::DbValue as V29; + match e { + V29::Boolean(e) => { + *base.add(0).cast::() = (0i32) as u8; + *base.add(8).cast::() = (match e { + true => 1, + false => 0, + }) + as u8; + } + V29::Int8(e) => { + *base.add(0).cast::() = (1i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u8; + } + V29::Int16(e) => { + *base.add(0).cast::() = (2i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u16; + } + V29::Int32(e) => { + *base.add(0).cast::() = (3i32) as u8; + *base.add(8).cast::() = _rt::as_i32(e); + } + V29::Int64(e) => { + *base.add(0).cast::() = (4i32) as u8; + *base.add(8).cast::() = _rt::as_i64(e); + } + V29::Uint8(e) => { + *base.add(0).cast::() = (5i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u8; + } + V29::Uint16(e) => { + *base.add(0).cast::() = (6i32) as u8; + *base.add(8).cast::() = + (_rt::as_i32(e)) as u16; + } + V29::Uint32(e) => { + *base.add(0).cast::() = (7i32) as u8; + *base.add(8).cast::() = _rt::as_i32(e); + } + V29::Uint64(e) => { + *base.add(0).cast::() = (8i32) as u8; + *base.add(8).cast::() = _rt::as_i64(e); + } + V29::Floating32(e) => { + *base.add(0).cast::() = (9i32) as u8; + *base.add(8).cast::() = _rt::as_f32(e); + } + V29::Floating64(e) => { + *base.add(0).cast::() = (10i32) as u8; + *base.add(8).cast::() = _rt::as_f64(e); + } + V29::Str(e) => { + *base.add(0).cast::() = (11i32) as u8; + let vec27 = (e.into_bytes()).into_boxed_slice(); + let ptr27 = vec27.as_ptr().cast::(); + let len27 = vec27.len(); + ::core::mem::forget(vec27); + *base.add(12).cast::() = len27; + *base.add(8).cast::<*mut u8>() = + ptr27.cast_mut(); + } + V29::Binary(e) => { + *base.add(0).cast::() = (12i32) as u8; + let vec28 = (e).into_boxed_slice(); + let ptr28 = vec28.as_ptr().cast::(); + let len28 = vec28.len(); + ::core::mem::forget(vec28); + *base.add(12).cast::() = len28; + *base.add(8).cast::<*mut u8>() = + ptr28.cast_mut(); + } + V29::DbNull => { + *base.add(0).cast::() = (13i32) as u8; + } + V29::Unsupported => { + *base.add(0).cast::() = (14i32) as u8; + } + } + } + } + *base.add(4).cast::() = len30; + *base.add(0).cast::<*mut u8>() = result30; + } + } + *ptr22.add(16).cast::() = len31; + *ptr22.add(12).cast::<*mut u8>() = result31; + } + Err(e) => { + *ptr22.add(0).cast::() = (1i32) as u8; + use super::super::super::super::exports::fermyon::spin::rdbms_types::Error as V37; + match e { + V37::ConnectionFailed(e) => { + *ptr22.add(4).cast::() = (0i32) as u8; + let vec32 = (e.into_bytes()).into_boxed_slice(); + let ptr32 = vec32.as_ptr().cast::(); + let len32 = vec32.len(); + ::core::mem::forget(vec32); + *ptr22.add(12).cast::() = len32; + *ptr22.add(8).cast::<*mut u8>() = ptr32.cast_mut(); + } + V37::BadParameter(e) => { + *ptr22.add(4).cast::() = (1i32) as u8; + let vec33 = (e.into_bytes()).into_boxed_slice(); + let ptr33 = vec33.as_ptr().cast::(); + let len33 = vec33.len(); + ::core::mem::forget(vec33); + *ptr22.add(12).cast::() = len33; + *ptr22.add(8).cast::<*mut u8>() = ptr33.cast_mut(); + } + V37::QueryFailed(e) => { + *ptr22.add(4).cast::() = (2i32) as u8; + let vec34 = (e.into_bytes()).into_boxed_slice(); + let ptr34 = vec34.as_ptr().cast::(); + let len34 = vec34.len(); + ::core::mem::forget(vec34); + *ptr22.add(12).cast::() = len34; + *ptr22.add(8).cast::<*mut u8>() = ptr34.cast_mut(); + } + V37::ValueConversionFailed(e) => { + *ptr22.add(4).cast::() = (3i32) as u8; + let vec35 = (e.into_bytes()).into_boxed_slice(); + let ptr35 = vec35.as_ptr().cast::(); + let len35 = vec35.len(); + ::core::mem::forget(vec35); + *ptr22.add(12).cast::() = len35; + *ptr22.add(8).cast::<*mut u8>() = ptr35.cast_mut(); + } + V37::Other(e) => { + *ptr22.add(4).cast::() = (4i32) as u8; + let vec36 = (e.into_bytes()).into_boxed_slice(); + let ptr36 = vec36.as_ptr().cast::(); + let len36 = vec36.len(); + ::core::mem::forget(vec36); + *ptr22.add(12).cast::() = len36; + *ptr22.add(8).cast::<*mut u8>() = ptr36.cast_mut(); + } + } + } + }; + ptr22 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_query( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + let base5 = l3; + let len5 = l4; + for i in 0..len5 { + let base = base5.add(i * 12); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + _rt::cabi_dealloc(base5, len5 * 12, 4); + let l15 = *arg0.add(12).cast::<*mut u8>(); + let l16 = *arg0.add(16).cast::(); + let base17 = l15; + let len17 = l16; + for i in 0..len17 { + let base = base17.add(i * 8); + { + let l12 = *base.add(0).cast::<*mut u8>(); + let l13 = *base.add(4).cast::(); + let base14 = l12; + let len14 = l13; + for i in 0..len14 { + let base = base14.add(i * 16); + { + let l6 = i32::from(*base.add(0).cast::()); + match l6 { + 0 => (), + 1 => (), + 2 => (), + 3 => (), + 4 => (), + 5 => (), + 6 => (), + 7 => (), + 8 => (), + 9 => (), + 10 => (), + 11 => { + let l7 = *base.add(8).cast::<*mut u8>(); + let l8 = *base.add(12).cast::(); + _rt::cabi_dealloc(l7, l8, 1); + } + 12 => { + let l9 = *base.add(8).cast::<*mut u8>(); + let l10 = *base.add(12).cast::(); + let base11 = l9; + let len11 = l10; + _rt::cabi_dealloc(base11, len11 * 1, 1); + } + 13 => (), + _ => (), + } + } + } + _rt::cabi_dealloc(base14, len14 * 16, 8); + } + } + _rt::cabi_dealloc(base17, len17 * 8, 4); + } + _ => { + let l18 = i32::from(*arg0.add(4).cast::()); + match l18 { + 0 => { + let l19 = *arg0.add(8).cast::<*mut u8>(); + let l20 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l19, l20, 1); + } + 1 => { + let l21 = *arg0.add(8).cast::<*mut u8>(); + let l22 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l21, l22, 1); + } + 2 => { + let l23 = *arg0.add(8).cast::<*mut u8>(); + let l24 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l23, l24, 1); + } + 3 => { + let l25 = *arg0.add(8).cast::<*mut u8>(); + let l26 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l25, l26, 1); + } + _ => { + let l27 = *arg0.add(8).cast::<*mut u8>(); + let l28 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l27, l28, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_execute_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base20 = arg3; + let len20 = arg4; + let mut result20 = _rt::Vec::with_capacity(len20); + for i in 0..len20 { + let base = base20.add(i * 16); + let e20 = { + let l1 = i32::from(*base.add(0).cast::()); + use super::super::super::super::exports::fermyon::spin::rdbms_types::ParameterValue as V19; + let v19 = match l1 { + 0 => { + let e19 = { + let l2 = i32::from(*base.add(8).cast::()); + + _rt::bool_lift(l2 as u8) + }; + V19::Boolean(e19) + } + 1 => { + let e19 = { + let l3 = i32::from(*base.add(8).cast::()); + + l3 as i8 + }; + V19::Int8(e19) + } + 2 => { + let e19 = { + let l4 = i32::from(*base.add(8).cast::()); + + l4 as i16 + }; + V19::Int16(e19) + } + 3 => { + let e19 = { + let l5 = *base.add(8).cast::(); + + l5 + }; + V19::Int32(e19) + } + 4 => { + let e19 = { + let l6 = *base.add(8).cast::(); + + l6 + }; + V19::Int64(e19) + } + 5 => { + let e19 = { + let l7 = i32::from(*base.add(8).cast::()); + + l7 as u8 + }; + V19::Uint8(e19) + } + 6 => { + let e19 = { + let l8 = i32::from(*base.add(8).cast::()); + + l8 as u16 + }; + V19::Uint16(e19) + } + 7 => { + let e19 = { + let l9 = *base.add(8).cast::(); + + l9 as u32 + }; + V19::Uint32(e19) + } + 8 => { + let e19 = { + let l10 = *base.add(8).cast::(); + + l10 as u64 + }; + V19::Uint64(e19) + } + 9 => { + let e19 = { + let l11 = *base.add(8).cast::(); + + l11 + }; + V19::Floating32(e19) + } + 10 => { + let e19 = { + let l12 = *base.add(8).cast::(); + + l12 + }; + V19::Floating64(e19) + } + 11 => { + let e19 = { + let l13 = *base.add(8).cast::<*mut u8>(); + let l14 = *base.add(12).cast::(); + let len15 = l14; + let bytes15 = + _rt::Vec::from_raw_parts(l13.cast(), len15, len15); + + _rt::string_lift(bytes15) + }; + V19::Str(e19) + } + 12 => { + let e19 = { + let l16 = *base.add(8).cast::<*mut u8>(); + let l17 = *base.add(12).cast::(); + let len18 = l17; + + _rt::Vec::from_raw_parts(l16.cast(), len18, len18) + }; + V19::Binary(e19) + } + n => { + debug_assert_eq!(n, 13, "invalid enum discriminant"); + V19::DbNull + } + }; + + v19 + }; + result20.push(e20); + } + _rt::cabi_dealloc(base20, len20 * 16, 8); + let result21 = T::execute( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result20, + ); + let ptr22 = _RET_AREA.0.as_mut_ptr().cast::(); + match result21 { + Ok(_) => { + *ptr22.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr22.add(0).cast::() = (1i32) as u8; + use super::super::super::super::exports::fermyon::spin::rdbms_types::Error as V28; + match e { + V28::ConnectionFailed(e) => { + *ptr22.add(4).cast::() = (0i32) as u8; + let vec23 = (e.into_bytes()).into_boxed_slice(); + let ptr23 = vec23.as_ptr().cast::(); + let len23 = vec23.len(); + ::core::mem::forget(vec23); + *ptr22.add(12).cast::() = len23; + *ptr22.add(8).cast::<*mut u8>() = ptr23.cast_mut(); + } + V28::BadParameter(e) => { + *ptr22.add(4).cast::() = (1i32) as u8; + let vec24 = (e.into_bytes()).into_boxed_slice(); + let ptr24 = vec24.as_ptr().cast::(); + let len24 = vec24.len(); + ::core::mem::forget(vec24); + *ptr22.add(12).cast::() = len24; + *ptr22.add(8).cast::<*mut u8>() = ptr24.cast_mut(); + } + V28::QueryFailed(e) => { + *ptr22.add(4).cast::() = (2i32) as u8; + let vec25 = (e.into_bytes()).into_boxed_slice(); + let ptr25 = vec25.as_ptr().cast::(); + let len25 = vec25.len(); + ::core::mem::forget(vec25); + *ptr22.add(12).cast::() = len25; + *ptr22.add(8).cast::<*mut u8>() = ptr25.cast_mut(); + } + V28::ValueConversionFailed(e) => { + *ptr22.add(4).cast::() = (3i32) as u8; + let vec26 = (e.into_bytes()).into_boxed_slice(); + let ptr26 = vec26.as_ptr().cast::(); + let len26 = vec26.len(); + ::core::mem::forget(vec26); + *ptr22.add(12).cast::() = len26; + *ptr22.add(8).cast::<*mut u8>() = ptr26.cast_mut(); + } + V28::Other(e) => { + *ptr22.add(4).cast::() = (4i32) as u8; + let vec27 = (e.into_bytes()).into_boxed_slice(); + let ptr27 = vec27.as_ptr().cast::(); + let len27 = vec27.len(); + ::core::mem::forget(vec27); + *ptr22.add(12).cast::() = len27; + *ptr22.add(8).cast::<*mut u8>() = ptr27.cast_mut(); + } + } + } + }; + ptr22 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_execute( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + 1 => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + 2 => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + 3 => { + let l8 = *arg0.add(8).cast::<*mut u8>(); + let l9 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l8, l9, 1); + } + _ => { + let l10 = *arg0.add(8).cast::<*mut u8>(); + let l11 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + pub trait Guest { + type Connection: GuestConnection; + } + pub trait GuestConnection: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/mysql@2.0.0")] + extern "C" { + #[link_name = "[resource-new]connection"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/mysql@2.0.0")] + extern "C" { + #[link_name = "[resource-rep]connection"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + /// Open a connection to the MySQL instance at `address`. + fn open(address: _rt::String) -> Result; + /// query the database: select + fn query( + &self, + statement: _rt::String, + params: _rt::Vec, + ) -> Result; + /// execute command to the database: insert, update, delete + fn execute( + &self, + statement: _rt::String, + params: _rt::Vec, + ) -> Result<(), Error>; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_mysql_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/mysql@2.0.0#[static]connection.open"] + unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) + } + #[export_name = "cabi_post_fermyon:spin/mysql@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { + $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/mysql@2.0.0#[method]connection.query"] + unsafe extern "C" fn export_method_connection_query(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_query_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/mysql@2.0.0#[method]connection.query"] + unsafe extern "C" fn _post_return_method_connection_query(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_query::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/mysql@2.0.0#[method]connection.execute"] + unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/mysql@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "fermyon:spin/mysql@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Connection::dtor::< + <$ty as $($path_to_types)*::Guest>::Connection + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_mysql_2_0_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 20]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); + } + + #[allow(dead_code, clippy::all)] + pub mod sqlite { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// A handle to an open sqlite instance + + #[derive(Debug)] + #[repr(transparent)] + pub struct Connection { + handle: _rt::Resource, + } + + type _ConnectionRep = Option; + + impl Connection { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `Connection`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _ConnectionRep = Some(val); + let ptr: *mut _ConnectionRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestConnection` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _ConnectionRep); + } + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`Connection`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct ConnectionBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a Connection>, + } + + impl<'a> ConnectionBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _ConnectionRep { + Connection::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for Connection { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0")] + extern "C" { + #[link_name = "[resource-drop]connection"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + /// The set of errors which may be raised by functions in this interface + #[derive(Clone)] + pub enum Error { + /// The host does not recognize the database name requested. + NoSuchDatabase, + /// The requesting component does not have access to the specified database (which may or may not exist). + AccessDenied, + /// The provided connection is not valid + InvalidConnection, + /// The database has reached its capacity + DatabaseFull, + /// Some implementation-specific error has occurred (e.g. I/O) + Io(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::NoSuchDatabase => { + f.debug_tuple("Error::NoSuchDatabase").finish() + } + Error::AccessDenied => f.debug_tuple("Error::AccessDenied").finish(), + Error::InvalidConnection => { + f.debug_tuple("Error::InvalidConnection").finish() + } + Error::DatabaseFull => f.debug_tuple("Error::DatabaseFull").finish(), + Error::Io(e) => f.debug_tuple("Error::Io").field(e).finish(), + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + /// A single column's result from a database query + #[derive(Clone)] + pub enum Value { + Integer(i64), + Real(f64), + Text(_rt::String), + Blob(_rt::Vec), + Null, + } + impl ::core::fmt::Debug for Value { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Value::Integer(e) => f.debug_tuple("Value::Integer").field(e).finish(), + Value::Real(e) => f.debug_tuple("Value::Real").field(e).finish(), + Value::Text(e) => f.debug_tuple("Value::Text").field(e).finish(), + Value::Blob(e) => f.debug_tuple("Value::Blob").field(e).finish(), + Value::Null => f.debug_tuple("Value::Null").finish(), + } + } + } + /// A set of values for each of the columns in a query-result + #[derive(Clone)] + pub struct RowResult { + pub values: _rt::Vec, + } + impl ::core::fmt::Debug for RowResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("RowResult") + .field("values", &self.values) + .finish() + } + } + /// A result of a query + #[derive(Clone)] + pub struct QueryResult { + /// The names of the columns retrieved in the query + pub columns: _rt::Vec<_rt::String>, + /// the row results each containing the values for all the columns for a given row + pub rows: _rt::Vec, + } + impl ::core::fmt::Debug for QueryResult { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("QueryResult") + .field("columns", &self.columns) + .field("rows", &self.rows) + .finish() + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_static_connection_open_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::open(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::NoSuchDatabase => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::AccessDenied => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::InvalidConnection => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::DatabaseFull => { + *ptr2.add(4).cast::() = (3i32) as u8; + } + Error::Io(e) => { + *ptr2.add(4).cast::() = (4i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_static_connection_open( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + 3 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_connection_execute_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let base11 = arg3; + let len11 = arg4; + let mut result11 = _rt::Vec::with_capacity(len11); + for i in 0..len11 { + let base = base11.add(i * 16); + let e11 = { + let l1 = i32::from(*base.add(0).cast::()); + let v10 = match l1 { + 0 => { + let e10 = { + let l2 = *base.add(8).cast::(); + + l2 + }; + Value::Integer(e10) + } + 1 => { + let e10 = { + let l3 = *base.add(8).cast::(); + + l3 + }; + Value::Real(e10) + } + 2 => { + let e10 = { + let l4 = *base.add(8).cast::<*mut u8>(); + let l5 = *base.add(12).cast::(); + let len6 = l5; + let bytes6 = + _rt::Vec::from_raw_parts(l4.cast(), len6, len6); + + _rt::string_lift(bytes6) + }; + Value::Text(e10) + } + 3 => { + let e10 = { + let l7 = *base.add(8).cast::<*mut u8>(); + let l8 = *base.add(12).cast::(); + let len9 = l8; + + _rt::Vec::from_raw_parts(l7.cast(), len9, len9) + }; + Value::Blob(e10) + } + n => { + debug_assert_eq!(n, 4, "invalid enum discriminant"); + Value::Null + } + }; + + v10 + }; + result11.push(e11); + } + _rt::cabi_dealloc(base11, len11 * 16, 8); + let result12 = T::execute( + ConnectionBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + result11, + ); + let ptr13 = _RET_AREA.0.as_mut_ptr().cast::(); + match result12 { + Ok(e) => { + *ptr13.add(0).cast::() = (0i32) as u8; + let QueryResult { + columns: columns14, + rows: rows14, + } = e; + let vec16 = columns14; + let len16 = vec16.len(); + let layout16 = + _rt::alloc::Layout::from_size_align_unchecked(vec16.len() * 8, 4); + let result16 = if layout16.size() != 0 { + let ptr = _rt::alloc::alloc(layout16).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout16); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec16.into_iter().enumerate() { + let base = result16.add(i * 8); + { + let vec15 = (e.into_bytes()).into_boxed_slice(); + let ptr15 = vec15.as_ptr().cast::(); + let len15 = vec15.len(); + ::core::mem::forget(vec15); + *base.add(4).cast::() = len15; + *base.add(0).cast::<*mut u8>() = ptr15.cast_mut(); + } + } + *ptr13.add(8).cast::() = len16; + *ptr13.add(4).cast::<*mut u8>() = result16; + let vec21 = rows14; + let len21 = vec21.len(); + let layout21 = + _rt::alloc::Layout::from_size_align_unchecked(vec21.len() * 8, 4); + let result21 = if layout21.size() != 0 { + let ptr = _rt::alloc::alloc(layout21).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout21); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec21.into_iter().enumerate() { + let base = result21.add(i * 8); + { + let RowResult { values: values17 } = e; + let vec20 = values17; + let len20 = vec20.len(); + let layout20 = _rt::alloc::Layout::from_size_align_unchecked( + vec20.len() * 16, + 8, + ); + let result20 = if layout20.size() != 0 { + let ptr = _rt::alloc::alloc(layout20).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout20); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec20.into_iter().enumerate() { + let base = result20.add(i * 16); + { + match e { + Value::Integer(e) => { + *base.add(0).cast::() = (0i32) as u8; + *base.add(8).cast::() = _rt::as_i64(e); + } + Value::Real(e) => { + *base.add(0).cast::() = (1i32) as u8; + *base.add(8).cast::() = _rt::as_f64(e); + } + Value::Text(e) => { + *base.add(0).cast::() = (2i32) as u8; + let vec18 = (e.into_bytes()).into_boxed_slice(); + let ptr18 = vec18.as_ptr().cast::(); + let len18 = vec18.len(); + ::core::mem::forget(vec18); + *base.add(12).cast::() = len18; + *base.add(8).cast::<*mut u8>() = + ptr18.cast_mut(); + } + Value::Blob(e) => { + *base.add(0).cast::() = (3i32) as u8; + let vec19 = (e).into_boxed_slice(); + let ptr19 = vec19.as_ptr().cast::(); + let len19 = vec19.len(); + ::core::mem::forget(vec19); + *base.add(12).cast::() = len19; + *base.add(8).cast::<*mut u8>() = + ptr19.cast_mut(); + } + Value::Null => { + *base.add(0).cast::() = (4i32) as u8; + } + } + } + } + *base.add(4).cast::() = len20; + *base.add(0).cast::<*mut u8>() = result20; + } + } + *ptr13.add(16).cast::() = len21; + *ptr13.add(12).cast::<*mut u8>() = result21; + } + Err(e) => { + *ptr13.add(0).cast::() = (1i32) as u8; + match e { + Error::NoSuchDatabase => { + *ptr13.add(4).cast::() = (0i32) as u8; + } + Error::AccessDenied => { + *ptr13.add(4).cast::() = (1i32) as u8; + } + Error::InvalidConnection => { + *ptr13.add(4).cast::() = (2i32) as u8; + } + Error::DatabaseFull => { + *ptr13.add(4).cast::() = (3i32) as u8; + } + Error::Io(e) => { + *ptr13.add(4).cast::() = (4i32) as u8; + let vec22 = (e.into_bytes()).into_boxed_slice(); + let ptr22 = vec22.as_ptr().cast::(); + let len22 = vec22.len(); + ::core::mem::forget(vec22); + *ptr13.add(12).cast::() = len22; + *ptr13.add(8).cast::<*mut u8>() = ptr22.cast_mut(); + } + } + } + }; + ptr13 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_connection_execute( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + let base5 = l3; + let len5 = l4; + for i in 0..len5 { + let base = base5.add(i * 8); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + _rt::cabi_dealloc(base5, len5 * 8, 4); + let l15 = *arg0.add(12).cast::<*mut u8>(); + let l16 = *arg0.add(16).cast::(); + let base17 = l15; + let len17 = l16; + for i in 0..len17 { + let base = base17.add(i * 8); + { + let l12 = *base.add(0).cast::<*mut u8>(); + let l13 = *base.add(4).cast::(); + let base14 = l12; + let len14 = l13; + for i in 0..len14 { + let base = base14.add(i * 16); + { + let l6 = i32::from(*base.add(0).cast::()); + match l6 { + 0 => (), + 1 => (), + 2 => { + let l7 = *base.add(8).cast::<*mut u8>(); + let l8 = *base.add(12).cast::(); + _rt::cabi_dealloc(l7, l8, 1); + } + 3 => { + let l9 = *base.add(8).cast::<*mut u8>(); + let l10 = *base.add(12).cast::(); + let base11 = l9; + let len11 = l10; + _rt::cabi_dealloc(base11, len11 * 1, 1); + } + _ => (), + } + } + } + _rt::cabi_dealloc(base14, len14 * 16, 8); + } + } + _rt::cabi_dealloc(base17, len17 * 8, 4); + } + _ => { + let l18 = i32::from(*arg0.add(4).cast::()); + match l18 { + 0 => (), + 1 => (), + 2 => (), + 3 => (), + _ => { + let l19 = *arg0.add(8).cast::<*mut u8>(); + let l20 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l19, l20, 1); + } + } + } + } + } + pub trait Guest { + type Connection: GuestConnection; + } + pub trait GuestConnection: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0")] + extern "C" { + #[link_name = "[resource-new]connection"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/sqlite@2.0.0")] + extern "C" { + #[link_name = "[resource-rep]connection"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + /// Open a connection to a named database instance. + /// + /// If `database` is "default", the default instance is opened. + /// + /// `error::no-such-database` will be raised if the `name` is not recognized. + fn open(database: _rt::String) -> Result; + /// Execute a statement returning back data if there is any + fn execute( + &self, + statement: _rt::String, + parameters: _rt::Vec, + ) -> Result; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_sqlite_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/sqlite@2.0.0#[static]connection.open"] + unsafe extern "C" fn export_static_connection_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_static_connection_open_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1) + } + #[export_name = "cabi_post_fermyon:spin/sqlite@2.0.0#[static]connection.open"] + unsafe extern "C" fn _post_return_static_connection_open(arg0: *mut u8,) { + $($path_to_types)*::__post_return_static_connection_open::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + #[export_name = "fermyon:spin/sqlite@2.0.0#[method]connection.execute"] + unsafe extern "C" fn export_method_connection_execute(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_connection_execute_cabi::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/sqlite@2.0.0#[method]connection.execute"] + unsafe extern "C" fn _post_return_method_connection_execute(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_connection_execute::<<$ty as $($path_to_types)*::Guest>::Connection>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "fermyon:spin/sqlite@2.0.0#[dtor]connection"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Connection::dtor::< + <$ty as $($path_to_types)*::Guest>::Connection + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_sqlite_2_0_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 20]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 20]); + } + + #[allow(dead_code, clippy::all)] + pub mod key_value { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// An open key-value store + + #[derive(Debug)] + #[repr(transparent)] + pub struct Store { + handle: _rt::Resource, + } + + type _StoreRep = Option; + + impl Store { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `Store`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _StoreRep = Some(val); + let ptr: *mut _StoreRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestStore` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _StoreRep); + } + + fn as_ptr(&self) -> *mut _StoreRep { + Store::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`Store`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct StoreBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a Store>, + } + + impl<'a> StoreBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _StoreRep { + Store::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for Store { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/key-value@2.0.0")] + extern "C" { + #[link_name = "[resource-drop]store"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + /// The set of errors which may be raised by functions in this interface + #[derive(Clone)] + pub enum Error { + /// Too many stores have been opened simultaneously. Closing one or more + /// stores prior to retrying may address this. + StoreTableFull, + /// The host does not recognize the store label requested. + NoSuchStore, + /// The requesting component does not have access to the specified store + /// (which may or may not exist). + AccessDenied, + /// Some implementation-specific error has occurred (e.g. I/O) + Other(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::StoreTableFull => { + f.debug_tuple("Error::StoreTableFull").finish() + } + Error::NoSuchStore => f.debug_tuple("Error::NoSuchStore").finish(), + Error::AccessDenied => f.debug_tuple("Error::AccessDenied").finish(), + Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_static_store_open_cabi( + arg0: *mut u8, + arg1: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::open(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::StoreTableFull => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::NoSuchStore => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::AccessDenied => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_static_store_open(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_store_get_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let result1 = T::get( + StoreBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + match e { + Some(e) => { + *ptr2.add(4).cast::() = (1i32) as u8; + let vec3 = (e).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + None => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + }; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::StoreTableFull => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::NoSuchStore => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::AccessDenied => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(12).cast::() = len4; + *ptr2.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_store_get(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + let base4 = l2; + let len4 = l3; + _rt::cabi_dealloc(base4, len4 * 1, 1); + } + } + } + _ => { + let l5 = i32::from(*arg0.add(4).cast::()); + match l5 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_store_set_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + arg3: *mut u8, + arg4: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let len1 = arg4; + let result2 = T::set( + StoreBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + _rt::Vec::from_raw_parts(arg3.cast(), len1, len1), + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + match e { + Error::StoreTableFull => { + *ptr3.add(4).cast::() = (0i32) as u8; + } + Error::NoSuchStore => { + *ptr3.add(4).cast::() = (1i32) as u8; + } + Error::AccessDenied => { + *ptr3.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr3.add(4).cast::() = (3i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr3.add(12).cast::() = len4; + *ptr3.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_store_set(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_store_delete_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let result1 = T::delete( + StoreBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(_) => { + *ptr2.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::StoreTableFull => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::NoSuchStore => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::AccessDenied => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_store_delete(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_store_exists_cabi( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg2; + let bytes0 = _rt::Vec::from_raw_parts(arg1.cast(), len0, len0); + let result1 = T::exists( + StoreBorrow::lift(arg0 as u32 as usize).get(), + _rt::string_lift(bytes0), + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + *ptr2.add(4).cast::() = (match e { + true => 1, + false => 0, + }) as u8; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::StoreTableFull => { + *ptr2.add(4).cast::() = (0i32) as u8; + } + Error::NoSuchStore => { + *ptr2.add(4).cast::() = (1i32) as u8; + } + Error::AccessDenied => { + *ptr2.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(12).cast::() = len3; + *ptr2.add(8).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_store_exists(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(4).cast::()); + match l1 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l2 = *arg0.add(8).cast::<*mut u8>(); + let l3 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + } + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_store_get_keys_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::get_keys(StoreBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + let vec3 = e; + let len3 = vec3.len(); + let layout3 = + _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 8, 4); + let result3 = if layout3.size() != 0 { + let ptr = _rt::alloc::alloc(layout3).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout3); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec3.into_iter().enumerate() { + let base = result3.add(i * 8); + { + let vec2 = (e.into_bytes()).into_boxed_slice(); + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + ::core::mem::forget(vec2); + *base.add(4).cast::() = len2; + *base.add(0).cast::<*mut u8>() = ptr2.cast_mut(); + } + } + *ptr1.add(8).cast::() = len3; + *ptr1.add(4).cast::<*mut u8>() = result3; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + match e { + Error::StoreTableFull => { + *ptr1.add(4).cast::() = (0i32) as u8; + } + Error::NoSuchStore => { + *ptr1.add(4).cast::() = (1i32) as u8; + } + Error::AccessDenied => { + *ptr1.add(4).cast::() = (2i32) as u8; + } + Error::Other(e) => { + *ptr1.add(4).cast::() = (3i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr1.add(12).cast::() = len4; + *ptr1.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_store_get_keys(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l3 = *arg0.add(4).cast::<*mut u8>(); + let l4 = *arg0.add(8).cast::(); + let base5 = l3; + let len5 = l4; + for i in 0..len5 { + let base = base5.add(i * 8); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + _rt::cabi_dealloc(base5, len5 * 8, 4); + } + _ => { + let l6 = i32::from(*arg0.add(4).cast::()); + match l6 { + 0 => (), + 1 => (), + 2 => (), + _ => { + let l7 = *arg0.add(8).cast::<*mut u8>(); + let l8 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l7, l8, 1); + } + } + } + } + } + pub trait Guest { + type Store: GuestStore; + } + pub trait GuestStore: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/key-value@2.0.0")] + extern "C" { + #[link_name = "[resource-new]store"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]fermyon:spin/key-value@2.0.0")] + extern "C" { + #[link_name = "[resource-rep]store"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + /// Open the store with the specified label. + /// + /// `label` must refer to a store allowed in the spin.toml manifest. + /// + /// `error::no-such-store` will be raised if the `label` is not recognized. + fn open(label: _rt::String) -> Result; + /// Get the value associated with the specified `key` + /// + /// Returns `ok(none)` if the key does not exist. + fn get(&self, key: _rt::String) -> Result>, Error>; + /// Set the `value` associated with the specified `key` overwriting any existing value. + fn set(&self, key: _rt::String, value: _rt::Vec) -> Result<(), Error>; + /// Delete the tuple with the specified `key` + /// + /// No error is raised if a tuple did not previously exist for `key`. + fn delete(&self, key: _rt::String) -> Result<(), Error>; + /// Return whether a tuple exists for the specified `key` + fn exists(&self, key: _rt::String) -> Result; + /// Return a list of all the keys + fn get_keys(&self) -> Result<_rt::Vec<_rt::String>, Error>; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_key_value_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/key-value@2.0.0#[static]store.open"] + unsafe extern "C" fn export_static_store_open(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_static_store_open_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1) + } + #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[static]store.open"] + unsafe extern "C" fn _post_return_static_store_open(arg0: *mut u8,) { + $($path_to_types)*::__post_return_static_store_open::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.get"] + unsafe extern "C" fn export_method_store_get(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_store_get_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.get"] + unsafe extern "C" fn _post_return_method_store_get(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_store_get::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.set"] + unsafe extern "C" fn export_method_store_set(arg0: *mut u8,arg1: *mut u8,arg2: usize,arg3: *mut u8,arg4: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_store_set_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2, arg3, arg4) + } + #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.set"] + unsafe extern "C" fn _post_return_method_store_set(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_store_set::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.delete"] + unsafe extern "C" fn export_method_store_delete(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_store_delete_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.delete"] + unsafe extern "C" fn _post_return_method_store_delete(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_store_delete::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.exists"] + unsafe extern "C" fn export_method_store_exists(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_store_exists_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.exists"] + unsafe extern "C" fn _post_return_method_store_exists(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_store_exists::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + #[export_name = "fermyon:spin/key-value@2.0.0#[method]store.get-keys"] + unsafe extern "C" fn export_method_store_get_keys(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_store_get_keys_cabi::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + #[export_name = "cabi_post_fermyon:spin/key-value@2.0.0#[method]store.get-keys"] + unsafe extern "C" fn _post_return_method_store_get_keys(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_store_get_keys::<<$ty as $($path_to_types)*::Guest>::Store>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "fermyon:spin/key-value@2.0.0#[dtor]store"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::Store::dtor::< + <$ty as $($path_to_types)*::Guest>::Store + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_key_value_2_0_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 16]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + } + + #[allow(dead_code, clippy::all)] + pub mod variables { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + /// The set of errors which may be raised by functions in this interface. + #[derive(Clone)] + pub enum Error { + /// The provided variable name is invalid. + InvalidName(_rt::String), + /// The provided variable is undefined. + Undefined(_rt::String), + /// A variables provider specific error has occurred. + Provider(_rt::String), + /// Some implementation-specific error has occurred. + Other(_rt::String), + } + impl ::core::fmt::Debug for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + Error::InvalidName(e) => { + f.debug_tuple("Error::InvalidName").field(e).finish() + } + Error::Undefined(e) => { + f.debug_tuple("Error::Undefined").field(e).finish() + } + Error::Provider(e) => { + f.debug_tuple("Error::Provider").field(e).finish() + } + Error::Other(e) => f.debug_tuple("Error::Other").field(e).finish(), + } + } + } + impl ::core::fmt::Display for Error { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!(f, "{:?}", self) + } + } + + impl std::error::Error for Error {} + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_get_cabi(arg0: *mut u8, arg1: usize) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let len0 = arg1; + let bytes0 = _rt::Vec::from_raw_parts(arg0.cast(), len0, len0); + let result1 = T::get(_rt::string_lift(bytes0)); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr2.add(8).cast::() = len3; + *ptr2.add(4).cast::<*mut u8>() = ptr3.cast_mut(); + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + match e { + Error::InvalidName(e) => { + *ptr2.add(4).cast::() = (0i32) as u8; + let vec4 = (e.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *ptr2.add(12).cast::() = len4; + *ptr2.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + Error::Undefined(e) => { + *ptr2.add(4).cast::() = (1i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr2.add(12).cast::() = len5; + *ptr2.add(8).cast::<*mut u8>() = ptr5.cast_mut(); + } + Error::Provider(e) => { + *ptr2.add(4).cast::() = (2i32) as u8; + let vec6 = (e.into_bytes()).into_boxed_slice(); + let ptr6 = vec6.as_ptr().cast::(); + let len6 = vec6.len(); + ::core::mem::forget(vec6); + *ptr2.add(12).cast::() = len6; + *ptr2.add(8).cast::<*mut u8>() = ptr6.cast_mut(); + } + Error::Other(e) => { + *ptr2.add(4).cast::() = (3i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr2.add(12).cast::() = len7; + *ptr2.add(8).cast::<*mut u8>() = ptr7.cast_mut(); + } + } + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_get(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + _ => { + let l3 = i32::from(*arg0.add(4).cast::()); + match l3 { + 0 => { + let l4 = *arg0.add(8).cast::<*mut u8>(); + let l5 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l4, l5, 1); + } + 1 => { + let l6 = *arg0.add(8).cast::<*mut u8>(); + let l7 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + 2 => { + let l8 = *arg0.add(8).cast::<*mut u8>(); + let l9 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l8, l9, 1); + } + _ => { + let l10 = *arg0.add(8).cast::<*mut u8>(); + let l11 = *arg0.add(12).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + pub trait Guest { + /// Get an application variable value for the current component. + /// + /// The name must match one defined in in the component manifest. + fn get(name: _rt::String) -> Result<_rt::String, Error>; + } + #[doc(hidden)] + + macro_rules! __export_fermyon_spin_variables_2_0_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "fermyon:spin/variables@2.0.0#get"] + unsafe extern "C" fn export_get(arg0: *mut u8,arg1: usize,) -> *mut u8 { + $($path_to_types)*::_export_get_cabi::<$ty>(arg0, arg1) + } + #[export_name = "cabi_post_fermyon:spin/variables@2.0.0#get"] + unsafe extern "C" fn _post_return_get(arg0: *mut u8,) { + $($path_to_types)*::__post_return_get::<$ty>(arg0) + } + };); +} + #[doc(hidden)] + pub(crate) use __export_fermyon_spin_variables_2_0_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 16]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 16]); + } + } + } + #[allow(dead_code)] + pub mod wasi { + #[allow(dead_code)] + pub mod cli0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod environment { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_get_environment_cabi() -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::get_environment(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + let vec5 = result0; + let len5 = vec5.len(); + let layout5 = _rt::alloc::Layout::from_size_align_unchecked(vec5.len() * 16, 4); + let result5 = if layout5.size() != 0 { + let ptr = _rt::alloc::alloc(layout5).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout5); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec5.into_iter().enumerate() { + let base = result5.add(i * 16); + { + let (t2_0, t2_1) = e; + let vec3 = (t2_0.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *base.add(4).cast::() = len3; + *base.add(0).cast::<*mut u8>() = ptr3.cast_mut(); + let vec4 = (t2_1.into_bytes()).into_boxed_slice(); + let ptr4 = vec4.as_ptr().cast::(); + let len4 = vec4.len(); + ::core::mem::forget(vec4); + *base.add(12).cast::() = len4; + *base.add(8).cast::<*mut u8>() = ptr4.cast_mut(); + } + } + *ptr1.add(4).cast::() = len5; + *ptr1.add(0).cast::<*mut u8>() = result5; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_get_environment(arg0: *mut u8) { + let l4 = *arg0.add(0).cast::<*mut u8>(); + let l5 = *arg0.add(4).cast::(); + let base6 = l4; + let len6 = l5; + for i in 0..len6 { + let base = base6.add(i * 16); + { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + _rt::cabi_dealloc(l0, l1, 1); + let l2 = *base.add(8).cast::<*mut u8>(); + let l3 = *base.add(12).cast::(); + _rt::cabi_dealloc(l2, l3, 1); + } + } + _rt::cabi_dealloc(base6, len6 * 16, 4); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_get_arguments_cabi() -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::get_arguments(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + let vec3 = result0; + let len3 = vec3.len(); + let layout3 = _rt::alloc::Layout::from_size_align_unchecked(vec3.len() * 8, 4); + let result3 = if layout3.size() != 0 { + let ptr = _rt::alloc::alloc(layout3).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout3); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec3.into_iter().enumerate() { + let base = result3.add(i * 8); + { + let vec2 = (e.into_bytes()).into_boxed_slice(); + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + ::core::mem::forget(vec2); + *base.add(4).cast::() = len2; + *base.add(0).cast::<*mut u8>() = ptr2.cast_mut(); + } + } + *ptr1.add(4).cast::() = len3; + *ptr1.add(0).cast::<*mut u8>() = result3; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_get_arguments(arg0: *mut u8) { + let l2 = *arg0.add(0).cast::<*mut u8>(); + let l3 = *arg0.add(4).cast::(); + let base4 = l2; + let len4 = l3; + for i in 0..len4 { + let base = base4.add(i * 8); + { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + _rt::cabi_dealloc(l0, l1, 1); + } + } + _rt::cabi_dealloc(base4, len4 * 8, 4); + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_initial_cwd_cabi() -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::initial_cwd(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Some(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + let vec2 = (e.into_bytes()).into_boxed_slice(); + let ptr2 = vec2.as_ptr().cast::(); + let len2 = vec2.len(); + ::core::mem::forget(vec2); + *ptr1.add(8).cast::() = len2; + *ptr1.add(4).cast::<*mut u8>() = ptr2.cast_mut(); + } + None => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_initial_cwd(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = *arg0.add(4).cast::<*mut u8>(); + let l2 = *arg0.add(8).cast::(); + _rt::cabi_dealloc(l1, l2, 1); + } + } + } + pub trait Guest { + fn get_environment() -> _rt::Vec<(_rt::String, _rt::String)>; + fn get_arguments() -> _rt::Vec<_rt::String>; + fn initial_cwd() -> Option<_rt::String>; + } + #[doc(hidden)] + + macro_rules! __export_wasi_cli_environment_0_2_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wasi:cli/environment@0.2.0#get-environment"] + unsafe extern "C" fn export_get_environment() -> *mut u8 { + $($path_to_types)*::_export_get_environment_cabi::<$ty>() + } + #[export_name = "cabi_post_wasi:cli/environment@0.2.0#get-environment"] + unsafe extern "C" fn _post_return_get_environment(arg0: *mut u8,) { + $($path_to_types)*::__post_return_get_environment::<$ty>(arg0) + } + #[export_name = "wasi:cli/environment@0.2.0#get-arguments"] + unsafe extern "C" fn export_get_arguments() -> *mut u8 { + $($path_to_types)*::_export_get_arguments_cabi::<$ty>() + } + #[export_name = "cabi_post_wasi:cli/environment@0.2.0#get-arguments"] + unsafe extern "C" fn _post_return_get_arguments(arg0: *mut u8,) { + $($path_to_types)*::__post_return_get_arguments::<$ty>(arg0) + } + #[export_name = "wasi:cli/environment@0.2.0#initial-cwd"] + unsafe extern "C" fn export_initial_cwd() -> *mut u8 { + $($path_to_types)*::_export_initial_cwd_cabi::<$ty>() + } + #[export_name = "cabi_post_wasi:cli/environment@0.2.0#initial-cwd"] + unsafe extern "C" fn _post_return_initial_cwd(arg0: *mut u8,) { + $($path_to_types)*::__post_return_initial_cwd::<$ty>(arg0) + } + };); +} + #[doc(hidden)] + pub(crate) use __export_wasi_cli_environment_0_2_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 12]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 12]); + } + } + #[allow(dead_code)] + pub mod filesystem0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod preopens { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Descriptor = + super::super::super::super::wasi::filesystem0_2_0::types::Descriptor; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_get_directories_cabi() -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::get_directories(); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + let vec4 = result0; + let len4 = vec4.len(); + let layout4 = _rt::alloc::Layout::from_size_align_unchecked(vec4.len() * 12, 4); + let result4 = if layout4.size() != 0 { + let ptr = _rt::alloc::alloc(layout4).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout4); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec4.into_iter().enumerate() { + let base = result4.add(i * 12); + { + let (t2_0, t2_1) = e; + *base.add(0).cast::() = (t2_0).take_handle() as i32; + let vec3 = (t2_1.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *base.add(8).cast::() = len3; + *base.add(4).cast::<*mut u8>() = ptr3.cast_mut(); + } + } + *ptr1.add(4).cast::() = len4; + *ptr1.add(0).cast::<*mut u8>() = result4; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_get_directories(arg0: *mut u8) { + let l2 = *arg0.add(0).cast::<*mut u8>(); + let l3 = *arg0.add(4).cast::(); + let base4 = l2; + let len4 = l3; + for i in 0..len4 { + let base = base4.add(i * 12); + { + let l0 = *base.add(4).cast::<*mut u8>(); + let l1 = *base.add(8).cast::(); + _rt::cabi_dealloc(l0, l1, 1); + } + } + _rt::cabi_dealloc(base4, len4 * 12, 4); + } + pub trait Guest { + fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)>; + } + #[doc(hidden)] + + macro_rules! __export_wasi_filesystem_preopens_0_2_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wasi:filesystem/preopens@0.2.0#get-directories"] + unsafe extern "C" fn export_get_directories() -> *mut u8 { + $($path_to_types)*::_export_get_directories_cabi::<$ty>() + } + #[export_name = "cabi_post_wasi:filesystem/preopens@0.2.0#get-directories"] + unsafe extern "C" fn _post_return_get_directories(arg0: *mut u8,) { + $($path_to_types)*::__post_return_get_directories::<$ty>(arg0) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_wasi_filesystem_preopens_0_2_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 8]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 8]); + } + } + #[allow(dead_code)] + pub mod http0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod outgoing_handler { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type OutgoingRequest = + super::super::super::super::wasi::http0_2_0::types::OutgoingRequest; + pub type RequestOptions = + super::super::super::super::wasi::http0_2_0::types::RequestOptions; + pub type FutureIncomingResponse = + super::super::super::super::wasi::http0_2_0::types::FutureIncomingResponse; + pub type ErrorCode = super::super::super::super::wasi::http0_2_0::types::ErrorCode; + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_handle_cabi( + arg0: i32, + arg1: i32, + arg2: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::handle(super::super::super::super::wasi::http0_2_0::types::OutgoingRequest::from_handle(arg0 as u32), match arg1 { + 0 => None, + 1 => { + let e = super::super::super::super::wasi::http0_2_0::types::RequestOptions::from_handle(arg2 as u32); + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + use super::super::super::super::wasi::http0_2_0::types::ErrorCode as V17; + match e { + V17::DnsTimeout => { + *ptr1.add(8).cast::() = (0i32) as u8; + } + V17::DnsError(e) => { + *ptr1.add(8).cast::() = (1i32) as u8; + let super::super::super::super::wasi::http0_2_0::types::DnsErrorPayload{ rcode:rcode2, info_code:info_code2, } = e; + match rcode2 { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec3 = (e.into_bytes()).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *ptr1.add(24).cast::() = len3; + *ptr1.add(20).cast::<*mut u8>() = ptr3.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + match info_code2 { + Some(e) => { + *ptr1.add(28).cast::() = (1i32) as u8; + *ptr1.add(30).cast::() = (_rt::as_i32(e)) as u16; + } + None => { + *ptr1.add(28).cast::() = (0i32) as u8; + } + }; + } + V17::DestinationNotFound => { + *ptr1.add(8).cast::() = (2i32) as u8; + } + V17::DestinationUnavailable => { + *ptr1.add(8).cast::() = (3i32) as u8; + } + V17::DestinationIpProhibited => { + *ptr1.add(8).cast::() = (4i32) as u8; + } + V17::DestinationIpUnroutable => { + *ptr1.add(8).cast::() = (5i32) as u8; + } + V17::ConnectionRefused => { + *ptr1.add(8).cast::() = (6i32) as u8; + } + V17::ConnectionTerminated => { + *ptr1.add(8).cast::() = (7i32) as u8; + } + V17::ConnectionTimeout => { + *ptr1.add(8).cast::() = (8i32) as u8; + } + V17::ConnectionReadTimeout => { + *ptr1.add(8).cast::() = (9i32) as u8; + } + V17::ConnectionWriteTimeout => { + *ptr1.add(8).cast::() = (10i32) as u8; + } + V17::ConnectionLimitReached => { + *ptr1.add(8).cast::() = (11i32) as u8; + } + V17::TlsProtocolError => { + *ptr1.add(8).cast::() = (12i32) as u8; + } + V17::TlsCertificateError => { + *ptr1.add(8).cast::() = (13i32) as u8; + } + V17::TlsAlertReceived(e) => { + *ptr1.add(8).cast::() = (14i32) as u8; + let super::super::super::super::wasi::http0_2_0::types::TlsAlertReceivedPayload{ alert_id:alert_id4, alert_message:alert_message4, } = e; + match alert_id4 { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(17).cast::() = (_rt::as_i32(e)) as u8; + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + match alert_message4 { + Some(e) => { + *ptr1.add(20).cast::() = (1i32) as u8; + let vec5 = (e.into_bytes()).into_boxed_slice(); + let ptr5 = vec5.as_ptr().cast::(); + let len5 = vec5.len(); + ::core::mem::forget(vec5); + *ptr1.add(28).cast::() = len5; + *ptr1.add(24).cast::<*mut u8>() = ptr5.cast_mut(); + } + None => { + *ptr1.add(20).cast::() = (0i32) as u8; + } + }; + } + V17::HttpRequestDenied => { + *ptr1.add(8).cast::() = (15i32) as u8; + } + V17::HttpRequestLengthRequired => { + *ptr1.add(8).cast::() = (16i32) as u8; + } + V17::HttpRequestBodySize(e) => { + *ptr1.add(8).cast::() = (17i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(24).cast::() = _rt::as_i64(e); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpRequestMethodInvalid => { + *ptr1.add(8).cast::() = (18i32) as u8; + } + V17::HttpRequestUriInvalid => { + *ptr1.add(8).cast::() = (19i32) as u8; + } + V17::HttpRequestUriTooLong => { + *ptr1.add(8).cast::() = (20i32) as u8; + } + V17::HttpRequestHeaderSectionSize(e) => { + *ptr1.add(8).cast::() = (21i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(20).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpRequestHeaderSize(e) => { + *ptr1.add(8).cast::() = (22i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name6, field_size:field_size6, } = e; + match field_name6 { + Some(e) => { + *ptr1.add(20).cast::() = (1i32) as u8; + let vec7 = (e.into_bytes()).into_boxed_slice(); + let ptr7 = vec7.as_ptr().cast::(); + let len7 = vec7.len(); + ::core::mem::forget(vec7); + *ptr1.add(28).cast::() = len7; + *ptr1.add(24).cast::<*mut u8>() = + ptr7.cast_mut(); + } + None => { + *ptr1.add(20).cast::() = (0i32) as u8; + } + }; + match field_size6 { + Some(e) => { + *ptr1.add(32).cast::() = (1i32) as u8; + *ptr1.add(36).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(32).cast::() = (0i32) as u8; + } + }; + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpRequestTrailerSectionSize(e) => { + *ptr1.add(8).cast::() = (23i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(20).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpRequestTrailerSize(e) => { + *ptr1.add(8).cast::() = (24i32) as u8; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name8, field_size:field_size8, } = e; + match field_name8 { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec9 = (e.into_bytes()).into_boxed_slice(); + let ptr9 = vec9.as_ptr().cast::(); + let len9 = vec9.len(); + ::core::mem::forget(vec9); + *ptr1.add(24).cast::() = len9; + *ptr1.add(20).cast::<*mut u8>() = ptr9.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + match field_size8 { + Some(e) => { + *ptr1.add(28).cast::() = (1i32) as u8; + *ptr1.add(32).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(28).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseIncomplete => { + *ptr1.add(8).cast::() = (25i32) as u8; + } + V17::HttpResponseHeaderSectionSize(e) => { + *ptr1.add(8).cast::() = (26i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(20).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseHeaderSize(e) => { + *ptr1.add(8).cast::() = (27i32) as u8; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name10, field_size:field_size10, } = e; + match field_name10 { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec11 = (e.into_bytes()).into_boxed_slice(); + let ptr11 = vec11.as_ptr().cast::(); + let len11 = vec11.len(); + ::core::mem::forget(vec11); + *ptr1.add(24).cast::() = len11; + *ptr1.add(20).cast::<*mut u8>() = ptr11.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + match field_size10 { + Some(e) => { + *ptr1.add(28).cast::() = (1i32) as u8; + *ptr1.add(32).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(28).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseBodySize(e) => { + *ptr1.add(8).cast::() = (28i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(24).cast::() = _rt::as_i64(e); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseTrailerSectionSize(e) => { + *ptr1.add(8).cast::() = (29i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + *ptr1.add(20).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseTrailerSize(e) => { + *ptr1.add(8).cast::() = (30i32) as u8; + let super::super::super::super::wasi::http0_2_0::types::FieldSizePayload{ field_name:field_name12, field_size:field_size12, } = e; + match field_name12 { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec13 = (e.into_bytes()).into_boxed_slice(); + let ptr13 = vec13.as_ptr().cast::(); + let len13 = vec13.len(); + ::core::mem::forget(vec13); + *ptr1.add(24).cast::() = len13; + *ptr1.add(20).cast::<*mut u8>() = ptr13.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + match field_size12 { + Some(e) => { + *ptr1.add(28).cast::() = (1i32) as u8; + *ptr1.add(32).cast::() = _rt::as_i32(e); + } + None => { + *ptr1.add(28).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseTransferCoding(e) => { + *ptr1.add(8).cast::() = (31i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec14 = (e.into_bytes()).into_boxed_slice(); + let ptr14 = vec14.as_ptr().cast::(); + let len14 = vec14.len(); + ::core::mem::forget(vec14); + *ptr1.add(24).cast::() = len14; + *ptr1.add(20).cast::<*mut u8>() = ptr14.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseContentCoding(e) => { + *ptr1.add(8).cast::() = (32i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec15 = (e.into_bytes()).into_boxed_slice(); + let ptr15 = vec15.as_ptr().cast::(); + let len15 = vec15.len(); + ::core::mem::forget(vec15); + *ptr1.add(24).cast::() = len15; + *ptr1.add(20).cast::<*mut u8>() = ptr15.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + V17::HttpResponseTimeout => { + *ptr1.add(8).cast::() = (33i32) as u8; + } + V17::HttpUpgradeFailed => { + *ptr1.add(8).cast::() = (34i32) as u8; + } + V17::HttpProtocolError => { + *ptr1.add(8).cast::() = (35i32) as u8; + } + V17::LoopDetected => { + *ptr1.add(8).cast::() = (36i32) as u8; + } + V17::ConfigurationError => { + *ptr1.add(8).cast::() = (37i32) as u8; + } + V17::InternalError(e) => { + *ptr1.add(8).cast::() = (38i32) as u8; + match e { + Some(e) => { + *ptr1.add(16).cast::() = (1i32) as u8; + let vec16 = (e.into_bytes()).into_boxed_slice(); + let ptr16 = vec16.as_ptr().cast::(); + let len16 = vec16.len(); + ::core::mem::forget(vec16); + *ptr1.add(24).cast::() = len16; + *ptr1.add(20).cast::<*mut u8>() = ptr16.cast_mut(); + } + None => { + *ptr1.add(16).cast::() = (0i32) as u8; + } + }; + } + } + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_handle(arg0: *mut u8) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => (), + _ => { + let l1 = i32::from(*arg0.add(8).cast::()); + match l1 { + 0 => (), + 1 => { + let l2 = i32::from(*arg0.add(16).cast::()); + match l2 { + 0 => (), + _ => { + let l3 = *arg0.add(20).cast::<*mut u8>(); + let l4 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l3, l4, 1); + } + } + } + 2 => (), + 3 => (), + 4 => (), + 5 => (), + 6 => (), + 7 => (), + 8 => (), + 9 => (), + 10 => (), + 11 => (), + 12 => (), + 13 => (), + 14 => { + let l5 = i32::from(*arg0.add(20).cast::()); + match l5 { + 0 => (), + _ => { + let l6 = *arg0.add(24).cast::<*mut u8>(); + let l7 = *arg0.add(28).cast::(); + _rt::cabi_dealloc(l6, l7, 1); + } + } + } + 15 => (), + 16 => (), + 17 => (), + 18 => (), + 19 => (), + 20 => (), + 21 => (), + 22 => { + let l8 = i32::from(*arg0.add(16).cast::()); + match l8 { + 0 => (), + _ => { + let l9 = i32::from(*arg0.add(20).cast::()); + match l9 { + 0 => (), + _ => { + let l10 = *arg0.add(24).cast::<*mut u8>(); + let l11 = *arg0.add(28).cast::(); + _rt::cabi_dealloc(l10, l11, 1); + } + } + } + } + } + 23 => (), + 24 => { + let l12 = i32::from(*arg0.add(16).cast::()); + match l12 { + 0 => (), + _ => { + let l13 = *arg0.add(20).cast::<*mut u8>(); + let l14 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l13, l14, 1); + } + } + } + 25 => (), + 26 => (), + 27 => { + let l15 = i32::from(*arg0.add(16).cast::()); + match l15 { + 0 => (), + _ => { + let l16 = *arg0.add(20).cast::<*mut u8>(); + let l17 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l16, l17, 1); + } + } + } + 28 => (), + 29 => (), + 30 => { + let l18 = i32::from(*arg0.add(16).cast::()); + match l18 { + 0 => (), + _ => { + let l19 = *arg0.add(20).cast::<*mut u8>(); + let l20 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l19, l20, 1); + } + } + } + 31 => { + let l21 = i32::from(*arg0.add(16).cast::()); + match l21 { + 0 => (), + _ => { + let l22 = *arg0.add(20).cast::<*mut u8>(); + let l23 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l22, l23, 1); + } + } + } + 32 => { + let l24 = i32::from(*arg0.add(16).cast::()); + match l24 { + 0 => (), + _ => { + let l25 = *arg0.add(20).cast::<*mut u8>(); + let l26 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l25, l26, 1); + } + } + } + 33 => (), + 34 => (), + 35 => (), + 36 => (), + 37 => (), + _ => { + let l27 = i32::from(*arg0.add(16).cast::()); + match l27 { + 0 => (), + _ => { + let l28 = *arg0.add(20).cast::<*mut u8>(); + let l29 = *arg0.add(24).cast::(); + _rt::cabi_dealloc(l28, l29, 1); + } + } + } + } + } + } + } + pub trait Guest { + fn handle( + request: OutgoingRequest, + options: Option, + ) -> Result; + } + #[doc(hidden)] + + macro_rules! __export_wasi_http_outgoing_handler_0_2_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wasi:http/outgoing-handler@0.2.0#handle"] + unsafe extern "C" fn export_handle(arg0: i32,arg1: i32,arg2: i32,) -> *mut u8 { + $($path_to_types)*::_export_handle_cabi::<$ty>(arg0, arg1, arg2) + } + #[export_name = "cabi_post_wasi:http/outgoing-handler@0.2.0#handle"] + unsafe extern "C" fn _post_return_handle(arg0: *mut u8,) { + $($path_to_types)*::__post_return_handle::<$ty>(arg0) + } + };); + } + #[doc(hidden)] + pub(crate) use __export_wasi_http_outgoing_handler_0_2_0_cabi; + #[repr(align(8))] + struct _RetArea([::core::mem::MaybeUninit; 40]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 40]); + } + } + #[allow(dead_code)] + pub mod sockets0_2_0 { + #[allow(dead_code, clippy::all)] + pub mod ip_name_lookup { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Pollable = super::super::super::super::wasi::io0_2_0::poll::Pollable; + pub type Network = super::super::super::super::wasi::sockets0_2_0::network::Network; + pub type ErrorCode = + super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpAddress = + super::super::super::super::wasi::sockets0_2_0::network::IpAddress; + + #[derive(Debug)] + #[repr(transparent)] + pub struct ResolveAddressStream { + handle: _rt::Resource, + } + + type _ResolveAddressStreamRep = Option; + + impl ResolveAddressStream { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `ResolveAddressStream`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _ResolveAddressStreamRep = Some(val); + let ptr: *mut _ResolveAddressStreamRep = + _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestResolveAddressStream` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _ResolveAddressStreamRep); + } + + fn as_ptr( + &self, + ) -> *mut _ResolveAddressStreamRep { + ResolveAddressStream::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`ResolveAddressStream`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct ResolveAddressStreamBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a ResolveAddressStream>, + } + + impl<'a> ResolveAddressStreamBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _ResolveAddressStreamRep { + ResolveAddressStream::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for ResolveAddressStream { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link( + wasm_import_module = "[export]wasi:sockets/ip-name-lookup@0.2.0" + )] + extern "C" { + #[link_name = "[resource-drop]resolve-address-stream"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_resolve_address_stream_resolve_next_address_cabi< + T: GuestResolveAddressStream, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::resolve_next_address( + ResolveAddressStreamBorrow::lift(arg0 as u32 as usize).get(), + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + match e { + Some(e) => { + *ptr1.add(2).cast::() = (1i32) as u8; + use super::super::super::super::wasi::sockets0_2_0::network::IpAddress as V4; + match e { + V4::Ipv4(e) => { + *ptr1.add(4).cast::() = (0i32) as u8; + let (t2_0, t2_1, t2_2, t2_3) = e; + *ptr1.add(6).cast::() = (_rt::as_i32(t2_0)) as u8; + *ptr1.add(7).cast::() = (_rt::as_i32(t2_1)) as u8; + *ptr1.add(8).cast::() = (_rt::as_i32(t2_2)) as u8; + *ptr1.add(9).cast::() = (_rt::as_i32(t2_3)) as u8; + } + V4::Ipv6(e) => { + *ptr1.add(4).cast::() = (1i32) as u8; + let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = + e; + *ptr1.add(6).cast::() = (_rt::as_i32(t3_0)) as u16; + *ptr1.add(8).cast::() = (_rt::as_i32(t3_1)) as u16; + *ptr1.add(10).cast::() = + (_rt::as_i32(t3_2)) as u16; + *ptr1.add(12).cast::() = + (_rt::as_i32(t3_3)) as u16; + *ptr1.add(14).cast::() = + (_rt::as_i32(t3_4)) as u16; + *ptr1.add(16).cast::() = + (_rt::as_i32(t3_5)) as u16; + *ptr1.add(18).cast::() = + (_rt::as_i32(t3_6)) as u16; + *ptr1.add(20).cast::() = + (_rt::as_i32(t3_7)) as u16; + } + } + } + None => { + *ptr1.add(2).cast::() = (0i32) as u8; + } + }; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(2).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_resolve_address_stream_subscribe_cabi< + T: GuestResolveAddressStream, + >( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::subscribe(ResolveAddressStreamBorrow::lift(arg0 as u32 as usize).get()); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_resolve_addresses_cabi( + arg0: i32, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let handle0; + let len1 = arg2; + let bytes1 = _rt::Vec::from_raw_parts(arg1.cast(), len1, len1); + let result2 = T::resolve_addresses( + { + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg0 as u32); + &handle0 + }, + _rt::string_lift(bytes1), + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(e) => { + *ptr3.add(0).cast::() = (0i32) as u8; + *ptr3.add(4).cast::() = (e).take_handle() as i32; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + *ptr3.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr3 + } + pub trait Guest { + type ResolveAddressStream: GuestResolveAddressStream; + fn resolve_addresses( + network: &Network, + name: _rt::String, + ) -> Result; + } + pub trait GuestResolveAddressStream: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link( + wasm_import_module = "[export]wasi:sockets/ip-name-lookup@0.2.0" + )] + extern "C" { + #[link_name = "[resource-new]resolve-address-stream"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link( + wasm_import_module = "[export]wasi:sockets/ip-name-lookup@0.2.0" + )] + extern "C" { + #[link_name = "[resource-rep]resolve-address-stream"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + fn resolve_next_address(&self) -> Result, ErrorCode>; + fn subscribe(&self) -> Pollable; + } + #[doc(hidden)] + + macro_rules! __export_wasi_sockets_ip_name_lookup_0_2_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#[method]resolve-address-stream.resolve-next-address"] + unsafe extern "C" fn export_method_resolve_address_stream_resolve_next_address(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_resolve_address_stream_resolve_next_address_cabi::<<$ty as $($path_to_types)*::Guest>::ResolveAddressStream>(arg0) + } + #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#[method]resolve-address-stream.subscribe"] + unsafe extern "C" fn export_method_resolve_address_stream_subscribe(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_resolve_address_stream_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::ResolveAddressStream>(arg0) + } + #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#resolve-addresses"] + unsafe extern "C" fn export_resolve_addresses(arg0: i32,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_resolve_addresses_cabi::<$ty>(arg0, arg1, arg2) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "wasi:sockets/ip-name-lookup@0.2.0#[dtor]resolve-address-stream"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::ResolveAddressStream::dtor::< + <$ty as $($path_to_types)*::Guest>::ResolveAddressStream + >(rep) + } + }; + + };); + } + #[doc(hidden)] + pub(crate) use __export_wasi_sockets_ip_name_lookup_0_2_0_cabi; + #[repr(align(4))] + struct _RetArea([::core::mem::MaybeUninit; 22]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 22]); + } + + #[allow(dead_code, clippy::all)] + pub mod tcp { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type InputStream = + super::super::super::super::wasi::io0_2_0::streams::InputStream; + pub type OutputStream = + super::super::super::super::wasi::io0_2_0::streams::OutputStream; + pub type Pollable = super::super::super::super::wasi::io0_2_0::poll::Pollable; + pub type Duration = + super::super::super::super::wasi::clocks0_2_0::monotonic_clock::Duration; + pub type Network = super::super::super::super::wasi::sockets0_2_0::network::Network; + pub type ErrorCode = + super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpSocketAddress = + super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress; + pub type IpAddressFamily = + super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + #[repr(u8)] + #[derive(Clone, Copy, Eq, PartialEq)] + pub enum ShutdownType { + Receive, + Send, + Both, + } + impl ::core::fmt::Debug for ShutdownType { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + match self { + ShutdownType::Receive => { + f.debug_tuple("ShutdownType::Receive").finish() + } + ShutdownType::Send => f.debug_tuple("ShutdownType::Send").finish(), + ShutdownType::Both => f.debug_tuple("ShutdownType::Both").finish(), + } + } + } + + impl ShutdownType { + #[doc(hidden)] + pub unsafe fn _lift(val: u8) -> ShutdownType { + if !cfg!(debug_assertions) { + return ::core::mem::transmute(val); + } + + match val { + 0 => ShutdownType::Receive, + 1 => ShutdownType::Send, + 2 => ShutdownType::Both, + + _ => panic!("invalid enum discriminant"), + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct TcpSocket { + handle: _rt::Resource, + } + + type _TcpSocketRep = Option; + + impl TcpSocket { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `TcpSocket`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _TcpSocketRep = Some(val); + let ptr: *mut _TcpSocketRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestTcpSocket` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _TcpSocketRep); + } + + fn as_ptr(&self) -> *mut _TcpSocketRep { + TcpSocket::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`TcpSocket`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct TcpSocketBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a TcpSocket>, + } + + impl<'a> TcpSocketBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _TcpSocketRep { + TcpSocket::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for TcpSocket { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/tcp@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]tcp-socket"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_start_bind_cabi( + arg0: *mut u8, + arg1: i32, + arg2: i32, + arg3: i32, + arg4: i32, + arg5: i32, + arg6: i32, + arg7: i32, + arg8: i32, + arg9: i32, + arg10: i32, + arg11: i32, + arg12: i32, + arg13: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let handle0; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V1; + let v1 = match arg2 { + 0 => { + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; + V1::Ipv4(e1) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ + port: arg3 as u16, + flow_info: arg4 as u32, + address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), + scope_id: arg13 as u32, + }; + V1::Ipv6(e1) + } + }; + let result2 = T::start_bind( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + { + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg1 as u32); + &handle0 + }, + v1, + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + *ptr3.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_finish_bind_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::finish_bind(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_start_connect_cabi( + arg0: *mut u8, + arg1: i32, + arg2: i32, + arg3: i32, + arg4: i32, + arg5: i32, + arg6: i32, + arg7: i32, + arg8: i32, + arg9: i32, + arg10: i32, + arg11: i32, + arg12: i32, + arg13: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let handle0; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V1; + let v1 = match arg2 { + 0 => { + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; + V1::Ipv4(e1) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ + port: arg3 as u16, + flow_info: arg4 as u32, + address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), + scope_id: arg13 as u32, + }; + V1::Ipv6(e1) + } + }; + let result2 = T::start_connect( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + { + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg1 as u32); + &handle0 + }, + v1, + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + *ptr3.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_finish_connect_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::finish_connect(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + let (t2_0, t2_1) = e; + *ptr1.add(4).cast::() = (t2_0).take_handle() as i32; + *ptr1.add(8).cast::() = (t2_1).take_handle() as i32; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_start_listen_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::start_listen(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_finish_listen_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::finish_listen(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_accept_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::accept(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + let (t2_0, t2_1, t2_2) = e; + *ptr1.add(4).cast::() = (t2_0).take_handle() as i32; + *ptr1.add(8).cast::() = (t2_1).take_handle() as i32; + *ptr1.add(12).cast::() = (t2_2).take_handle() as i32; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_local_address_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::local_address(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V6; + match e { + V6::Ipv4(e) => { + *ptr1.add(4).cast::() = (0i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; + let (t3_0, t3_1, t3_2, t3_3) = address2; + *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; + *ptr1.add(11).cast::() = (_rt::as_i32(t3_1)) as u8; + *ptr1.add(12).cast::() = (_rt::as_i32(t3_2)) as u8; + *ptr1.add(13).cast::() = (_rt::as_i32(t3_3)) as u8; + } + V6::Ipv6(e) => { + *ptr1.add(4).cast::() = (1i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; + *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); + let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; + *ptr1.add(16).cast::() = (_rt::as_i32(t5_0)) as u16; + *ptr1.add(18).cast::() = (_rt::as_i32(t5_1)) as u16; + *ptr1.add(20).cast::() = (_rt::as_i32(t5_2)) as u16; + *ptr1.add(22).cast::() = (_rt::as_i32(t5_3)) as u16; + *ptr1.add(24).cast::() = (_rt::as_i32(t5_4)) as u16; + *ptr1.add(26).cast::() = (_rt::as_i32(t5_5)) as u16; + *ptr1.add(28).cast::() = (_rt::as_i32(t5_6)) as u16; + *ptr1.add(30).cast::() = (_rt::as_i32(t5_7)) as u16; + *ptr1.add(32).cast::() = _rt::as_i32(scope_id4); + } + } + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_remote_address_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::remote_address(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V6; + match e { + V6::Ipv4(e) => { + *ptr1.add(4).cast::() = (0i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; + let (t3_0, t3_1, t3_2, t3_3) = address2; + *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; + *ptr1.add(11).cast::() = (_rt::as_i32(t3_1)) as u8; + *ptr1.add(12).cast::() = (_rt::as_i32(t3_2)) as u8; + *ptr1.add(13).cast::() = (_rt::as_i32(t3_3)) as u8; + } + V6::Ipv6(e) => { + *ptr1.add(4).cast::() = (1i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; + *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); + let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; + *ptr1.add(16).cast::() = (_rt::as_i32(t5_0)) as u16; + *ptr1.add(18).cast::() = (_rt::as_i32(t5_1)) as u16; + *ptr1.add(20).cast::() = (_rt::as_i32(t5_2)) as u16; + *ptr1.add(22).cast::() = (_rt::as_i32(t5_3)) as u16; + *ptr1.add(24).cast::() = (_rt::as_i32(t5_4)) as u16; + *ptr1.add(26).cast::() = (_rt::as_i32(t5_5)) as u16; + *ptr1.add(28).cast::() = (_rt::as_i32(t5_6)) as u16; + *ptr1.add(30).cast::() = (_rt::as_i32(t5_7)) as u16; + *ptr1.add(32).cast::() = _rt::as_i32(scope_id4); + } + } + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_is_listening_cabi( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::is_listening(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + match result0 { + true => 1, + false => 0, + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_address_family_cabi( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::address_family(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + result0.clone() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_listen_backlog_size_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_listen_backlog_size( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_keep_alive_enabled_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::keep_alive_enabled(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(1).cast::() = (match e { + true => 1, + false => 0, + }) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_keep_alive_enabled_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_keep_alive_enabled( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + _rt::bool_lift(arg1 as u8), + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_keep_alive_idle_time_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::keep_alive_idle_time(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_keep_alive_idle_time_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_keep_alive_idle_time( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_keep_alive_interval_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::keep_alive_interval(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_keep_alive_interval_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_keep_alive_interval( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_keep_alive_count_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::keep_alive_count(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(4).cast::() = _rt::as_i32(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_keep_alive_count_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_keep_alive_count( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u32, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_hop_limit_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::hop_limit(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(1).cast::() = (_rt::as_i32(e)) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_hop_limit_cabi( + arg0: *mut u8, + arg1: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_hop_limit( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u8, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_receive_buffer_size_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::receive_buffer_size(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_receive_buffer_size_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_receive_buffer_size( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_send_buffer_size_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::send_buffer_size(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_set_send_buffer_size_cabi< + T: GuestTcpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_send_buffer_size( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_subscribe_cabi( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::subscribe(TcpSocketBorrow::lift(arg0 as u32 as usize).get()); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_tcp_socket_shutdown_cabi( + arg0: *mut u8, + arg1: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::shutdown( + TcpSocketBorrow::lift(arg0 as u32 as usize).get(), + ShutdownType::_lift(arg1 as u8), + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + pub trait Guest { + type TcpSocket: GuestTcpSocket; + } + pub trait GuestTcpSocket: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/tcp@0.2.0")] + extern "C" { + #[link_name = "[resource-new]tcp-socket"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/tcp@0.2.0")] + extern "C" { + #[link_name = "[resource-rep]tcp-socket"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + fn start_bind( + &self, + network: &Network, + local_address: IpSocketAddress, + ) -> Result<(), ErrorCode>; + fn finish_bind(&self) -> Result<(), ErrorCode>; + fn start_connect( + &self, + network: &Network, + remote_address: IpSocketAddress, + ) -> Result<(), ErrorCode>; + fn finish_connect(&self) -> Result<(InputStream, OutputStream), ErrorCode>; + fn start_listen(&self) -> Result<(), ErrorCode>; + fn finish_listen(&self) -> Result<(), ErrorCode>; + fn accept(&self) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode>; + fn local_address(&self) -> Result; + fn remote_address(&self) -> Result; + fn is_listening(&self) -> bool; + fn address_family(&self) -> IpAddressFamily; + fn set_listen_backlog_size(&self, value: u64) -> Result<(), ErrorCode>; + fn keep_alive_enabled(&self) -> Result; + fn set_keep_alive_enabled(&self, value: bool) -> Result<(), ErrorCode>; + fn keep_alive_idle_time(&self) -> Result; + fn set_keep_alive_idle_time(&self, value: Duration) -> Result<(), ErrorCode>; + fn keep_alive_interval(&self) -> Result; + fn set_keep_alive_interval(&self, value: Duration) -> Result<(), ErrorCode>; + fn keep_alive_count(&self) -> Result; + fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode>; + fn hop_limit(&self) -> Result; + fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode>; + fn receive_buffer_size(&self) -> Result; + fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + fn send_buffer_size(&self) -> Result; + fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + fn subscribe(&self) -> Pollable; + fn shutdown(&self, shutdown_type: ShutdownType) -> Result<(), ErrorCode>; + } + #[doc(hidden)] + + macro_rules! __export_wasi_sockets_tcp_0_2_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-bind"] + unsafe extern "C" fn export_method_tcp_socket_start_bind(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_start_bind_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-bind"] + unsafe extern "C" fn export_method_tcp_socket_finish_bind(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_finish_bind_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-connect"] + unsafe extern "C" fn export_method_tcp_socket_start_connect(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_start_connect_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-connect"] + unsafe extern "C" fn export_method_tcp_socket_finish_connect(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_finish_connect_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.start-listen"] + unsafe extern "C" fn export_method_tcp_socket_start_listen(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_start_listen_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.finish-listen"] + unsafe extern "C" fn export_method_tcp_socket_finish_listen(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_finish_listen_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.accept"] + unsafe extern "C" fn export_method_tcp_socket_accept(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_accept_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.local-address"] + unsafe extern "C" fn export_method_tcp_socket_local_address(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_local_address_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.remote-address"] + unsafe extern "C" fn export_method_tcp_socket_remote_address(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_remote_address_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.is-listening"] + unsafe extern "C" fn export_method_tcp_socket_is_listening(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_tcp_socket_is_listening_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.address-family"] + unsafe extern "C" fn export_method_tcp_socket_address_family(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_tcp_socket_address_family_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-listen-backlog-size"] + unsafe extern "C" fn export_method_tcp_socket_set_listen_backlog_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_listen_backlog_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-enabled"] + unsafe extern "C" fn export_method_tcp_socket_keep_alive_enabled(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_keep_alive_enabled_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-enabled"] + unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_enabled(arg0: *mut u8,arg1: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_enabled_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-idle-time"] + unsafe extern "C" fn export_method_tcp_socket_keep_alive_idle_time(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_keep_alive_idle_time_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-idle-time"] + unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_idle_time(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_idle_time_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-interval"] + unsafe extern "C" fn export_method_tcp_socket_keep_alive_interval(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_keep_alive_interval_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-interval"] + unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_interval(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_interval_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.keep-alive-count"] + unsafe extern "C" fn export_method_tcp_socket_keep_alive_count(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_keep_alive_count_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-keep-alive-count"] + unsafe extern "C" fn export_method_tcp_socket_set_keep_alive_count(arg0: *mut u8,arg1: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_keep_alive_count_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.hop-limit"] + unsafe extern "C" fn export_method_tcp_socket_hop_limit(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-hop-limit"] + unsafe extern "C" fn export_method_tcp_socket_set_hop_limit(arg0: *mut u8,arg1: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.receive-buffer-size"] + unsafe extern "C" fn export_method_tcp_socket_receive_buffer_size(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-receive-buffer-size"] + unsafe extern "C" fn export_method_tcp_socket_set_receive_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.send-buffer-size"] + unsafe extern "C" fn export_method_tcp_socket_send_buffer_size(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.set-send-buffer-size"] + unsafe extern "C" fn export_method_tcp_socket_set_send_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_set_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.subscribe"] + unsafe extern "C" fn export_method_tcp_socket_subscribe(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_tcp_socket_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0) + } + #[export_name = "wasi:sockets/tcp@0.2.0#[method]tcp-socket.shutdown"] + unsafe extern "C" fn export_method_tcp_socket_shutdown(arg0: *mut u8,arg1: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_tcp_socket_shutdown_cabi::<<$ty as $($path_to_types)*::Guest>::TcpSocket>(arg0, arg1) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "wasi:sockets/tcp@0.2.0#[dtor]tcp-socket"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::TcpSocket::dtor::< + <$ty as $($path_to_types)*::Guest>::TcpSocket + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_wasi_sockets_tcp_0_2_0_cabi; + #[repr(align(8))] + struct _RetArea([::core::mem::MaybeUninit; 36]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 36]); + } + + #[allow(dead_code, clippy::all)] + pub mod udp { + #[used] + #[doc(hidden)] + #[cfg(target_arch = "wasm32")] + static __FORCE_SECTION_REF: fn() = + super::super::super::super::__link_custom_section_describing_imports; + use super::super::super::super::_rt; + pub type Pollable = super::super::super::super::wasi::io0_2_0::poll::Pollable; + pub type Network = super::super::super::super::wasi::sockets0_2_0::network::Network; + pub type ErrorCode = + super::super::super::super::wasi::sockets0_2_0::network::ErrorCode; + pub type IpSocketAddress = + super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress; + pub type IpAddressFamily = + super::super::super::super::wasi::sockets0_2_0::network::IpAddressFamily; + #[derive(Clone)] + pub struct IncomingDatagram { + pub data: _rt::Vec, + pub remote_address: IpSocketAddress, + } + impl ::core::fmt::Debug for IncomingDatagram { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("IncomingDatagram") + .field("data", &self.data) + .field("remote-address", &self.remote_address) + .finish() + } + } + #[derive(Clone)] + pub struct OutgoingDatagram { + pub data: _rt::Vec, + pub remote_address: Option, + } + impl ::core::fmt::Debug for OutgoingDatagram { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_struct("OutgoingDatagram") + .field("data", &self.data) + .field("remote-address", &self.remote_address) + .finish() + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct UdpSocket { + handle: _rt::Resource, + } + + type _UdpSocketRep = Option; + + impl UdpSocket { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `UdpSocket`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _UdpSocketRep = Some(val); + let ptr: *mut _UdpSocketRep = _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestUdpSocket` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _UdpSocketRep); + } + + fn as_ptr(&self) -> *mut _UdpSocketRep { + UdpSocket::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`UdpSocket`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct UdpSocketBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a UdpSocket>, + } + + impl<'a> UdpSocketBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _UdpSocketRep { + UdpSocket::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for UdpSocket { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]udp-socket"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct IncomingDatagramStream { + handle: _rt::Resource, + } + + type _IncomingDatagramStreamRep = Option; + + impl IncomingDatagramStream { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `IncomingDatagramStream`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _IncomingDatagramStreamRep = Some(val); + let ptr: *mut _IncomingDatagramStreamRep = + _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestIncomingDatagramStream` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _IncomingDatagramStreamRep); + } + + fn as_ptr( + &self, + ) -> *mut _IncomingDatagramStreamRep { + IncomingDatagramStream::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`IncomingDatagramStream`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct IncomingDatagramStreamBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a IncomingDatagramStream>, + } + + impl<'a> IncomingDatagramStreamBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _IncomingDatagramStreamRep { + IncomingDatagramStream::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for IncomingDatagramStream { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]incoming-datagram-stream"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[derive(Debug)] + #[repr(transparent)] + pub struct OutgoingDatagramStream { + handle: _rt::Resource, + } + + type _OutgoingDatagramStreamRep = Option; + + impl OutgoingDatagramStream { + /// Creates a new resource from the specified representation. + /// + /// This function will create a new resource handle by moving `val` onto + /// the heap and then passing that heap pointer to the component model to + /// create a handle. The owned handle is then returned as `OutgoingDatagramStream`. + pub fn new(val: T) -> Self { + Self::type_guard::(); + let val: _OutgoingDatagramStreamRep = Some(val); + let ptr: *mut _OutgoingDatagramStreamRep = + _rt::Box::into_raw(_rt::Box::new(val)); + unsafe { Self::from_handle(T::_resource_new(ptr.cast())) } + } + + /// Gets access to the underlying `T` which represents this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &*self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + /// Gets mutable access to the underlying `T` which represents this + /// resource. + pub fn get_mut(&mut self) -> &mut T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_mut().unwrap() + } + + /// Consumes this resource and returns the underlying `T`. + pub fn into_inner(self) -> T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.take().unwrap() + } + + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + Self { + handle: _rt::Resource::from_handle(handle), + } + } + + #[doc(hidden)] + pub fn take_handle(&self) -> u32 { + _rt::Resource::take_handle(&self.handle) + } + + #[doc(hidden)] + pub fn handle(&self) -> u32 { + _rt::Resource::handle(&self.handle) + } + + // It's theoretically possible to implement the `GuestOutgoingDatagramStream` trait twice + // so guard against using it with two different types here. + #[doc(hidden)] + fn type_guard() { + use core::any::TypeId; + static mut LAST_TYPE: Option = None; + unsafe { + assert!(!cfg!(target_feature = "threads")); + let id = TypeId::of::(); + match LAST_TYPE { + Some(ty) => assert!( + ty == id, + "cannot use two types with this resource type" + ), + None => LAST_TYPE = Some(id), + } + } + } + + #[doc(hidden)] + pub unsafe fn dtor(handle: *mut u8) { + Self::type_guard::(); + let _ = _rt::Box::from_raw(handle as *mut _OutgoingDatagramStreamRep); + } + + fn as_ptr( + &self, + ) -> *mut _OutgoingDatagramStreamRep { + OutgoingDatagramStream::type_guard::(); + T::_resource_rep(self.handle()).cast() + } + } + + /// A borrowed version of [`OutgoingDatagramStream`] which represents a borrowed value + /// with the lifetime `'a`. + #[derive(Debug)] + #[repr(transparent)] + pub struct OutgoingDatagramStreamBorrow<'a> { + rep: *mut u8, + _marker: core::marker::PhantomData<&'a OutgoingDatagramStream>, + } + + impl<'a> OutgoingDatagramStreamBorrow<'a> { + #[doc(hidden)] + pub unsafe fn lift(rep: usize) -> Self { + Self { + rep: rep as *mut u8, + _marker: core::marker::PhantomData, + } + } + + /// Gets access to the underlying `T` in this resource. + pub fn get(&self) -> &T { + let ptr = unsafe { &mut *self.as_ptr::() }; + ptr.as_ref().unwrap() + } + + // NB: mutable access is not allowed due to the component model allowing + // multiple borrows of the same resource. + + fn as_ptr(&self) -> *mut _OutgoingDatagramStreamRep { + OutgoingDatagramStream::type_guard::(); + self.rep.cast() + } + } + + unsafe impl _rt::WasmResource for OutgoingDatagramStream { + #[inline] + unsafe fn drop(_handle: u32) { + #[cfg(not(target_arch = "wasm32"))] + unreachable!(); + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-drop]outgoing-datagram-stream"] + fn drop(_: u32); + } + + drop(_handle); + } + } + } + + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_start_bind_cabi( + arg0: *mut u8, + arg1: i32, + arg2: i32, + arg3: i32, + arg4: i32, + arg5: i32, + arg6: i32, + arg7: i32, + arg8: i32, + arg9: i32, + arg10: i32, + arg11: i32, + arg12: i32, + arg13: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let handle0; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V1; + let v1 = match arg2 { + 0 => { + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; + V1::Ipv4(e1) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e1 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ + port: arg3 as u16, + flow_info: arg4 as u32, + address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), + scope_id: arg13 as u32, + }; + V1::Ipv6(e1) + } + }; + let result2 = T::start_bind( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + { + handle0 = super::super::super::super::wasi::sockets0_2_0::network::Network::from_handle(arg1 as u32); + &handle0 + }, + v1, + ); + let ptr3 = _RET_AREA.0.as_mut_ptr().cast::(); + match result2 { + Ok(_) => { + *ptr3.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr3.add(0).cast::() = (1i32) as u8; + *ptr3.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr3 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_finish_bind_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::finish_bind(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_stream_cabi( + arg0: *mut u8, + arg1: i32, + arg2: i32, + arg3: i32, + arg4: i32, + arg5: i32, + arg6: i32, + arg7: i32, + arg8: i32, + arg9: i32, + arg10: i32, + arg11: i32, + arg12: i32, + arg13: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result1 = T::stream( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + match arg1 { + 0 => None, + 1 => { + let e = { + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V0; + let v0 = match arg2 { + 0 => { + let e0 = super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ + port: arg3 as u16, + address: (arg4 as u8, arg5 as u8, arg6 as u8, arg7 as u8), + }; + V0::Ipv4(e0) + } + n => { + debug_assert_eq!(n, 1, "invalid enum discriminant"); + let e0 = super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ + port: arg3 as u16, + flow_info: arg4 as u32, + address: (arg5 as u16, arg6 as u16, arg7 as u16, arg8 as u16, arg9 as u16, arg10 as u16, arg11 as u16, arg12 as u16), + scope_id: arg13 as u32, + }; + V0::Ipv6(e0) + } + }; + + v0 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + ); + let ptr2 = _RET_AREA.0.as_mut_ptr().cast::(); + match result1 { + Ok(e) => { + *ptr2.add(0).cast::() = (0i32) as u8; + let (t3_0, t3_1) = e; + *ptr2.add(4).cast::() = (t3_0).take_handle() as i32; + *ptr2.add(8).cast::() = (t3_1).take_handle() as i32; + } + Err(e) => { + *ptr2.add(0).cast::() = (1i32) as u8; + *ptr2.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr2 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_local_address_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::local_address(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V6; + match e { + V6::Ipv4(e) => { + *ptr1.add(4).cast::() = (0i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; + let (t3_0, t3_1, t3_2, t3_3) = address2; + *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; + *ptr1.add(11).cast::() = (_rt::as_i32(t3_1)) as u8; + *ptr1.add(12).cast::() = (_rt::as_i32(t3_2)) as u8; + *ptr1.add(13).cast::() = (_rt::as_i32(t3_3)) as u8; + } + V6::Ipv6(e) => { + *ptr1.add(4).cast::() = (1i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; + *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); + let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; + *ptr1.add(16).cast::() = (_rt::as_i32(t5_0)) as u16; + *ptr1.add(18).cast::() = (_rt::as_i32(t5_1)) as u16; + *ptr1.add(20).cast::() = (_rt::as_i32(t5_2)) as u16; + *ptr1.add(22).cast::() = (_rt::as_i32(t5_3)) as u16; + *ptr1.add(24).cast::() = (_rt::as_i32(t5_4)) as u16; + *ptr1.add(26).cast::() = (_rt::as_i32(t5_5)) as u16; + *ptr1.add(28).cast::() = (_rt::as_i32(t5_6)) as u16; + *ptr1.add(30).cast::() = (_rt::as_i32(t5_7)) as u16; + *ptr1.add(32).cast::() = _rt::as_i32(scope_id4); + } + } + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_remote_address_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::remote_address(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V6; + match e { + V6::Ipv4(e) => { + *ptr1.add(4).cast::() = (0i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port2, address:address2, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port2)) as u16; + let (t3_0, t3_1, t3_2, t3_3) = address2; + *ptr1.add(10).cast::() = (_rt::as_i32(t3_0)) as u8; + *ptr1.add(11).cast::() = (_rt::as_i32(t3_1)) as u8; + *ptr1.add(12).cast::() = (_rt::as_i32(t3_2)) as u8; + *ptr1.add(13).cast::() = (_rt::as_i32(t3_3)) as u8; + } + V6::Ipv6(e) => { + *ptr1.add(4).cast::() = (1i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port4, flow_info:flow_info4, address:address4, scope_id:scope_id4, } = e; + *ptr1.add(8).cast::() = (_rt::as_i32(port4)) as u16; + *ptr1.add(12).cast::() = _rt::as_i32(flow_info4); + let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; + *ptr1.add(16).cast::() = (_rt::as_i32(t5_0)) as u16; + *ptr1.add(18).cast::() = (_rt::as_i32(t5_1)) as u16; + *ptr1.add(20).cast::() = (_rt::as_i32(t5_2)) as u16; + *ptr1.add(22).cast::() = (_rt::as_i32(t5_3)) as u16; + *ptr1.add(24).cast::() = (_rt::as_i32(t5_4)) as u16; + *ptr1.add(26).cast::() = (_rt::as_i32(t5_5)) as u16; + *ptr1.add(28).cast::() = (_rt::as_i32(t5_6)) as u16; + *ptr1.add(30).cast::() = (_rt::as_i32(t5_7)) as u16; + *ptr1.add(32).cast::() = _rt::as_i32(scope_id4); + } + } + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_address_family_cabi( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::address_family(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + result0.clone() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_unicast_hop_limit_cabi< + T: GuestUdpSocket, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::unicast_hop_limit(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(1).cast::() = (_rt::as_i32(e)) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_set_unicast_hop_limit_cabi< + T: GuestUdpSocket, + >( + arg0: *mut u8, + arg1: i32, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_unicast_hop_limit( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u8, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_receive_buffer_size_cabi< + T: GuestUdpSocket, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::receive_buffer_size(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_set_receive_buffer_size_cabi< + T: GuestUdpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_receive_buffer_size( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_send_buffer_size_cabi( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = + T::send_buffer_size(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_set_send_buffer_size_cabi< + T: GuestUdpSocket, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::set_send_buffer_size( + UdpSocketBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(_) => { + *ptr1.add(0).cast::() = (0i32) as u8; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(1).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_udp_socket_subscribe_cabi( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::subscribe(UdpSocketBorrow::lift(arg0 as u32 as usize).get()); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_incoming_datagram_stream_receive_cabi< + T: GuestIncomingDatagramStream, + >( + arg0: *mut u8, + arg1: i64, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::receive( + IncomingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), + arg1 as u64, + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + let vec9 = e; + let len9 = vec9.len(); + let layout9 = + _rt::alloc::Layout::from_size_align_unchecked(vec9.len() * 40, 4); + let result9 = if layout9.size() != 0 { + let ptr = _rt::alloc::alloc(layout9).cast::(); + if ptr.is_null() { + _rt::alloc::handle_alloc_error(layout9); + } + ptr + } else { + { + ::core::ptr::null_mut() + } + }; + for (i, e) in vec9.into_iter().enumerate() { + let base = result9.add(i * 40); + { + let IncomingDatagram { + data: data2, + remote_address: remote_address2, + } = e; + let vec3 = (data2).into_boxed_slice(); + let ptr3 = vec3.as_ptr().cast::(); + let len3 = vec3.len(); + ::core::mem::forget(vec3); + *base.add(4).cast::() = len3; + *base.add(0).cast::<*mut u8>() = ptr3.cast_mut(); + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V8; + match remote_address2 { + V8::Ipv4(e) => { + *base.add(8).cast::() = (0i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ port:port4, address:address4, } = e; + *base.add(12).cast::() = + (_rt::as_i32(port4)) as u16; + let (t5_0, t5_1, t5_2, t5_3) = address4; + *base.add(14).cast::() = (_rt::as_i32(t5_0)) as u8; + *base.add(15).cast::() = (_rt::as_i32(t5_1)) as u8; + *base.add(16).cast::() = (_rt::as_i32(t5_2)) as u8; + *base.add(17).cast::() = (_rt::as_i32(t5_3)) as u8; + } + V8::Ipv6(e) => { + *base.add(8).cast::() = (1i32) as u8; + let super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ port:port6, flow_info:flow_info6, address:address6, scope_id:scope_id6, } = e; + *base.add(12).cast::() = + (_rt::as_i32(port6)) as u16; + *base.add(16).cast::() = _rt::as_i32(flow_info6); + let (t7_0, t7_1, t7_2, t7_3, t7_4, t7_5, t7_6, t7_7) = + address6; + *base.add(20).cast::() = + (_rt::as_i32(t7_0)) as u16; + *base.add(22).cast::() = + (_rt::as_i32(t7_1)) as u16; + *base.add(24).cast::() = + (_rt::as_i32(t7_2)) as u16; + *base.add(26).cast::() = + (_rt::as_i32(t7_3)) as u16; + *base.add(28).cast::() = + (_rt::as_i32(t7_4)) as u16; + *base.add(30).cast::() = + (_rt::as_i32(t7_5)) as u16; + *base.add(32).cast::() = + (_rt::as_i32(t7_6)) as u16; + *base.add(34).cast::() = + (_rt::as_i32(t7_7)) as u16; + *base.add(36).cast::() = _rt::as_i32(scope_id6); + } + } + } + } + *ptr1.add(8).cast::() = len9; + *ptr1.add(4).cast::<*mut u8>() = result9; + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(4).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn __post_return_method_incoming_datagram_stream_receive< + T: GuestIncomingDatagramStream, + >( + arg0: *mut u8, + ) { + let l0 = i32::from(*arg0.add(0).cast::()); + match l0 { + 0 => { + let l4 = *arg0.add(4).cast::<*mut u8>(); + let l5 = *arg0.add(8).cast::(); + let base6 = l4; + let len6 = l5; + for i in 0..len6 { + let base = base6.add(i * 40); + { + let l1 = *base.add(0).cast::<*mut u8>(); + let l2 = *base.add(4).cast::(); + let base3 = l1; + let len3 = l2; + _rt::cabi_dealloc(base3, len3 * 1, 1); + } + } + _rt::cabi_dealloc(base6, len6 * 40, 4); + } + _ => (), + } + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_incoming_datagram_stream_subscribe_cabi< + T: GuestIncomingDatagramStream, + >( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::subscribe( + IncomingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), + ); + (result0).take_handle() as i32 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_outgoing_datagram_stream_check_send_cabi< + T: GuestOutgoingDatagramStream, + >( + arg0: *mut u8, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::check_send( + OutgoingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), + ); + let ptr1 = _RET_AREA.0.as_mut_ptr().cast::(); + match result0 { + Ok(e) => { + *ptr1.add(0).cast::() = (0i32) as u8; + *ptr1.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr1.add(0).cast::() = (1i32) as u8; + *ptr1.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr1 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_outgoing_datagram_stream_send_cabi< + T: GuestOutgoingDatagramStream, + >( + arg0: *mut u8, + arg1: *mut u8, + arg2: usize, + ) -> *mut u8 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let base22 = arg1; + let len22 = arg2; + let mut result22 = _rt::Vec::with_capacity(len22); + for i in 0..len22 { + let base = base22.add(i * 44); + let e22 = { + let l0 = *base.add(0).cast::<*mut u8>(); + let l1 = *base.add(4).cast::(); + let len2 = l1; + let l3 = i32::from(*base.add(8).cast::()); + + OutgoingDatagram { + data: _rt::Vec::from_raw_parts(l0.cast(), len2, len2), + remote_address: match l3 { + 0 => None, + 1 => { + let e = { + let l4 = i32::from(*base.add(12).cast::()); + use super::super::super::super::wasi::sockets0_2_0::network::IpSocketAddress as V21; + let v21 = match l4 { + 0 => { + let e21 = { + let l5 = + i32::from(*base.add(16).cast::()); + let l6 = + i32::from(*base.add(18).cast::()); + let l7 = + i32::from(*base.add(19).cast::()); + let l8 = + i32::from(*base.add(20).cast::()); + let l9 = + i32::from(*base.add(21).cast::()); + + super::super::super::super::wasi::sockets0_2_0::network::Ipv4SocketAddress{ + port: l5 as u16, + address: (l6 as u8, l7 as u8, l8 as u8, l9 as u8), + } + }; + V21::Ipv4(e21) + } + n => { + debug_assert_eq!( + n, 1, + "invalid enum discriminant" + ); + let e21 = { + let l10 = + i32::from(*base.add(16).cast::()); + let l11 = *base.add(20).cast::(); + let l12 = + i32::from(*base.add(24).cast::()); + let l13 = + i32::from(*base.add(26).cast::()); + let l14 = + i32::from(*base.add(28).cast::()); + let l15 = + i32::from(*base.add(30).cast::()); + let l16 = + i32::from(*base.add(32).cast::()); + let l17 = + i32::from(*base.add(34).cast::()); + let l18 = + i32::from(*base.add(36).cast::()); + let l19 = + i32::from(*base.add(38).cast::()); + let l20 = *base.add(40).cast::(); + + super::super::super::super::wasi::sockets0_2_0::network::Ipv6SocketAddress{ + port: l10 as u16, + flow_info: l11 as u32, + address: (l12 as u16, l13 as u16, l14 as u16, l15 as u16, l16 as u16, l17 as u16, l18 as u16, l19 as u16), + scope_id: l20 as u32, + } + }; + V21::Ipv6(e21) + } + }; + + v21 + }; + Some(e) + } + _ => _rt::invalid_enum_discriminant(), + }, + } + }; + result22.push(e22); + } + _rt::cabi_dealloc(base22, len22 * 44, 4); + let result23 = T::send( + OutgoingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), + result22, + ); + let ptr24 = _RET_AREA.0.as_mut_ptr().cast::(); + match result23 { + Ok(e) => { + *ptr24.add(0).cast::() = (0i32) as u8; + *ptr24.add(8).cast::() = _rt::as_i64(e); + } + Err(e) => { + *ptr24.add(0).cast::() = (1i32) as u8; + *ptr24.add(8).cast::() = (e.clone() as i32) as u8; + } + }; + ptr24 + } + #[doc(hidden)] + #[allow(non_snake_case)] + pub unsafe fn _export_method_outgoing_datagram_stream_subscribe_cabi< + T: GuestOutgoingDatagramStream, + >( + arg0: *mut u8, + ) -> i32 { + #[cfg(target_arch = "wasm32")] + _rt::run_ctors_once(); + let result0 = T::subscribe( + OutgoingDatagramStreamBorrow::lift(arg0 as u32 as usize).get(), + ); + (result0).take_handle() as i32 + } + pub trait Guest { + type UdpSocket: GuestUdpSocket; + type IncomingDatagramStream: GuestIncomingDatagramStream; + type OutgoingDatagramStream: GuestOutgoingDatagramStream; + } + pub trait GuestUdpSocket: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-new]udp-socket"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-rep]udp-socket"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + fn start_bind( + &self, + network: &Network, + local_address: IpSocketAddress, + ) -> Result<(), ErrorCode>; + fn finish_bind(&self) -> Result<(), ErrorCode>; + fn stream( + &self, + remote_address: Option, + ) -> Result<(IncomingDatagramStream, OutgoingDatagramStream), ErrorCode>; + fn local_address(&self) -> Result; + fn remote_address(&self) -> Result; + fn address_family(&self) -> IpAddressFamily; + fn unicast_hop_limit(&self) -> Result; + fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode>; + fn receive_buffer_size(&self) -> Result; + fn set_receive_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + fn send_buffer_size(&self) -> Result; + fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode>; + fn subscribe(&self) -> Pollable; + } + pub trait GuestIncomingDatagramStream: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-new]incoming-datagram-stream"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-rep]incoming-datagram-stream"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + fn receive( + &self, + max_results: u64, + ) -> Result<_rt::Vec, ErrorCode>; + fn subscribe(&self) -> Pollable; + } + pub trait GuestOutgoingDatagramStream: 'static { + #[doc(hidden)] + unsafe fn _resource_new(val: *mut u8) -> u32 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = val; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-new]outgoing-datagram-stream"] + fn new(_: *mut u8) -> u32; + } + new(val) + } + } + + #[doc(hidden)] + fn _resource_rep(handle: u32) -> *mut u8 + where + Self: Sized, + { + #[cfg(not(target_arch = "wasm32"))] + { + let _ = handle; + unreachable!(); + } + + #[cfg(target_arch = "wasm32")] + { + #[link(wasm_import_module = "[export]wasi:sockets/udp@0.2.0")] + extern "C" { + #[link_name = "[resource-rep]outgoing-datagram-stream"] + fn rep(_: u32) -> *mut u8; + } + unsafe { rep(handle) } + } + } + + fn check_send(&self) -> Result; + fn send(&self, datagrams: _rt::Vec) + -> Result; + fn subscribe(&self) -> Pollable; + } + #[doc(hidden)] + + macro_rules! __export_wasi_sockets_udp_0_2_0_cabi{ + ($ty:ident with_types_in $($path_to_types:tt)*) => (const _: () = { + + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.start-bind"] + unsafe extern "C" fn export_method_udp_socket_start_bind(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_start_bind_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.finish-bind"] + unsafe extern "C" fn export_method_udp_socket_finish_bind(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_finish_bind_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.stream"] + unsafe extern "C" fn export_method_udp_socket_stream(arg0: *mut u8,arg1: i32,arg2: i32,arg3: i32,arg4: i32,arg5: i32,arg6: i32,arg7: i32,arg8: i32,arg9: i32,arg10: i32,arg11: i32,arg12: i32,arg13: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_stream_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.local-address"] + unsafe extern "C" fn export_method_udp_socket_local_address(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_local_address_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.remote-address"] + unsafe extern "C" fn export_method_udp_socket_remote_address(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_remote_address_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.address-family"] + unsafe extern "C" fn export_method_udp_socket_address_family(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_udp_socket_address_family_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.unicast-hop-limit"] + unsafe extern "C" fn export_method_udp_socket_unicast_hop_limit(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_unicast_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.set-unicast-hop-limit"] + unsafe extern "C" fn export_method_udp_socket_set_unicast_hop_limit(arg0: *mut u8,arg1: i32,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_set_unicast_hop_limit_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.receive-buffer-size"] + unsafe extern "C" fn export_method_udp_socket_receive_buffer_size(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.set-receive-buffer-size"] + unsafe extern "C" fn export_method_udp_socket_set_receive_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_set_receive_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.send-buffer-size"] + unsafe extern "C" fn export_method_udp_socket_send_buffer_size(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.set-send-buffer-size"] + unsafe extern "C" fn export_method_udp_socket_set_send_buffer_size(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_udp_socket_set_send_buffer_size_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0, arg1) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]udp-socket.subscribe"] + unsafe extern "C" fn export_method_udp_socket_subscribe(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_udp_socket_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::UdpSocket>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.receive"] + unsafe extern "C" fn export_method_incoming_datagram_stream_receive(arg0: *mut u8,arg1: i64,) -> *mut u8 { + $($path_to_types)*::_export_method_incoming_datagram_stream_receive_cabi::<<$ty as $($path_to_types)*::Guest>::IncomingDatagramStream>(arg0, arg1) + } + #[export_name = "cabi_post_wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.receive"] + unsafe extern "C" fn _post_return_method_incoming_datagram_stream_receive(arg0: *mut u8,) { + $($path_to_types)*::__post_return_method_incoming_datagram_stream_receive::<<$ty as $($path_to_types)*::Guest>::IncomingDatagramStream>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]incoming-datagram-stream.subscribe"] + unsafe extern "C" fn export_method_incoming_datagram_stream_subscribe(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_incoming_datagram_stream_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::IncomingDatagramStream>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.check-send"] + unsafe extern "C" fn export_method_outgoing_datagram_stream_check_send(arg0: *mut u8,) -> *mut u8 { + $($path_to_types)*::_export_method_outgoing_datagram_stream_check_send_cabi::<<$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream>(arg0) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.send"] + unsafe extern "C" fn export_method_outgoing_datagram_stream_send(arg0: *mut u8,arg1: *mut u8,arg2: usize,) -> *mut u8 { + $($path_to_types)*::_export_method_outgoing_datagram_stream_send_cabi::<<$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream>(arg0, arg1, arg2) + } + #[export_name = "wasi:sockets/udp@0.2.0#[method]outgoing-datagram-stream.subscribe"] + unsafe extern "C" fn export_method_outgoing_datagram_stream_subscribe(arg0: *mut u8,) -> i32 { + $($path_to_types)*::_export_method_outgoing_datagram_stream_subscribe_cabi::<<$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream>(arg0) + } + + const _: () = { + #[doc(hidden)] + #[export_name = "wasi:sockets/udp@0.2.0#[dtor]udp-socket"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::UdpSocket::dtor::< + <$ty as $($path_to_types)*::Guest>::UdpSocket + >(rep) + } + }; + + + const _: () = { + #[doc(hidden)] + #[export_name = "wasi:sockets/udp@0.2.0#[dtor]incoming-datagram-stream"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::IncomingDatagramStream::dtor::< + <$ty as $($path_to_types)*::Guest>::IncomingDatagramStream + >(rep) + } + }; + + + const _: () = { + #[doc(hidden)] + #[export_name = "wasi:sockets/udp@0.2.0#[dtor]outgoing-datagram-stream"] + #[allow(non_snake_case)] + unsafe extern "C" fn dtor(rep: *mut u8) { + $($path_to_types)*::OutgoingDatagramStream::dtor::< + <$ty as $($path_to_types)*::Guest>::OutgoingDatagramStream + >(rep) + } + }; + + };); +} + #[doc(hidden)] + pub(crate) use __export_wasi_sockets_udp_0_2_0_cabi; + #[repr(align(8))] + struct _RetArea([::core::mem::MaybeUninit; 36]); + static mut _RET_AREA: _RetArea = _RetArea([::core::mem::MaybeUninit::uninit(); 36]); + } + } + } +} +mod _rt { + + use core::fmt; + use core::marker; + use core::sync::atomic::{AtomicU32, Ordering::Relaxed}; + + /// A type which represents a component model resource, either imported or + /// exported into this component. + /// + /// This is a low-level wrapper which handles the lifetime of the resource + /// (namely this has a destructor). The `T` provided defines the component model + /// intrinsics that this wrapper uses. + /// + /// One of the chief purposes of this type is to provide `Deref` implementations + /// to access the underlying data when it is owned. + /// + /// This type is primarily used in generated code for exported and imported + /// resources. + #[repr(transparent)] + pub struct Resource { + // NB: This would ideally be `u32` but it is not. The fact that this has + // interior mutability is not exposed in the API of this type except for the + // `take_handle` method which is supposed to in theory be private. + // + // This represents, almost all the time, a valid handle value. When it's + // invalid it's stored as `u32::MAX`. + handle: AtomicU32, + _marker: marker::PhantomData, + } + + /// A trait which all wasm resources implement, namely providing the ability to + /// drop a resource. + /// + /// This generally is implemented by generated code, not user-facing code. + #[allow(clippy::missing_safety_doc)] + pub unsafe trait WasmResource { + /// Invokes the `[resource-drop]...` intrinsic. + unsafe fn drop(handle: u32); + } + + impl Resource { + #[doc(hidden)] + pub unsafe fn from_handle(handle: u32) -> Self { + debug_assert!(handle != u32::MAX); + Self { + handle: AtomicU32::new(handle), + _marker: marker::PhantomData, + } + } + + /// Takes ownership of the handle owned by `resource`. + /// + /// Note that this ideally would be `into_handle` taking `Resource` by + /// ownership. The code generator does not enable that in all situations, + /// unfortunately, so this is provided instead. + /// + /// Also note that `take_handle` is in theory only ever called on values + /// owned by a generated function. For example a generated function might + /// take `Resource` as an argument but then call `take_handle` on a + /// reference to that argument. In that sense the dynamic nature of + /// `take_handle` should only be exposed internally to generated code, not + /// to user code. + #[doc(hidden)] + pub fn take_handle(resource: &Resource) -> u32 { + resource.handle.swap(u32::MAX, Relaxed) + } + + #[doc(hidden)] + pub fn handle(resource: &Resource) -> u32 { + resource.handle.load(Relaxed) + } + } + + impl fmt::Debug for Resource { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("Resource") + .field("handle", &self.handle) + .finish() + } + } + + impl Drop for Resource { + fn drop(&mut self) { + unsafe { + match self.handle.load(Relaxed) { + // If this handle was "taken" then don't do anything in the + // destructor. + u32::MAX => {} + + // ... but otherwise do actually destroy it with the imported + // component model intrinsic as defined through `T`. + other => T::drop(other), + } + } + } + } + pub use alloc_crate::string::String; + pub use alloc_crate::vec::Vec; + pub unsafe fn string_lift(bytes: Vec) -> String { + if cfg!(debug_assertions) { + String::from_utf8(bytes).unwrap() + } else { + String::from_utf8_unchecked(bytes) + } + } + pub unsafe fn bool_lift(val: u8) -> bool { + if cfg!(debug_assertions) { + match val { + 0 => false, + 1 => true, + _ => panic!("invalid bool discriminant"), + } + } else { + val != 0 + } + } + pub use alloc_crate::alloc; + + pub fn as_i64(t: T) -> i64 { + t.as_i64() + } + + pub trait AsI64 { + fn as_i64(self) -> i64; + } + + impl<'a, T: Copy + AsI64> AsI64 for &'a T { + fn as_i64(self) -> i64 { + (*self).as_i64() + } + } + + impl AsI64 for i64 { + #[inline] + fn as_i64(self) -> i64 { + self as i64 + } + } + + impl AsI64 for u64 { + #[inline] + fn as_i64(self) -> i64 { + self as i64 + } + } + pub unsafe fn invalid_enum_discriminant() -> T { + if cfg!(debug_assertions) { + panic!("invalid enum discriminant") + } else { + core::hint::unreachable_unchecked() + } + } + + pub fn as_i32(t: T) -> i32 { + t.as_i32() + } + + pub trait AsI32 { + fn as_i32(self) -> i32; + } + + impl<'a, T: Copy + AsI32> AsI32 for &'a T { + fn as_i32(self) -> i32 { + (*self).as_i32() + } + } + + impl AsI32 for i32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u32 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u16 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for i8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for u8 { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for char { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + + impl AsI32 for usize { + #[inline] + fn as_i32(self) -> i32 { + self as i32 + } + } + pub 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); + } + + #[cfg(target_arch = "wasm32")] + pub fn run_ctors_once() { + wit_bindgen_rt::run_ctors_once(); + } + pub use alloc_crate::boxed::Box; + + pub fn as_f32(t: T) -> f32 { + t.as_f32() + } + + pub trait AsF32 { + fn as_f32(self) -> f32; + } + + impl<'a, T: Copy + AsF32> AsF32 for &'a T { + fn as_f32(self) -> f32 { + (*self).as_f32() + } + } + + impl AsF32 for f32 { + #[inline] + fn as_f32(self) -> f32 { + self as f32 + } + } + + pub fn as_f64(t: T) -> f64 { + t.as_f64() + } + + pub trait AsF64 { + fn as_f64(self) -> f64; + } + + impl<'a, T: Copy + AsF64> AsF64 for &'a T { + fn as_f64(self) -> f64 { + (*self).as_f64() + } + } + + impl AsF64 for f64 { + #[inline] + fn as_f64(self) -> f64 { + self as f64 + } + } + extern crate alloc as alloc_crate; +} + +/// Generates `#[no_mangle]` functions to export the specified type as the +/// root implementation of all generated traits. +/// +/// For more information see the documentation of `wit_bindgen::generate!`. +/// +/// ```rust +/// # macro_rules! export{ ($($t:tt)*) => (); } +/// # trait Guest {} +/// struct MyType; +/// +/// impl Guest for MyType { +/// // ... +/// } +/// +/// export!(MyType); +/// ``` +#[allow(unused_macros)] +#[doc(hidden)] + +macro_rules! __export_deny_all_impl { + ($ty:ident) => (self::export!($ty with_types_in self);); + ($ty:ident with_types_in $($path_to_types_root:tt)*) => ( + $($path_to_types_root)*::exports::wasi::cli0_2_0::environment::__export_wasi_cli_environment_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::cli0_2_0::environment); + $($path_to_types_root)*::exports::wasi::filesystem0_2_0::preopens::__export_wasi_filesystem_preopens_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::filesystem0_2_0::preopens); + $($path_to_types_root)*::exports::wasi::http0_2_0::outgoing_handler::__export_wasi_http_outgoing_handler_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::http0_2_0::outgoing_handler); + $($path_to_types_root)*::exports::wasi::sockets0_2_0::ip_name_lookup::__export_wasi_sockets_ip_name_lookup_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::sockets0_2_0::ip_name_lookup); + $($path_to_types_root)*::exports::wasi::sockets0_2_0::tcp::__export_wasi_sockets_tcp_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::sockets0_2_0::tcp); + $($path_to_types_root)*::exports::wasi::sockets0_2_0::udp::__export_wasi_sockets_udp_0_2_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::wasi::sockets0_2_0::udp); + $($path_to_types_root)*::exports::fermyon::spin::llm::__export_fermyon_spin_llm_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::llm); + $($path_to_types_root)*::exports::fermyon::spin::redis::__export_fermyon_spin_redis_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::redis); + $($path_to_types_root)*::exports::fermyon::spin::mqtt::__export_fermyon_spin_mqtt_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::mqtt); + $($path_to_types_root)*::exports::fermyon::spin::rdbms_types::__export_fermyon_spin_rdbms_types_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::rdbms_types); + $($path_to_types_root)*::exports::fermyon::spin::postgres::__export_fermyon_spin_postgres_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::postgres); + $($path_to_types_root)*::exports::fermyon::spin::mysql::__export_fermyon_spin_mysql_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::mysql); + $($path_to_types_root)*::exports::fermyon::spin::sqlite::__export_fermyon_spin_sqlite_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::sqlite); + $($path_to_types_root)*::exports::fermyon::spin::key_value::__export_fermyon_spin_key_value_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::key_value); + $($path_to_types_root)*::exports::fermyon::spin::variables::__export_fermyon_spin_variables_2_0_0_cabi!($ty with_types_in $($path_to_types_root)*::exports::fermyon::spin::variables); + ) +} +#[doc(inline)] +pub(crate) use __export_deny_all_impl as export; + +#[cfg(target_arch = "wasm32")] +#[link_section = "component-type:wit-bindgen:0.25.0:deny-all:encoded world"] +#[doc(hidden)] +pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 18084] = *b"\ +\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xa4\x8c\x01\x01A\x02\ +\x01AB\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\0\x01B\x0a\ +\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]po\ +llable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\ +\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\x01\x12wa\ +si:io/poll@0.2.0\x05\x01\x02\x03\0\0\x05error\x02\x03\0\x01\x08pollable\x01B(\x02\ +\x03\x02\x01\x02\x04\0\x05error\x03\0\0\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\ +\0\x02\x01i\x01\x01q\x02\x15last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0c\ +stream-error\x03\0\x05\x04\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\ +\x01h\x07\x01p}\x01j\x01\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19\ +[method]input-stream.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\x04\x01B\x05\x01r\x02\x07secondsw\x0bn\ +anosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\x04\0\x0a\ +resolution\x01\x02\x03\x01\x1cwasi:clocks/wall-clock@0.2.0\x05\x05\x02\x03\0\x02\ +\x0cinput-stream\x02\x03\0\x02\x0doutput-stream\x02\x03\0\x02\x05error\x02\x03\0\ +\x03\x08datetime\x01Br\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\0\x02\x03\ +\x02\x01\x07\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x05error\ +\x03\0\x04\x02\x03\x02\x01\x09\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08filesiz\ +e\x03\0\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09directory\ +\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-type\x03\ +\0\x0a\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-sync\x14\ +requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\x0c\x01\ +n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\x09dire\ +ctory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0alink-\ +count\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\x15d\ +ata-access-timestamp\x14\x1bdata-modification-timestamp\x14\x17status-change-tim\ +estamp\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\x04\ +names\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07alrea\ +dy\x0ebad-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-large\x15\ +illegal-byte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-direc\ +tory\x04loop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09no-device\x08\ +no-entry\x07no-lock\x13insufficient-memory\x12insufficient-space\x0dnot-director\ +y\x09not-empty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-such-device\x08\ +overflow\x0dnot-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file-busy\ +\x0ccross-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequential\x06\ +random\x09will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01r\x02\x05\ +lowerw\x05upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescriptor\x03\x01\ +\x04\0\x16directory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\x1c\x01@\x02\ +\x04self#\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-stream\x01&\x01i\x03\ +\x01j\x01'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[method]descriptor.w\ +rite-via-stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]descriptor.append-via-st\ +ream\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[m\ +ethod]descriptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\x04self#\0.\x04\0\x1c\ +[method]descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01@\x01\x04self#\00\x04\0\ +\x1b[method]descriptor.get-type\x011\x01@\x02\x04self#\x04size\x09\0+\x04\0\x1b[\ +method]descriptor.set-size\x012\x01@\x03\x04self#\x15data-access-timestamp\x18\x1b\ +data-modification-timestamp\x18\0+\x04\0\x1c[method]descriptor.set-times\x013\x01\ +p}\x01o\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#\ +\x06buffer4\x06offset\x09\08\x04\0\x18[method]descriptor.write\x019\x01i\"\x01j\x01\ +:\x01\x1c\x01@\x01\x04self#\0;\x04\0![method]descriptor.read-directory\x01<\x04\0\ +\x17[method]descriptor.sync\x01-\x01@\x02\x04self#\x04paths\0+\x04\0&[method]des\ +criptor.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\x04\ +paths\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\x08\ +old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a[method]descriptor.link-at\ +\x01B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0apath-flags\x0f\x04paths\x0a\ +open-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]descriptor.open-at\x01E\x01\ +j\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\0\x1e[method]descriptor.re\ +adlink-at\x01G\x04\0&[method]descriptor.remove-directory-at\x01=\x01@\x04\x04sel\ +f#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1c[method]descriptor.r\ +ename-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-paths\0+\x04\0\x1d[method]de\ +scriptor.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\x0a\x01B\x0f\x02\x03\x02\x01\x03\x04\0\x08pollab\ +le\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\x01i\x01\x01\ +@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\x01\x09\x01@\x01\x04when\x05\0\ +\x08\x04\0\x12subscribe-duration\x01\x0a\x03\x01!wasi:clocks/monotonic-clock@0.2\ +.0\x05\x0b\x02\x03\0\x05\x08duration\x01B\xc0\x01\x02\x03\x02\x01\x0c\x04\0\x08d\ +uration\x03\0\0\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01\ +\x07\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\x01\x02\x04\0\x08io-error\x03\0\ +\x06\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\x08\x01q\x0a\x03get\0\0\x04head\ +\0\0\x04post\0\0\x03put\0\0\x06delete\0\0\x07connect\0\0\x07options\0\0\x05trace\ +\0\0\x05patch\0\0\x05other\x01s\0\x04\0\x06method\x03\0\x0a\x01q\x03\x04HTTP\0\0\ +\x05HTTPS\0\0\x05other\x01s\0\x04\0\x06scheme\x03\0\x0c\x01ks\x01k{\x01r\x02\x05\ +rcode\x0e\x09info-code\x0f\x04\0\x11DNS-error-payload\x03\0\x10\x01k}\x01r\x02\x08\ +alert-id\x12\x0dalert-message\x0e\x04\0\x1aTLS-alert-received-payload\x03\0\x13\x01\ +ky\x01r\x02\x0afield-name\x0e\x0afield-size\x15\x04\0\x12field-size-payload\x03\0\ +\x16\x01kw\x01k\x17\x01q'\x0bDNS-timeout\0\0\x09DNS-error\x01\x11\0\x15destinati\ +on-not-found\0\0\x17destination-unavailable\0\0\x19destination-IP-prohibited\0\0\ +\x19destination-IP-unroutable\0\0\x12connection-refused\0\0\x15connection-termin\ +ated\0\0\x12connection-timeout\0\0\x17connection-read-timeout\0\0\x18connection-\ +write-timeout\0\0\x18connection-limit-reached\0\0\x12TLS-protocol-error\0\0\x15T\ +LS-certificate-error\0\0\x12TLS-alert-received\x01\x14\0\x13HTTP-request-denied\0\ +\0\x1cHTTP-request-length-required\0\0\x16HTTP-request-body-size\x01\x18\0\x1bHT\ +TP-request-method-invalid\0\0\x18HTTP-request-URI-invalid\0\0\x19HTTP-request-UR\ +I-too-long\0\0\x20HTTP-request-header-section-size\x01\x15\0\x18HTTP-request-hea\ +der-size\x01\x19\0!HTTP-request-trailer-section-size\x01\x15\0\x19HTTP-request-t\ +railer-size\x01\x17\0\x18HTTP-response-incomplete\0\0!HTTP-response-header-secti\ +on-size\x01\x15\0\x19HTTP-response-header-size\x01\x17\0\x17HTTP-response-body-s\ +ize\x01\x18\0\"HTTP-response-trailer-section-size\x01\x15\0\x1aHTTP-response-tra\ +iler-size\x01\x17\0\x1dHTTP-response-transfer-coding\x01\x0e\0\x1cHTTP-response-\ +content-coding\x01\x0e\0\x15HTTP-response-timeout\0\0\x13HTTP-upgrade-failed\0\0\ +\x13HTTP-protocol-error\0\0\x0dloop-detected\0\0\x13configuration-error\0\0\x0ei\ +nternal-error\x01\x0e\0\x04\0\x0aerror-code\x03\0\x1a\x01q\x03\x0einvalid-syntax\ +\0\0\x09forbidden\0\0\x09immutable\0\0\x04\0\x0cheader-error\x03\0\x1c\x01s\x04\0\ +\x09field-key\x03\0\x1e\x01p}\x04\0\x0bfield-value\x03\0\x20\x04\0\x06fields\x03\ +\x01\x04\0\x07headers\x03\0\"\x04\0\x08trailers\x03\0\"\x04\0\x10incoming-reques\ +t\x03\x01\x04\0\x10outgoing-request\x03\x01\x04\0\x0frequest-options\x03\x01\x04\ +\0\x11response-outparam\x03\x01\x01{\x04\0\x0bstatus-code\x03\0)\x04\0\x11incomi\ +ng-response\x03\x01\x04\0\x0dincoming-body\x03\x01\x04\0\x0ffuture-trailers\x03\x01\ +\x04\0\x11outgoing-response\x03\x01\x04\0\x0doutgoing-body\x03\x01\x04\0\x18futu\ +re-incoming-response\x03\x01\x01i\"\x01@\0\01\x04\0\x13[constructor]fields\x012\x01\ +o\x02\x1f!\x01p3\x01j\x011\x01\x1d\x01@\x01\x07entries4\05\x04\0\x18[static]fiel\ +ds.from-list\x016\x01h\"\x01p!\x01@\x02\x04self7\x04name\x1f\08\x04\0\x12[method\ +]fields.get\x019\x01@\x02\x04self7\x04name\x1f\0\x7f\x04\0\x12[method]fields.has\ +\x01:\x01j\0\x01\x1d\x01@\x03\x04self7\x04name\x1f\x05value8\0;\x04\0\x12[method\ +]fields.set\x01<\x01@\x02\x04self7\x04name\x1f\0;\x04\0\x15[method]fields.delete\ +\x01=\x01@\x03\x04self7\x04name\x1f\x05value!\0;\x04\0\x15[method]fields.append\x01\ +>\x01@\x01\x04self7\04\x04\0\x16[method]fields.entries\x01?\x01@\x01\x04self7\01\ +\x04\0\x14[method]fields.clone\x01@\x01h%\x01@\x01\x04self\xc1\0\0\x0b\x04\0\x1f\ +[method]incoming-request.method\x01B\x01@\x01\x04self\xc1\0\0\x0e\x04\0([method]\ +incoming-request.path-with-query\x01C\x01k\x0d\x01@\x01\x04self\xc1\0\0\xc4\0\x04\ +\0\x1f[method]incoming-request.scheme\x01E\x04\0\"[method]incoming-request.autho\ +rity\x01C\x01i#\x01@\x01\x04self\xc1\0\0\xc6\0\x04\0\x20[method]incoming-request\ +.headers\x01G\x01i,\x01j\x01\xc8\0\0\x01@\x01\x04self\xc1\0\0\xc9\0\x04\0\x20[me\ +thod]incoming-request.consume\x01J\x01i&\x01@\x01\x07headers\xc6\0\0\xcb\0\x04\0\ +\x1d[constructor]outgoing-request\x01L\x01h&\x01i/\x01j\x01\xce\0\0\x01@\x01\x04\ +self\xcd\0\0\xcf\0\x04\0\x1d[method]outgoing-request.body\x01P\x01@\x01\x04self\xcd\ +\0\0\x0b\x04\0\x1f[method]outgoing-request.method\x01Q\x01j\0\0\x01@\x02\x04self\ +\xcd\0\x06method\x0b\0\xd2\0\x04\0#[method]outgoing-request.set-method\x01S\x01@\ +\x01\x04self\xcd\0\0\x0e\x04\0([method]outgoing-request.path-with-query\x01T\x01\ +@\x02\x04self\xcd\0\x0fpath-with-query\x0e\0\xd2\0\x04\0,[method]outgoing-reques\ +t.set-path-with-query\x01U\x01@\x01\x04self\xcd\0\0\xc4\0\x04\0\x1f[method]outgo\ +ing-request.scheme\x01V\x01@\x02\x04self\xcd\0\x06scheme\xc4\0\0\xd2\0\x04\0#[me\ +thod]outgoing-request.set-scheme\x01W\x04\0\"[method]outgoing-request.authority\x01\ +T\x01@\x02\x04self\xcd\0\x09authority\x0e\0\xd2\0\x04\0&[method]outgoing-request\ +.set-authority\x01X\x01@\x01\x04self\xcd\0\0\xc6\0\x04\0\x20[method]outgoing-req\ +uest.headers\x01Y\x01i'\x01@\0\0\xda\0\x04\0\x1c[constructor]request-options\x01\ +[\x01h'\x01k\x01\x01@\x01\x04self\xdc\0\0\xdd\0\x04\0'[method]request-options.co\ +nnect-timeout\x01^\x01@\x02\x04self\xdc\0\x08duration\xdd\0\0\xd2\0\x04\0+[metho\ +d]request-options.set-connect-timeout\x01_\x04\0*[method]request-options.first-b\ +yte-timeout\x01^\x04\0.[method]request-options.set-first-byte-timeout\x01_\x04\0\ +-[method]request-options.between-bytes-timeout\x01^\x04\01[method]request-option\ +s.set-between-bytes-timeout\x01_\x01i(\x01i.\x01j\x01\xe1\0\x01\x1b\x01@\x02\x05\ +param\xe0\0\x08response\xe2\0\x01\0\x04\0\x1d[static]response-outparam.set\x01c\x01\ +h+\x01@\x01\x04self\xe4\0\0*\x04\0\x20[method]incoming-response.status\x01e\x01@\ +\x01\x04self\xe4\0\0\xc6\0\x04\0![method]incoming-response.headers\x01f\x01@\x01\ +\x04self\xe4\0\0\xc9\0\x04\0![method]incoming-response.consume\x01g\x01h,\x01i\x03\ +\x01j\x01\xe9\0\0\x01@\x01\x04self\xe8\0\0\xea\0\x04\0\x1c[method]incoming-body.\ +stream\x01k\x01i-\x01@\x01\x04this\xc8\0\0\xec\0\x04\0\x1c[static]incoming-body.\ +finish\x01m\x01h-\x01i\x09\x01@\x01\x04self\xee\0\0\xef\0\x04\0![method]future-t\ +railers.subscribe\x01p\x01i$\x01k\xf1\0\x01j\x01\xf2\0\x01\x1b\x01j\x01\xf3\0\0\x01\ +k\xf4\0\x01@\x01\x04self\xee\0\0\xf5\0\x04\0\x1b[method]future-trailers.get\x01v\ +\x01@\x01\x07headers\xc6\0\0\xe1\0\x04\0\x1e[constructor]outgoing-response\x01w\x01\ +h.\x01@\x01\x04self\xf8\0\0*\x04\0%[method]outgoing-response.status-code\x01y\x01\ +@\x02\x04self\xf8\0\x0bstatus-code*\0\xd2\0\x04\0)[method]outgoing-response.set-\ +status-code\x01z\x01@\x01\x04self\xf8\0\0\xc6\0\x04\0![method]outgoing-response.\ +headers\x01{\x01@\x01\x04self\xf8\0\0\xcf\0\x04\0\x1e[method]outgoing-response.b\ +ody\x01|\x01h/\x01i\x05\x01j\x01\xfe\0\0\x01@\x01\x04self\xfd\0\0\xff\0\x04\0\x1b\ +[method]outgoing-body.write\x01\x80\x01\x01j\0\x01\x1b\x01@\x02\x04this\xce\0\x08\ +trailers\xf2\0\0\x81\x01\x04\0\x1c[static]outgoing-body.finish\x01\x82\x01\x01h0\ +\x01@\x01\x04self\x83\x01\0\xef\0\x04\0*[method]future-incoming-response.subscri\ +be\x01\x84\x01\x01i+\x01j\x01\x85\x01\x01\x1b\x01j\x01\x86\x01\0\x01k\x87\x01\x01\ +@\x01\x04self\x83\x01\0\x88\x01\x04\0$[method]future-incoming-response.get\x01\x89\ +\x01\x01h\x07\x01k\x1b\x01@\x01\x03err\x8a\x01\0\x8b\x01\x04\0\x0fhttp-error-cod\ +e\x01\x8c\x01\x03\x01\x15wasi:http/types@0.2.0\x05\x0d\x01B\x11\x04\0\x07network\ +\x03\x01\x01m\x15\x07unknown\x0daccess-denied\x0dnot-supported\x10invalid-argume\ +nt\x0dout-of-memory\x07timeout\x14concurrency-conflict\x0fnot-in-progress\x0bwou\ +ld-block\x0dinvalid-state\x10new-socket-limit\x14address-not-bindable\x0eaddress\ +-in-use\x12remote-unreachable\x12connection-refused\x10connection-reset\x12conne\ +ction-aborted\x12datagram-too-large\x11name-unresolvable\x1atemporary-resolver-f\ +ailure\x1apermanent-resolver-failure\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04i\ +pv4\x04ipv6\x04\0\x11ip-address-family\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-addr\ +ess\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{\x07addr\ +ess\x06\x04\0\x13ipv4-socket-address\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07\ +address\x08\x08scope-idy\x04\0\x13ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\ +\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\x11ip-socket-address\x03\0\x0f\x03\x01\x1awas\ +i:sockets/network@0.2.0\x05\x0e\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0f\ +get-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\x04\x01\x1awasi:cli/environment@0.2.0\x05\ +\x0f\x02\x03\0\x04\x0adescriptor\x01B\x07\x02\x03\x02\x01\x10\x04\0\x0adescripto\ +r\x03\0\0\x01i\x01\x01o\x02\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\ +\x05\x04\x01\x1ewasi:filesystem/preopens@0.2.0\x05\x11\x02\x03\0\x06\x10outgoing\ +-request\x02\x03\0\x06\x0frequest-options\x02\x03\0\x06\x18future-incoming-respo\ +nse\x02\x03\0\x06\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x12\x04\0\x10outgoing-r\ +equest\x03\0\0\x02\x03\x02\x01\x13\x04\0\x0frequest-options\x03\0\x02\x02\x03\x02\ +\x01\x14\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01\x15\x04\0\x0a\ +error-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01\ +@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x04\x01\x20was\ +i:http/outgoing-handler@0.2.0\x05\x16\x02\x03\0\x07\x07network\x02\x03\0\x07\x0a\ +error-code\x02\x03\0\x07\x0aip-address\x01B\x16\x02\x03\x02\x01\x03\x04\0\x08pol\ +lable\x03\0\0\x02\x03\x02\x01\x17\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x18\ +\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01\x19\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-addres\ +s\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]resolve-address-stre\ +am.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\x02\x07network\x0f\ +\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x04\x01!wasi:sockets/ip-name-\ +lookup@0.2.0\x05\x1a\x02\x03\0\x07\x11ip-socket-address\x02\x03\0\x07\x11ip-addr\ +ess-family\x01BT\x02\x03\x02\x01\x06\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\ +\x07\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\ +\x04\x02\x03\x02\x01\x0c\x04\0\x08duration\x03\0\x06\x02\x03\x02\x01\x17\x04\0\x07\ +network\x03\0\x08\x02\x03\x02\x01\x18\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01\ +\x1b\x04\0\x11ip-socket-address\x03\0\x0c\x02\x03\x02\x01\x1c\x04\0\x11ip-addres\ +s-family\x03\0\x0e\x01m\x03\x07receive\x04send\x04both\x04\0\x0dshutdown-type\x03\ +\0\x10\x04\0\x0atcp-socket\x03\x01\x01h\x12\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04\ +self\x13\x07network\x14\x0dlocal-address\x0d\0\x15\x04\0\x1d[method]tcp-socket.s\ +tart-bind\x01\x16\x01@\x01\x04self\x13\0\x15\x04\0\x1e[method]tcp-socket.finish-\ +bind\x01\x17\x01@\x03\x04self\x13\x07network\x14\x0eremote-address\x0d\0\x15\x04\ +\0\x20[method]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-socket.finish\ +-connect\x01\x1d\x04\0\x1f[method]tcp-socket.start-listen\x01\x17\x04\0\x20[meth\ +od]tcp-socket.finish-listen\x01\x17\x01i\x12\x01o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\ +\x0b\x01@\x01\x04self\x13\0\x20\x04\0\x19[method]tcp-socket.accept\x01!\x01j\x01\ +\x0d\x01\x0b\x01@\x01\x04self\x13\0\"\x04\0\x20[method]tcp-socket.local-address\x01\ +#\x04\0![method]tcp-socket.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]tc\ +p-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\x04self\x13\ +\0'\x04\0%[method]tcp-socket.keep-alive-enabled\x01(\x01@\x02\x04self\x13\x05val\ +ue\x7f\0\x15\x04\0)[method]tcp-socket.set-keep-alive-enabled\x01)\x01j\x01\x07\x01\ +\x0b\x01@\x01\x04self\x13\0*\x04\0'[method]tcp-socket.keep-alive-idle-time\x01+\x01\ +@\x02\x04self\x13\x05value\x07\0\x15\x04\0+[method]tcp-socket.set-keep-alive-idl\ +e-time\x01,\x04\0&[method]tcp-socket.keep-alive-interval\x01+\x04\0*[method]tcp-\ +socket.set-keep-alive-interval\x01,\x01j\x01y\x01\x0b\x01@\x01\x04self\x13\0-\x04\ +\0#[method]tcp-socket.keep-alive-count\x01.\x01@\x02\x04self\x13\x05valuey\0\x15\ +\x04\0'[method]tcp-socket.set-keep-alive-count\x01/\x01j\x01}\x01\x0b\x01@\x01\x04\ +self\x13\00\x04\0\x1c[method]tcp-socket.hop-limit\x011\x01@\x02\x04self\x13\x05v\ +alue}\0\x15\x04\0\x20[method]tcp-socket.set-hop-limit\x012\x01j\x01w\x01\x0b\x01\ +@\x01\x04self\x13\03\x04\0&[method]tcp-socket.receive-buffer-size\x014\x04\0*[me\ +thod]tcp-socket.set-receive-buffer-size\x01&\x04\0#[method]tcp-socket.send-buffe\ +r-size\x014\x04\0'[method]tcp-socket.set-send-buffer-size\x01&\x01i\x05\x01@\x01\ +\x04self\x13\05\x04\0\x1c[method]tcp-socket.subscribe\x016\x01@\x02\x04self\x13\x0d\ +shutdown-type\x11\0\x15\x04\0\x1b[method]tcp-socket.shutdown\x017\x04\x01\x16was\ +i:sockets/tcp@0.2.0\x05\x1d\x01BD\x02\x03\x02\x01\x03\x04\0\x08pollable\x03\0\0\x02\ +\x03\x02\x01\x17\x04\0\x07network\x03\0\x02\x02\x03\x02\x01\x18\x04\0\x0aerror-c\ +ode\x03\0\x04\x02\x03\x02\x01\x1b\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\ +\x01\x1c\x04\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremo\ +te-address\x07\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\ +\x0eremote-address\x0d\x04\0\x11outgoing-datagram\x03\0\x0e\x04\0\x0audp-socket\x03\ +\x01\x04\0\x18incoming-datagram-stream\x03\x01\x04\0\x18outgoing-datagram-stream\ +\x03\x01\x01h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0d\ +local-address\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04\ +self\x13\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\ +\x01o\x02\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\ +\0\x1b\x04\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04\ +self\x13\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]u\ +dp-socket.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-so\ +cket.address-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[\ +method]udp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\ +\0([method]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04\ +self\x13\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\ +\x05valuew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[me\ +thod]udp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-s\ +ize\x01%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01\ +'\x01h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0\ +([method]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[metho\ +d]incoming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[m\ +ethod]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09dat\ +agrams/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\ +\x04\0*[method]outgoing-datagram-stream.subscribe\x011\x04\x01\x16wasi:sockets/u\ +dp@0.2.0\x05\x1e\x01B\x1a\x01s\x04\0\x11inferencing-model\x03\0\0\x01r\x06\x0ama\ +x-tokensy\x0erepeat-penaltyv!repeat-penalty-last-n-token-county\x0btemperaturev\x05\ +top-ky\x05top-pv\x04\0\x12inferencing-params\x03\0\x02\x01q\x03\x13model-not-sup\ +ported\0\0\x0druntime-error\x01s\0\x0dinvalid-input\x01s\0\x04\0\x05error\x03\0\x04\ +\x01r\x02\x12prompt-token-county\x15generated-token-county\x04\0\x11inferencing-\ +usage\x03\0\x06\x01r\x02\x04texts\x05usage\x07\x04\0\x12inferencing-result\x03\0\ +\x08\x01s\x04\0\x0fembedding-model\x03\0\x0a\x01r\x01\x12prompt-token-county\x04\ +\0\x10embeddings-usage\x03\0\x0c\x01pv\x01p\x0e\x01r\x02\x0aembeddings\x0f\x05us\ +age\x0d\x04\0\x11embeddings-result\x03\0\x10\x01k\x03\x01j\x01\x09\x01\x05\x01@\x03\ +\x05model\x01\x06prompts\x06params\x12\0\x13\x04\0\x05infer\x01\x14\x01ps\x01j\x01\ +\x11\x01\x05\x01@\x02\x05model\x0b\x04text\x15\0\x16\x04\0\x13generate-embedding\ +s\x01\x17\x04\x01\x16fermyon:spin/llm@2.0.0\x05\x1f\x01B)\x01q\x04\x0finvalid-ad\ +dress\0\0\x14too-many-connections\0\0\x0atype-error\0\0\x05other\x01s\0\x04\0\x05\ +error\x03\0\0\x04\0\x0aconnection\x03\x01\x01p}\x04\0\x07payload\x03\0\x03\x01q\x02\ +\x05int64\x01x\0\x06binary\x01\x04\0\x04\0\x0fredis-parameter\x03\0\x05\x01q\x04\ +\x03nil\0\0\x06status\x01s\0\x05int64\x01x\0\x06binary\x01\x04\0\x04\0\x0credis-\ +result\x03\0\x07\x01i\x02\x01j\x01\x09\x01\x01\x01@\x01\x07addresss\0\x0a\x04\0\x17\ +[static]connection.open\x01\x0b\x01h\x02\x01j\0\x01\x01\x01@\x03\x04self\x0c\x07\ +channels\x07payload\x04\0\x0d\x04\0\x1a[method]connection.publish\x01\x0e\x01k\x04\ +\x01j\x01\x0f\x01\x01\x01@\x02\x04self\x0c\x03keys\0\x10\x04\0\x16[method]connec\ +tion.get\x01\x11\x01@\x03\x04self\x0c\x03keys\x05value\x04\0\x0d\x04\0\x16[metho\ +d]connection.set\x01\x12\x01j\x01x\x01\x01\x01@\x02\x04self\x0c\x03keys\0\x13\x04\ +\0\x17[method]connection.incr\x01\x14\x01ps\x01j\x01y\x01\x01\x01@\x02\x04self\x0c\ +\x04keys\x15\0\x16\x04\0\x16[method]connection.del\x01\x17\x01@\x03\x04self\x0c\x03\ +keys\x06values\x15\0\x16\x04\0\x17[method]connection.sadd\x01\x18\x01j\x01\x15\x01\ +\x01\x01@\x02\x04self\x0c\x03keys\0\x19\x04\0\x1b[method]connection.smembers\x01\ +\x1a\x04\0\x17[method]connection.srem\x01\x18\x01p\x06\x01p\x08\x01j\x01\x1c\x01\ +\x01\x01@\x03\x04self\x0c\x07commands\x09arguments\x1b\0\x1d\x04\0\x1a[method]co\ +nnection.execute\x01\x1e\x04\x01\x18fermyon:spin/redis@2.0.0\x05\x20\x01B\x0f\x01\ +q\x04\x0finvalid-address\0\0\x14too-many-connections\0\0\x11connection-failed\x01\ +s\0\x05other\x01s\0\x04\0\x05error\x03\0\0\x01m\x03\x0cat-most-once\x0dat-least-\ +once\x0cexactly-once\x04\0\x03qos\x03\0\x02\x04\0\x0aconnection\x03\x01\x01p}\x04\ +\0\x07payload\x03\0\x05\x01i\x04\x01j\x01\x07\x01\x01\x01@\x04\x07addresss\x08us\ +ernames\x08passwords\x1bkeep-alive-interval-in-secsw\0\x08\x04\0\x17[static]conn\ +ection.open\x01\x09\x01h\x04\x01j\0\x01\x01\x01@\x04\x04self\x0a\x05topics\x07pa\ +yload\x06\x03qos\x03\0\x0b\x04\0\x1a[method]connection.publish\x01\x0c\x04\x01\x17\ +fermyon:spin/mqtt@2.0.0\x05!\x01B\x11\x01q\x05\x11connection-failed\x01s\0\x0dba\ +d-parameter\x01s\0\x0cquery-failed\x01s\0\x17value-conversion-failed\x01s\0\x05o\ +ther\x01s\0\x04\0\x05error\x03\0\0\x01m\x0e\x07boolean\x04int8\x05int16\x05int32\ +\x05int64\x05uint8\x06uint16\x06uint32\x06uint64\x0afloating32\x0afloating64\x03\ +str\x06binary\x05other\x04\0\x0cdb-data-type\x03\0\x02\x01p}\x01q\x0f\x07boolean\ +\x01\x7f\0\x04int8\x01~\0\x05int16\x01|\0\x05int32\x01z\0\x05int64\x01x\0\x05uin\ +t8\x01}\0\x06uint16\x01{\0\x06uint32\x01y\0\x06uint64\x01w\0\x0afloating32\x01v\0\ +\x0afloating64\x01u\0\x03str\x01s\0\x06binary\x01\x04\0\x07db-null\0\0\x0bunsupp\ +orted\0\0\x04\0\x08db-value\x03\0\x05\x01q\x0e\x07boolean\x01\x7f\0\x04int8\x01~\ +\0\x05int16\x01|\0\x05int32\x01z\0\x05int64\x01x\0\x05uint8\x01}\0\x06uint16\x01\ +{\0\x06uint32\x01y\0\x06uint64\x01w\0\x0afloating32\x01v\0\x0afloating64\x01u\0\x03\ +str\x01s\0\x06binary\x01\x04\0\x07db-null\0\0\x04\0\x0fparameter-value\x03\0\x07\ +\x01r\x02\x04names\x09data-type\x03\x04\0\x06column\x03\0\x09\x01p\x06\x04\0\x03\ +row\x03\0\x0b\x01p\x0a\x01p\x0c\x01r\x02\x07columns\x0d\x04rows\x0e\x04\0\x07row\ +-set\x03\0\x0f\x04\x01\x1efermyon:spin/rdbms-types@2.0.0\x05\"\x02\x03\0\x11\x0f\ +parameter-value\x02\x03\0\x11\x07row-set\x02\x03\0\x11\x05error\x01B\x13\x02\x03\ +\x02\x01#\x04\0\x0fparameter-value\x03\0\0\x02\x03\x02\x01$\x04\0\x07row-set\x03\ +\0\x02\x02\x03\x02\x01%\x04\0\x05error\x03\0\x04\x04\0\x0aconnection\x03\x01\x01\ +i\x06\x01j\x01\x07\x01\x05\x01@\x01\x07addresss\0\x08\x04\0\x17[static]connectio\ +n.open\x01\x09\x01h\x06\x01p\x01\x01j\x01\x03\x01\x05\x01@\x03\x04self\x0a\x09st\ +atements\x06params\x0b\0\x0c\x04\0\x18[method]connection.query\x01\x0d\x01j\x01w\ +\x01\x05\x01@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0e\x04\0\x1a[method\ +]connection.execute\x01\x0f\x04\x01\x1bfermyon:spin/postgres@2.0.0\x05&\x01B\x13\ +\x02\x03\x02\x01#\x04\0\x0fparameter-value\x03\0\0\x02\x03\x02\x01$\x04\0\x07row\ +-set\x03\0\x02\x02\x03\x02\x01%\x04\0\x05error\x03\0\x04\x04\0\x0aconnection\x03\ +\x01\x01i\x06\x01j\x01\x07\x01\x05\x01@\x01\x07addresss\0\x08\x04\0\x17[static]c\ +onnection.open\x01\x09\x01h\x06\x01p\x01\x01j\x01\x03\x01\x05\x01@\x03\x04self\x0a\ +\x09statements\x06params\x0b\0\x0c\x04\0\x18[method]connection.query\x01\x0d\x01\ +j\0\x01\x05\x01@\x03\x04self\x0a\x09statements\x06params\x0b\0\x0e\x04\0\x1a[met\ +hod]connection.execute\x01\x0f\x04\x01\x18fermyon:spin/mysql@2.0.0\x05'\x01B\x15\ +\x04\0\x0aconnection\x03\x01\x01q\x05\x10no-such-database\0\0\x0daccess-denied\0\ +\0\x12invalid-connection\0\0\x0ddatabase-full\0\0\x02io\x01s\0\x04\0\x05error\x03\ +\0\x01\x01p}\x01q\x05\x07integer\x01x\0\x04real\x01u\0\x04text\x01s\0\x04blob\x01\ +\x03\0\x04null\0\0\x04\0\x05value\x03\0\x04\x01p\x05\x01r\x01\x06values\x06\x04\0\ +\x0arow-result\x03\0\x07\x01ps\x01p\x08\x01r\x02\x07columns\x09\x04rows\x0a\x04\0\ +\x0cquery-result\x03\0\x0b\x01i\0\x01j\x01\x0d\x01\x02\x01@\x01\x08databases\0\x0e\ +\x04\0\x17[static]connection.open\x01\x0f\x01h\0\x01j\x01\x0c\x01\x02\x01@\x03\x04\ +self\x10\x09statements\x0aparameters\x06\0\x11\x04\0\x1a[method]connection.execu\ +te\x01\x12\x04\x01\x19fermyon:spin/sqlite@2.0.0\x05(\x01B\x19\x04\0\x05store\x03\ +\x01\x01q\x04\x10store-table-full\0\0\x0dno-such-store\0\0\x0daccess-denied\0\0\x05\ +other\x01s\0\x04\0\x05error\x03\0\x01\x01i\0\x01j\x01\x03\x01\x02\x01@\x01\x05la\ +bels\0\x04\x04\0\x12[static]store.open\x01\x05\x01h\0\x01p}\x01k\x07\x01j\x01\x08\ +\x01\x02\x01@\x02\x04self\x06\x03keys\0\x09\x04\0\x11[method]store.get\x01\x0a\x01\ +j\0\x01\x02\x01@\x03\x04self\x06\x03keys\x05value\x07\0\x0b\x04\0\x11[method]sto\ +re.set\x01\x0c\x01@\x02\x04self\x06\x03keys\0\x0b\x04\0\x14[method]store.delete\x01\ +\x0d\x01j\x01\x7f\x01\x02\x01@\x02\x04self\x06\x03keys\0\x0e\x04\0\x14[method]st\ +ore.exists\x01\x0f\x01ps\x01j\x01\x10\x01\x02\x01@\x01\x04self\x06\0\x11\x04\0\x16\ +[method]store.get-keys\x01\x12\x04\x01\x1cfermyon:spin/key-value@2.0.0\x05)\x01B\ +\x05\x01q\x04\x0cinvalid-name\x01s\0\x09undefined\x01s\0\x08provider\x01s\0\x05o\ +ther\x01s\0\x04\0\x05error\x03\0\0\x01j\x01s\x01\x01\x01@\x01\x04names\0\x02\x04\ +\0\x03get\x01\x03\x04\x01\x1cfermyon:spin/variables@2.0.0\x05*\x04\x01\x1afermyo\ +n:spin-virt/deny-all\x04\0\x0b\x0e\x01\0\x08deny-all\x03\0\0\0G\x09producers\x01\ +\x0cprocessed-by\x02\x0dwit-component\x070.208.1\x10wit-bindgen-rust\x060.25.0"; + +#[inline(never)] +#[doc(hidden)] +#[cfg(target_arch = "wasm32")] +pub fn __link_custom_section_describing_imports() { + wit_bindgen_rt::maybe_link_cabi_realloc(); +} diff --git a/crates/compose/deny-all/src/fermyon.rs b/crates/compose/deny-all/src/fermyon.rs new file mode 100644 index 0000000000..1e7bdc66df --- /dev/null +++ b/crates/compose/deny-all/src/fermyon.rs @@ -0,0 +1,217 @@ +use crate::bindings::exports::fermyon::spin::{ + key_value, + llm, + mqtt, + mysql, + postgres, + redis, + sqlite, + variables, +}; + +pub struct KeyValueStore; + +impl key_value::GuestStore for KeyValueStore { + fn open(_label: String) -> Result { + Err(key_value::Error::NoSuchStore) + } + + fn get(&self, _key: String) -> Result>, key_value::Error> { + unimplemented!() + } + + fn set(&self, _key: String, _value: Vec) -> Result<(), key_value::Error> { + unimplemented!() + } + + fn delete(&self, _key: String) -> Result<(), key_value::Error> { + unimplemented!() + } + + fn exists(&self, _key: String) -> Result { + unimplemented!() + } + + fn get_keys(&self) -> Result, key_value::Error> { + unimplemented!() + } +} + +impl key_value::Guest for crate::Component { + type Store = KeyValueStore; +} + +impl llm::Guest for crate::Component { + fn infer( + _model: llm::InferencingModel, + _prompt: String, + _params: Option, + ) -> Result { + Err(llm::Error::ModelNotSupported) + } + + fn generate_embeddings( + _model: llm::EmbeddingModel, + _text: Vec, + ) -> Result { + Err(llm::Error::ModelNotSupported) + } +} + +impl mqtt::GuestConnection for crate::Component { + fn open( + _address: String, + _username: String, + _password: String, + _keep_alive_interval_in_secs: u64, + ) -> Result { + Err(mqtt::Error::Other("Access Denied".to_string())) + } + + fn publish( + &self, + _topic: String, + _payload: mqtt::Payload, + _qos: mqtt::Qos, + ) -> Result<(), mqtt::Error> { + unimplemented!() + } +} + +impl mqtt::Guest for crate::Component { + type Connection = Self; +} + +impl mysql::GuestConnection for crate::Component { + fn open(_address: String) -> Result { + Err(mysql::Error::Other("Access Denied".to_string())) + } + + fn query( + &self, + _statement: String, + _params: Vec, + ) -> Result { + unimplemented!() + } + + fn execute( + &self, + _statement: String, + _params: Vec, + ) -> Result<(), mysql::Error> { + unimplemented!() + } +} + +impl mysql::Guest for crate::Component { + type Connection = Self; +} + +impl postgres::GuestConnection for crate::Component { + fn open(_address: String) -> Result { + Err(postgres::Error::Other("Access Denied".to_string())) + } + + fn query( + &self, + _statement: String, + _params: Vec, + ) -> Result { + unimplemented!() + } + + fn execute( + &self, + _statement: String, + _params: Vec, + ) -> Result { + unimplemented!() + } +} + +impl postgres::Guest for crate::Component { + type Connection = Self; +} + +impl redis::GuestConnection for crate::Component { + fn open(_address: String) -> Result { + Err(redis::Error::Other("Access Denied".to_string())) + } + + fn publish(&self, _channel: String, _payload: redis::Payload) -> Result<(), redis::Error> { + unimplemented!() + } + + fn get(&self, _key: String) -> Result, redis::Error> { + unimplemented!() + } + + fn set(&self, _key: String, _value: redis::Payload) -> Result<(), redis::Error> { + unimplemented!() + } + + fn incr(&self, _key: String) -> Result { + unimplemented!() + } + + fn del(&self, _keys: Vec) -> Result { + unimplemented!() + } + + fn sadd( + &self, + _key: String, + _values: Vec, + ) -> Result { + unimplemented!() + } + + fn smembers(&self, _key: String) -> Result, redis::Error> { + unimplemented!() + } + + fn srem( + &self, + _key: String, + _values: Vec, + ) -> Result { + unimplemented!() + } + + fn execute( + &self, + _command: String, + _arguments: Vec, + ) -> Result, redis::Error> { + unimplemented!() + } +} + +impl redis::Guest for crate::Component { + type Connection = Self; +} + +impl sqlite::GuestConnection for crate::Component { + fn open(_database: String) -> Result { + Err(sqlite::Error::NoSuchDatabase) + } + + fn execute( + &self, + _statement: String, + _parameters: Vec, + ) -> Result { + unimplemented!() + } +} + +impl sqlite::Guest for crate::Component { + type Connection = Self; +} + +impl variables::Guest for crate::Component { + fn get(name: String) -> Result { + Err(variables::Error::Undefined(name)) + } +} \ No newline at end of file diff --git a/crates/compose/deny-all/src/lib.rs b/crates/compose/deny-all/src/lib.rs new file mode 100644 index 0000000000..02058e5158 --- /dev/null +++ b/crates/compose/deny-all/src/lib.rs @@ -0,0 +1,10 @@ +#[allow(warnings)] +mod bindings; +#[allow(warnings)] +mod fermyon; +#[allow(warnings)] +mod wasi; + +struct Component; + +bindings::export!(Component with_types_in bindings); diff --git a/crates/compose/deny-all/src/wasi.rs b/crates/compose/deny-all/src/wasi.rs new file mode 100644 index 0000000000..3b2e6e7fe2 --- /dev/null +++ b/crates/compose/deny-all/src/wasi.rs @@ -0,0 +1,341 @@ +use crate::bindings::exports::wasi::{ + cli0_2_0 as cli, + filesystem0_2_0 as filesystem, + http0_2_0 as http, + sockets0_2_0 as sockets, +}; + +impl cli::environment::Guest for crate::Component { + fn get_environment() -> Vec<(String, String)> { + Vec::new() + } + + fn get_arguments() -> Vec { + Vec::new() + } + + fn initial_cwd() -> Option { + None + } +} + +impl filesystem::preopens::Guest for crate::Component { + fn get_directories() -> Vec<( + filesystem::preopens::Descriptor, + String, + )> { + Vec::new() + } +} + +impl http::outgoing_handler::Guest for crate::Component { + fn handle( + _request: http::outgoing_handler::OutgoingRequest, + _options: Option, + ) -> Result< + http::outgoing_handler::FutureIncomingResponse, + http::outgoing_handler::ErrorCode, + > { + Err(http::outgoing_handler::ErrorCode::InternalError(Some("Access denied".to_string()))) + } +} + +pub struct ResolveAddressStream; + +impl sockets::ip_name_lookup::GuestResolveAddressStream for ResolveAddressStream { + fn resolve_next_address( + &self, + ) -> Result, sockets::ip_name_lookup::ErrorCode> + { + unimplemented!() + } + fn subscribe(&self) -> sockets::ip_name_lookup::Pollable { + unimplemented!() + } +} + +impl sockets::ip_name_lookup::Guest for crate::Component { + type ResolveAddressStream = ResolveAddressStream; + + fn resolve_addresses( + network: &sockets::ip_name_lookup::Network, + name: String, + ) -> Result< + sockets::ip_name_lookup::ResolveAddressStream, + sockets::ip_name_lookup::ErrorCode, + > { + Err(sockets::ip_name_lookup::ErrorCode::AccessDenied) + } +} + +pub struct TcpSocket; + +impl sockets::tcp::GuestTcpSocket for TcpSocket { + fn start_bind( + &self, + network: &sockets::tcp::Network, + local_address: sockets::tcp::IpSocketAddress, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn finish_bind(&self) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn start_connect( + &self, + network: &sockets::tcp::Network, + remote_address: sockets::tcp::IpSocketAddress, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn finish_connect( + &self, + ) -> Result< + ( + sockets::tcp::InputStream, + sockets::tcp::OutputStream, + ), + sockets::tcp::ErrorCode, + > { + unimplemented!() + } + fn start_listen(&self) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn finish_listen(&self) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn accept( + &self, + ) -> Result< + ( + sockets::tcp::TcpSocket, + sockets::tcp::InputStream, + sockets::tcp::OutputStream, + ), + sockets::tcp::ErrorCode, + > { + unimplemented!() + } + fn local_address( + &self, + ) -> Result { + unimplemented!() + } + fn remote_address( + &self, + ) -> Result { + unimplemented!() + } + fn is_listening(&self) -> bool { + unimplemented!() + } + fn address_family(&self) -> sockets::tcp::IpAddressFamily { + unimplemented!() + } + fn set_listen_backlog_size( + &self, + value: u64, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn keep_alive_enabled(&self) -> Result { + unimplemented!() + } + fn set_keep_alive_enabled( + &self, + value: bool, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn keep_alive_idle_time( + &self, + ) -> Result< + sockets::tcp::Duration, + sockets::tcp::ErrorCode, + > { + unimplemented!() + } + fn set_keep_alive_idle_time( + &self, + value: sockets::tcp::Duration, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn keep_alive_interval( + &self, + ) -> Result< + sockets::tcp::Duration, + sockets::tcp::ErrorCode, + > { + unimplemented!() + } + fn set_keep_alive_interval( + &self, + value: sockets::tcp::Duration, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn keep_alive_count(&self) -> Result { + unimplemented!() + } + fn set_keep_alive_count( + &self, + value: u32, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn hop_limit(&self) -> Result { + unimplemented!() + } + fn set_hop_limit( + &self, + value: u8, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn receive_buffer_size(&self) -> Result { + unimplemented!() + } + fn set_receive_buffer_size( + &self, + value: u64, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn send_buffer_size(&self) -> Result { + unimplemented!() + } + fn set_send_buffer_size( + &self, + value: u64, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } + fn subscribe(&self) -> sockets::tcp::Pollable { + unimplemented!() + } + fn shutdown( + &self, + shutdown_type: sockets::tcp::ShutdownType, + ) -> Result<(), sockets::tcp::ErrorCode> { + unimplemented!() + } +} + +impl sockets::tcp::Guest for crate::Component { + type TcpSocket = TcpSocket; +} + +pub struct UdpSocket; + +impl sockets::udp::GuestUdpSocket for UdpSocket { + fn start_bind( + &self, + network: &sockets::udp::Network, + local_address: sockets::udp::IpSocketAddress, + ) -> Result<(), sockets::udp::ErrorCode> { + unimplemented!() + } + fn finish_bind(&self) -> Result<(), sockets::udp::ErrorCode> { + unimplemented!() + } + fn stream( + &self, + remote_address: Option, + ) -> Result< + ( + sockets::udp::IncomingDatagramStream, + sockets::udp::OutgoingDatagramStream, + ), + sockets::udp::ErrorCode, + > { + unimplemented!() + } + fn local_address( + &self, + ) -> Result< + sockets::udp::IpSocketAddress, + sockets::udp::ErrorCode, + > { + unimplemented!() + } + fn remote_address( + &self, + ) -> Result< + sockets::udp::IpSocketAddress, + sockets::udp::ErrorCode, + > { + unimplemented!() + } + fn address_family(&self) -> sockets::udp::IpAddressFamily { + unimplemented!() + } + fn unicast_hop_limit(&self) -> Result { + unimplemented!() + } + fn set_unicast_hop_limit( + &self, + value: u8, + ) -> Result<(), sockets::udp::ErrorCode> { + unimplemented!() + } + fn receive_buffer_size(&self) -> Result { + unimplemented!() + } + fn set_receive_buffer_size( + &self, + value: u64, + ) -> Result<(), sockets::udp::ErrorCode> { + unimplemented!() + } + fn send_buffer_size(&self) -> Result { + unimplemented!() + } + fn set_send_buffer_size( + &self, + value: u64, + ) -> Result<(), sockets::udp::ErrorCode> { + unimplemented!() + } + fn subscribe(&self) -> sockets::udp::Pollable { + unimplemented!() + } +} + +pub struct IncomingDatagramStream; + +impl sockets::udp::GuestIncomingDatagramStream for IncomingDatagramStream { + fn receive( + &self, + max_results: u64, + ) -> Result, sockets::udp::ErrorCode> { + unimplemented!() + } + fn subscribe(&self) -> sockets::udp::Pollable { + unimplemented!() + } +} + +pub struct OutgoingDatagramStream; + +impl sockets::udp::GuestOutgoingDatagramStream for OutgoingDatagramStream { + fn check_send(&self) -> Result { + unimplemented!() + } + fn send( + &self, + datagrams: Vec, + ) -> Result { + unimplemented!() + } + fn subscribe(&self) -> sockets::udp::Pollable { + unimplemented!() + } +} + +impl sockets::udp::Guest for crate::Component { + type UdpSocket = UdpSocket; + type IncomingDatagramStream = IncomingDatagramStream; + type OutgoingDatagramStream = OutgoingDatagramStream; +} \ No newline at end of file diff --git a/crates/compose/deny-all/wit/deps/fermyon/spin.wasm b/crates/compose/deny-all/wit/deps/fermyon/spin.wasm new file mode 100644 index 0000000000000000000000000000000000000000..8cfe6dc552a99c92060e16fb9466af827ce2c8ad GIT binary patch literal 88674 zcmeHw>yso&a#uvxtKZL=>3L60&(6-y?o`in=l13v+UdLFZej0k?{=j_+@5Z-tFpUt zx+=3ev#NV)SECg#fe;_~f?@mz7+?9w7Xd;DVUj=~Ob7`>7$1a;har%e%rFo?_jqJv zR@UtE&Q7O1v)ieTjPQu?@NoC=@NgGi(q9r%H2!u)KAe#|XR4x>45QeuNO@RY<)5vg zx7+hud!t@Yh@~)UC8Kt?#h>uE*KYes((3qO;CFNi%R~T>AIDK#5mE+1K9&_Z zBVU!Zp114w@VP41znu)dVbJ~#gW8S;ekg0QE9Bs*JZPZBEVY=aCVp?PUODi`iI}U3 zwQu+RVK?gNR{Q=?&dbMws#ct;wIi=L@*84dqD6uhi#fQcbs`J5;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9m? zO~Nqlj=;MD*6GL`sK;pTYj6Tn*RUB5@x9pPq?t?zUK*}mBfB;1oOv#!+^Iz51Yi{E z$xLm8`nD3a&|pd9erVB2_h-BjW24g*-6K)+jA;c<2+s9F>ls&2e2l_^i<@)ksWWOr hlaq`1iMx0h6Oao`F2V2wgOOf{1{?%#-QK?S{{eA!bYK7g literal 0 HcmV?d00001 diff --git a/crates/compose/deny-all/wit/deps/wasi/cli.wasm b/crates/compose/deny-all/wit/deps/wasi/cli.wasm new file mode 100644 index 0000000000000000000000000000000000000000..f59159da2cbf8332e761e155b66e83bf96eb8781 GIT binary patch literal 25083 zcmeHQTaVmEcCKo&Z*#xtZp+k+FOn^e#0S0z?7KX;x2D(@nNX z_OyBp!G9osBd>YNKS+?507`0mv$o6S1hCfr zuLgg*&QBqMrbyEyb+}VtjFJa(M6Z&QI^$$G49~F8UyVDMy_rmMd&J>aq%=UVnv@kZyP&jDS=G!1R)CK#X+@TY zQ4B8lff2MEDj>Jk*Ews-5vRr4|Gg4+QwqDfHKnwx?AIARMD$Jo5YG32bV_AjI@!tvY6MLLRN7)N<9aU%Jf=8#mM z6`}S4u|CfYorMEfpI?#YK7IQ8 z2{)YY4mbGecZ3z%$;(is3@bQ4b&ZGSd_X~on~7ncv&?00{>@0_gCzW0u$QFAdE$rS zY;sO6H;T{U`RgNx2H3aVd=>7uF1xDX>fquSu05O~1k>0lAX=PtHcWaKQ1UV7;~C~Q zq8P*@bRsysRUe=@(D;T4P#hC|@YB0=d`tFKfC6x4%I`Zs;e$3GzvR#P8gKC@4Jr7p zGZgWZt-I`omXaOkNJ;SxmmStVl@h|<_#{xi0npP0(3{IZXBW|!Z@m( zyX!s0|;5&TK(F=ANXt<*nDC=FsamT%Z=w0~JG|C0vLzrBWzuW00aZVBW z8ryf-t@`z9<$=qN>z^A5$%%dthkk!J$p-wOq;5HMHT8h11#>cKv^)mmQ)Jmu zjLbgH$${W!C!DCv7MjUbOz6akw9LqzUAC5rEE!HH_vLMw0daR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C zIl&?gbU?|H!Pq2IqPRc7sTFkWfeJUQk>#33uoO|Q&YMjE#PvgEpd@XCfS*553X+CG z3Rf$BnUwIfr5}U6oMcq|4V{+`I3Fng_#W}J&|U71Ao#Ta<~ld zY}VL>>fq*#!acU|f30wGeBxm6=E?En;}h@hhmV4jKm^{ylZTJ|lMnrekMI2t+fc7N literal 0 HcmV?d00001 diff --git a/crates/compose/deny-all/wit/deps/wasi/clocks.wasm b/crates/compose/deny-all/wit/deps/wasi/clocks.wasm new file mode 100644 index 0000000000000000000000000000000000000000..a39f020f7322308d9e6a068bebaae6ae7cd7920f GIT binary patch literal 3631 zcmdT{O>f&q5amjAoY)D{25o^BJ#5uOTR{R_SI&63oIljf_r)DU2inw@zw^X3g12s^zIuwe6V#)cd0h=sw`++>*; zWwOoM?AAFxXVuI-y-VXwl`>v@C>E zMz@2I-423w7__ySu`6`35e8d@v?eRbf^9Oz*liZhCKBdX!{B3Ej%-q>k?hr8*|o-C zgA8sh4VpM?D`a1J{7Gh#b32$CZJg06>G>OVI<4(bS#a~xZ^&@-H#TgsqYYNHHmyvI zPVH=43vKF)Ii)0=bZRPLPFbJ`KBd-rHm#6-xr$>ZvTO}Pu>BDWwwAZstzh%7HiaK< zvZJlFp0Ei*vCztF%z{6{;Iqe5=_V$9(zLB#NRiH2YhlHLS6PjyCg^a^SU!hsOX-l> z5RxBu<^SIL_FJ|7!?d^khW55Y_W5f6)igJSvlaisVEYE$%!dM=W4aVC4I zNo?@EqqLL7SR~SR4xe`}QI&3yUFWd#Xn1nW?=>vvcc{f&SuVIIJRjaa=HyGKGUd+j zOgdg#Sy(=m!j^^PG84I#X{?FW{aDBP*pY|TQzOXY_Im zQV={|K-4N?Srk&c%I_KspYp>6D5Sc`zDq|7iHLvl zT8ON237JVzP|7COO*(>G`FklfGDFU?8w9DJ;Q27Jt%0gRj)JUl} z0V86a7$j+PsG&z{7Tj_wIqxIfQip4yM$|hfxdU1F(?+D8@~X+cKOPGDXDAiw-D=1E z3W>Ez67Vx!kI=w-j}T`djOL94B3rEMMt3=47LM`*y$KI>p1xO@*V}`^_KgF!6_hW! z9XHRbd0o_DF{eWfD*MFn-+S-UmzCwx=c_grB)}{Y$1$}6Q~CO-03eNOf-#uY#7uL6 z($Uc>D&~cc3p2%(Q?Uh-Tkx^kOZ^TKXo|BUFvDfVXv|QSmw?Vf z{w~S{hS!V*0cgHzZQ>7sT@&`$M~gdrD$bD^QWsie<_tV1dd8hf{4h$CE+LCM-Kv+d z#-!n)fNM!2A_|hNMJ+g5s~p_=I)bIr`ANQ{7Krj;B$1%~n;O;vU5}-oCXJSQVkQ{M zdK_bI4N4*}urN>r@Ma8k!CZOZcVD^JJ8QJpT;n}!4>0v$_L zZG_io=PT9;SwrBkPAcI8U27GkM=MhJDo3)LlvANCDZqOx@a4=_k^wi~QifygRqHZs z-bI$F62#xaYc0(t8VNy|<}~U#Q4NcP=&H-BJYxvt ziY#%g;Vf+yhACZM`o{y2&BWZ|QNR*GF@ZZ#^XJ{X5y&B*IG5YQ!63(je&6I$pB1Le z`=&S>K*^Mr^uyp_|KQ*NsUI8+F7P%n_<8U2Vw9dH6Ol)I{fV1qUpsMjy1R24?VaxI z$NKRyp=AuI`!jW}a+xaOBhb}=EKjKs@4hsfe*VW&k?JniM)Pj5BA~;1;4u|`Jg_qw zR^(X;C0o9oK*8xRxOc7QWntNMd?lHaX>T-d-IyuYqvc>U$aV$qc2PfSe*n#nwYC5N literal 0 HcmV?d00001 diff --git a/crates/compose/deny-all/wit/deps/wasi/filesystem.wasm b/crates/compose/deny-all/wit/deps/wasi/filesystem.wasm new file mode 100644 index 0000000000000000000000000000000000000000..da8224d9b9dff256c04e483476aa811687183534 GIT binary patch literal 28760 zcmeHQ3v(OSb>1aGO4Q2_`IR`2jhu&^5|r#XZb~PuD2Z~|QlvssmeVjJEP(~FCa??d zE=0kZO#VZELH|oToz8To?X*9n(|^$KJLleg0U&9)X_}TZ_6P*-J@=e*&pq$E>-g#5 zs^dBr{`PHm?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eGnfnJQ}2#UD^!5m!S# z=+sH3*l}cCMicn&S`wA#>^2d+Y5L!$z)=UL+=yC`hD9desgwe{Cjm0fpCb1qeH1jp zj#9c~z@rDp;HsnXVZ1Ue?_!g7R$k;(Y6Dhn3ErH1*ZX940c|}}ar46Gm=!o|NCiNL zMuS`{tRf-KD`CR!7$pj6O;v{(sS6?~xsM75y&M1nsF0q(MsJCUM%ln^TJULO!DA!~ zfS`RiLhk3PPU}w!if>OhgJTdC5lXepn0saM8b)$m@_vmz@VZKZqtyzuX_X0}YK>YZ zTnwtjWnQv`A8c*8?f*DMvd;gpL80(kO<4(Q1q6594B1iqqRM;Lo4ue;obcik=4VjtV!PO~MMwjZ_USnp%O&|~Gz(bJ&yA4t8(*H@R zmvBUvb!i2!48-8xFODEYE={r$D%AwizAbJibcQZlrrxbZfGAY9c(q}WO-7{s^5pQR*A00w(aFnHw0^nw4}JcM>tyQpYVtnvs(_a=iR&xgSOxiA>My6Ie?iD zBSOoj56RI^vCT3js{d@ z_D{AhL1`dhwCZpBW*OYX@KZ>L~r%*Wy=izWSx!%~yM`e&v<_ E3tn5wX8-^I literal 0 HcmV?d00001 diff --git a/crates/compose/deny-all/wit/deps/wasi/io.wasm b/crates/compose/deny-all/wit/deps/wasi/io.wasm new file mode 100644 index 0000000000000000000000000000000000000000..c9ff4999603da9ca9b25cdc063477460acc2ec48 GIT binary patch literal 13985 zcmeHNYmXeqb?x3Ak$R9xWLtKEyh@7%-ZgfHE6Fxw>H#eU+u(;-1WkhpGJ(3cr)HBDea5)l){DyqY@5pb;|HwJ_R#kT|XGtm#CkUhu;%s+4Zr#VZ=icflZPvG=IJ)`w z@#$WCZ!(Eqvvpn7`*FOA;?LqqV~b@RHIwKs|8Z^GRkiphc|U8b>B63M=hLRG^YT32 zo5bJ0Oq={}Ufq!qpPkI!pPjrGz4cb?*Nmc@{}RhSZ%(4uH&s!jXNA48)jv<7ANsBQ zkXdch#Wvmx0>#m;QD;S!UBvtGCXP2-jNQvioM#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_p+?EbidBG*s`GZ%mw=L-rx7Wa;gIhZJv zBy!Gwl)gjL_cOH>7!*WnKqqp~-l~yz-UyTkYO#sk7?fztq5Lru${(li((HmyCi(!F zm(QX*29Oek^h^eupJvcYdk)@DnBaYgev`%zKwM{7RM+^MZv@Etlg-X1PlvxTAVqr) zwBeYbz7diB9fd4V(P4dzr*|{`LKGqjLy=f?C8JyO;)FrR zxP%rf2L0i7B<$SGf~nfVI2X}VOhlW@G#$mIlw+oMm5mN0p`l2CQ9sD;h7RZ$6qJdbTIkL~A9a|bW@AuoQV+^tnrOC;JI*73@ zNZ?&Cmc{|uqDLcRQINfRz*v_hh6TQvnPMSl3R`m#D}ub;L!nPoN(TG<$@yiz)M}N7 zSBQ(v_=#?0_X^J+jcHtPB(HLaVyZ>`trsIybA;g3GlQMl5q@gtX#g3+Px)_`K3_(8ry3qQ)G_JSg{ zuaq~MOnouZG?p+2#v70O$Z3z)Ilo3Z1RW`~tP&>RIfc-NWw3=5Pucyr4s2 zYa7$jA`^Dno^j3>$>sWujVtX|( + loader: &'a L, + component: &LockedComponent, +) -> anyhow::Result> { + Composer::new(loader).compose(component).await +} + +/// This trait is used to load component source code from a locked component source across various embdeddings. +#[async_trait::async_trait] +pub trait ComponentLoader { + async fn load_component( + &self, + source: &locked::LockedComponentSource, + ) -> anyhow::Result>; +} + +struct Composer<'a, L> { + graph: CompositionGraph, + loader: &'a L, +} + +impl<'a, L: ComponentLoader> Composer<'a, L> { + async fn compose(mut self, component: &LockedComponent) -> anyhow::Result> { + let source = self.loader.load_component(&component.source).await?; + + if component.dependencies.is_empty() { + return Ok(source); + } + + let (world_id, instantiation_id) = self.register_package(&component.id, None, source)?; + + let prepared = self.prepare_dependencies(world_id, component).await?; + + let arguments = self + .build_instantiation_arguments(world_id, prepared) + .await?; + + for (argument_name, argument) in arguments { + self.graph + .set_instantiation_argument(instantiation_id, &argument_name, argument)?; + } + + self.export_dependents_exports(world_id, instantiation_id)?; + + self.graph + .encode(Default::default()) + .with_context(|| "failed to encode composition graph") + .map(Into::into) + } + + fn new(loader: &'a L) -> Self { + Self { + graph: CompositionGraph::new(), + loader, + } + } + + async fn prepare_dependencies( + &mut self, + world_id: WorldId, + component: &LockedComponent, + ) -> anyhow::Result> { + let mut imports = self.graph.types()[world_id].imports.clone(); + + let mut prepared = IndexMap::new(); + + // TODO: collect and return conflicts + + for (dependency_name, dependency) in component.dependencies.iter() { + let import_keys = imports.keys().cloned().collect::>(); + + let mut matched = Vec::new(); + + for import_name in import_keys.iter() { + if dependency_name.matches_import(import_name) { + match imports.swap_remove(import_name) { + Some(_item) => { + matched.push(import_name.clone()); + break; + } + None => { + anyhow::bail!( + "import '{import_name}' of component '{component_id}' is already used by another dependency", + component_id = component.id, + ); + } + } + } + } + + if matched.is_empty() { + anyhow::bail!( + "dependency '{dependency_name}' doesn't match any imports of component '{component_id}'", + component_id = component.id, + ); + } + + let info = self + .register_dependency(dependency_name.clone(), dependency) + .await?; + + // Insert the expanded dependency name into the map detecting duplicates + for import_name in matched.into_iter() { + if let Some(previous_info) = prepared.insert(import_name.clone(), info.clone()) { + anyhow::bail!( + "component '{component_id}' dependency '{dependency_name}' introduces import '{import_name}' which conflicts with dependency '{previous_dependency_name}'", + component_id = component.id, + previous_dependency_name = previous_info.manifest_name, + ); + } + } + } + + Ok(prepared) + } + + async fn build_instantiation_arguments( + &mut self, + world_id: WorldId, + dependencies: IndexMap, + ) -> anyhow::Result> { + let mut cache = Default::default(); + let mut checker = SubtypeChecker::new(&mut cache); + + let mut arguments = IndexMap::new(); + + for (import_name, dependency_info) in dependencies { + let (export_name, export_ty) = match dependency_info.export_name { + Some(export_name) => { + let Some(export_ty) = self.graph.types()[dependency_info.world_id] + .exports + .get(&export_name) + else { + anyhow::bail!( + "dependency '{dependency_name}' doesn't export '{export_name}' to satisfy import '{import_name}'", + dependency_name = dependency_info.manifest_name, + ); + }; + + (export_name, export_ty) + } + None => { + let Some(export_ty) = self.graph.types()[dependency_info.world_id] + .exports + .get(&import_name) + else { + anyhow::bail!( + "dependency '{dependency_name}' doesn't export '{import_name}' to satisfy import '{import_name}'", + dependency_name = dependency_info.manifest_name, + ); + }; + + (import_name.clone(), export_ty) + } + }; + + let import_ty = self.graph.types()[world_id] + .imports + .get(&import_name) + .unwrap(); + + // Ensure that export_ty is a subtype of import_ty + checker.is_subtype( + *export_ty, + self.graph.types(), + *import_ty, + self.graph.types(), + ).with_context(|| { + format!( + "dependency '{dependency_name}' export '{export_name}' of type '{export_ty:?}' is not a subtype of import '{import_name}' of type '{import_ty:?}'", + dependency_name = dependency_info.manifest_name, + ) + })?; + + let export_id = self + .graph + .alias_instance_export(dependency_info.instantiation_id, &import_name)?; + + assert!(arguments.insert(import_name, export_id).is_none()); + } + + Ok(arguments) + } + + async fn register_dependency( + &mut self, + dependency_name: DependencyName, + dependency: &LockedComponentDependency, + ) -> anyhow::Result { + let mut dependency_source = self.loader.load_component(&dependency.source).await?; + + let package_name = dependency_name.package.to_string(); + + match dependency.inherit.as_ref() { + Some(InheritConfiguration::Some(_configurations)) => { + unreachable!("granular configuration inheritance is not yet supported"); + } + Some(InheritConfiguration::All) => { + // Do nothing, allow configuration to be inherited + } + None => { + // Configuration inheritance is disabled, apply deny_all adapter + dependency_source = apply_deny_all_adapter(&package_name, &dependency_source)?; + } + } + + let (world_id, instantiation_id) = + self.register_package(&package_name, None, dependency_source)?; + + Ok(DependencyInfo { + manifest_name: dependency_name, + instantiation_id, + world_id, + export_name: dependency.export.clone(), + }) + } + + fn register_package( + &mut self, + name: &str, + version: Option<&Version>, + source: impl Into>, + ) -> anyhow::Result<(WorldId, NodeId)> { + let package = Package::from_bytes(name, version, source, self.graph.types_mut())?; + let world_id = package.ty(); + let package_id = self.graph.register_package(package)?; + let instantiation_id = self.graph.instantiate(package_id); + + Ok((world_id, instantiation_id)) + } + + fn export_dependents_exports( + &mut self, + world_id: WorldId, + instantiation_id: NodeId, + ) -> anyhow::Result<()> { + // Export all exports from the root component + for export_name in self.graph.types()[world_id] + .exports + .keys() + .cloned() + .collect::>() + { + let export_id = self + .graph + .alias_instance_export(instantiation_id, &export_name)?; + + self.graph.export(export_id, &export_name)?; + } + + Ok(()) + } +} + +#[derive(Clone)] +struct DependencyInfo { + // The name of the dependency as it appears in the component's dependencies section. + // This is used to correlate errors when composing back to what was specified in the + // manifest. + manifest_name: DependencyName, + // The instantiation id for the dependency node. + instantiation_id: NodeId, + // The world id for the dependency node. + world_id: WorldId, + // Name of optional export to use to satisfy the dependency. + export_name: Option, +} + +fn apply_deny_all_adapter( + dependency_name: &str, + dependency_source: &[u8], +) -> anyhow::Result> { + const SPIN_VIRT_DENY_ALL_ADAPTER_BYTES: &[u8] = include_bytes!("../deny_all.wasm"); + let mut graph = CompositionGraph::new(); + + let dependency_package = + Package::from_bytes(dependency_name, None, dependency_source, graph.types_mut())?; + + let dependency_id = graph.register_package(dependency_package)?; + + let deny_adapter_package = Package::from_bytes( + "spin-virt-deny-all-adapter", + None, + SPIN_VIRT_DENY_ALL_ADAPTER_BYTES, + graph.types_mut(), + )?; + + let deny_adapter_id = graph.register_package(deny_adapter_package)?; + + match wac_graph::plug(&mut graph, vec![deny_adapter_id], dependency_id) { + Err(wac_graph::PlugError::NoPlugHappened) => { + // Dependencies may not depend on any interfaces that the plug fills so we shouldn't error here. + // Just return the origin `dependency_source` as is. + return Ok(dependency_source.to_vec()); + } + Err(other) => { + anyhow::bail!( + "failed to plug deny-all adapter into dependency: {:?}", + other + ); + } + Ok(_) => {} + } + + let bytes = graph.encode(Default::default())?; + Ok(bytes) +} diff --git a/crates/loader/src/local.rs b/crates/loader/src/local.rs index 5278f373b2..41c8f5fce8 100644 --- a/crates/loader/src/local.rs +++ b/crates/loader/src/local.rs @@ -3,16 +3,17 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, bail, ensure, Context, Result}; use futures::{future::try_join_all, StreamExt}; use reqwest::Url; -use spin_common::{paths::parent_dir, sloth, ui::quoted_path}; +use spin_common::{dependencies::DependencyName, paths::parent_dir, sloth, ui::quoted_path}; use spin_locked_app::{ locked::{ - self, ContentPath, ContentRef, LockedApp, LockedComponent, LockedComponentSource, - LockedTrigger, + self, ContentPath, ContentRef, LockedApp, LockedComponent, LockedComponentDependency, + LockedComponentSource, LockedTrigger, }, values::{ValuesMap, ValuesMapBuilder}, }; use spin_manifest::schema::v2::{self, AppManifest, KebabId, WasiFilesMount}; use spin_outbound_networking::SERVICE_CHAINING_DOMAIN_SUFFIX; +use std::collections::BTreeMap; use tokio::{io::AsyncWriteExt, sync::Semaphore}; use crate::{cache::Cache, FilesMountStrategy}; @@ -160,6 +161,14 @@ impl LocalLoader { .await .with_context(|| format!("Failed to load Wasm source {}", component.source))?; + let inherit_configuration = component + .dependencies_inherit_configuration + .unwrap_or_default(); + + let dependencies = self + .load_component_dependencies(id, inherit_configuration, &component.dependencies) + .await?; + let env = component.environment.into_iter().collect(); let files = if component.files.is_empty() { @@ -208,6 +217,83 @@ impl LocalLoader { env, files, config, + dependencies, + }) + } + + async fn load_component_dependencies( + &self, + id: &KebabId, + inherit_configuration: bool, + dependencies: &v2::ComponentDependencies, + ) -> Result> { + Ok(try_join_all(dependencies.inner.iter().map( + |(dependency_name, dependency)| async move { + let locked_dependency = self + .load_component_dependency( + inherit_configuration, + dependency_name.clone(), + dependency.clone(), + ) + .await + .with_context(|| { + format!( + "Failed to load component dependency `{dependency_name}` for `{id}`" + ) + })?; + + anyhow::Ok((dependency_name.clone(), locked_dependency)) + }, + )) + .await? + .into_iter() + .collect()) + } + + async fn load_component_dependency( + &self, + inherit_configuration: bool, + dependency_name: DependencyName, + dependency: v2::ComponentDependency, + ) -> Result { + let (content, export) = match dependency { + v2::ComponentDependency::Version(version) => { + let content = self + .load_registry_source(None, &dependency_name.package, &version) + .await?; + (content, None) + } + v2::ComponentDependency::Package { + version, + registry, + package, + export, + } => { + let package = package.unwrap_or(dependency_name.package); + let content = self + .load_registry_source(registry.as_ref(), &package, &version) + .await?; + (content, export) + } + v2::ComponentDependency::Local { path, export } => { + let content = file_content_ref(self.app_root.join(path))?; + (content, export) + } + }; + + let export = export.map(|export| export.to_string()); + + Ok(LockedComponentDependency { + source: LockedComponentSource { + content_type: "application/wasm".into(), + content, + }, + export, + inherit: if inherit_configuration { + Some(locked::InheritConfiguration::All) + } else { + None + }, }) } @@ -229,7 +315,9 @@ impl LocalLoader { version, } => { let version = semver::Version::parse(&version).with_context(|| format!("Component {component_id} specifies an invalid semantic version ({version:?}) for its package version"))?; - self.load_registry_source(registry.as_ref(), &package, &version) + let version_req = format!("={version}").parse().expect("version"); + + self.load_registry_source(registry.as_ref(), &package, &version_req) .await? } }; @@ -265,7 +353,7 @@ impl LocalLoader { &self, registry: Option<&wasm_pkg_loader::Registry>, package: &wasm_pkg_loader::PackageRef, - version: &semver::Version, + version: &semver::VersionReq, ) -> Result { let mut client_config = wasm_pkg_loader::Config::global_defaults()?; @@ -274,7 +362,7 @@ impl LocalLoader { } let mut pkg_loader = wasm_pkg_loader::Client::new(client_config); - let release = pkg_loader.get_release(package, version).await.map_err(|e| { + let mut releases = pkg_loader.list_all_versions(package).await.map_err(|e| { if matches!(e, wasm_pkg_loader::Error::NoRegistryForNamespace(_)) && registry.is_none() { anyhow!("No default registry specified for wasm-pkg-loader. Create a default config, or set `registry` for package {package:?}") } else { @@ -282,6 +370,18 @@ impl LocalLoader { } })?; + releases.sort(); + + let release_version = releases + .iter() + .rev() + .find(|release| version.matches(&release.version) && !release.yanked) + .with_context(|| format!("No matching version found for {package} {version}",))?; + + let release = pkg_loader + .get_release(package, &release_version.version) + .await?; + let digest = match &release.content_digest { wasm_pkg_loader::ContentDigest::Sha256 { hex } => format!("sha256:{hex}"), }; diff --git a/crates/locked-app/Cargo.toml b/crates/locked-app/Cargo.toml index 44b25fee5f..9c40df9e93 100644 --- a/crates/locked-app/Cargo.toml +++ b/crates/locked-app/Cargo.toml @@ -10,5 +10,5 @@ async-trait = "0.1" ouroboros = "0.18.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -spin-serde = { path = "../serde" } -thiserror = "1.0" +spin-common = { path = "../common" } +thiserror = "1.0" \ No newline at end of file diff --git a/crates/locked-app/src/locked.rs b/crates/locked-app/src/locked.rs index 7dd4c5a2f7..80720dff08 100644 --- a/crates/locked-app/src/locked.rs +++ b/crates/locked-app/src/locked.rs @@ -4,7 +4,9 @@ use std::path::PathBuf; use serde::{Deserialize, Serialize}; use serde_json::Value; -use spin_serde::FixedVersionBackwardCompatible; +use spin_common::dependencies::DependencyName; +use spin_common::serde::FixedVersionBackwardCompatible; +use std::collections::BTreeMap; use crate::{ metadata::MetadataExt, @@ -221,6 +223,29 @@ pub struct LockedComponent { /// Custom config values #[serde(default, skip_serializing_if = "LockedMap::is_empty")] pub config: LockedMap, + /// Component dependencies + #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] + pub dependencies: BTreeMap, +} + +/// A LockedDependency represents a "fully resolved" Spin component dependency. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct LockedComponentDependency { + /// Locked dependency source + pub source: LockedComponentSource, + /// The specific export to use from the dependency, if any. + pub export: Option, + /// Which configurations to inherit from parent + pub inherit: Option, +} + +/// InheritConfiguration specifies which configurations to inherit from parent. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum InheritConfiguration { + /// Dependencies will inherit all configurations from parent. + All, + /// Dependencies will inherit only the specified configurations from parent (must contain atleast 1 option). + Some(Vec), } /// A LockedComponentSource specifies a Wasm source. @@ -245,7 +270,7 @@ pub struct ContentPath { /// A ContentRef represents content used by an application. /// -/// At least one of `source` or `digest` must be specified. Implementations may +/// At least one of `source`, `inline`, or `digest` must be specified. Implementations may /// require one or the other (or both). #[derive(Clone, Debug, Default, Serialize, Deserialize)] pub struct ContentRef { @@ -260,7 +285,7 @@ pub struct ContentRef { #[serde( default, skip_serializing_if = "Option::is_none", - with = "spin_serde::base64" + with = "spin_common::serde::base64" )] pub inline: Option>, /// If set, the content must have the given SHA-256 digest. diff --git a/crates/manifest/Cargo.toml b/crates/manifest/Cargo.toml index 8ae06ffedc..7b80d90692 100644 --- a/crates/manifest/Cargo.toml +++ b/crates/manifest/Cargo.toml @@ -9,7 +9,7 @@ anyhow = "1.0.75" indexmap = { version = "1", features = ["serde"] } semver = { version = "1.0", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } -spin-serde = { path = "../serde" } +spin-common = { path = "../common" } thiserror = "1" terminal = { path = "../terminal" } toml = { version = "0.8.0", features = ["preserve_order"] } diff --git a/crates/manifest/src/compat.rs b/crates/manifest/src/compat.rs index e7d7af7396..bfbb27ab30 100644 --- a/crates/manifest/src/compat.rs +++ b/crates/manifest/src/compat.rs @@ -74,6 +74,8 @@ pub fn v1_to_v2_app(manifest: v1::AppManifestV1) -> Result Result { fn id_from_string( id: String, -) -> Result, Error> { +) -> Result, Error> { id.clone() .try_into() .map_err(|err: String| Error::InvalidID { id, reason: err }) diff --git a/crates/manifest/src/schema/v1.rs b/crates/manifest/src/schema/v1.rs index d242f1bff7..62b63b6d4a 100644 --- a/crates/manifest/src/schema/v1.rs +++ b/crates/manifest/src/schema/v1.rs @@ -1,6 +1,6 @@ use serde::Deserialize; -use spin_serde::FixedStringVersion; +use spin_common::serde::FixedStringVersion; pub use super::common::{ ComponentBuildConfig as ComponentBuildConfigV1, ComponentSource as ComponentSourceV1, diff --git a/crates/manifest/src/schema/v2.rs b/crates/manifest/src/schema/v2.rs index dbea7eac97..bdfb0d8518 100644 --- a/crates/manifest/src/schema/v2.rs +++ b/crates/manifest/src/schema/v2.rs @@ -1,6 +1,9 @@ use serde::{Deserialize, Serialize}; -use spin_serde::{FixedVersion, LowerSnakeId}; -pub use spin_serde::{KebabId, SnakeId}; +use spin_common::dependencies::DependencyName; +use spin_common::serde::{FixedVersion, LowerSnakeId}; +pub use spin_common::serde::{KebabId, SnakeId}; +use std::path::PathBuf; +use wasm_pkg_common::{package::PackageRef, registry::Registry}; pub use super::common::{ComponentBuildConfig, ComponentSource, Variable, WasiFilesMount}; @@ -95,6 +98,32 @@ impl TryFrom for ComponentSpec { } } +/// Component dependency +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(untagged, deny_unknown_fields)] +pub enum ComponentDependency { + /// `... = ">= 0.1.0"` + Version(semver::VersionReq), + /// `... = { version = "0.1.0", registry = "registry.io", ...}` + Package { + /// Package version + version: semver::VersionReq, + /// Optional registry spec + registry: Option, + /// Optional package name `foo:bar` + package: Option, + /// Optional export name + export: Option, + }, + /// `... = { path = "path/to/component.wasm", export = "my-export" }` + Local { + /// Path to Wasm + path: PathBuf, + /// Optional export name + export: Option, + }, +} + /// Component definition #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(deny_unknown_fields)] @@ -145,11 +174,116 @@ pub struct Component { /// Settings for custom tools or plugins. Spin ignores this field. #[serde(default, skip_serializing_if = "Map::is_empty")] pub tool: Map, + /// If true, allow dependencies to inherit configuration. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub dependencies_inherit_configuration: Option, + /// Component dependencies + #[serde(default, skip_serializing_if = "ComponentDependencies::is_empty")] + pub dependencies: ComponentDependencies, +} + +/// Component dependencies +#[derive(Clone, Debug, Default, Serialize, Deserialize)] +#[serde(try_from = "Map")] +pub struct ComponentDependencies { + /// `dependencies = { "foo:bar" = ">= 0.1.0" }` + pub inner: Map, +} + +impl TryFrom> for ComponentDependencies { + type Error = anyhow::Error; + + fn try_from(value: Map) -> Result { + let dependencies = ComponentDependencies { inner: value }; + dependencies.validate()?; + Ok(dependencies) + } +} + +impl ComponentDependencies { + fn validate(&self) -> anyhow::Result<()> { + self.ensure_package_names_no_export()?; + self.ensure_disjoint()?; + Ok(()) + } + + /// This method ensures that dependency names in the package form (e.g. "foo:bar" or "foo:bar@0.1.0") do not have an export specified. + fn ensure_package_names_no_export(&self) -> anyhow::Result<()> { + for (dependency_name, dependency) in self.inner.iter() { + if dependency_name.interface.is_none() { + let export = match dependency { + ComponentDependency::Package { export, .. } => export, + ComponentDependency::Local { export, .. } => export, + _ => continue, + }; + + anyhow::ensure!( + export.is_none(), + "using an export to satisfy the package dependency `{dependency_name}` is not currently permitted", + ); + } + } + Ok(()) + } + + // TODO: document this invariant + fn ensure_disjoint(&self) -> anyhow::Result<()> { + for (idx, this) in self.inner.keys().enumerate() { + for other in self.inner.keys().skip(idx + 1) { + if this.package == other.package { + Self::check_disjoint(this, other)?; + } + } + } + Ok(()) + } + + fn check_disjoint(this: &DependencyName, other: &DependencyName) -> anyhow::Result<()> { + assert_eq!(this.package, other.package); + + if let (Some(this), Some(other)) = (this.version.clone(), other.version.clone()) { + if Self::normalize_version(this) != Self::normalize_version(other) { + return Ok(()); + } + } + + if let (Some(this), Some(other)) = (this.interface.as_ref(), other.interface.as_ref()) { + if this != other { + return Ok(()); + } + } + + anyhow::bail!("{this} depedency conflicts with {other}") + } + + fn normalize_version(mut version: semver::Version) -> semver::Version { + version.build = semver::BuildMetadata::EMPTY; + + if version.pre != semver::Prerelease::EMPTY { + return version; + } + if version.major > 0 { + version.minor = 0; + version.patch = 0; + return version; + } + + if version.minor > 0 { + version.patch = 0; + return version; + } + + version + } + + fn is_empty(&self) -> bool { + self.inner.is_empty() + } } mod kebab_or_snake_case { use serde::{Deserialize, Serialize}; - pub use spin_serde::{KebabId, SnakeId}; + pub use spin_common::serde::{KebabId, SnakeId}; pub fn serialize(value: &[String], serializer: S) -> Result where S: serde::ser::Serializer, @@ -355,6 +489,8 @@ mod tests { ai_models: vec![], build: None, tool: Map::new(), + dependencies_inherit_configuration: None, + dependencies: Default::default(), } } @@ -404,4 +540,111 @@ mod tests { } } } + + #[test] + fn test_check_disjoint() { + for (a, b) in [ + ("foo:bar@0.1.0", "foo:bar@0.2.0"), + ("foo:bar/baz@0.1.0", "foo:bar/baz@0.2.0"), + ("foo:bar/baz@0.1.0", "foo:bar/bub@0.1.0"), + ("foo:bar@0.1.0", "foo:bar/bub@0.2.0"), + ("foo:bar@1.0.0", "foo:bar@2.0.0"), + ("foo:bar@0.1.0", "foo:bar@1.0.0"), + ("foo:bar/baz", "foo:bar/bub"), + ("foo:bar/baz@0.1.0-alpha", "foo:bar/baz@0.1.0-beta"), + ] { + let a: DependencyName = a.parse().unwrap(); + let b: DependencyName = b.parse().unwrap(); + ComponentDependencies::check_disjoint(&a, &b).unwrap(); // TODO: should method on depednecny name + } + + for (a, b) in [ + ("foo:bar@0.1.0", "foo:bar@0.1.1"), + ("foo:bar/baz@0.1.0", "foo:bar@0.1.0"), + ("foo:bar/baz@0.1.0", "foo:bar@0.1.0"), + ("foo:bar", "foo:bar@0.1.0"), + ("foo:bar@0.1.0-pre", "foo:bar@0.1.0-pre"), + ] { + let a: DependencyName = a.parse().unwrap(); + let b: DependencyName = b.parse().unwrap(); + assert!( + ComponentDependencies::check_disjoint(&a, &b).is_err(), + "{a} should conflict with {b}", + ); + } + } + + #[test] + fn test_validate_dependencies() { + // Specifying an export to satisfy a package dependency name is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:baz@0.1.0" = { path = "foo.wasm", export = "foo"} + }) + .is_err()); + + // Two compatible versions of the same package is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:baz@0.1.0" = "0.1.0" + "foo:bar@0.2.1" = "0.2.1" + "foo:bar@0.2.2" = "0.2.2" + }) + .is_err()); + + // Two disjoint versions of the same package is ok + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar@0.1.0" = "0.1.0" + "foo:bar@0.2.0" = "0.2.0" + "foo:baz@0.2.0" = "0.1.0" + }) + .is_ok()); + + // Unversioned and versioned dependencies of the same package is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar@0.1.0" = "0.1.0" + "foo:bar" = ">= 0.2.0" + }) + .is_err()); + + // Two interfaces of two disjoint versions of a package is ok + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar/baz@0.1.0" = "0.1.0" + "foo:bar/baz@0.2.0" = "0.2.0" + }) + .is_ok()); + + // A versioned interface and a different versioned package is ok + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar/baz@0.1.0" = "0.1.0" + "foo:bar@0.2.0" = "0.2.0" + }) + .is_ok()); + + // A versioned interface and package of the same version is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar/baz@0.1.0" = "0.1.0" + "foo:bar@0.1.0" = "0.1.0" + }) + .is_err()); + + // A versioned interface and unversioned package is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar/baz@0.1.0" = "0.1.0" + "foo:bar" = "0.1.0" + }) + .is_err()); + + // An unversioned interface and versioned package is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar/baz" = "0.1.0" + "foo:bar@0.1.0" = "0.1.0" + }) + .is_err()); + + // An unversioned interface and unversioned package is an error + assert!(ComponentDependencies::deserialize(toml! { + "foo:bar/baz" = "0.1.0" + "foo:bar" = "0.1.0" + }) + .is_err()); + } } diff --git a/crates/manifest/tests/ui/maximal.json b/crates/manifest/tests/ui/maximal.json index 39806618e1..32546a2254 100644 --- a/crates/manifest/tests/ui/maximal.json +++ b/crates/manifest/tests/ui/maximal.json @@ -87,6 +87,32 @@ "clean": { "command": "cargo clean" } + }, + "dependencies_inherit_configuration": true, + "dependencies": { + "inner": { + "a:b": { + "version": "^1.2.3", + "registry": "my-registry.com", + "package": "a:b", + "export": "foo" + }, + "foo:bar/baz@0.1.0": { + "path": "path/to/component.wasm", + "export": null + }, + "fib:fub/fob": { + "path": "path/to/component.wasm", + "export": "my-export" + }, + "fizz:buzz": ">=0.1.0", + "abc:xyz@0.1.0": { + "version": "=0.1.0", + "registry": null, + "package": null, + "export": "foo" + } + } } } } diff --git a/crates/manifest/tests/ui/maximal.toml b/crates/manifest/tests/ui/maximal.toml index d4d53f00e1..15e1510a7a 100644 --- a/crates/manifest/tests/ui/maximal.toml +++ b/crates/manifest/tests/ui/maximal.toml @@ -36,6 +36,7 @@ allowed_outbound_hosts = ["https://example.com:443"] key_value_stores = ["default"] sqlite_databases = ["default"] ai_models = ["llama2-chat"] +dependencies_inherit_configuration = true [component.maximal-component.build] command = "cargo build" @@ -44,3 +45,10 @@ watch = ["src/**/*.rs"] [component.maximal-component.tool.clean] command = "cargo clean" + +[component.maximal-component.dependencies] +"a:b" = { registry = "my-registry.com", version = "1.2.3", package = "a:b", export = "foo"} +"foo:bar/baz@0.1.0" = { path = "path/to/component.wasm" } +"fib:fub/fob" = { path = "path/to/component.wasm", export = "my-export" } +"fizz:buzz" = ">= 0.1.0" +"abc:xyz@0.1.0" = { version = "=0.1.0", export = "foo"} \ No newline at end of file diff --git a/crates/serde/Cargo.toml b/crates/serde/Cargo.toml deleted file mode 100644 index e025d54d36..0000000000 --- a/crates/serde/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "spin-serde" -version = { workspace = true } -authors = { workspace = true } -edition = { workspace = true } - -[dependencies] -base64 = "0.21.4" -serde = "1.0.189" \ No newline at end of file diff --git a/crates/testing/src/lib.rs b/crates/testing/src/lib.rs index 48b56bf589..5be8ad1d53 100644 --- a/crates/testing/src/lib.rs +++ b/crates/testing/src/lib.rs @@ -205,9 +205,12 @@ impl Loader for TestLoader { async fn load_component( &self, engine: &spin_core::wasmtime::Engine, - source: &LockedComponentSource, + component: &AppComponent, ) -> anyhow::Result { - assert_eq!(source.content.digest.as_deref(), Some("test-source")); + assert_eq!( + component.source().content.digest.as_deref(), + Some("test-source") + ); Component::new( engine, spin_componentize::componentize_if_necessary(&fs::read(&self.module_path).await?)?, diff --git a/crates/trigger/Cargo.toml b/crates/trigger/Cargo.toml index 164a265aae..5d026b8fa2 100644 --- a/crates/trigger/Cargo.toml +++ b/crates/trigger/Cargo.toml @@ -31,8 +31,8 @@ outbound-mysql = { path = "../outbound-mysql" } rustls-pemfile = "2.1.2" rustls-pki-types = "1.7.0" spin-common = { path = "../common" } +spin-compose ={ path = "../compose" } spin-expressions = { path = "../expressions" } -spin-serde = { path = "../serde" } spin-key-value = { path = "../key-value" } spin-key-value-azure = { path = "../key-value-azure" } spin-key-value-redis = { path = "../key-value-redis" } diff --git a/crates/trigger/src/loader.rs b/crates/trigger/src/loader.rs index 7b42fca438..c0d243bdf1 100644 --- a/crates/trigger/src/loader.rs +++ b/crates/trigger/src/loader.rs @@ -87,14 +87,16 @@ impl Loader for TriggerLoader { async fn load_component( &self, engine: &spin_core::wasmtime::Engine, - source: &LockedComponentSource, + component: &AppComponent, ) -> Result { - let source = source + let source = component + .source() .content .source .as_ref() .context("LockedComponentSource missing source field")?; let path = parse_file_url(source)?; + match self.compilation_status { #[cfg(feature = "unsafe-aot-compilation")] CompilationStatus::AllAotComponents => { @@ -112,15 +114,13 @@ impl Loader for TriggerLoader { } }, CompilationStatus::NoneAot => { - let bytes = fs::read(&path).await.with_context(|| { - format!( - "failed to read component source from disk at path {}", - quoted_path(&path) - ) - })?; - let component = spin_componentize::componentize_if_necessary(&bytes)?; - spin_core::Component::new(engine, component.as_ref()) - .with_context(|| format!("loading module {}", quoted_path(&path))) + let component_loader = TriggerComponentLoader; + let composed = spin_compose::compose(&component_loader, component.locked) + .await + .with_context(|| format!("composing component {:?}", component.id()))?; + + spin_core::Component::new(engine, composed) + .with_context(|| format!("loading module {}", quoted_path(&path))) } } } @@ -204,6 +204,35 @@ fn check_uncomponentizable_module_deprecation(module_path: &Path) { } } +struct TriggerComponentLoader; + +#[async_trait] +impl spin_compose::ComponentLoader for TriggerComponentLoader { + async fn load_component( + &self, + source: &spin_app::locked::LockedComponentSource, + ) -> anyhow::Result> { + let source = source + .content + .source + .as_ref() + .context("LockedComponentSource missing source field")?; + + let path = parse_file_url(source)?; + + let bytes: Vec = fs::read(&path).await.with_context(|| { + format!( + "failed to read component source from disk at path {}", + quoted_path(&path) + ) + })?; + + let component = spin_componentize::componentize_if_necessary(&bytes)?; + + Ok(component.into()) + } +} + #[cfg(test)] mod tests { use super::*; @@ -211,6 +240,7 @@ mod tests { use std::io::Write; use tempfile::NamedTempFile; + #[allow(dead_code)] // TODO: remove the dead_code attribute once I figure out how to refactor the test. fn precompiled_component(file: &mut NamedTempFile) -> LockedComponentSource { let wasmtime_engine = wasmtime::Engine::default(); let component = wasmtime::component::Component::new(&wasmtime_engine, "(component)") @@ -243,14 +273,23 @@ mod tests { .unwrap(); } - #[tokio::test] - async fn load_component_fails_for_precompiled_component() { - let mut file = NamedTempFile::new().unwrap(); - let source = precompiled_component(&mut file); - let loader = super::TriggerLoader::new("/unreferenced", false); - let result = loader - .load_component(&spin_core::wasmtime::Engine::default(), &source) - .await; - assert!(result.is_err()); - } + // #[tokio::test] + // async fn load_component_fails_for_precompiled_component() { + // let mut file = NamedTempFile::new().unwrap(); + // let source = precompiled_component(&mut file); + // let locked = spin_app::locked::LockedComponent { + // id: "test".to_string(), + // source, + // metadata: Default::default(), + // env: Default::default(), + // files: Default::default(), + // config: Default::default(), + // dependencies: Default::default(), + // }; + // let loader = super::TriggerLoader::new("/unreferenced", false); + // let result = loader + // .load_component(&spin_core::wasmtime::Engine::default(), &locked) + // .await; + // assert!(result.is_err()); + // } } diff --git a/crates/trigger/src/runtime_config.rs b/crates/trigger/src/runtime_config.rs index 5399399028..934ae5784b 100644 --- a/crates/trigger/src/runtime_config.rs +++ b/crates/trigger/src/runtime_config.rs @@ -393,6 +393,7 @@ impl SummariseRuntimeConfigHook { mod tests { use std::io::Write; + use spin_common::serde::KebabId; use tempfile::NamedTempFile; use toml::toml; @@ -558,8 +559,8 @@ mod tests { Ok(()) } - fn to_component_id(inp: &str) -> spin_serde::KebabId { - spin_serde::KebabId::try_from(inp.to_string()).expect("parse component id into kebab id") + fn to_component_id(inp: &str) -> KebabId { + KebabId::try_from(inp.to_string()).expect("parse component id into kebab id") } #[test] diff --git a/crates/trigger/src/runtime_config/client_tls.rs b/crates/trigger/src/runtime_config/client_tls.rs index 59390841e7..84b77af252 100644 --- a/crates/trigger/src/runtime_config/client_tls.rs +++ b/crates/trigger/src/runtime_config/client_tls.rs @@ -1,5 +1,6 @@ use anyhow::Context; use rustls_pemfile::private_key; +use spin_common::serde::KebabId; use std::io; use std::{ fs, @@ -9,7 +10,7 @@ use std::{ #[derive(Debug, serde::Deserialize)] #[serde(rename_all = "snake_case", tag = "type")] pub struct ClientTlsOpts { - pub component_ids: Vec, + pub component_ids: Vec, pub hosts: Vec, pub ca_roots_file: Option, pub cert_chain_file: Option, diff --git a/examples/spin-timer/Cargo.lock b/examples/spin-timer/Cargo.lock index e78d138518..8d192128e9 100644 --- a/examples/spin-timer/Cargo.lock +++ b/examples/spin-timer/Cargo.lock @@ -151,9 +151,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -503,7 +503,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34ce3de4b65b1ee2667c81d1fc692949049502a4cf9c38118d811d6d79a7eaef" dependencies = [ "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bytes", "dyn-clone", "futures", @@ -614,9 +614,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -719,9 +719,9 @@ checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytemuck" -version = "1.16.1" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" [[package]] name = "byteorder" @@ -917,7 +917,7 @@ dependencies = [ "num-traits 0.2.19", "serde 1.0.203", "wasm-bindgen", - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -3118,9 +3118,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "logos" @@ -3813,9 +3813,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" dependencies = [ "cc", "libc", @@ -4909,7 +4909,7 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", @@ -5150,7 +5150,7 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "rustls-pki-types", ] @@ -5445,7 +5445,7 @@ version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", @@ -5677,9 +5677,9 @@ dependencies = [ "ouroboros", "serde 1.0.203", "serde_json", + "spin-common", "spin-core", "spin-locked-app", - "spin-serde", "thiserror", ] @@ -5688,11 +5688,15 @@ name = "spin-common" version = "2.7.0-pre0" dependencies = [ "anyhow", - "dirs 4.0.0", + "base64 0.22.1", + "dirs 5.0.1", + "semver", + "serde 1.0.203", "sha2", "tempfile", "tokio", "url", + "wasm-pkg-common", ] [[package]] @@ -5708,6 +5712,21 @@ dependencies = [ "wit-parser 0.200.0", ] +[[package]] +name = "spin-compose" +version = "2.7.0-pre0" +dependencies = [ + "anyhow", + "async-trait", + "indexmap 2.2.6", + "semver", + "spin-app", + "spin-common", + "spin-componentize", + "tokio", + "wac-graph", +] + [[package]] name = "spin-core" version = "2.7.0-pre0" @@ -5878,7 +5897,7 @@ dependencies = [ "ouroboros", "serde 1.0.203", "serde_json", - "spin-serde", + "spin-common", "thiserror", ] @@ -5890,7 +5909,7 @@ dependencies = [ "indexmap 1.9.3", "semver", "serde 1.0.203", - "spin-serde", + "spin-common", "terminal", "thiserror", "toml 0.8.14", @@ -5912,14 +5931,6 @@ dependencies = [ "urlencoding", ] -[[package]] -name = "spin-serde" -version = "2.7.0-pre0" -dependencies = [ - "base64 0.21.7", - "serde 1.0.203", -] - [[package]] name = "spin-sqlite" version = "2.7.0-pre0" @@ -6009,6 +6020,7 @@ dependencies = [ "spin-app", "spin-common", "spin-componentize", + "spin-compose", "spin-core", "spin-expressions", "spin-key-value", @@ -6020,7 +6032,6 @@ dependencies = [ "spin-loader", "spin-manifest", "spin-outbound-networking", - "spin-serde", "spin-sqlite", "spin-sqlite-inproc", "spin-sqlite-libsql", @@ -6290,18 +6301,18 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", @@ -6988,6 +6999,39 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wac-graph" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d62ffef518aba9d62dc1532960702a67a62ca1b0ffb3cf152391d477bc7e11" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "log", + "petgraph", + "semver", + "thiserror", + "wac-types", + "wasm-encoder 0.202.0", + "wasm-metadata 0.202.0", + "wasmparser 0.202.0", +] + +[[package]] +name = "wac-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fe3e5531080631b8d14f355119f4b3bac92bdacaad6786599cf474958eee01f" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "semver", + "wasm-encoder 0.202.0", + "wasmparser 0.202.0", +] + [[package]] name = "waker-fn" version = "1.1.1" @@ -7302,6 +7346,15 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.202.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfd106365a7f5f7aa3c1916a98cbb3ad477f5ff96ddb130285a91c6e7429e67a" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-encoder" version = "0.209.1" @@ -7336,6 +7389,22 @@ dependencies = [ "wasmparser 0.200.0", ] +[[package]] +name = "wasm-metadata" +version = "0.202.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "094aea3cb90e09f16ee25a4c0e324b3e8c934e7fd838bfa039aef5352f44a917" +dependencies = [ + "anyhow", + "indexmap 2.2.6", + "serde 1.0.203", + "serde_derive", + "serde_json", + "spdx", + "wasm-encoder 0.202.0", + "wasmparser 0.202.0", +] + [[package]] name = "wasm-metadata" version = "0.209.1" @@ -7378,7 +7447,7 @@ checksum = "11338b173351bc505bc752c00068a7d1da5106a9d351753f0d01267dcc4747b2" dependencies = [ "anyhow", "async-trait", - "base64 0.22.0", + "base64 0.22.1", "bytes", "dirs 5.0.1", "docker_credential", @@ -7436,6 +7505,17 @@ dependencies = [ "semver", ] +[[package]] +name = "wasmparser" +version = "0.202.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6998515d3cf3f8b980ef7c11b29a9b1017d4cf86b99ae93b546992df9931413" +dependencies = [ + "bitflags 2.4.2", + "indexmap 2.2.6", + "semver", +] + [[package]] name = "wasmparser" version = "0.209.1" @@ -7914,11 +7994,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -7950,7 +8030,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -7968,7 +8048,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.5", ] [[package]] @@ -7988,17 +8068,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] @@ -8009,9 +8090,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" @@ -8021,9 +8102,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" @@ -8033,9 +8114,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" @@ -8045,9 +8132,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" @@ -8057,9 +8144,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" [[package]] name = "windows_x86_64_gnullvm" @@ -8069,9 +8156,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" @@ -8081,9 +8168,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow"