diff --git a/.docker/service-cid b/.docker/service-cid index 71ff62dd..20add883 100644 --- a/.docker/service-cid +++ b/.docker/service-cid @@ -1 +1 @@ -QmZUK6LA31b6vH66YbbxNBTeLmnogxRhRK6vkMkeRKuK1C \ No newline at end of file +Qmde5D6hW5fmttzJrKxZoMbZV69TbUtLGhFtSrJnFMM74K \ No newline at end of file diff --git a/.env.example b/.env.example index cc03e7b3..892c1c00 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,7 @@ RPC_URL=http://localhost:8545 # RPC_URL=https://ethereum-sepolia-rpc.publicnode.com/ # Sepolia testnet # this key requires funds. used as the admin / deployer of contracts and core contracts. -FUNDED_KEY=0x323ef3a895cad9fcb625aa859953bba2812a64b39f2fd0b857f4757f0e896858 +FUNDED_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 # WASI package namespace - required for non-LOCAL deployments (e.g., wavs for https://wa.dev/wavs) WASI_NAMESPACE=wavs diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..82b9c4d4 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,149 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## What This Is + +A monorepo template for building **WAVS** (WebAssembly-based Actively Validated Services) applications. The stack combines: +- **Rust WASM components** (compiled to WASI) that run off-chain as AVS operators +- **Solidity contracts** (Foundry) for on-chain triggers and submission +- **TypeScript deployment scripts** that orchestrate the full pipeline + +The sample service is a price oracle: a `SimpleTrigger` contract emits events, the WAVS node runs the Rust WASM component to fetch prices, and results are posted on-chain via `SimpleSubmit`. + +## Commands + +### Install & Setup +```bash +task setup # Install pnpm + forge dependencies +cp .env.example .env # First-time setup +``` + +### Build +```bash +task build:forge # Build Solidity contracts (forge build) +task build:wasi # Build all WASI components + +# Build a single component +WASI_BUILD_DIR=components/evm-price-oracle task build:wasi +``` + +### Test +```bash +forge test # Run all Solidity tests +pnpm test # Same via pnpm +pnpm test:unit # Only unit tests (--match-contract Unit) +pnpm test:integration # Only integration tests (--match-contract Integration) + +# Test a WASM component locally +INPUT_DATA="1" COMPONENT_FILENAME=evm_price_oracle.wasm task wasi:exec +``` + +### Lint & Format +```bash +pnpm lint:check # Check Solidity linting + forge fmt +pnpm lint:fix # Auto-fix linting issues +forge fmt # Format Solidity only +cargo fmt # Format Rust only +``` + +### Local Development (Full Stack) +```bash +# Terminal 1 — start anvil + IPFS + WARG registry (keep running) +task start-all-local + +# Terminal 2 — deploy everything (POA contracts, WASM upload, service registration) +task deploy-full +``` + +### MCP-Based Deployment (AI agent / WAVS skill flow) + +When using the WAVS MCP tools (see the `wavs` Claude Code skill), deploy step-by-step instead of `task deploy-full`. Requires the WAVS node running and MCP registered. + +```bash +# 1. Build the component +# Use wavs:wavs_build_component(dir="components/evm-price-oracle") + +# 2. Deploy the PoA ServiceManager on-chain +# Use wavs:wavs_deploy_poa_service_manager(rpc_url="http://localhost:8545") +# → returns POA_ADDRESS + +# 3. Deploy Solidity contracts (needs the PoA address from step 2) +pnpm deploy:contracts --service-manager-address + +# 4. Upload component, save service, set URI on-chain, deploy to node +# Use wavs:wavs_upload_component, wavs:wavs_save_service, +# wavs:wavs_set_service_uri, wavs:wavs_deploy_service + +# 5. Register operator (POA only) — may require manual fallback (see Known Issues below) +# Use wavs:wavs_register_operator(rpc_url="http://localhost:8545", service_manager_json=...) +``` + +**Known issue — `wavs_register_operator` InvalidSignature fallback:** +If `wavs_register_operator` fails with `0x8baa579f` (InvalidSignature) on the +`updateOperatorSigningKey` step, call it manually. The contract expects a raw ECDSA +signature of `keccak256(abi.encode(operatorAddr))` signed by the service signing key: + +```bash +MNEMONIC="" +OPERATOR_ADDR= +POA= +OPERATOR_PK=$(cast wallet private-key --mnemonic "$MNEMONIC" --mnemonic-derivation-path "m/44'/60'/0'/0/0") +SIGNING_KEY_PK=$(cast wallet private-key --mnemonic "$MNEMONIC" --mnemonic-derivation-path "m/44'/60'/0'/0/") +SIGNING_KEY_ADDR=$(cast wallet address $SIGNING_KEY_PK) +MSG_HASH=$(cast keccak $(cast abi-encode "f(address)" $OPERATOR_ADDR)) +SIG=$(cast wallet sign --no-hash "$MSG_HASH" --private-key "$SIGNING_KEY_PK") +cast send $POA "updateOperatorSigningKey(address,bytes)" $SIGNING_KEY_ADDR "$SIG" \ + --private-key "$OPERATOR_PK" --rpc-url http://localhost:8545 +``` + +Use `wavs:wavs_get_service_signer` to find the HD index for the deployed service. + +### Validate a Component Before Building +```bash +make validate-component COMPONENT=your-component-name +``` + +## Architecture + +### Data Flow +1. User calls `SimpleTrigger.addTrigger(data)` → emits `NewTrigger(bytes)` event +2. WAVS operator (Docker) detects the event, runs the WASM component +3. WASM component fetches external data, encodes result as ABI bytes +4. Aggregator collects operator signatures, calls `SimpleSubmit.handleSignedEnvelope()` +5. Result is stored on-chain, queryable via `SimpleSubmit.getData(triggerId)` + +### Key Directories +- `src/contracts/` — `SimpleTrigger.sol` (emit triggers), `SimpleSubmit.sol` (receive results) +- `src/interfaces/ITypes.sol` — shared Solidity types (`TriggerInfo`, `DataWithId`) imported by both Solidity and Rust via `sol!` macro +- `components/evm-price-oracle/` — reference Rust WASM component (copy this as a starting point) +- `components/aggregator/` — aggregator WASM component (rarely modified) +- `config/components.json` — maps WASM filenames to trigger/submit contracts and config; controls what `deploy-full` deploys +- `deploy/` — TypeScript scripts (`tsx`) for the deployment pipeline +- `taskfile/` — task definitions included by `Taskfile.yml` +- `.docker/` — runtime output: `deployment_summary.json`, `service.json`, compiled component digests +- `.nodes/` — generated operator/aggregator infra configs + +### Environment Modes +- **`dev`** (default): local anvil (chain `evm:31337`), local IPFS, local WARG registry (`http://localhost:8090`) +- **`prod`**: Sepolia (`evm:11155111`), Pinata IPFS — set `DEPLOY_ENV=prod` in `.env` + +`DEPLOY_ENV` drives `deploy/env.ts` which selects `DevEnv` or `ProdEnv` with appropriate RPC URLs, IPFS endpoints, and chain IDs. + +### Service Configuration (`config/components.json`) +This file defines which WASM components to deploy and how: +- `trigger.event.contract_json_path` — reads the trigger contract address from `.docker/deployment_summary.json` +- `submit.contract_json_path` — same for the submit contract +- `config.values` supports `${VAR_NAME}` (env var), `${get(json.path)}` (deployment summary), `${getEnv(field)}` (deploy env fields) +- `env_variables` — secrets passed as `WAVS_ENV_*` prefixed vars (must be prefixed `WAVS_ENV_` in `.env`) + +## Important Files + +| File | Purpose | +|---|---| +| `wavs.toml` | WAVS node config: chain endpoints, ports (WAVS=8041, aggregator=8040), signing mnemonic | +| `config/components.json` | Defines which components to deploy and their trigger/submit bindings | +| `.docker/deployment_summary.json` | Generated after deploy; contains all contract addresses and service ID | +| `src/interfaces/ITypes.sol` | Shared types imported by both Solidity and Rust (`sol!` macro in `trigger.rs`) | +| `deploy/env.ts` | `DevEnv`/`ProdEnv` classes; controls RPC URLs, IPFS, chain IDs per environment | +| `components/evm-price-oracle/` | Reference component — copy this when creating new components | diff --git a/Cargo-component.lock b/Cargo-component.lock index f727c5ed..00bc239d 100644 --- a/Cargo-component.lock +++ b/Cargo-component.lock @@ -1,11 +1,3 @@ # This file is automatically generated by cargo-component. # It is not intended for manual editing. version = 1 - -[[package]] -name = "wavs:operator" - -[[package.version]] -requirement = "=1.2.0" -version = "1.2.0" -digest = "sha256:268da3de372803eb95bc93731fc5db190d7cd3d7eff5704d2e9ac26a88a2a34c" diff --git a/Cargo.lock b/Cargo.lock index 4b99abb9..35099e4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "aggregator" version = "1.0.0" @@ -27,7 +12,7 @@ dependencies = [ "serde", "serde_json", "wavs-wasi-utils", - "wit-bindgen-rt 0.44.0", + "wit-bindgen 0.46.0", "wstd", ] @@ -39,9 +24,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-chains" -version = "0.2.1" +version = "0.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5848366a4f08dca1caca0a6151294a4799fe2e59ba25df100491d92e0b921b1c" +checksum = "90f374d3c6d729268bbe2d0e0ff992bb97898b2df756691a62ee1d5f0506bc39" dependencies = [ "alloy-primitives", "num_enum", @@ -50,9 +35,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59094911f05dbff1cf5b29046a00ef26452eccc8d47136d50a47c0cf22f00c85" +checksum = "b0c0dc44157867da82c469c13186015b86abef209bf0e41625e4b68bac61d728" dependencies = [ "alloy-eips", "alloy-primitives", @@ -61,6 +46,7 @@ dependencies = [ "alloy-trie", "alloy-tx-macros", "auto_impl", + "borsh", "c-kzg", "derive_more", "either", @@ -76,9 +62,9 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903cb8f728107ca27c816546f15be38c688df3c381d7bd1a4a9f215effc1ddb4" +checksum = "ba4cdb42df3871cd6b346d6a938ec2ba69a9a0f49d1f82714bc5c48349268434" dependencies = [ "alloy-consensus", "alloy-eips", @@ -103,40 +89,56 @@ dependencies = [ [[package]] name = "alloy-eip2930" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b82752a889170df67bbb36d42ca63c531eb16274f0d7299ae2a680facba17bd" +checksum = "9441120fa82df73e8959ae0e4ab8ade03de2aaae61be313fbf5746277847ce25" dependencies = [ "alloy-primitives", "alloy-rlp", + "borsh", "serde", ] [[package]] name = "alloy-eip7702" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" +checksum = "2919c5a56a1007492da313e7a3b6d45ef5edc5d33416fdec63c0d7a2702a0d20" dependencies = [ "alloy-primitives", "alloy-rlp", + "borsh", "serde", "thiserror", ] +[[package]] +name = "alloy-eip7928" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3231de68d5d6e75332b7489cfcc7f4dfabeba94d990a10e4b923af0e6623540" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "borsh", + "serde", +] + [[package]] name = "alloy-eips" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac7f1c9a1ccc7f3e03c36976455751a6166a4f0d2d2c530c3f87dfe7d0cdc836" +checksum = "b9f7ef09f21bd1e9cb8a686f168cb4a206646804567f0889eadb8dcc4c9288c8" dependencies = [ "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", + "alloy-eip7928", "alloy-primitives", "alloy-rlp", "alloy-serde", "auto_impl", + "borsh", "c-kzg", "derive_more", "either", @@ -148,9 +150,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2acb6637a9c0e1cdf8971e0ced8f3fa34c04c5e9dccf6bb184f6a64fe0e37d8" +checksum = "e9dbe713da0c737d9e5e387b0ba790eb98b14dd207fe53eef50e19a5a8ec3dac" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -160,9 +162,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f763621707fa09cece30b73ecc607eb43fd7a72451fe3b46f645b905086926" +checksum = "ff42cd777eea61f370c0b10f2648a1c81e0b783066cd7269228aa993afd487f7" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -175,9 +177,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f59a869fa4b4c3a7f08b1c8cb79aec61c29febe6e24a24fe0fcfded8a9b5703" +checksum = "8cbca04f9b410fdc51aaaf88433cbac761213905a65fe832058bcf6690585762" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -201,9 +203,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46e9374c667c95c41177602ebe6f6a2edd455193844f011d973d374b65501b38" +checksum = "42d6d15e069a8b11f56bef2eccbad2a873c6dd4d4c81d04dda29710f5ea52f04" dependencies = [ "alloy-consensus", "alloy-eips", @@ -214,9 +216,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b77f7d5e60ad8ae6bd2200b8097919712a07a6db622a4b201e7ead6166f02e5" +checksum = "de3b431b4e72cd8bd0ec7a50b4be18e73dab74de0dba180eef171055e5d5926e" dependencies = [ "alloy-rlp", "bytes", @@ -224,26 +226,26 @@ dependencies = [ "const-hex", "derive_more", "foldhash 0.2.0", - "hashbrown 0.16.0", - "indexmap 2.9.0", + "hashbrown 0.16.1", + "indexmap 2.13.0", "itoa", "k256", "keccak-asm", "paste", "proptest", - "rand 0.9.1", + "rand 0.9.2", + "rapidhash", "ruint", "rustc-hash", "serde", "sha3", - "tiny-keccak", ] [[package]] name = "alloy-provider" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77818b7348bd5486491a5297579dbfe5f706a81f8e1f5976393025f1e22a7c7d" +checksum = "d181c8cc7cf4805d7e589bf4074d56d55064fa1a979f005a45a62b047616d870" dependencies = [ "alloy-chains", "alloy-consensus", @@ -281,9 +283,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6c1d995bff8d011f7cd6c81820d51825e6e06d6db73914c1630ecf544d83d6" +checksum = "e93e50f64a77ad9c5470bf2ad0ca02f228da70c792a8f06634801e202579f35e" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -292,20 +294,20 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40e1ef334153322fd878d07e86af7a529bcb86b2439525920a88eba87bcf943" +checksum = "ce8849c74c9ca0f5a03da1c865e3eb6f768df816e67dd3721a398a8a7e398011" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "alloy-rpc-client" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2430d5623e428dd012c6c2156ae40b7fe638d6fca255e3244e0fba51fa698e93" +checksum = "f2792758a93ae32a32e9047c843d536e1448044f78422d71bf7d7c05149e103f" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -326,9 +328,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e131624d08a25cfc40557041e7dc42e1182fa1153e7592d120f769a1edce56" +checksum = "7bdcbf9dfd5eea8bfeb078b1d906da8cd3a39c4d4dbe7a628025648e323611f6" dependencies = [ "alloy-primitives", "alloy-serde", @@ -337,9 +339,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07429a1099cd17227abcddb91b5e38c960aaeb02a6967467f5bb561fbe716ac6" +checksum = "dd720b63f82b457610f2eaaf1f32edf44efffe03ae25d537632e7d23e7929e1a" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -348,9 +350,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db46b0901ee16bbb68d986003c66dcb74a12f9d9b3c44f8e85d51974f2458f0f" +checksum = "9b2dc411f13092f237d2bf6918caf80977fc2f51485f9b90cb2a2f956912c8c9" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -369,9 +371,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5413814be7a22fbc81e0f04a2401fcc3eb25e56fd53b04683e8acecc6e1fe01b" +checksum = "e2ce1e0dbf7720eee747700e300c99aac01b1a95bb93f493a01e78ee28bb1a37" dependencies = [ "alloy-primitives", "serde", @@ -380,9 +382,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53410a18a61916e2c073a6519499514e027b01e77eeaf96acd1df7cf96ef6bb2" +checksum = "2425c6f314522c78e8198979c8cbf6769362be4da381d4152ea8eefce383535d" dependencies = [ "alloy-primitives", "async-trait", @@ -395,42 +397,42 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c84c3637bee9b5c4a4d2b93360ee16553d299c3b932712353caf1cea76d0e6" +checksum = "ab81bab693da9bb79f7a95b64b394718259fdd7e41dceeced4cad57cb71c4f6a" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "alloy-sol-macro-expander" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a882aa4e1790063362434b9b40d358942b188477ac1c44cfb8a52816ffc0cc17" +checksum = "489f1620bb7e2483fb5819ed01ab6edc1d2f93939dce35a5695085a1afd1d699" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck", - "indexmap 2.9.0", + "indexmap 2.13.0", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.101", + "sha3", + "syn 2.0.117", "syn-solidity", - "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e5772107f9bb265d8d8c86e0733937bb20d0857ea5425b1b6ddf51a9804042" +checksum = "56cef806ad22d4392c5fc83cf8f2089f988eb99c7067b4e0c6f1971fc1cca318" dependencies = [ "alloy-json-abi", "const-hex", @@ -440,15 +442,15 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.101", + "syn 2.0.117", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e188b939aa4793edfaaa099cb1be4e620036a775b4bdf24fdc56f1cd6fd45890" +checksum = "a6df77fea9d6a2a75c0ef8d2acbdfd92286cc599983d3175ccdc170d3433d249" dependencies = [ "serde", "winnow", @@ -456,9 +458,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c8a9a909872097caffc05df134e5ef2253a1cdb56d3a9cf0052a042ac763f9" +checksum = "64612d29379782a5dde6f4b6570d9c756d734d760c0c94c254d361e678a6591f" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -468,12 +470,11 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d94ee404368a3d9910dfe61b203e888c6b0e151a50e147f95da8baff9f9c7763" +checksum = "fa186e560d523d196580c48bf00f1bf62e63041f28ecf276acc22f8b27bb9f53" dependencies = [ "alloy-json-rpc", - "alloy-primitives", "auto_impl", "base64", "derive_more", @@ -492,24 +493,28 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f8a6338d594f6c6481292215ee8f2fd7b986c80aba23f3f44e761a8658de78" +checksum = "aa501ad58dd20acddbfebc65b52e60f05ebf97c52fa40d1b35e91f5e2da0ad0e" dependencies = [ "alloy-json-rpc", "alloy-transport", + "itertools 0.14.0", + "opentelemetry", + "opentelemetry-http", "reqwest", "serde_json", "tower", "tracing", + "tracing-opentelemetry", "url", ] [[package]] name = "alloy-trie" -version = "0.9.1" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3412d52bb97c6c6cc27ccc28d4e6e8cf605469101193b50b0bd5813b1f990b5" +checksum = "4d7fd448ab0a017de542de1dcca7a58e7019fe0e7a34ed3f9543ebddf6aceffa" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -518,28 +523,22 @@ dependencies = [ "nybbles", "serde", "smallvec", + "thiserror", "tracing", ] [[package]] name = "alloy-tx-macros" -version = "1.0.37" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64c09ec565a90ed8390d82aa08cd3b22e492321b96cb4a3d4f58414683c9e2f" +checksum = "6fa0c53e8c1e1ef4d01066b01c737fb62fc9397ab52c6e7bb5669f97d281b9bc" dependencies = [ - "alloy-primitives", - "darling 0.21.3", + "darling", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -551,9 +550,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.98" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "ark-ff" @@ -640,7 +639,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -678,7 +677,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -772,7 +771,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -783,15 +782,21 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "auto_impl" version = "1.3.0" @@ -800,29 +805,14 @@ checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.75" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "base16ct" @@ -838,9 +828,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.7.3" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" [[package]] name = "bit-set" @@ -859,15 +849,15 @@ checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitcoin-io" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" +checksum = "2dee39a0ee5b4095224a0cfc6bf4cc1baf0f9624b96b367e53b66d974e51d953" [[package]] name = "bitcoin_hashes" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b" dependencies = [ "bitcoin-io", "hex-conservative", @@ -875,9 +865,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.9.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" [[package]] name = "bitvec" @@ -902,9 +892,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.14" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c79a94619fade3c0b887670333513a67ac28a6a7e653eb260bf0d4103db38d" +checksum = "dcdb4c7013139a150f9fc55d123186dbfaba0d912817466282c73ac49e71fb45" dependencies = [ "cc", "glob", @@ -912,11 +902,34 @@ dependencies = [ "zeroize", ] +[[package]] +name = "borsh" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "byte-slice-cast" @@ -932,18 +945,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.10.1" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" dependencies = [ "serde", ] [[package]] name = "c-kzg" -version = "2.1.1" +version = "2.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7318cfa722931cb5fe0838b98d3ce5621e75f6a6408abc21721d80de9223f2e4" +checksum = "1a0f582957c24870b7bfd12bf562c40b4734b533cafbaf8ded31d6d85f462c01" dependencies = [ "blst", "cc", @@ -956,26 +969,32 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.23" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4ac86a9e5bc1e2b3449ab9d7d3a6a405e3d1bb28d7b9be8614f55846ae3766" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ - "android-tzdata", "iana-time-zone", "num-traits", "serde", @@ -984,15 +1003,14 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.14.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e22e0ed40b96a48d3db274f72fd365bd78f67af39b6bbd47e8a15e1c6207ff" +checksum = "af9a108e542ddf1de36743a6126e94d6659dccda38fc8a77e80b915102ac784a" dependencies = [ "cfg-if", "cpufeatures", - "hex", "proptest", - "serde", + "serde_core", ] [[package]] @@ -1003,9 +1021,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const_format" -version = "0.2.34" +version = "0.2.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" +checksum = "7faa7469a93a566e9ccc1c73fe783b4a65c274c5ace346038dca9c39fe0030ad" dependencies = [ "const_format_proc_macros", ] @@ -1021,11 +1039,20 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "convert_case" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" -version = "0.9.4" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" dependencies = [ "core-foundation-sys", "libc", @@ -1048,9 +1075,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" dependencies = [ "crc-catalog", ] @@ -1069,9 +1096,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-bigint" @@ -1095,38 +1122,14 @@ dependencies = [ "typenum", ] -[[package]] -name = "darling" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" -dependencies = [ - "darling_core 0.20.11", - "darling_macro 0.20.11", -] - [[package]] name = "darling" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core 0.21.3", - "darling_macro 0.21.3", -] - -[[package]] -name = "darling_core" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.101", + "darling_core", + "darling_macro", ] [[package]] @@ -1141,18 +1144,7 @@ dependencies = [ "quote", "serde", "strsim", - "syn 2.0.101", -] - -[[package]] -name = "darling_macro" -version = "0.20.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" -dependencies = [ - "darling_core 0.20.11", - "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -1161,9 +1153,9 @@ version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core 0.21.3", + "darling_core", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -1192,12 +1184,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.0" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", - "serde", + "serde_core", ] [[package]] @@ -1213,22 +1205,24 @@ dependencies = [ [[package]] name = "derive_more" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" dependencies = [ "derive_more-impl", ] [[package]] name = "derive_more-impl" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" dependencies = [ + "convert_case", "proc-macro2", "quote", - "syn 2.0.101", + "rustc_version 0.4.1", + "syn 2.0.117", "unicode-xid", ] @@ -1261,7 +1255,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -1270,6 +1264,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "ecdsa" version = "0.16.9" @@ -1294,7 +1294,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -1328,22 +1328,22 @@ dependencies = [ [[package]] name = "enum-ordinalize" -version = "4.3.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" dependencies = [ "enum-ordinalize-derive", ] [[package]] name = "enum-ordinalize-derive" -version = "4.3.1" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -1354,12 +1354,12 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.12" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1372,7 +1372,7 @@ dependencies = [ "serde", "serde_json", "wavs-wasi-utils", - "wit-bindgen-rt 0.44.0", + "wit-bindgen 0.46.0", "wstd", ] @@ -1414,6 +1414,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1461,9 +1467,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] @@ -1476,9 +1482,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -1491,9 +1497,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -1501,15 +1507,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -1518,38 +1524,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -1559,7 +1565,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -1571,9 +1576,9 @@ checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" [[package]] name = "generic-array" -version = "0.14.7" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" dependencies = [ "typenum", "version_check", @@ -1582,38 +1587,45 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasip2", ] [[package]] -name = "gimli" -version = "0.31.1" +name = "getrandom" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "139ef39800118c7683f2fd3c98c1b23c09ae076556b435f8e9064ae108aaeeec" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] [[package]] name = "glob" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "group" @@ -1640,23 +1652,24 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "allocator-api2", - "equivalent", "foldhash 0.1.5", ] [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ + "allocator-api2", + "equivalent", "foldhash 0.2.0", "serde", + "serde_core", ] [[package]] @@ -1667,24 +1680,21 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] [[package]] name = "hex-conservative" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" dependencies = [ "arrayvec", ] @@ -1700,12 +1710,11 @@ dependencies = [ [[package]] name = "http" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", - "fnv", "itoa", ] @@ -1740,18 +1749,20 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "hyper" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", + "futures-core", "http", "http-body", "httparse", "itoa", "pin-project-lite", + "pin-utils", "smallvec", "tokio", "want", @@ -1775,17 +1786,20 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.11" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ + "base64", "bytes", "futures-channel", "futures-util", "http", "http-body", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", "tokio", @@ -1795,9 +1809,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.63" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1819,9 +1833,9 @@ dependencies = [ [[package]] name = "icu_collections" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", "potential_utf", @@ -1832,9 +1846,9 @@ dependencies = [ [[package]] name = "icu_locale_core" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", @@ -1845,11 +1859,10 @@ dependencies = [ [[package]] name = "icu_normalizer" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", @@ -1860,42 +1873,38 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.0.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2549ca8c7241c82f59c80ba2a6f415d931c5b58d24fb8412caa1a1f02c49139a" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" dependencies = [ - "displaydoc", "icu_collections", "icu_locale_core", "icu_properties_data", "icu_provider", - "potential_utf", "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "2.0.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8197e866e47b68f8f7d95249e172903bec06004b18b2937f1095d40a0c57de04" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" [[package]] name = "icu_provider" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", "icu_locale_core", - "stable_deref_trait", - "tinystr", "writeable", "yoke", "zerofrom", @@ -1903,6 +1912,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -1911,9 +1926,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", @@ -1947,7 +1962,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -1963,13 +1978,14 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", - "hashbrown 0.15.3", + "hashbrown 0.16.1", "serde", + "serde_core", ] [[package]] @@ -1978,6 +1994,16 @@ version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "itertools" version = "0.10.5" @@ -2007,15 +2033,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -2037,18 +2063,18 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ "cpufeatures", ] [[package]] name = "keccak-asm" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +checksum = "b646a74e746cd25045aa0fd42f4f7f78aa6d119380182c7e63a5593c4ab8df6f" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -2060,53 +2086,58 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.172" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "linux-raw-sys" -version = "0.9.4" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.27" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lru" -version = "0.13.0" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "227748d55f2f0ab4735d87fd623798cb6b664512fe979705f829c9f81c934465" +checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593" dependencies = [ - "hashbrown 0.15.3", + "hashbrown 0.16.1", ] [[package]] @@ -2117,46 +2148,31 @@ checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.8.8" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" -dependencies = [ - "adler2", -] +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "mio" -version = "1.0.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.61.2", ] [[package]] name = "native-tls" -version = "0.2.14" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" dependencies = [ "libc", "log", @@ -2181,9 +2197,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-integer" @@ -2206,9 +2222,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" dependencies = [ "hermit-abi", "libc", @@ -2216,29 +2232,30 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" dependencies = [ "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.7.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "nybbles" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c4b5ecbd0beec843101bffe848217f770e8b8da81d8355b7d6e226f2199b3dc" +checksum = "0d49ff0c0d00d4a502b39df9af3a525e1efeb14b9dabb5bb83335284c1309210" dependencies = [ "alloy-rlp", "cfg-if", @@ -2248,15 +2265,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.21.3" @@ -2265,9 +2273,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "openssl" -version = "0.10.72" +version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fedfea7d58a1f73118430a55da6a286e7b044961736ce96a16a17068ea25e5da" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ "bitflags", "cfg-if", @@ -2286,20 +2294,20 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "openssl-probe" -version = "0.1.6" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "openssl-sys" -version = "0.9.108" +version = "0.9.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e145e1651e858e820e4860f7b9c5e169bc1d8ce1c86043be79fa7b7634821847" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" dependencies = [ "cc", "libc", @@ -2307,11 +2315,37 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b84bcd6ae87133e903af7ef497404dda70c60d0ea14895fc8a5e6722754fc2a0" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "pin-project-lite", + "thiserror", + "tracing", +] + +[[package]] +name = "opentelemetry-http" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a6d09a73194e6b66df7c8f1b680f156d916a1a942abf2de06823dd02b7855d" +dependencies = [ + "async-trait", + "bytes", + "http", + "opentelemetry", +] + [[package]] name = "parity-scale-codec" -version = "3.7.4" +version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fde3d0718baf5bc92f577d652001da0f8d54cd03a7974e118d04fc888dc23d" +checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" dependencies = [ "arrayvec", "bitvec", @@ -2325,21 +2359,21 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.7.4" +version = "3.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581c837bb6b9541ce7faa9377c20616e4fb7650f6b0f68bc93c827ee504fb7b3" +checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -2347,15 +2381,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -2366,46 +2400,45 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.8.0" +version = "2.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" dependencies = [ "memchr", - "thiserror", "ucd-trie", ] [[package]] name = "pin-project" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pin-utils" @@ -2431,9 +2464,9 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "potential_utf" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" dependencies = [ "zerovec", ] @@ -2453,6 +2486,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + [[package]] name = "primitive-types" version = "0.12.2" @@ -2466,9 +2509,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" dependencies = [ "toml_edit", ] @@ -2492,31 +2535,30 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.6.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" +checksum = "37566cb3fdacef14c0737f9546df7cfeadbfbc9fef10991038bf5015d0c80532" dependencies = [ "bit-set", "bit-vec", "bitflags", - "lazy_static", "num-traits", - "rand 0.8.5", - "rand_chacha 0.3.1", + "rand 0.9.2", + "rand_chacha 0.9.0", "rand_xorshift", "regex-syntax", "rusty-fork", @@ -2532,18 +2574,18 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "radium" @@ -2565,12 +2607,12 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.3", + "rand_core 0.9.5", "serde", ] @@ -2591,7 +2633,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -2600,68 +2642,93 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "serde", ] [[package]] name = "rand_xorshift" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" dependencies = [ - "rand_core 0.6.4", + "rand_core 0.9.5", +] + +[[package]] +name = "rapidhash" +version = "4.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e48930979c155e2f33aa36ab3119b5ee81332beb6482199a8ecd6029b80b59" +dependencies = [ + "rustversion", ] [[package]] name = "redox_syscall" -version = "0.5.12" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ "bitflags", ] +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "reqwest" -version = "0.12.15" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64", "bytes", "futures-core", - "futures-util", "http", "http-body", "http-body-util", "hyper", "hyper-tls", "hyper-util", - "ipnet", "js-sys", "log", - "mime", "native-tls", - "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -2669,12 +2736,12 @@ dependencies = [ "tokio", "tokio-native-tls", "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows-registry", ] [[package]] @@ -2699,9 +2766,9 @@ dependencies = [ [[package]] name = "ruint" -version = "1.17.0" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68df0380e5c9d20ce49534f292a36a7514ae21350726efe1865bdb1fa91d278" +checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", @@ -2717,7 +2784,7 @@ dependencies = [ "primitive-types", "proptest", "rand 0.8.5", - "rand 0.9.1", + "rand 0.9.2", "rlp", "ruint-macro", "serde_core", @@ -2731,12 +2798,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustc-hash" version = "2.1.1" @@ -2764,51 +2825,42 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.26", + "semver 1.0.27", ] [[package]] name = "rustix" -version = "1.0.7" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", + "windows-sys 0.61.2", ] [[package]] name = "rustls-pki-types" -version = "1.12.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ "zeroize", ] [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "rusty-fork" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +checksum = "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2" dependencies = [ "fnv", "quick-error", @@ -2818,17 +2870,41 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "schannel" -version = "0.1.27" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" dependencies = [ - "windows-sys 0.59.0", + "dyn-clone", + "ref-cast", + "serde", + "serde_json", ] [[package]] @@ -2875,9 +2951,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.1" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" dependencies = [ "bitflags", "core-foundation", @@ -2888,9 +2964,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.14.0" +version = "2.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" dependencies = [ "core-foundation-sys", "libc", @@ -2907,9 +2983,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] name = "semver-parser" @@ -2947,19 +3023,20 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", + "serde_core", + "zmij", ] [[package]] @@ -2976,17 +3053,18 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.12.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.9.0", - "serde", - "serde_derive", + "indexmap 2.13.0", + "schemars 0.9.0", + "schemars 1.2.1", + "serde_core", "serde_json", "serde_with_macros", "time", @@ -2994,14 +3072,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.12.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" dependencies = [ - "darling 0.20.11", + "darling", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -3037,14 +3115,23 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +checksum = "b31139435f327c93c6038ed350ae4588e2c70a13d50599509fee6349967ba35a" dependencies = [ "cc", "cfg-if", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -3063,30 +3150,27 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] [[package]] name = "socket2" -version = "0.5.9" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -3101,9 +3185,9 @@ dependencies = [ [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "static_assertions" @@ -3119,24 +3203,23 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" dependencies = [ "heck", "proc-macro2", "quote", - "rustversion", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -3158,9 +3241,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -3169,14 +3252,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.4.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2375c17f6067adc651d8c2c51658019cef32edfff4a982adaf1d7fd1c039f08b" +checksum = "53f425ae0b12e2f5ae65542e00898d500d4d318b4baf09f40fd0d410454e9947" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -3196,7 +3279,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -3207,35 +3290,44 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.20.0" +version = "3.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ "fastrand", - "getrandom 0.3.3", + "getrandom 0.4.1", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", ] [[package]] @@ -3249,49 +3341,40 @@ dependencies = [ [[package]] name = "time" -version = "0.3.41" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.4" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.22" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinystr" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", "zerovec", @@ -3299,29 +3382,28 @@ dependencies = [ [[package]] name = "tokio" -version = "1.45.0" +version = "1.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" dependencies = [ - "backtrace", "bytes", "libc", "mio", "pin-project-lite", "socket2", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -3336,9 +3418,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -3348,9 +3430,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -3361,26 +3443,39 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.9" +version = "0.7.5+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] [[package]] name = "toml_edit" -version = "0.22.26" +version = "0.23.10+spec-1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ - "indexmap 2.9.0", + "indexmap 2.13.0", "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.9+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" +dependencies = [ "winnow", ] [[package]] name = "tower" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", @@ -3391,6 +3486,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -3405,9 +3518,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -3416,22 +3529,61 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.28" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac28f2d093c6c477eaa76b23525478f38de514fa9aeb1285738d4b97a9552fc" +dependencies = [ + "js-sys", + "opentelemetry", + "smallvec", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", + "web-time", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "sharded-slab", + "thread_local", + "tracing-core", ] [[package]] @@ -3442,9 +3594,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "ucd-trie" @@ -3472,9 +3624,15 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-xid" @@ -3484,13 +3642,15 @@ checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "url" -version = "2.5.4" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", + "serde_derive", ] [[package]] @@ -3537,61 +3697,58 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" -version = "0.14.2+wasi-0.2.4" +version = "0.14.7+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" dependencies = [ - "wit-bindgen-rt 0.39.0", + "wasip2", ] [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "wit-bindgen", + "wit-bindgen 0.51.0", ] [[package]] -name = "wasm-bindgen" -version = "0.2.100" +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", + "wit-bindgen 0.51.0", ] [[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" +name = "wasm-bindgen" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.101", + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.50" +version = "0.4.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" dependencies = [ "cfg-if", + "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -3600,9 +3757,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3610,31 +3767,99 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.101", - "wasm-bindgen-backend", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +dependencies = [ + "leb128fmt", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser 0.244.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20b3ec880a9ac69ccd92fbdbcf46ee833071cf09f82bb005b2327c7ae6025ae2" +dependencies = [ + "anyhow", + "indexmap 2.13.0", + "wasm-encoder 0.239.0", + "wasmparser 0.239.0", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.13.0", + "wasm-encoder 0.244.0", + "wasmparser 0.244.0", +] + +[[package]] +name = "wasmparser" +version = "0.239.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap 2.13.0", + "semver 1.0.27", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap 2.13.0", + "semver 1.0.27", +] + [[package]] name = "wasmtimer" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23" +checksum = "1c598d6b99ea013e35844697fc4670d08339d5cda15588f193c6beedd12f644b" dependencies = [ "futures", "js-sys", @@ -3646,9 +3871,9 @@ dependencies = [ [[package]] name = "wavs-wasi-utils" -version = "1.0.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcecf1034f84a086b020d9a300d7dd38e4071aa9662371351eb61952a38ddd69" +checksum = "9d3c5ae2f3e2b699b1ac4fc8bfc52049390a53c7d83c8bd9fae2ddb5381d8aeb" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -3664,15 +3889,25 @@ dependencies = [ "serde", "serde_json", "tower-service", - "wasi 0.14.2+wasi-0.2.4", + "wasi 0.14.7+wasi-0.2.4", "wstd", ] [[package]] name = "web-sys" -version = "0.3.77" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -3680,270 +3915,340 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.1" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ec44dc15085cea82cf9c78f85a9114c463a369786585ad2882d1ff0b0acf40" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ "windows-implement", "windows-interface", "windows-link", "windows-result", - "windows-strings 0.4.1", + "windows-strings", ] [[package]] name = "windows-implement" -version = "0.60.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "windows-interface" -version = "0.59.1" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "windows-link" -version = "0.1.1" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" - -[[package]] -name = "windows-registry" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" -dependencies = [ - "windows-result", - "windows-strings 0.3.1", - "windows-targets 0.53.0", -] +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "windows-result" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b895b5356fc36103d0f64dd1e94dfa7ac5633f1c9dd6e80fe9ec4adef69e09d" -dependencies = [ - "windows-link", -] - -[[package]] -name = "windows-strings" -version = "0.3.1" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a7ab927b2637c19b3dbe0965e75d8f2d30bdd697a1516191cad2ec4df8fb28a" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ "windows-link", ] [[package]] name = "windows-sys" -version = "0.52.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] name = "windows-sys" -version = "0.59.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "windows-targets" -version = "0.52.6" +version = "0.53.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm 0.52.6", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows-link", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] -name = "windows-targets" -version = "0.53.0" +name = "windows_aarch64_gnullvm" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" -dependencies = [ - "windows_aarch64_gnullvm 0.53.0", - "windows_aarch64_msvc 0.53.0", - "windows_i686_gnu 0.53.0", - "windows_i686_gnullvm 0.53.0", - "windows_i686_msvc 0.53.0", - "windows_x86_64_gnu 0.53.0", - "windows_x86_64_gnullvm 0.53.0", - "windows_x86_64_msvc 0.53.0", -] +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" [[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" +name = "windows_aarch64_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" [[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.0" +name = "windows_i686_gnu" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" [[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" +name = "windows_i686_gnullvm" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" [[package]] -name = "windows_aarch64_msvc" -version = "0.53.0" +name = "windows_i686_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" [[package]] -name = "windows_i686_gnu" -version = "0.52.6" +name = "windows_x86_64_gnu" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" [[package]] -name = "windows_i686_gnu" -version = "0.53.0" +name = "windows_x86_64_gnullvm" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" [[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" +name = "windows_x86_64_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] -name = "windows_i686_gnullvm" -version = "0.53.0" +name = "winnow" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] [[package]] -name = "windows_i686_msvc" -version = "0.52.6" +name = "wit-bindgen" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +dependencies = [ + "bitflags", + "futures", + "once_cell", + "wit-bindgen-rust-macro 0.46.0", +] [[package]] -name = "windows_i686_msvc" -version = "0.53.0" +name = "wit-bindgen" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "bitflags", + "wit-bindgen-rust-macro 0.51.0", +] [[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" +name = "wit-bindgen-core" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +checksum = "cabd629f94da277abc739c71353397046401518efb2c707669f805205f0b9890" +dependencies = [ + "anyhow", + "heck", + "wit-parser 0.239.0", +] [[package]] -name = "windows_x86_64_gnu" -version = "0.53.0" +name = "wit-bindgen-core" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser 0.244.0", +] [[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" +name = "wit-bindgen-rust" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +checksum = "9a4232e841089fa5f3c4fc732a92e1c74e1a3958db3b12f1de5934da2027f1f4" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.13.0", + "prettyplease", + "syn 2.0.117", + "wasm-metadata 0.239.0", + "wit-bindgen-core 0.46.0", + "wit-component 0.239.0", +] [[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.0" +name = "wit-bindgen-rust" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.13.0", + "prettyplease", + "syn 2.0.117", + "wasm-metadata 0.244.0", + "wit-bindgen-core 0.51.0", + "wit-component 0.244.0", +] [[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" +name = "wit-bindgen-rust-macro" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +checksum = "1e0d4698c2913d8d9c2b220d116409c3f51a7aa8d7765151b886918367179ee9" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core 0.46.0", + "wit-bindgen-rust 0.46.0", +] [[package]] -name = "windows_x86_64_msvc" -version = "0.53.0" +name = "wit-bindgen-rust-macro" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core 0.51.0", + "wit-bindgen-rust 0.51.0", +] [[package]] -name = "winnow" -version = "0.7.10" +name = "wit-component" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +checksum = "88a866b19dba2c94d706ec58c92a4c62ab63e482b4c935d2a085ac94caecb136" dependencies = [ - "memchr", + "anyhow", + "bitflags", + "indexmap 2.13.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.239.0", + "wasm-metadata 0.239.0", + "wasmparser 0.239.0", + "wit-parser 0.239.0", ] [[package]] -name = "wit-bindgen" -version = "0.46.0" +name = "wit-component" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" dependencies = [ + "anyhow", "bitflags", + "indexmap 2.13.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder 0.244.0", + "wasm-metadata 0.244.0", + "wasmparser 0.244.0", + "wit-parser 0.244.0", ] [[package]] -name = "wit-bindgen-rt" -version = "0.39.0" +name = "wit-parser" +version = "0.239.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +checksum = "55c92c939d667b7bf0c6bf2d1f67196529758f99a2a45a3355cc56964fd5315d" dependencies = [ - "bitflags", + "anyhow", + "id-arena", + "indexmap 2.13.0", + "log", + "semver 1.0.27", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.239.0", ] [[package]] -name = "wit-bindgen-rt" -version = "0.44.0" +name = "wit-parser" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653c85dd7aee6fe6f4bded0d242406deadae9819029ce6f7d258c920c384358a" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" dependencies = [ - "bitflags", + "anyhow", + "id-arena", + "indexmap 2.13.0", + "log", + "semver 1.0.27", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser 0.244.0", ] [[package]] name = "writeable" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "wstd" @@ -3969,7 +4274,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb142608f932022fa7d155d8ed99649d02c56a50532e71913a5a03c7c4e288d3" dependencies = [ "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -3983,11 +4288,10 @@ dependencies = [ [[package]] name = "yoke" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -3995,34 +4299,34 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "a789c6e490b576db9f7e6b6d661bcc9799f7c0ac8352f56ea20193b2681532e5" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "f65c489a7071a749c849713807783f70672b28094011623e200cb86dcb835953" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] @@ -4042,35 +4346,35 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", "synstructure", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] [[package]] name = "zerotrie" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ "displaydoc", "yoke", @@ -4079,9 +4383,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ "yoke", "zerofrom", @@ -4090,11 +4394,17 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.117", ] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index 0d8b5a26..6f8550c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,10 @@ rust-version = "1.87.0" [workspace.dependencies] # WASI -wit-bindgen-rt = { version = "0.44.0", features = ["bitflags"] } -wit-bindgen = "0.44.0" -wstd = "0.5.4" +wit-bindgen = { version = "0.46.0", features = ["bitflags"] } +wstd = "0.5.6" wasi = "0.14.2" -wavs-wasi-utils = "=1.0.0" +wavs-wasi-utils = "=2.6.0" # Other schemars = "1.0.4" diff --git a/Makefile b/Makefile index 00f563b5..e3d2bc6b 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CARGO=cargo INPUT_DATA?=`` COMPONENT_FILENAME?=evm_price_oracle.wasm CREDENTIAL?="" -DOCKER_IMAGE?=ghcr.io/lay3rlabs/wavs:1.5.1 +DOCKER_IMAGE?=ghcr.io/lay3rlabs/wavs:216aa67 MIDDLEWARE_DOCKER_IMAGE?=ghcr.io/lay3rlabs/wavs-middleware:0.5.0-beta.10 IPFS_ENDPOINT?=http://127.0.0.1:5001 RPC_URL?=http://127.0.0.1:8545 diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 00000000..b35e1f87 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,4 @@ +PLAN: +- Delete makefile? +- Upgrade to official WAVS 2 when there is a new release +- Clean up old claude notes on component authoring... diff --git a/Taskfile.yml b/Taskfile.yml index 60395ccf..0745f30e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -9,7 +9,7 @@ dotenv: [".env"] includes: # Upstream common taskfiles (from wavs-taskfiles repo) docker: https://raw.githubusercontent.com/Lay3rLabs/wavs-taskfiles/main/base/docker.yml - operator: https://raw.githubusercontent.com/Lay3rLabs/wavs-taskfiles/main/base/poa-operator.yml + operator: ./taskfile/poa-operator.yml wasi: https://raw.githubusercontent.com/Lay3rLabs/wavs-taskfiles/main/base/wasi.yml core: taskfile: https://raw.githubusercontent.com/Lay3rLabs/wavs-taskfiles/main/base/core.yml @@ -25,7 +25,7 @@ includes: vars: # Docker configuration - DOCKER_IMAGE: '{{.DOCKER_IMAGE | default "ghcr.io/lay3rlabs/wavs:1.5.1"}}' + DOCKER_IMAGE: '{{.DOCKER_IMAGE | default "ghcr.io/lay3rlabs/wavs:216aa67"}}' MIDDLEWARE_DOCKER_IMAGE: '{{.MIDDLEWARE_DOCKER_IMAGE | default "ghcr.io/lay3rlabs/wavs-middleware:0.5.0-beta.10"}}' # Check if user is in docker group to determine if sudo is needed diff --git a/components/aggregator/Cargo.toml b/components/aggregator/Cargo.toml index 105e8197..be30e166 100644 --- a/components/aggregator/Cargo.toml +++ b/components/aggregator/Cargo.toml @@ -18,13 +18,12 @@ lto = true [package.metadata.component] package = "component:aggregator" -target = "wavs:aggregator@=1.3.0" [dependencies] alloy-primitives = { workspace = true } alloy-network = { workspace = true } alloy-provider = { workspace = true } -wit-bindgen-rt = { workspace = true } +wit-bindgen = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } wavs-wasi-utils = { workspace = true } diff --git a/components/aggregator/src/bindings.rs b/components/aggregator/src/bindings.rs index ae8379b9..0eafa934 100644 --- a/components/aggregator/src/bindings.rs +++ b/components/aggregator/src/bindings.rs @@ -1,24703 +1,8 @@ -// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT! -// Options used: -// * runtime_path: "wit_bindgen_rt" -pub type Packet = wavs::aggregator::aggregator::Packet; -pub type AggregatorAction = wavs::aggregator::aggregator::AggregatorAction; -pub type AnyTxHash = wavs::types::chain::AnyTxHash; -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn _export_process_packet_cabi(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len2 = l1; - let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); - let l3 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l4 = *arg0.add(3 * ::core::mem::size_of::<*const u8>()).cast::(); - let base160 = l3; - let len160 = l4; - let mut result160 = _rt::Vec::with_capacity(len160); - for i in 0..len160 { - let base = base160.add(i * (144 + 42 * ::core::mem::size_of::<*const u8>())); - let e160 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base.add(::core::mem::size_of::<*const u8>()).cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); - let l8 = i32::from( - *base.add(2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::Trigger as V43; - let v43 = match l8 { - 0 => { - let e43 = { - let l9 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let l12 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len14 = l13; - let bytes14 = _rt::Vec::from_raw_parts(l12.cast(), len14, len14); - let l15 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l16 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len17 = l16; - wavs::types::service::TriggerEvmContractEvent { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l9.cast(), len11, len11), - }, - chain: _rt::string_lift(bytes14), - event_hash: _rt::Vec::from_raw_parts( - l15.cast(), - len17, - len17, - ), - } - }; - V43::EvmContractEvent(e43) - } - 1 => { - let e43 = { - let l18 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l19 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len20 = l19; - let bytes20 = _rt::Vec::from_raw_parts(l18.cast(), len20, len20); - let l21 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l22 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l23 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - let l25 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l26 = *base - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len27 = l26; - let bytes27 = _rt::Vec::from_raw_parts(l25.cast(), len27, len27); - wavs::types::service::TriggerCosmosContractEvent { - address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes20), - prefix_len: l21 as u32, - }, - chain: _rt::string_lift(bytes24), - event_type: _rt::string_lift(bytes27), - } - }; - V43::CosmosContractEvent(e43) - } - 2 => { - let e43 = { - let l28 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l29 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len30 = l29; - let bytes30 = _rt::Vec::from_raw_parts(l28.cast(), len30, len30); - let l31 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l32 = i32::from( - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l34 = i32::from( - *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes30), - n_blocks: l31 as u32, - start_block: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l33 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *base - .add(40 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V43::BlockInterval(e43) - } - 3 => { - let e43 = { - let l36 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l37 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len38 = l37; - let bytes38 = _rt::Vec::from_raw_parts(l36.cast(), len38, len38); - let l39 = i32::from( - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l41 = i32::from( - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes38), - start_time: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l40 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l42 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V43::Cron(e43) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V43::Manual - } - }; - let l44 = i32::from( - *base.add(48 + 4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ComponentSource as V68; - let v68 = match l44 { - 0 => { - let e68 = { - let l45 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l46 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len47 = l46; - let bytes47 = _rt::Vec::from_raw_parts(l45.cast(), len47, len47); - let l48 = *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l49 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len50 = l49; - let bytes50 = _rt::Vec::from_raw_parts(l48.cast(), len50, len50); - wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes47), - digest: _rt::string_lift(bytes50), - } - }; - V68::Download(e68) - } - 1 => { - let e68 = { - let l51 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l52 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len53 = l52; - let bytes53 = _rt::Vec::from_raw_parts(l51.cast(), len53, len53); - let l54 = i32::from( - *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l58 = i32::from( - *base - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l62 = *base - .add(48 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *base - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len64 = l63; - let bytes64 = _rt::Vec::from_raw_parts(l62.cast(), len64, len64); - wavs::types::service::Registry { - digest: _rt::string_lift(bytes53), - domain: match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l56 = *base - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len57 = l56; - let bytes57 = _rt::Vec::from_raw_parts( - l55.cast(), - len57, - len57, - ); - _rt::string_lift(bytes57) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l58 { - 0 => None, - 1 => { - let e = { - let l59 = *base - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *base - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts( - l59.cast(), - len61, - len61, - ); - _rt::string_lift(bytes61) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes64), - } - }; - V68::Registry(e68) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e68 = { - let l65 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l66 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len67 = l66; - let bytes67 = _rt::Vec::from_raw_parts(l65.cast(), len67, len67); - _rt::string_lift(bytes67) - }; - V68::Digest(e68) - } - }; - let l69 = i32::from( - *base.add(48 + 15 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::AllowedHostPermission as V76; - let v76 = match l69 { - 0 => V76::All, - 1 => { - let e76 = { - let l70 = *base - .add(48 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l71 = *base - .add(48 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base75 = l70; - let len75 = l71; - let mut result75 = _rt::Vec::with_capacity(len75); - for i in 0..len75 { - let base = base75 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e75 = { - let l72 = *base.add(0).cast::<*mut u8>(); - let l73 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len74 = l73; - let bytes74 = _rt::Vec::from_raw_parts( - l72.cast(), - len74, - len74, - ); - _rt::string_lift(bytes74) - }; - result75.push(e75); - } - _rt::cabi_dealloc( - base75, - len75 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result75 - }; - V76::Only(e76) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V76::None - } - }; - let l77 = i32::from( - *base.add(48 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l78 = i32::from( - *base.add(56 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l80 = i32::from( - *base.add(72 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l82 = *base - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l83 = *base - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base90 = l82; - let len90 = l83; - let mut result90 = _rt::Vec::with_capacity(len90); - for i in 0..len90 { - let base = base90.add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e90 = { - let l84 = *base.add(0).cast::<*mut u8>(); - let l85 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len86 = l85; - let bytes86 = _rt::Vec::from_raw_parts(l84.cast(), len86, len86); - let l87 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l88 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len89 = l88; - let bytes89 = _rt::Vec::from_raw_parts(l87.cast(), len89, len89); - (_rt::string_lift(bytes86), _rt::string_lift(bytes89)) - }; - result90.push(e90); - } - _rt::cabi_dealloc( - base90, - len90 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l91 = *base - .add(88 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l92 = *base - .add(88 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base96 = l91; - let len96 = l92; - let mut result96 = _rt::Vec::with_capacity(len96); - for i in 0..len96 { - let base = base96.add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e96 = { - let l93 = *base.add(0).cast::<*mut u8>(); - let l94 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len95 = l94; - let bytes95 = _rt::Vec::from_raw_parts(l93.cast(), len95, len95); - _rt::string_lift(bytes95) - }; - result96.push(e96); - } - _rt::cabi_dealloc( - base96, - len96 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l97 = i32::from( - *base.add(88 + 22 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::Submit as V159; - let v159 = match l97 { - 0 => V159::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e159 = { - let l98 = *base - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l99 = *base - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len100 = l99; - let bytes100 = _rt::Vec::from_raw_parts( - l98.cast(), - len100, - len100, - ); - let l101 = i32::from( - *base - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::ComponentSource as V125; - let v125 = match l101 { - 0 => { - let e125 = { - let l102 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l103 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len104 = l103; - let bytes104 = _rt::Vec::from_raw_parts( - l102.cast(), - len104, - len104, - ); - let l105 = *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l106 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len107 = l106; - let bytes107 = _rt::Vec::from_raw_parts( - l105.cast(), - len107, - len107, - ); - wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes104), - digest: _rt::string_lift(bytes107), - } - }; - V125::Download(e125) - } - 1 => { - let e125 = { - let l108 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l109 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len110 = l109; - let bytes110 = _rt::Vec::from_raw_parts( - l108.cast(), - len110, - len110, - ); - let l111 = i32::from( - *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l115 = i32::from( - *base - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l119 = *base - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l120 = *base - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len121 = l120; - let bytes121 = _rt::Vec::from_raw_parts( - l119.cast(), - len121, - len121, - ); - wavs::types::service::Registry { - digest: _rt::string_lift(bytes110), - domain: match l111 { - 0 => None, - 1 => { - let e = { - let l112 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l113 = *base - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len114 = l113; - let bytes114 = _rt::Vec::from_raw_parts( - l112.cast(), - len114, - len114, - ); - _rt::string_lift(bytes114) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l115 { - 0 => None, - 1 => { - let e = { - let l116 = *base - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l117 = *base - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len118 = l117; - let bytes118 = _rt::Vec::from_raw_parts( - l116.cast(), - len118, - len118, - ); - _rt::string_lift(bytes118) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes121), - } - }; - V125::Registry(e125) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e125 = { - let l122 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l123 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len124 = l123; - let bytes124 = _rt::Vec::from_raw_parts( - l122.cast(), - len124, - len124, - ); - _rt::string_lift(bytes124) - }; - V125::Digest(e125) - } - }; - let l126 = i32::from( - *base - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::AllowedHostPermission as V133; - let v133 = match l126 { - 0 => V133::All, - 1 => { - let e133 = { - let l127 = *base - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l128 = *base - .add(96 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base132 = l127; - let len132 = l128; - let mut result132 = _rt::Vec::with_capacity(len132); - for i in 0..len132 { - let base = base132 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e132 = { - let l129 = *base.add(0).cast::<*mut u8>(); - let l130 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len131 = l130; - let bytes131 = _rt::Vec::from_raw_parts( - l129.cast(), - len131, - len131, - ); - _rt::string_lift(bytes131) - }; - result132.push(e132); - } - _rt::cabi_dealloc( - base132, - len132 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result132 - }; - V133::Only(e133) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V133::None - } - }; - let l134 = i32::from( - *base - .add(96 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l135 = i32::from( - *base - .add(104 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l137 = i32::from( - *base - .add(120 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l139 = *base - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l140 = *base - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base147 = l139; - let len147 = l140; - let mut result147 = _rt::Vec::with_capacity(len147); - for i in 0..len147 { - let base = base147 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e147 = { - let l141 = *base.add(0).cast::<*mut u8>(); - let l142 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len143 = l142; - let bytes143 = _rt::Vec::from_raw_parts( - l141.cast(), - len143, - len143, - ); - let l144 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l145 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len146 = l145; - let bytes146 = _rt::Vec::from_raw_parts( - l144.cast(), - len146, - len146, - ); - (_rt::string_lift(bytes143), _rt::string_lift(bytes146)) - }; - result147.push(e147); - } - _rt::cabi_dealloc( - base147, - len147 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l148 = *base - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l149 = *base - .add(136 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base153 = l148; - let len153 = l149; - let mut result153 = _rt::Vec::with_capacity(len153); - for i in 0..len153 { - let base = base153 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e153 = { - let l150 = *base.add(0).cast::<*mut u8>(); - let l151 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len152 = l151; - let bytes152 = _rt::Vec::from_raw_parts( - l150.cast(), - len152, - len152, - ); - _rt::string_lift(bytes152) - }; - result153.push(e153); - } - _rt::cabi_dealloc( - base153, - len153 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l154 = i32::from( - *base - .add(136 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignatureAlgorithm as V155; - let v155 = match l154 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V155::Secp256k1 - } - }; - let l156 = i32::from( - *base - .add(137 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes100), - component: wavs::types::service::Component { - source: v125, - permissions: wavs::types::service::Permissions { - allowed_http_hosts: v133, - file_system: _rt::bool_lift(l134 as u8), - }, - fuel_limit: match l135 { - 0 => None, - 1 => { - let e = { - let l136 = *base - .add(112 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l136 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l137 { - 0 => None, - 1 => { - let e = { - let l138 = *base - .add(128 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l138 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result147, - env_keys: result153, - }, - signature_kind: wavs::types::service::SignatureKind { - algorithm: v155, - prefix: match l156 { - 0 => None, - 1 => { - let e = { - let l157 = i32::from( - *base - .add(138 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignaturePrefix as V158; - let v158 = match l157 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V158::Eip191 - } - }; - v158 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V159::Aggregator(e159) - } - }; - ( - _rt::string_lift(bytes7), - wavs::types::service::Workflow { - trigger: v43, - component: wavs::types::service::Component { - source: v68, - permissions: wavs::types::service::Permissions { - allowed_http_hosts: v76, - file_system: _rt::bool_lift(l77 as u8), - }, - fuel_limit: match l78 { - 0 => None, - 1 => { - let e = { - let l79 = *base - .add(64 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l79 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l80 { - 0 => None, - 1 => { - let e = { - let l81 = *base - .add(80 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l81 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result90, - env_keys: result96, - }, - submit: v159, - }, - ) - }; - result160.push(e160); - } - _rt::cabi_dealloc( - base160, - len160 * (144 + 42 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let l161 = i32::from( - *arg0.add(4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ServiceStatus as V162; - let v162 = match l161 { - 0 => V162::Active, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - V162::Paused - } - }; - let l163 = i32::from( - *arg0.add(5 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ServiceManager as V170; - let v170 = match l163 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - let e170 = { - let l164 = *arg0 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l165 = *arg0 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len166 = l165; - let bytes166 = _rt::Vec::from_raw_parts(l164.cast(), len166, len166); - let l167 = *arg0 - .add(8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l168 = *arg0 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len169 = l168; - wavs::types::service::EvmManager { - chain: _rt::string_lift(bytes166), - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l167.cast(), len169, len169), - }, - } - }; - V170::Evm(e170) - } - }; - let l171 = *arg0.add(10 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l172 = *arg0.add(11 * ::core::mem::size_of::<*const u8>()).cast::(); - let len173 = l172; - let bytes173 = _rt::Vec::from_raw_parts(l171.cast(), len173, len173); - let l174 = *arg0.add(12 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l175 = *arg0.add(13 * ::core::mem::size_of::<*const u8>()).cast::(); - let len176 = l175; - let l177 = *arg0.add(14 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l178 = *arg0.add(15 * ::core::mem::size_of::<*const u8>()).cast::(); - let len179 = l178; - let l180 = *arg0.add(16 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l181 = *arg0.add(17 * ::core::mem::size_of::<*const u8>()).cast::(); - let len182 = l181; - let l183 = *arg0.add(18 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l184 = *arg0.add(19 * ::core::mem::size_of::<*const u8>()).cast::(); - let len185 = l184; - let l186 = i32::from( - *arg0.add(20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::SignatureAlgorithm as V187; - let v187 = match l186 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V187::Secp256k1 - } - }; - let l188 = i32::from( - *arg0.add(1 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l191 = i32::from( - *arg0.add(8 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::events::TriggerData as V247; - let v247 = match l191 { - 0 => { - let e247 = { - let l192 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l193 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len194 = l193; - let bytes194 = _rt::Vec::from_raw_parts(l192.cast(), len194, len194); - let l195 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l196 = *arg0 - .add(16 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len197 = l196; - let l198 = *arg0 - .add(16 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l199 = *arg0 - .add(16 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base203 = l198; - let len203 = l199; - let mut result203 = _rt::Vec::with_capacity(len203); - for i in 0..len203 { - let base = base203 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e203 = { - let l200 = *base.add(0).cast::<*mut u8>(); - let l201 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len202 = l201; - _rt::Vec::from_raw_parts(l200.cast(), len202, len202) - }; - result203.push(e203); - } - _rt::cabi_dealloc( - base203, - len203 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l204 = *arg0 - .add(16 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l205 = *arg0 - .add(16 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len206 = l205; - let l207 = *arg0 - .add(16 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l208 = *arg0 - .add(16 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len209 = l208; - let l210 = *arg0 - .add(16 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l211 = *arg0 - .add(24 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l212 = *arg0 - .add(32 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l213 = *arg0 - .add(32 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len214 = l213; - let l215 = i32::from( - *arg0.add(32 + 32 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l217 = *arg0 - .add(48 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataEvmContractEvent { - chain: _rt::string_lift(bytes194), - log: wavs::types::chain::EvmEventLog { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l195.cast(), - len197, - len197, - ), - }, - data: wavs::types::chain::EvmEventLogData { - topics: result203, - data: _rt::Vec::from_raw_parts(l204.cast(), len206, len206), - }, - tx_hash: _rt::Vec::from_raw_parts(l207.cast(), len209, len209), - block_number: l210 as u64, - log_index: l211 as u64, - block_hash: _rt::Vec::from_raw_parts( - l212.cast(), - len214, - len214, - ), - block_timestamp: match l215 { - 0 => None, - 1 => { - let e = { - let l216 = *arg0 - .add(40 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l216 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - tx_index: l217 as u64, - }, - } - }; - V247::EvmContractEvent(e247) - } - 1 => { - let e247 = { - let l218 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l219 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len220 = l219; - let bytes220 = _rt::Vec::from_raw_parts(l218.cast(), len220, len220); - let l221 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l222 = *arg0 - .add(16 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l223 = *arg0 - .add(16 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len224 = l223; - let bytes224 = _rt::Vec::from_raw_parts(l222.cast(), len224, len224); - let l225 = *arg0 - .add(16 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l226 = *arg0 - .add(16 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len227 = l226; - let bytes227 = _rt::Vec::from_raw_parts(l225.cast(), len227, len227); - let l228 = *arg0 - .add(16 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l229 = *arg0 - .add(16 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base236 = l228; - let len236 = l229; - let mut result236 = _rt::Vec::with_capacity(len236); - for i in 0..len236 { - let base = base236 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e236 = { - let l230 = *base.add(0).cast::<*mut u8>(); - let l231 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len232 = l231; - let bytes232 = _rt::Vec::from_raw_parts( - l230.cast(), - len232, - len232, - ); - let l233 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l234 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len235 = l234; - let bytes235 = _rt::Vec::from_raw_parts( - l233.cast(), - len235, - len235, - ); - (_rt::string_lift(bytes232), _rt::string_lift(bytes235)) - }; - result236.push(e236); - } - _rt::cabi_dealloc( - base236, - len236 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l237 = *arg0 - .add(24 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l238 = *arg0 - .add(32 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCosmosContractEvent { - contract_address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes220), - prefix_len: l221 as u32, - }, - chain: _rt::string_lift(bytes224), - event: wavs::types::chain::CosmosEvent { - ty: _rt::string_lift(bytes227), - attributes: result236, - }, - event_index: l237 as u64, - block_height: l238 as u64, - } - }; - V247::CosmosContractEvent(e247) - } - 2 => { - let e247 = { - let l239 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l240 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len241 = l240; - let bytes241 = _rt::Vec::from_raw_parts(l239.cast(), len241, len241); - let l242 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataBlockInterval { - chain: _rt::string_lift(bytes241), - block_height: l242 as u64, - } - }; - V247::BlockInterval(e247) - } - 3 => { - let e247 = { - let l243 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCron { - trigger_time: wavs::types::core::Timestamp { - nanos: l243 as u64, - }, - } - }; - V247::Cron(e247) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - let e247 = { - let l244 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l245 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len246 = l245; - _rt::Vec::from_raw_parts(l244.cast(), len246, len246) - }; - V247::Raw(e247) - } - }; - let result248 = T::process_packet(wavs::aggregator::aggregator::Packet { - service: wavs::types::service::Service { - name: _rt::string_lift(bytes2), - workflows: result160, - status: v162, - manager: v170, - }, - workflow_id: _rt::string_lift(bytes173), - envelope: wavs::aggregator::aggregator::Envelope { - event_id: _rt::Vec::from_raw_parts(l174.cast(), len176, len176), - ordering: _rt::Vec::from_raw_parts(l177.cast(), len179, len179), - payload: _rt::Vec::from_raw_parts(l180.cast(), len182, len182), - }, - signature: wavs::aggregator::aggregator::EnvelopeSignature { - data: _rt::Vec::from_raw_parts(l183.cast(), len185, len185), - kind: wavs::types::service::SignatureKind { - algorithm: v187, - prefix: match l188 { - 0 => None, - 1 => { - let e = { - let l189 = i32::from( - *arg0 - .add(2 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignaturePrefix as V190; - let v190 = match l189 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V190::Eip191 - } - }; - v190 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - }, - trigger_data: v247, - }); - _rt::cabi_dealloc(arg0, 56 + 32 * ::core::mem::size_of::<*const u8>(), 8); - let ptr249 = (&raw mut _RET_AREA.0).cast::(); - match result248 { - Ok(e) => { - *ptr249.add(0).cast::() = (0i32) as u8; - let vec259 = e; - let len259 = vec259.len(); - let layout259 = _rt::alloc::Layout::from_size_align_unchecked( - vec259.len() * (32 + 4 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let result259 = if layout259.size() != 0 { - let ptr = _rt::alloc::alloc(layout259).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout259); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec259.into_iter().enumerate() { - let base = result259 - .add(i * (32 + 4 * ::core::mem::size_of::<*const u8>())); - { - use wavs::aggregator::aggregator::AggregatorAction as V258; - match e { - V258::Timer(e) => { - *base.add(0).cast::() = (0i32) as u8; - let wavs::aggregator::aggregator::TimerAction { - delay: delay250, - } = e; - let wavs::types::core::Duration { secs: secs251 } = delay250; - *base.add(8).cast::() = _rt::as_i64(secs251); - } - V258::Submit(e) => { - *base.add(0).cast::() = (1i32) as u8; - let wavs::aggregator::aggregator::SubmitAction { - chain: chain252, - contract_address: contract_address252, - gas_price: gas_price252, - } = e; - let vec253 = (chain252.into_bytes()).into_boxed_slice(); - let ptr253 = vec253.as_ptr().cast::(); - let len253 = vec253.len(); - ::core::mem::forget(vec253); - *base - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::() = len253; - *base.add(8).cast::<*mut u8>() = ptr253.cast_mut(); - let wavs::types::chain::EvmAddress { - raw_bytes: raw_bytes254, - } = contract_address252; - let vec255 = (raw_bytes254).into_boxed_slice(); - let ptr255 = vec255.as_ptr().cast::(); - let len255 = vec255.len(); - ::core::mem::forget(vec255); - *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len255; - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr255.cast_mut(); - match gas_price252 { - Some(e) => { - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let wavs::types::core::U128 { value: value256 } = e; - let (t257_0, t257_1) = value256; - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i64(t257_0); - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i64(t257_1); - } - None => { - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - } - }; - } - } - } - } - *ptr249.add(2 * ::core::mem::size_of::<*const u8>()).cast::() = len259; - *ptr249.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>() = result259; - } - Err(e) => { - *ptr249.add(0).cast::() = (1i32) as u8; - let vec260 = (e.into_bytes()).into_boxed_slice(); - let ptr260 = vec260.as_ptr().cast::(); - let len260 = vec260.len(); - ::core::mem::forget(vec260); - *ptr249.add(2 * ::core::mem::size_of::<*const u8>()).cast::() = len260; - *ptr249.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>() = ptr260 - .cast_mut(); - } - }; - ptr249 -} -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn __post_return_process_packet(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l2 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::(); - let base9 = l1; - let len9 = l2; - for i in 0..len9 { - let base = base9.add(i * (32 + 4 * ::core::mem::size_of::<*const u8>())); - { - let l3 = i32::from(*base.add(0).cast::()); - match l3 { - 0 => {} - _ => { - let l4 = *base.add(8).cast::<*mut u8>(); - let l5 = *base - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - let l6 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base8 = l6; - let len8 = l7; - _rt::cabi_dealloc(base8, len8 * 1, 1); - } - } - } - } - _rt::cabi_dealloc( - base9, - len9 * (32 + 4 * ::core::mem::size_of::<*const u8>()), - 8, - ); - } - _ => { - let l10 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l11 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::(); - _rt::cabi_dealloc(l10, l11, 1); - } - } -} -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn _export_handle_timer_callback_cabi(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len2 = l1; - let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); - let l3 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l4 = *arg0.add(3 * ::core::mem::size_of::<*const u8>()).cast::(); - let base160 = l3; - let len160 = l4; - let mut result160 = _rt::Vec::with_capacity(len160); - for i in 0..len160 { - let base = base160.add(i * (144 + 42 * ::core::mem::size_of::<*const u8>())); - let e160 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base.add(::core::mem::size_of::<*const u8>()).cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); - let l8 = i32::from( - *base.add(2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::Trigger as V43; - let v43 = match l8 { - 0 => { - let e43 = { - let l9 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let l12 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len14 = l13; - let bytes14 = _rt::Vec::from_raw_parts(l12.cast(), len14, len14); - let l15 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l16 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len17 = l16; - wavs::types::service::TriggerEvmContractEvent { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l9.cast(), len11, len11), - }, - chain: _rt::string_lift(bytes14), - event_hash: _rt::Vec::from_raw_parts( - l15.cast(), - len17, - len17, - ), - } - }; - V43::EvmContractEvent(e43) - } - 1 => { - let e43 = { - let l18 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l19 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len20 = l19; - let bytes20 = _rt::Vec::from_raw_parts(l18.cast(), len20, len20); - let l21 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l22 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l23 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - let l25 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l26 = *base - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len27 = l26; - let bytes27 = _rt::Vec::from_raw_parts(l25.cast(), len27, len27); - wavs::types::service::TriggerCosmosContractEvent { - address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes20), - prefix_len: l21 as u32, - }, - chain: _rt::string_lift(bytes24), - event_type: _rt::string_lift(bytes27), - } - }; - V43::CosmosContractEvent(e43) - } - 2 => { - let e43 = { - let l28 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l29 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len30 = l29; - let bytes30 = _rt::Vec::from_raw_parts(l28.cast(), len30, len30); - let l31 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l32 = i32::from( - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l34 = i32::from( - *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes30), - n_blocks: l31 as u32, - start_block: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l33 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *base - .add(40 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V43::BlockInterval(e43) - } - 3 => { - let e43 = { - let l36 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l37 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len38 = l37; - let bytes38 = _rt::Vec::from_raw_parts(l36.cast(), len38, len38); - let l39 = i32::from( - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l41 = i32::from( - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes38), - start_time: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l40 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l42 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V43::Cron(e43) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V43::Manual - } - }; - let l44 = i32::from( - *base.add(48 + 4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ComponentSource as V68; - let v68 = match l44 { - 0 => { - let e68 = { - let l45 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l46 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len47 = l46; - let bytes47 = _rt::Vec::from_raw_parts(l45.cast(), len47, len47); - let l48 = *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l49 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len50 = l49; - let bytes50 = _rt::Vec::from_raw_parts(l48.cast(), len50, len50); - wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes47), - digest: _rt::string_lift(bytes50), - } - }; - V68::Download(e68) - } - 1 => { - let e68 = { - let l51 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l52 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len53 = l52; - let bytes53 = _rt::Vec::from_raw_parts(l51.cast(), len53, len53); - let l54 = i32::from( - *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l58 = i32::from( - *base - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l62 = *base - .add(48 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *base - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len64 = l63; - let bytes64 = _rt::Vec::from_raw_parts(l62.cast(), len64, len64); - wavs::types::service::Registry { - digest: _rt::string_lift(bytes53), - domain: match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l56 = *base - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len57 = l56; - let bytes57 = _rt::Vec::from_raw_parts( - l55.cast(), - len57, - len57, - ); - _rt::string_lift(bytes57) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l58 { - 0 => None, - 1 => { - let e = { - let l59 = *base - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *base - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts( - l59.cast(), - len61, - len61, - ); - _rt::string_lift(bytes61) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes64), - } - }; - V68::Registry(e68) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e68 = { - let l65 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l66 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len67 = l66; - let bytes67 = _rt::Vec::from_raw_parts(l65.cast(), len67, len67); - _rt::string_lift(bytes67) - }; - V68::Digest(e68) - } - }; - let l69 = i32::from( - *base.add(48 + 15 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::AllowedHostPermission as V76; - let v76 = match l69 { - 0 => V76::All, - 1 => { - let e76 = { - let l70 = *base - .add(48 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l71 = *base - .add(48 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base75 = l70; - let len75 = l71; - let mut result75 = _rt::Vec::with_capacity(len75); - for i in 0..len75 { - let base = base75 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e75 = { - let l72 = *base.add(0).cast::<*mut u8>(); - let l73 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len74 = l73; - let bytes74 = _rt::Vec::from_raw_parts( - l72.cast(), - len74, - len74, - ); - _rt::string_lift(bytes74) - }; - result75.push(e75); - } - _rt::cabi_dealloc( - base75, - len75 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result75 - }; - V76::Only(e76) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V76::None - } - }; - let l77 = i32::from( - *base.add(48 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l78 = i32::from( - *base.add(56 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l80 = i32::from( - *base.add(72 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l82 = *base - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l83 = *base - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base90 = l82; - let len90 = l83; - let mut result90 = _rt::Vec::with_capacity(len90); - for i in 0..len90 { - let base = base90.add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e90 = { - let l84 = *base.add(0).cast::<*mut u8>(); - let l85 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len86 = l85; - let bytes86 = _rt::Vec::from_raw_parts(l84.cast(), len86, len86); - let l87 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l88 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len89 = l88; - let bytes89 = _rt::Vec::from_raw_parts(l87.cast(), len89, len89); - (_rt::string_lift(bytes86), _rt::string_lift(bytes89)) - }; - result90.push(e90); - } - _rt::cabi_dealloc( - base90, - len90 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l91 = *base - .add(88 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l92 = *base - .add(88 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base96 = l91; - let len96 = l92; - let mut result96 = _rt::Vec::with_capacity(len96); - for i in 0..len96 { - let base = base96.add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e96 = { - let l93 = *base.add(0).cast::<*mut u8>(); - let l94 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len95 = l94; - let bytes95 = _rt::Vec::from_raw_parts(l93.cast(), len95, len95); - _rt::string_lift(bytes95) - }; - result96.push(e96); - } - _rt::cabi_dealloc( - base96, - len96 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l97 = i32::from( - *base.add(88 + 22 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::Submit as V159; - let v159 = match l97 { - 0 => V159::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e159 = { - let l98 = *base - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l99 = *base - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len100 = l99; - let bytes100 = _rt::Vec::from_raw_parts( - l98.cast(), - len100, - len100, - ); - let l101 = i32::from( - *base - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::ComponentSource as V125; - let v125 = match l101 { - 0 => { - let e125 = { - let l102 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l103 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len104 = l103; - let bytes104 = _rt::Vec::from_raw_parts( - l102.cast(), - len104, - len104, - ); - let l105 = *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l106 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len107 = l106; - let bytes107 = _rt::Vec::from_raw_parts( - l105.cast(), - len107, - len107, - ); - wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes104), - digest: _rt::string_lift(bytes107), - } - }; - V125::Download(e125) - } - 1 => { - let e125 = { - let l108 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l109 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len110 = l109; - let bytes110 = _rt::Vec::from_raw_parts( - l108.cast(), - len110, - len110, - ); - let l111 = i32::from( - *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l115 = i32::from( - *base - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l119 = *base - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l120 = *base - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len121 = l120; - let bytes121 = _rt::Vec::from_raw_parts( - l119.cast(), - len121, - len121, - ); - wavs::types::service::Registry { - digest: _rt::string_lift(bytes110), - domain: match l111 { - 0 => None, - 1 => { - let e = { - let l112 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l113 = *base - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len114 = l113; - let bytes114 = _rt::Vec::from_raw_parts( - l112.cast(), - len114, - len114, - ); - _rt::string_lift(bytes114) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l115 { - 0 => None, - 1 => { - let e = { - let l116 = *base - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l117 = *base - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len118 = l117; - let bytes118 = _rt::Vec::from_raw_parts( - l116.cast(), - len118, - len118, - ); - _rt::string_lift(bytes118) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes121), - } - }; - V125::Registry(e125) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e125 = { - let l122 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l123 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len124 = l123; - let bytes124 = _rt::Vec::from_raw_parts( - l122.cast(), - len124, - len124, - ); - _rt::string_lift(bytes124) - }; - V125::Digest(e125) - } - }; - let l126 = i32::from( - *base - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::AllowedHostPermission as V133; - let v133 = match l126 { - 0 => V133::All, - 1 => { - let e133 = { - let l127 = *base - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l128 = *base - .add(96 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base132 = l127; - let len132 = l128; - let mut result132 = _rt::Vec::with_capacity(len132); - for i in 0..len132 { - let base = base132 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e132 = { - let l129 = *base.add(0).cast::<*mut u8>(); - let l130 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len131 = l130; - let bytes131 = _rt::Vec::from_raw_parts( - l129.cast(), - len131, - len131, - ); - _rt::string_lift(bytes131) - }; - result132.push(e132); - } - _rt::cabi_dealloc( - base132, - len132 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result132 - }; - V133::Only(e133) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V133::None - } - }; - let l134 = i32::from( - *base - .add(96 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l135 = i32::from( - *base - .add(104 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l137 = i32::from( - *base - .add(120 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l139 = *base - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l140 = *base - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base147 = l139; - let len147 = l140; - let mut result147 = _rt::Vec::with_capacity(len147); - for i in 0..len147 { - let base = base147 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e147 = { - let l141 = *base.add(0).cast::<*mut u8>(); - let l142 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len143 = l142; - let bytes143 = _rt::Vec::from_raw_parts( - l141.cast(), - len143, - len143, - ); - let l144 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l145 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len146 = l145; - let bytes146 = _rt::Vec::from_raw_parts( - l144.cast(), - len146, - len146, - ); - (_rt::string_lift(bytes143), _rt::string_lift(bytes146)) - }; - result147.push(e147); - } - _rt::cabi_dealloc( - base147, - len147 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l148 = *base - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l149 = *base - .add(136 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base153 = l148; - let len153 = l149; - let mut result153 = _rt::Vec::with_capacity(len153); - for i in 0..len153 { - let base = base153 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e153 = { - let l150 = *base.add(0).cast::<*mut u8>(); - let l151 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len152 = l151; - let bytes152 = _rt::Vec::from_raw_parts( - l150.cast(), - len152, - len152, - ); - _rt::string_lift(bytes152) - }; - result153.push(e153); - } - _rt::cabi_dealloc( - base153, - len153 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l154 = i32::from( - *base - .add(136 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignatureAlgorithm as V155; - let v155 = match l154 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V155::Secp256k1 - } - }; - let l156 = i32::from( - *base - .add(137 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes100), - component: wavs::types::service::Component { - source: v125, - permissions: wavs::types::service::Permissions { - allowed_http_hosts: v133, - file_system: _rt::bool_lift(l134 as u8), - }, - fuel_limit: match l135 { - 0 => None, - 1 => { - let e = { - let l136 = *base - .add(112 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l136 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l137 { - 0 => None, - 1 => { - let e = { - let l138 = *base - .add(128 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l138 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result147, - env_keys: result153, - }, - signature_kind: wavs::types::service::SignatureKind { - algorithm: v155, - prefix: match l156 { - 0 => None, - 1 => { - let e = { - let l157 = i32::from( - *base - .add(138 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignaturePrefix as V158; - let v158 = match l157 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V158::Eip191 - } - }; - v158 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V159::Aggregator(e159) - } - }; - ( - _rt::string_lift(bytes7), - wavs::types::service::Workflow { - trigger: v43, - component: wavs::types::service::Component { - source: v68, - permissions: wavs::types::service::Permissions { - allowed_http_hosts: v76, - file_system: _rt::bool_lift(l77 as u8), - }, - fuel_limit: match l78 { - 0 => None, - 1 => { - let e = { - let l79 = *base - .add(64 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l79 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l80 { - 0 => None, - 1 => { - let e = { - let l81 = *base - .add(80 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l81 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result90, - env_keys: result96, - }, - submit: v159, - }, - ) - }; - result160.push(e160); - } - _rt::cabi_dealloc( - base160, - len160 * (144 + 42 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let l161 = i32::from( - *arg0.add(4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ServiceStatus as V162; - let v162 = match l161 { - 0 => V162::Active, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - V162::Paused - } - }; - let l163 = i32::from( - *arg0.add(5 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ServiceManager as V170; - let v170 = match l163 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - let e170 = { - let l164 = *arg0 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l165 = *arg0 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len166 = l165; - let bytes166 = _rt::Vec::from_raw_parts(l164.cast(), len166, len166); - let l167 = *arg0 - .add(8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l168 = *arg0 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len169 = l168; - wavs::types::service::EvmManager { - chain: _rt::string_lift(bytes166), - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l167.cast(), len169, len169), - }, - } - }; - V170::Evm(e170) - } - }; - let l171 = *arg0.add(10 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l172 = *arg0.add(11 * ::core::mem::size_of::<*const u8>()).cast::(); - let len173 = l172; - let bytes173 = _rt::Vec::from_raw_parts(l171.cast(), len173, len173); - let l174 = *arg0.add(12 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l175 = *arg0.add(13 * ::core::mem::size_of::<*const u8>()).cast::(); - let len176 = l175; - let l177 = *arg0.add(14 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l178 = *arg0.add(15 * ::core::mem::size_of::<*const u8>()).cast::(); - let len179 = l178; - let l180 = *arg0.add(16 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l181 = *arg0.add(17 * ::core::mem::size_of::<*const u8>()).cast::(); - let len182 = l181; - let l183 = *arg0.add(18 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l184 = *arg0.add(19 * ::core::mem::size_of::<*const u8>()).cast::(); - let len185 = l184; - let l186 = i32::from( - *arg0.add(20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::SignatureAlgorithm as V187; - let v187 = match l186 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V187::Secp256k1 - } - }; - let l188 = i32::from( - *arg0.add(1 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l191 = i32::from( - *arg0.add(8 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::events::TriggerData as V247; - let v247 = match l191 { - 0 => { - let e247 = { - let l192 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l193 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len194 = l193; - let bytes194 = _rt::Vec::from_raw_parts(l192.cast(), len194, len194); - let l195 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l196 = *arg0 - .add(16 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len197 = l196; - let l198 = *arg0 - .add(16 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l199 = *arg0 - .add(16 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base203 = l198; - let len203 = l199; - let mut result203 = _rt::Vec::with_capacity(len203); - for i in 0..len203 { - let base = base203 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e203 = { - let l200 = *base.add(0).cast::<*mut u8>(); - let l201 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len202 = l201; - _rt::Vec::from_raw_parts(l200.cast(), len202, len202) - }; - result203.push(e203); - } - _rt::cabi_dealloc( - base203, - len203 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l204 = *arg0 - .add(16 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l205 = *arg0 - .add(16 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len206 = l205; - let l207 = *arg0 - .add(16 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l208 = *arg0 - .add(16 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len209 = l208; - let l210 = *arg0 - .add(16 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l211 = *arg0 - .add(24 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l212 = *arg0 - .add(32 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l213 = *arg0 - .add(32 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len214 = l213; - let l215 = i32::from( - *arg0.add(32 + 32 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l217 = *arg0 - .add(48 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataEvmContractEvent { - chain: _rt::string_lift(bytes194), - log: wavs::types::chain::EvmEventLog { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l195.cast(), - len197, - len197, - ), - }, - data: wavs::types::chain::EvmEventLogData { - topics: result203, - data: _rt::Vec::from_raw_parts(l204.cast(), len206, len206), - }, - tx_hash: _rt::Vec::from_raw_parts(l207.cast(), len209, len209), - block_number: l210 as u64, - log_index: l211 as u64, - block_hash: _rt::Vec::from_raw_parts( - l212.cast(), - len214, - len214, - ), - block_timestamp: match l215 { - 0 => None, - 1 => { - let e = { - let l216 = *arg0 - .add(40 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l216 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - tx_index: l217 as u64, - }, - } - }; - V247::EvmContractEvent(e247) - } - 1 => { - let e247 = { - let l218 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l219 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len220 = l219; - let bytes220 = _rt::Vec::from_raw_parts(l218.cast(), len220, len220); - let l221 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l222 = *arg0 - .add(16 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l223 = *arg0 - .add(16 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len224 = l223; - let bytes224 = _rt::Vec::from_raw_parts(l222.cast(), len224, len224); - let l225 = *arg0 - .add(16 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l226 = *arg0 - .add(16 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len227 = l226; - let bytes227 = _rt::Vec::from_raw_parts(l225.cast(), len227, len227); - let l228 = *arg0 - .add(16 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l229 = *arg0 - .add(16 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base236 = l228; - let len236 = l229; - let mut result236 = _rt::Vec::with_capacity(len236); - for i in 0..len236 { - let base = base236 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e236 = { - let l230 = *base.add(0).cast::<*mut u8>(); - let l231 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len232 = l231; - let bytes232 = _rt::Vec::from_raw_parts( - l230.cast(), - len232, - len232, - ); - let l233 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l234 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len235 = l234; - let bytes235 = _rt::Vec::from_raw_parts( - l233.cast(), - len235, - len235, - ); - (_rt::string_lift(bytes232), _rt::string_lift(bytes235)) - }; - result236.push(e236); - } - _rt::cabi_dealloc( - base236, - len236 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l237 = *arg0 - .add(24 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l238 = *arg0 - .add(32 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCosmosContractEvent { - contract_address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes220), - prefix_len: l221 as u32, - }, - chain: _rt::string_lift(bytes224), - event: wavs::types::chain::CosmosEvent { - ty: _rt::string_lift(bytes227), - attributes: result236, - }, - event_index: l237 as u64, - block_height: l238 as u64, - } - }; - V247::CosmosContractEvent(e247) - } - 2 => { - let e247 = { - let l239 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l240 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len241 = l240; - let bytes241 = _rt::Vec::from_raw_parts(l239.cast(), len241, len241); - let l242 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataBlockInterval { - chain: _rt::string_lift(bytes241), - block_height: l242 as u64, - } - }; - V247::BlockInterval(e247) - } - 3 => { - let e247 = { - let l243 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCron { - trigger_time: wavs::types::core::Timestamp { - nanos: l243 as u64, - }, - } - }; - V247::Cron(e247) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - let e247 = { - let l244 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l245 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len246 = l245; - _rt::Vec::from_raw_parts(l244.cast(), len246, len246) - }; - V247::Raw(e247) - } - }; - let result248 = T::handle_timer_callback(wavs::aggregator::aggregator::Packet { - service: wavs::types::service::Service { - name: _rt::string_lift(bytes2), - workflows: result160, - status: v162, - manager: v170, - }, - workflow_id: _rt::string_lift(bytes173), - envelope: wavs::aggregator::aggregator::Envelope { - event_id: _rt::Vec::from_raw_parts(l174.cast(), len176, len176), - ordering: _rt::Vec::from_raw_parts(l177.cast(), len179, len179), - payload: _rt::Vec::from_raw_parts(l180.cast(), len182, len182), - }, - signature: wavs::aggregator::aggregator::EnvelopeSignature { - data: _rt::Vec::from_raw_parts(l183.cast(), len185, len185), - kind: wavs::types::service::SignatureKind { - algorithm: v187, - prefix: match l188 { - 0 => None, - 1 => { - let e = { - let l189 = i32::from( - *arg0 - .add(2 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignaturePrefix as V190; - let v190 = match l189 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V190::Eip191 - } - }; - v190 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - }, - trigger_data: v247, - }); - _rt::cabi_dealloc(arg0, 56 + 32 * ::core::mem::size_of::<*const u8>(), 8); - let ptr249 = (&raw mut _RET_AREA.0).cast::(); - match result248 { - Ok(e) => { - *ptr249.add(0).cast::() = (0i32) as u8; - let vec259 = e; - let len259 = vec259.len(); - let layout259 = _rt::alloc::Layout::from_size_align_unchecked( - vec259.len() * (32 + 4 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let result259 = if layout259.size() != 0 { - let ptr = _rt::alloc::alloc(layout259).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout259); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec259.into_iter().enumerate() { - let base = result259 - .add(i * (32 + 4 * ::core::mem::size_of::<*const u8>())); - { - use wavs::aggregator::aggregator::AggregatorAction as V258; - match e { - V258::Timer(e) => { - *base.add(0).cast::() = (0i32) as u8; - let wavs::aggregator::aggregator::TimerAction { - delay: delay250, - } = e; - let wavs::types::core::Duration { secs: secs251 } = delay250; - *base.add(8).cast::() = _rt::as_i64(secs251); - } - V258::Submit(e) => { - *base.add(0).cast::() = (1i32) as u8; - let wavs::aggregator::aggregator::SubmitAction { - chain: chain252, - contract_address: contract_address252, - gas_price: gas_price252, - } = e; - let vec253 = (chain252.into_bytes()).into_boxed_slice(); - let ptr253 = vec253.as_ptr().cast::(); - let len253 = vec253.len(); - ::core::mem::forget(vec253); - *base - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::() = len253; - *base.add(8).cast::<*mut u8>() = ptr253.cast_mut(); - let wavs::types::chain::EvmAddress { - raw_bytes: raw_bytes254, - } = contract_address252; - let vec255 = (raw_bytes254).into_boxed_slice(); - let ptr255 = vec255.as_ptr().cast::(); - let len255 = vec255.len(); - ::core::mem::forget(vec255); - *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len255; - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr255.cast_mut(); - match gas_price252 { - Some(e) => { - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let wavs::types::core::U128 { value: value256 } = e; - let (t257_0, t257_1) = value256; - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i64(t257_0); - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i64(t257_1); - } - None => { - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - } - }; - } - } - } - } - *ptr249.add(2 * ::core::mem::size_of::<*const u8>()).cast::() = len259; - *ptr249.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>() = result259; - } - Err(e) => { - *ptr249.add(0).cast::() = (1i32) as u8; - let vec260 = (e.into_bytes()).into_boxed_slice(); - let ptr260 = vec260.as_ptr().cast::(); - let len260 = vec260.len(); - ::core::mem::forget(vec260); - *ptr249.add(2 * ::core::mem::size_of::<*const u8>()).cast::() = len260; - *ptr249.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>() = ptr260 - .cast_mut(); - } - }; - ptr249 -} -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn __post_return_handle_timer_callback(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => { - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l2 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::(); - let base9 = l1; - let len9 = l2; - for i in 0..len9 { - let base = base9.add(i * (32 + 4 * ::core::mem::size_of::<*const u8>())); - { - let l3 = i32::from(*base.add(0).cast::()); - match l3 { - 0 => {} - _ => { - let l4 = *base.add(8).cast::<*mut u8>(); - let l5 = *base - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l4, l5, 1); - let l6 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base8 = l6; - let len8 = l7; - _rt::cabi_dealloc(base8, len8 * 1, 1); - } - } - } - } - _rt::cabi_dealloc( - base9, - len9 * (32 + 4 * ::core::mem::size_of::<*const u8>()), - 8, - ); - } - _ => { - let l10 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l11 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::(); - _rt::cabi_dealloc(l10, l11, 1); - } - } -} -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn _export_handle_submit_callback_cabi(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len2 = l1; - let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); - let l3 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l4 = *arg0.add(3 * ::core::mem::size_of::<*const u8>()).cast::(); - let base160 = l3; - let len160 = l4; - let mut result160 = _rt::Vec::with_capacity(len160); - for i in 0..len160 { - let base = base160.add(i * (144 + 42 * ::core::mem::size_of::<*const u8>())); - let e160 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base.add(::core::mem::size_of::<*const u8>()).cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); - let l8 = i32::from( - *base.add(2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::Trigger as V43; - let v43 = match l8 { - 0 => { - let e43 = { - let l9 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let l12 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len14 = l13; - let bytes14 = _rt::Vec::from_raw_parts(l12.cast(), len14, len14); - let l15 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l16 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len17 = l16; - wavs::types::service::TriggerEvmContractEvent { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l9.cast(), len11, len11), - }, - chain: _rt::string_lift(bytes14), - event_hash: _rt::Vec::from_raw_parts( - l15.cast(), - len17, - len17, - ), - } - }; - V43::EvmContractEvent(e43) - } - 1 => { - let e43 = { - let l18 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l19 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len20 = l19; - let bytes20 = _rt::Vec::from_raw_parts(l18.cast(), len20, len20); - let l21 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l22 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l23 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - let l25 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l26 = *base - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len27 = l26; - let bytes27 = _rt::Vec::from_raw_parts(l25.cast(), len27, len27); - wavs::types::service::TriggerCosmosContractEvent { - address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes20), - prefix_len: l21 as u32, - }, - chain: _rt::string_lift(bytes24), - event_type: _rt::string_lift(bytes27), - } - }; - V43::CosmosContractEvent(e43) - } - 2 => { - let e43 = { - let l28 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l29 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len30 = l29; - let bytes30 = _rt::Vec::from_raw_parts(l28.cast(), len30, len30); - let l31 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l32 = i32::from( - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l34 = i32::from( - *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes30), - n_blocks: l31 as u32, - start_block: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l33 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *base - .add(40 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V43::BlockInterval(e43) - } - 3 => { - let e43 = { - let l36 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l37 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len38 = l37; - let bytes38 = _rt::Vec::from_raw_parts(l36.cast(), len38, len38); - let l39 = i32::from( - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l41 = i32::from( - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes38), - start_time: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l40 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l42 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V43::Cron(e43) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V43::Manual - } - }; - let l44 = i32::from( - *base.add(48 + 4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ComponentSource as V68; - let v68 = match l44 { - 0 => { - let e68 = { - let l45 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l46 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len47 = l46; - let bytes47 = _rt::Vec::from_raw_parts(l45.cast(), len47, len47); - let l48 = *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l49 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len50 = l49; - let bytes50 = _rt::Vec::from_raw_parts(l48.cast(), len50, len50); - wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes47), - digest: _rt::string_lift(bytes50), - } - }; - V68::Download(e68) - } - 1 => { - let e68 = { - let l51 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l52 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len53 = l52; - let bytes53 = _rt::Vec::from_raw_parts(l51.cast(), len53, len53); - let l54 = i32::from( - *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l58 = i32::from( - *base - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l62 = *base - .add(48 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *base - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len64 = l63; - let bytes64 = _rt::Vec::from_raw_parts(l62.cast(), len64, len64); - wavs::types::service::Registry { - digest: _rt::string_lift(bytes53), - domain: match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l56 = *base - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len57 = l56; - let bytes57 = _rt::Vec::from_raw_parts( - l55.cast(), - len57, - len57, - ); - _rt::string_lift(bytes57) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l58 { - 0 => None, - 1 => { - let e = { - let l59 = *base - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *base - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts( - l59.cast(), - len61, - len61, - ); - _rt::string_lift(bytes61) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes64), - } - }; - V68::Registry(e68) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e68 = { - let l65 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l66 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len67 = l66; - let bytes67 = _rt::Vec::from_raw_parts(l65.cast(), len67, len67); - _rt::string_lift(bytes67) - }; - V68::Digest(e68) - } - }; - let l69 = i32::from( - *base.add(48 + 15 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::AllowedHostPermission as V76; - let v76 = match l69 { - 0 => V76::All, - 1 => { - let e76 = { - let l70 = *base - .add(48 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l71 = *base - .add(48 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base75 = l70; - let len75 = l71; - let mut result75 = _rt::Vec::with_capacity(len75); - for i in 0..len75 { - let base = base75 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e75 = { - let l72 = *base.add(0).cast::<*mut u8>(); - let l73 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len74 = l73; - let bytes74 = _rt::Vec::from_raw_parts( - l72.cast(), - len74, - len74, - ); - _rt::string_lift(bytes74) - }; - result75.push(e75); - } - _rt::cabi_dealloc( - base75, - len75 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result75 - }; - V76::Only(e76) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V76::None - } - }; - let l77 = i32::from( - *base.add(48 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l78 = i32::from( - *base.add(56 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l80 = i32::from( - *base.add(72 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l82 = *base - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l83 = *base - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base90 = l82; - let len90 = l83; - let mut result90 = _rt::Vec::with_capacity(len90); - for i in 0..len90 { - let base = base90.add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e90 = { - let l84 = *base.add(0).cast::<*mut u8>(); - let l85 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len86 = l85; - let bytes86 = _rt::Vec::from_raw_parts(l84.cast(), len86, len86); - let l87 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l88 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len89 = l88; - let bytes89 = _rt::Vec::from_raw_parts(l87.cast(), len89, len89); - (_rt::string_lift(bytes86), _rt::string_lift(bytes89)) - }; - result90.push(e90); - } - _rt::cabi_dealloc( - base90, - len90 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l91 = *base - .add(88 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l92 = *base - .add(88 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base96 = l91; - let len96 = l92; - let mut result96 = _rt::Vec::with_capacity(len96); - for i in 0..len96 { - let base = base96.add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e96 = { - let l93 = *base.add(0).cast::<*mut u8>(); - let l94 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len95 = l94; - let bytes95 = _rt::Vec::from_raw_parts(l93.cast(), len95, len95); - _rt::string_lift(bytes95) - }; - result96.push(e96); - } - _rt::cabi_dealloc( - base96, - len96 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l97 = i32::from( - *base.add(88 + 22 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::Submit as V159; - let v159 = match l97 { - 0 => V159::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e159 = { - let l98 = *base - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l99 = *base - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len100 = l99; - let bytes100 = _rt::Vec::from_raw_parts( - l98.cast(), - len100, - len100, - ); - let l101 = i32::from( - *base - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::ComponentSource as V125; - let v125 = match l101 { - 0 => { - let e125 = { - let l102 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l103 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len104 = l103; - let bytes104 = _rt::Vec::from_raw_parts( - l102.cast(), - len104, - len104, - ); - let l105 = *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l106 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len107 = l106; - let bytes107 = _rt::Vec::from_raw_parts( - l105.cast(), - len107, - len107, - ); - wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes104), - digest: _rt::string_lift(bytes107), - } - }; - V125::Download(e125) - } - 1 => { - let e125 = { - let l108 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l109 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len110 = l109; - let bytes110 = _rt::Vec::from_raw_parts( - l108.cast(), - len110, - len110, - ); - let l111 = i32::from( - *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l115 = i32::from( - *base - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l119 = *base - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l120 = *base - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len121 = l120; - let bytes121 = _rt::Vec::from_raw_parts( - l119.cast(), - len121, - len121, - ); - wavs::types::service::Registry { - digest: _rt::string_lift(bytes110), - domain: match l111 { - 0 => None, - 1 => { - let e = { - let l112 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l113 = *base - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len114 = l113; - let bytes114 = _rt::Vec::from_raw_parts( - l112.cast(), - len114, - len114, - ); - _rt::string_lift(bytes114) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l115 { - 0 => None, - 1 => { - let e = { - let l116 = *base - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l117 = *base - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len118 = l117; - let bytes118 = _rt::Vec::from_raw_parts( - l116.cast(), - len118, - len118, - ); - _rt::string_lift(bytes118) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes121), - } - }; - V125::Registry(e125) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e125 = { - let l122 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l123 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len124 = l123; - let bytes124 = _rt::Vec::from_raw_parts( - l122.cast(), - len124, - len124, - ); - _rt::string_lift(bytes124) - }; - V125::Digest(e125) - } - }; - let l126 = i32::from( - *base - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::AllowedHostPermission as V133; - let v133 = match l126 { - 0 => V133::All, - 1 => { - let e133 = { - let l127 = *base - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l128 = *base - .add(96 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base132 = l127; - let len132 = l128; - let mut result132 = _rt::Vec::with_capacity(len132); - for i in 0..len132 { - let base = base132 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e132 = { - let l129 = *base.add(0).cast::<*mut u8>(); - let l130 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len131 = l130; - let bytes131 = _rt::Vec::from_raw_parts( - l129.cast(), - len131, - len131, - ); - _rt::string_lift(bytes131) - }; - result132.push(e132); - } - _rt::cabi_dealloc( - base132, - len132 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result132 - }; - V133::Only(e133) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V133::None - } - }; - let l134 = i32::from( - *base - .add(96 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l135 = i32::from( - *base - .add(104 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l137 = i32::from( - *base - .add(120 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l139 = *base - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l140 = *base - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base147 = l139; - let len147 = l140; - let mut result147 = _rt::Vec::with_capacity(len147); - for i in 0..len147 { - let base = base147 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e147 = { - let l141 = *base.add(0).cast::<*mut u8>(); - let l142 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len143 = l142; - let bytes143 = _rt::Vec::from_raw_parts( - l141.cast(), - len143, - len143, - ); - let l144 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l145 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len146 = l145; - let bytes146 = _rt::Vec::from_raw_parts( - l144.cast(), - len146, - len146, - ); - (_rt::string_lift(bytes143), _rt::string_lift(bytes146)) - }; - result147.push(e147); - } - _rt::cabi_dealloc( - base147, - len147 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l148 = *base - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l149 = *base - .add(136 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base153 = l148; - let len153 = l149; - let mut result153 = _rt::Vec::with_capacity(len153); - for i in 0..len153 { - let base = base153 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e153 = { - let l150 = *base.add(0).cast::<*mut u8>(); - let l151 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len152 = l151; - let bytes152 = _rt::Vec::from_raw_parts( - l150.cast(), - len152, - len152, - ); - _rt::string_lift(bytes152) - }; - result153.push(e153); - } - _rt::cabi_dealloc( - base153, - len153 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l154 = i32::from( - *base - .add(136 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignatureAlgorithm as V155; - let v155 = match l154 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V155::Secp256k1 - } - }; - let l156 = i32::from( - *base - .add(137 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes100), - component: wavs::types::service::Component { - source: v125, - permissions: wavs::types::service::Permissions { - allowed_http_hosts: v133, - file_system: _rt::bool_lift(l134 as u8), - }, - fuel_limit: match l135 { - 0 => None, - 1 => { - let e = { - let l136 = *base - .add(112 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l136 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l137 { - 0 => None, - 1 => { - let e = { - let l138 = *base - .add(128 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l138 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result147, - env_keys: result153, - }, - signature_kind: wavs::types::service::SignatureKind { - algorithm: v155, - prefix: match l156 { - 0 => None, - 1 => { - let e = { - let l157 = i32::from( - *base - .add(138 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignaturePrefix as V158; - let v158 = match l157 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V158::Eip191 - } - }; - v158 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V159::Aggregator(e159) - } - }; - ( - _rt::string_lift(bytes7), - wavs::types::service::Workflow { - trigger: v43, - component: wavs::types::service::Component { - source: v68, - permissions: wavs::types::service::Permissions { - allowed_http_hosts: v76, - file_system: _rt::bool_lift(l77 as u8), - }, - fuel_limit: match l78 { - 0 => None, - 1 => { - let e = { - let l79 = *base - .add(64 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l79 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l80 { - 0 => None, - 1 => { - let e = { - let l81 = *base - .add(80 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l81 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result90, - env_keys: result96, - }, - submit: v159, - }, - ) - }; - result160.push(e160); - } - _rt::cabi_dealloc( - base160, - len160 * (144 + 42 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let l161 = i32::from( - *arg0.add(4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ServiceStatus as V162; - let v162 = match l161 { - 0 => V162::Active, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - V162::Paused - } - }; - let l163 = i32::from( - *arg0.add(5 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::ServiceManager as V170; - let v170 = match l163 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - let e170 = { - let l164 = *arg0 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l165 = *arg0 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len166 = l165; - let bytes166 = _rt::Vec::from_raw_parts(l164.cast(), len166, len166); - let l167 = *arg0 - .add(8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l168 = *arg0 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len169 = l168; - wavs::types::service::EvmManager { - chain: _rt::string_lift(bytes166), - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l167.cast(), len169, len169), - }, - } - }; - V170::Evm(e170) - } - }; - let l171 = *arg0.add(10 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l172 = *arg0.add(11 * ::core::mem::size_of::<*const u8>()).cast::(); - let len173 = l172; - let bytes173 = _rt::Vec::from_raw_parts(l171.cast(), len173, len173); - let l174 = *arg0.add(12 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l175 = *arg0.add(13 * ::core::mem::size_of::<*const u8>()).cast::(); - let len176 = l175; - let l177 = *arg0.add(14 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l178 = *arg0.add(15 * ::core::mem::size_of::<*const u8>()).cast::(); - let len179 = l178; - let l180 = *arg0.add(16 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l181 = *arg0.add(17 * ::core::mem::size_of::<*const u8>()).cast::(); - let len182 = l181; - let l183 = *arg0.add(18 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l184 = *arg0.add(19 * ::core::mem::size_of::<*const u8>()).cast::(); - let len185 = l184; - let l186 = i32::from( - *arg0.add(20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::service::SignatureAlgorithm as V187; - let v187 = match l186 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V187::Secp256k1 - } - }; - let l188 = i32::from( - *arg0.add(1 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l191 = i32::from( - *arg0.add(8 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::events::TriggerData as V247; - let v247 = match l191 { - 0 => { - let e247 = { - let l192 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l193 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len194 = l193; - let bytes194 = _rt::Vec::from_raw_parts(l192.cast(), len194, len194); - let l195 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l196 = *arg0 - .add(16 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len197 = l196; - let l198 = *arg0 - .add(16 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l199 = *arg0 - .add(16 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base203 = l198; - let len203 = l199; - let mut result203 = _rt::Vec::with_capacity(len203); - for i in 0..len203 { - let base = base203 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e203 = { - let l200 = *base.add(0).cast::<*mut u8>(); - let l201 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len202 = l201; - _rt::Vec::from_raw_parts(l200.cast(), len202, len202) - }; - result203.push(e203); - } - _rt::cabi_dealloc( - base203, - len203 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l204 = *arg0 - .add(16 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l205 = *arg0 - .add(16 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len206 = l205; - let l207 = *arg0 - .add(16 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l208 = *arg0 - .add(16 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len209 = l208; - let l210 = *arg0 - .add(16 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l211 = *arg0 - .add(24 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l212 = *arg0 - .add(32 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l213 = *arg0 - .add(32 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len214 = l213; - let l215 = i32::from( - *arg0.add(32 + 32 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l217 = *arg0 - .add(48 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataEvmContractEvent { - chain: _rt::string_lift(bytes194), - log: wavs::types::chain::EvmEventLog { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l195.cast(), - len197, - len197, - ), - }, - data: wavs::types::chain::EvmEventLogData { - topics: result203, - data: _rt::Vec::from_raw_parts(l204.cast(), len206, len206), - }, - tx_hash: _rt::Vec::from_raw_parts(l207.cast(), len209, len209), - block_number: l210 as u64, - log_index: l211 as u64, - block_hash: _rt::Vec::from_raw_parts( - l212.cast(), - len214, - len214, - ), - block_timestamp: match l215 { - 0 => None, - 1 => { - let e = { - let l216 = *arg0 - .add(40 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l216 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - tx_index: l217 as u64, - }, - } - }; - V247::EvmContractEvent(e247) - } - 1 => { - let e247 = { - let l218 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l219 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len220 = l219; - let bytes220 = _rt::Vec::from_raw_parts(l218.cast(), len220, len220); - let l221 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l222 = *arg0 - .add(16 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l223 = *arg0 - .add(16 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len224 = l223; - let bytes224 = _rt::Vec::from_raw_parts(l222.cast(), len224, len224); - let l225 = *arg0 - .add(16 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l226 = *arg0 - .add(16 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len227 = l226; - let bytes227 = _rt::Vec::from_raw_parts(l225.cast(), len227, len227); - let l228 = *arg0 - .add(16 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l229 = *arg0 - .add(16 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base236 = l228; - let len236 = l229; - let mut result236 = _rt::Vec::with_capacity(len236); - for i in 0..len236 { - let base = base236 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e236 = { - let l230 = *base.add(0).cast::<*mut u8>(); - let l231 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len232 = l231; - let bytes232 = _rt::Vec::from_raw_parts( - l230.cast(), - len232, - len232, - ); - let l233 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l234 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len235 = l234; - let bytes235 = _rt::Vec::from_raw_parts( - l233.cast(), - len235, - len235, - ); - (_rt::string_lift(bytes232), _rt::string_lift(bytes235)) - }; - result236.push(e236); - } - _rt::cabi_dealloc( - base236, - len236 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l237 = *arg0 - .add(24 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l238 = *arg0 - .add(32 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCosmosContractEvent { - contract_address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes220), - prefix_len: l221 as u32, - }, - chain: _rt::string_lift(bytes224), - event: wavs::types::chain::CosmosEvent { - ty: _rt::string_lift(bytes227), - attributes: result236, - }, - event_index: l237 as u64, - block_height: l238 as u64, - } - }; - V247::CosmosContractEvent(e247) - } - 2 => { - let e247 = { - let l239 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l240 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len241 = l240; - let bytes241 = _rt::Vec::from_raw_parts(l239.cast(), len241, len241); - let l242 = *arg0 - .add(16 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataBlockInterval { - chain: _rt::string_lift(bytes241), - block_height: l242 as u64, - } - }; - V247::BlockInterval(e247) - } - 3 => { - let e247 = { - let l243 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCron { - trigger_time: wavs::types::core::Timestamp { - nanos: l243 as u64, - }, - } - }; - V247::Cron(e247) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - let e247 = { - let l244 = *arg0 - .add(16 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l245 = *arg0 - .add(16 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len246 = l245; - _rt::Vec::from_raw_parts(l244.cast(), len246, len246) - }; - V247::Raw(e247) - } - }; - let l248 = i32::from( - *arg0.add(56 + 32 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let result260 = T::handle_submit_callback( - wavs::aggregator::aggregator::Packet { - service: wavs::types::service::Service { - name: _rt::string_lift(bytes2), - workflows: result160, - status: v162, - manager: v170, - }, - workflow_id: _rt::string_lift(bytes173), - envelope: wavs::aggregator::aggregator::Envelope { - event_id: _rt::Vec::from_raw_parts(l174.cast(), len176, len176), - ordering: _rt::Vec::from_raw_parts(l177.cast(), len179, len179), - payload: _rt::Vec::from_raw_parts(l180.cast(), len182, len182), - }, - signature: wavs::aggregator::aggregator::EnvelopeSignature { - data: _rt::Vec::from_raw_parts(l183.cast(), len185, len185), - kind: wavs::types::service::SignatureKind { - algorithm: v187, - prefix: match l188 { - 0 => None, - 1 => { - let e = { - let l189 = i32::from( - *arg0 - .add(2 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::service::SignaturePrefix as V190; - let v190 = match l189 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V190::Eip191 - } - }; - v190 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - }, - trigger_data: v247, - }, - match l248 { - 0 => { - let e = { - let l249 = i32::from( - *arg0 - .add(56 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use wavs::types::chain::AnyTxHash as V256; - let v256 = match l249 { - 0 => { - let e256 = { - let l250 = *arg0 - .add(56 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l251 = *arg0 - .add(56 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len252 = l251; - _rt::Vec::from_raw_parts(l250.cast(), len252, len252) - }; - V256::Evm(e256) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e256 = { - let l253 = *arg0 - .add(56 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l254 = *arg0 - .add(56 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len255 = l254; - let bytes255 = _rt::Vec::from_raw_parts( - l253.cast(), - len255, - len255, - ); - _rt::string_lift(bytes255) - }; - V256::Cosmos(e256) - } - }; - v256 - }; - Ok(e) - } - 1 => { - let e = { - let l257 = *arg0 - .add(56 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l258 = *arg0 - .add(56 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len259 = l258; - let bytes259 = _rt::Vec::from_raw_parts(l257.cast(), len259, len259); - _rt::string_lift(bytes259) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - ); - _rt::cabi_dealloc(arg0, 56 + 36 * ::core::mem::size_of::<*const u8>(), 8); - let ptr261 = (&raw mut _RET_AREA.0).cast::(); - match result260 { - Ok(_) => { - *ptr261.add(0).cast::() = (0i32) as u8; - } - Err(e) => { - *ptr261.add(0).cast::() = (1i32) as u8; - let vec262 = (e.into_bytes()).into_boxed_slice(); - let ptr262 = vec262.as_ptr().cast::(); - let len262 = vec262.len(); - ::core::mem::forget(vec262); - *ptr261.add(2 * ::core::mem::size_of::<*const u8>()).cast::() = len262; - *ptr261.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>() = ptr262 - .cast_mut(); - } - }; - ptr261 -} -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn __post_return_handle_submit_callback(arg0: *mut u8) { - let l0 = i32::from(*arg0.add(0).cast::()); - match l0 { - 0 => {} - _ => { - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l2 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::(); - _rt::cabi_dealloc(l1, l2, 1); - } - } -} -pub trait Guest { - fn process_packet(packet: Packet) -> Result<_rt::Vec, _rt::String>; - fn handle_timer_callback( - packet: Packet, - ) -> Result<_rt::Vec, _rt::String>; - fn handle_submit_callback( - packet: Packet, - tx_result: Result, - ) -> Result<(), _rt::String>; -} -#[doc(hidden)] -macro_rules! __export_world_aggregator_world_cabi { - ($ty:ident with_types_in $($path_to_types:tt)*) => { - const _ : () = { #[unsafe (export_name = "process-packet")] unsafe extern "C" fn - export_process_packet(arg0 : * mut u8,) -> * mut u8 { unsafe { - $($path_to_types)*:: _export_process_packet_cabi::<$ty > (arg0) } } #[unsafe - (export_name = "cabi_post_process-packet")] unsafe extern "C" fn - _post_return_process_packet(arg0 : * mut u8,) { unsafe { $($path_to_types)*:: - __post_return_process_packet::<$ty > (arg0) } } #[unsafe (export_name = - "handle-timer-callback")] unsafe extern "C" fn export_handle_timer_callback(arg0 - : * mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_handle_timer_callback_cabi::<$ty > (arg0) } } #[unsafe (export_name = - "cabi_post_handle-timer-callback")] unsafe extern "C" fn - _post_return_handle_timer_callback(arg0 : * mut u8,) { unsafe { - $($path_to_types)*:: __post_return_handle_timer_callback::<$ty > (arg0) } } - #[unsafe (export_name = "handle-submit-callback")] unsafe extern "C" fn - export_handle_submit_callback(arg0 : * mut u8,) -> * mut u8 { unsafe { - $($path_to_types)*:: _export_handle_submit_callback_cabi::<$ty > (arg0) } } - #[unsafe (export_name = "cabi_post_handle-submit-callback")] unsafe extern "C" fn - _post_return_handle_submit_callback(arg0 : * mut u8,) { unsafe { - $($path_to_types)*:: __post_return_handle_submit_callback::<$ty > (arg0) } } }; - }; -} -#[doc(hidden)] -pub(crate) use __export_world_aggregator_world_cabi; -#[cfg_attr(target_pointer_width = "64", repr(align(8)))] -#[cfg_attr(target_pointer_width = "32", repr(align(4)))] -struct _RetArea([::core::mem::MaybeUninit; 3 * ::core::mem::size_of::<*const u8>()]); -static mut _RET_AREA: _RetArea = _RetArea( - [::core::mem::MaybeUninit::uninit(); 3 * ::core::mem::size_of::<*const u8>()], -); #[rustfmt::skip] -#[allow(dead_code, clippy::all)] -pub mod wasi { - pub mod cli { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod environment { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn get_environment() -> _rt::Vec<(_rt::String, _rt::String)> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] - unsafe extern "C" { - #[link_name = "get-environment"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base10 = l2; - let len10 = l3; - let mut result10 = _rt::Vec::with_capacity(len10); - for i in 0..len10 { - let base = base10 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e10 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - (_rt::string_lift(bytes6), _rt::string_lift(bytes9)) - }; - result10.push(e10); - } - _rt::cabi_dealloc( - base10, - len10 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result11 = result10; - result11 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_arguments() -> _rt::Vec<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] - unsafe extern "C" { - #[link_name = "get-arguments"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .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 * (2 * ::core::mem::size_of::<*const u8>())); - let e7 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - _rt::string_lift(bytes6) - }; - result7.push(e7); - } - _rt::cabi_dealloc( - base7, - len7 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result8 = result7; - result8 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn initial_cwd() -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] - unsafe extern "C" { - #[link_name = "initial-cwd"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod exit { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - #[allow(unused_unsafe, clippy::all)] - pub fn exit(status: Result<(), ()>) -> () { - unsafe { - let result0 = match status { - Ok(_) => 0i32, - Err(_) => 1i32, - }; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/exit@0.2.0")] - unsafe extern "C" { - #[link_name = "exit"] - fn wit_import1(_: i32); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32) { - unreachable!() - } - unsafe { wit_import1(result0) }; - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod stdin { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - #[allow(unused_unsafe, clippy::all)] - pub fn get_stdin() -> InputStream { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stdin@0.2.0")] - unsafe extern "C" { - #[link_name = "get-stdin"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod stdout { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - #[allow(unused_unsafe, clippy::all)] - pub fn get_stdout() -> OutputStream { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stdout@0.2.0")] - unsafe extern "C" { - #[link_name = "get-stdout"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod stderr { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - #[allow(unused_unsafe, clippy::all)] - pub fn get_stderr() -> OutputStream { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stderr@0.2.0")] - unsafe extern "C" { - #[link_name = "get-stderr"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_input { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Debug)] - #[repr(transparent)] - pub struct TerminalInput { - handle: _rt::Resource, - } - impl TerminalInput { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for TerminalInput { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:cli/terminal-input@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]terminal-input"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_output { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Debug)] - #[repr(transparent)] - pub struct TerminalOutput { - handle: _rt::Resource, - } - impl TerminalOutput { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for TerminalOutput { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:cli/terminal-output@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]terminal-output"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_stdin { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type TerminalInput = super::super::super::wasi::cli::terminal_input::TerminalInput; - #[allow(unused_unsafe, clippy::all)] - pub fn get_terminal_stdin() -> Option { - 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:cli/terminal-stdin@0.2.0")] - unsafe extern "C" { - #[link_name = "get-terminal-stdin"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::cli::terminal_input::TerminalInput::from_handle( - l3 as u32, - ) - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_stdout { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput; - #[allow(unused_unsafe, clippy::all)] - pub fn get_terminal_stdout() -> Option { - 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:cli/terminal-stdout@0.2.0")] - unsafe extern "C" { - #[link_name = "get-terminal-stdout"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( - l3 as u32, - ) - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_stderr { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput; - #[allow(unused_unsafe, clippy::all)] - pub fn get_terminal_stderr() -> Option { - 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:cli/terminal-stderr@0.2.0")] - unsafe extern "C" { - #[link_name = "get-terminal-stderr"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( - l3 as u32, - ) - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - } - pub mod clocks { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod monotonic_clock { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type 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")] - unsafe extern "C" { - #[link_name = "now"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - 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")] - unsafe extern "C" { - #[link_name = "resolution"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - 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")] - unsafe extern "C" { - #[link_name = "subscribe-instant"] - fn wit_import0(_: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i64) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0(_rt::as_i64(when)) }; - unsafe { - super::super::super::wasi::io::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")] - unsafe extern "C" { - #[link_name = "subscribe-duration"] - fn wit_import0(_: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i64) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0(_rt::as_i64(when)) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod wall_clock { - #[used] - #[doc(hidden)] - 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")] - unsafe extern "C" { - #[link_name = "now"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::(); - let l3 = *ptr0.add(8).cast::(); - let result4 = Datetime { - seconds: l2 as u64, - nanoseconds: l3 as u32, - }; - result4 - } - } - #[allow(unused_unsafe, clippy::all)] - 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")] - unsafe extern "C" { - #[link_name = "resolution"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::(); - let l3 = *ptr0.add(8).cast::(); - let result4 = Datetime { - seconds: l2 as u64, - nanoseconds: l3 as u32, - }; - result4 - } - } - } - } - pub mod filesystem { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - pub type Error = super::super::super::wasi::io::streams::Error; - pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime; - pub type Filesize = u64; - #[repr(u8)] - #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] - 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, Ord, PartialEq, PartialOrd)] - 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, Ord, PartialEq, PartialOrd)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]descriptor"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]directory-entry-stream"] - fn drop(_: u32); - } - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.read-via-stream"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(offset), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.write-via-stream"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(offset), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.append-via-stream"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.advise"] - fn wit_import1(_: i32, _: i64, _: i64, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i64, - _: i64, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(offset), - _rt::as_i64(length), - advice.clone() as i32, - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.sync-data"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.get-flags"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - DescriptorFlags::empty() - | DescriptorFlags::from_bits_retain(((l3 as u8) << 0) as _) - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.get-type"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - DescriptorType::_lift(l3 as u8) - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.set-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(size), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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::clocks::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::clocks::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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.set-times"] - fn wit_import5( - _: i32, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: i32, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import5( - (self).handle() as i32, - result1_0, - result1_1, - result1_2, - result3_0, - result3_1, - result3_2, - ptr4, - ) - }; - let l6 = i32::from(*ptr4.add(0).cast::()); - let result8 = match l6 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from(*ptr4.add(1).cast::()); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - impl Descriptor { - #[allow(unused_unsafe, clippy::all)] - pub fn read( - &self, - length: Filesize, - offset: Filesize, - ) -> Result<(_rt::Vec, bool), ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]descriptor.read"] - fn wit_import1(_: i32, _: i64, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i64, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(length), - _rt::as_i64(offset), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result8 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let l6 = i32::from( - *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - ( - _rt::Vec::from_raw_parts(l3.cast(), len5, len5), - _rt::bool_lift(l6 as u8), - ) - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.write"] - fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: i64, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - _rt::as_i64(offset), - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result6 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(8).cast::(); - l4 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(8).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.read-directory"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { DirectoryEntryStream::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.sync"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.create-directory-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result5 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.stat"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result16 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = *ptr0.add(16).cast::(); - let l5 = *ptr0.add(24).cast::(); - let l6 = i32::from(*ptr0.add(32).cast::()); - let l9 = i32::from(*ptr0.add(56).cast::()); - let l12 = i32::from(*ptr0.add(80).cast::()); - DescriptorStat { - type_: DescriptorType::_lift(l3 as u8), - link_count: l4 as u64, - size: l5 as u64, - data_access_timestamp: match l6 { - 0 => None, - 1 => { - let e = { - let l7 = *ptr0.add(40).cast::(); - let l8 = *ptr0.add(48).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l7 as u64, - nanoseconds: l8 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - data_modification_timestamp: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = *ptr0.add(64).cast::(); - let l11 = *ptr0.add(72).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l10 as u64, - nanoseconds: l11 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - status_change_timestamp: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = *ptr0.add(88).cast::(); - let l14 = *ptr0.add(96).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l13 as u64, - nanoseconds: l14 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Ok(e) - } - 1 => { - let e = { - let l15 = i32::from(*ptr0.add(8).cast::()); - ErrorCode::_lift(l15 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result16 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.stat-at"] - fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - (flags0.bits() >> 0) as i32, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result18 = match l4 { - 0 => { - let e = { - let l5 = i32::from(*ptr2.add(8).cast::()); - let l6 = *ptr2.add(16).cast::(); - let l7 = *ptr2.add(24).cast::(); - let l8 = i32::from(*ptr2.add(32).cast::()); - let l11 = i32::from(*ptr2.add(56).cast::()); - let l14 = i32::from(*ptr2.add(80).cast::()); - DescriptorStat { - type_: DescriptorType::_lift(l5 as u8), - link_count: l6 as u64, - size: l7 as u64, - data_access_timestamp: match l8 { - 0 => None, - 1 => { - let e = { - let l9 = *ptr2.add(40).cast::(); - let l10 = *ptr2.add(48).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l9 as u64, - nanoseconds: l10 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - data_modification_timestamp: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr2.add(64).cast::(); - let l13 = *ptr2.add(72).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l12 as u64, - nanoseconds: l13 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - status_change_timestamp: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = *ptr2.add(88).cast::(); - let l16 = *ptr2.add(96).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l15 as u64, - nanoseconds: l16 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Ok(e) - } - 1 => { - let e = { - let l17 = i32::from(*ptr2.add(8).cast::()); - ErrorCode::_lift(l17 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result18 - } - } - } - 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::clocks::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::clocks::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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.set-times-at"] - fn wit_import7( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (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 l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - ErrorCode::_lift(l9 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.link-at"] - fn wit_import4( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import4( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import4( - (self).handle() as i32, - (flags0.bits() >> 0) as i32, - ptr1.cast_mut(), - len1, - (new_descriptor).handle() as i32, - ptr2.cast_mut(), - len2, - ptr3, - ) - }; - let l5 = i32::from(*ptr3.add(0).cast::()); - let result7 = match l5 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*ptr3.add(1).cast::()); - ErrorCode::_lift(l6 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.open-at"] - fn wit_import5( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import5( - (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 l6 = i32::from(*ptr4.add(0).cast::()); - let result9 = match l6 { - 0 => { - let e = { - let l7 = *ptr4.add(4).cast::(); - unsafe { Descriptor::from_handle(l7 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from(*ptr4.add(4).cast::()); - ErrorCode::_lift(l8 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - impl Descriptor { - #[allow(unused_unsafe, clippy::all)] - pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.readlink-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result8 = match l3 { - 0 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - _rt::string_lift(bytes6) - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.remove-directory-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result5 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.rename-at"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - (new_descriptor).handle() as i32, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result6 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr2.add(1).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.symlink-at"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result6 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr2.add(1).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.unlink-file-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result5 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.is-same-object"] - fn wit_import0(_: i32, _: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.metadata-hash"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - let l4 = *ptr0.add(16).cast::(); - MetadataHashValue { - lower: l3 as u64, - upper: l4 as u64, - } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr0.add(8).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.metadata-hash-at"] - fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - (flags0.bits() >> 0) as i32, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result8 = match l4 { - 0 => { - let e = { - let l5 = *ptr2.add(8).cast::(); - let l6 = *ptr2.add(16).cast::(); - MetadataHashValue { - lower: l5 as u64, - upper: l6 as u64, - } - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from(*ptr2.add(8).cast::()); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - impl DirectoryEntryStream { - #[allow(unused_unsafe, clippy::all)] - pub fn read_directory_entry( - &self, - ) -> Result, ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 5 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 5 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]directory-entry-stream.read-directory-entry"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result9 = match l2 { - 0 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => None, - 1 => { - let e = { - let l4 = i32::from( - *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr0 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts( - l5.cast(), - len7, - len7, - ); - DirectoryEntry { - type_: DescriptorType::_lift(l4 as u8), - name: _rt::string_lift(bytes7), - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - ErrorCode::_lift(l8 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - #[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")] - unsafe extern "C" { - #[link_name = "filesystem-error-code"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((err).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod preopens { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Descriptor = super::super::super::wasi::filesystem::types::Descriptor; - #[allow(unused_unsafe, clippy::all)] - pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.0")] - unsafe extern "C" { - #[link_name = "get-directories"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base8 = l2; - let len8 = l3; - let mut result8 = _rt::Vec::with_capacity(len8); - for i in 0..len8 { - let base = base8 - .add(i * (3 * ::core::mem::size_of::<*const u8>())); - let e8 = { - let l4 = *base.add(0).cast::(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); - ( - unsafe { - super::super::super::wasi::filesystem::types::Descriptor::from_handle( - l4 as u32, - ) - }, - _rt::string_lift(bytes7), - ) - }; - result8.push(e8); - } - _rt::cabi_dealloc( - base8, - len8 * (3 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result9 = result8; - result9 - } - } - } - } - pub mod http { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - pub type IoError = super::super::super::wasi::io::error::Error; - pub type Pollable = super::super::super::wasi::io::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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]fields"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-request"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-request"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]request-options"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]response-outparam"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-response"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-body"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]future-trailers"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-response"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-body"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]future-incoming-response"] - fn drop(_: u32); - } - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[constructor]fields"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { 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() * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - 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 * (4 * ::core::mem::size_of::<*const u8>())); - { - let (t0_0, t0_1) = e; - let vec1 = t0_0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .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(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len2; - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .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")] - unsafe extern "C" { - #[link_name = "[static]fields.from-list"] - fn wit_import5(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { wit_import5(result3, len3, ptr4) }; - let l6 = i32::from(*ptr4.add(0).cast::()); - let result10 = match l6 { - 0 => { - let e = { - let l7 = *ptr4.add(4).cast::(); - unsafe { Fields::from_handle(l7 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from(*ptr4.add(4).cast::()); - let v9 = match l8 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout3.size() != 0 { - _rt::alloc::dealloc(result3.cast(), layout3); - } - result10 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn get(&self, name: &str) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "[method]fields.get"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = *ptr1.add(0).cast::<*mut u8>(); - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base8 = l3; - let len8 = l4; - let mut result8 = _rt::Vec::with_capacity(len8); - for i in 0..len8 { - let base = base8 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e8 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - _rt::Vec::from_raw_parts(l5.cast(), len7, len7) - }; - result8.push(e8); - } - _rt::cabi_dealloc( - base8, - len8 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result9 = result8; - result9 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn has(&self, name: &str) -> bool { - unsafe { - let vec0 = name; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]fields.has"] - fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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: &str, - value: &[FieldValue], - ) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let 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() * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - 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 * (2 * ::core::mem::size_of::<*const u8>())); - { - let vec1 = e; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .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")] - unsafe extern "C" { - #[link_name = "[method]fields.set"] - fn wit_import4( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import4( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import4( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - result2, - len2, - ptr3, - ) - }; - let l5 = i32::from(*ptr3.add(0).cast::()); - let result8 = match l5 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*ptr3.add(1).cast::()); - let v7 = match l6 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - v7 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout2.size() != 0 { - _rt::alloc::dealloc(result2.cast(), layout2); - } - result8 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn delete(&self, name: &str) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let 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")] - unsafe extern "C" { - #[link_name = "[method]fields.delete"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result6 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.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(), - }; - result6 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn append( - &self, - name: &str, - value: &[u8], - ) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let vec0 = name; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - let vec1 = value; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]fields.append"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result7 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr2.add(1).cast::()); - let v6 = match l5 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]fields.entries"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base10 = l2; - let len10 = l3; - let mut result10 = _rt::Vec::with_capacity(len10); - for i in 0..len10 { - let base = base10 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e10 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - let l7 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - ( - _rt::string_lift(bytes6), - _rt::Vec::from_raw_parts(l7.cast(), len9, len9), - ) - }; - result10.push(e10); - } - _rt::cabi_dealloc( - base10, - len10 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result11 = result10; - result11 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]fields.clone"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { Fields::from_handle(ret as u32) } - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn method(&self) -> Method { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.method"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let v6 = match l2 { - 0 => Method::Get, - 1 => Method::Head, - 2 => Method::Post, - 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 e6 = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Method::Other(e6) - } - }; - let result7 = v6; - result7 - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn path_with_query(&self) -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.path-with-query"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn scheme(&self) -> Option { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.scheme"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result8 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v7 = match l3 { - 0 => Scheme::Http, - 1 => Scheme::Https, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e7 = { - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - _rt::string_lift(bytes6) - }; - Scheme::Other(e7) - } - }; - v7 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn authority(&self) -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.authority"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.consume"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { IncomingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[constructor]outgoing-request"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((&headers).take_handle() as i32) - }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.body"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { OutgoingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl OutgoingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn method(&self) -> Method { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.method"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let v6 = match l2 { - 0 => Method::Get, - 1 => Method::Head, - 2 => Method::Post, - 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 e6 = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Method::Other(e6) - } - }; - let result7 = v6; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-method"] - fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import2( - (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 { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.path-with-query"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl OutgoingRequest { - #[allow(unused_unsafe, clippy::all)] - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-path-with-query"] - fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import2( - (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 { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.scheme"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result8 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v7 = match l3 { - 0 => Scheme::Http, - 1 => Scheme::Https, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e7 = { - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - _rt::string_lift(bytes6) - }; - Scheme::Other(e7) - } - }; - v7 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-scheme"] - fn wit_import3( - _: i32, - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import3( - (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 { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.authority"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl OutgoingRequest { - #[allow(unused_unsafe, clippy::all)] - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-authority"] - fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import2( - (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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[constructor]request-options"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.connect-timeout"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.set-connect-timeout"] - fn wit_import1(_: i32, _: i32, _: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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")] - unsafe extern "C" { - #[link_name = "[method]request-options.first-byte-timeout"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.set-first-byte-timeout"] - fn wit_import1(_: i32, _: i32, _: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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")] - unsafe extern "C" { - #[link_name = "[method]request-options.between-bytes-timeout"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.set-between-bytes-timeout"] - fn wit_import1(_: i32, _: i32, _: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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")] - unsafe extern "C" { - #[link_name = "[static]response-outparam.set"] - fn wit_import39( - _: i32, - _: i32, - _: i32, - _: i32, - _: ::core::mem::MaybeUninit, - _: *mut u8, - _: *mut u8, - _: usize, - _: i32, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import39( - _: i32, - _: i32, - _: i32, - _: i32, - _: ::core::mem::MaybeUninit, - _: *mut u8, - _: *mut u8, - _: usize, - _: i32, - ) { - unreachable!() - } - unsafe { - wit_import39( - (¶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")] - unsafe extern "C" { - #[link_name = "[method]incoming-response.status"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]incoming-response.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-response.consume"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { IncomingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-body.stream"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[static]incoming-body.finish"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((&this).take_handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]future-trailers.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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< - u8, - >; 40 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 40 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]future-trailers.get"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result70 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - match l3 { - 0 => { - let e = { - let l4 = i32::from(*ptr0.add(16).cast::()); - match l4 { - 0 => { - let e = { - let l5 = i32::from(*ptr0.add(24).cast::()); - match l5 { - 0 => None, - 1 => { - let e = { - let l6 = *ptr0.add(28).cast::(); - unsafe { Fields::from_handle(l6 as u32) } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from(*ptr0.add(24).cast::()); - let v69 = match l7 { - 0 => ErrorCode::DnsTimeout, - 1 => { - let e69 = { - let l8 = i32::from(*ptr0.add(32).cast::()); - let l12 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l8 { - 0 => None, - 1 => { - let e = { - let l9 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let bytes11 = _rt::Vec::from_raw_parts( - l9.cast(), - len11, - len11, - ); - _rt::string_lift(bytes11) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = i32::from( - *ptr0 - .add(34 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - l13 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e69) - } - 2 => ErrorCode::DestinationNotFound, - 3 => ErrorCode::DestinationUnavailable, - 4 => ErrorCode::DestinationIpProhibited, - 5 => ErrorCode::DestinationIpUnroutable, - 6 => ErrorCode::ConnectionRefused, - 7 => ErrorCode::ConnectionTerminated, - 8 => ErrorCode::ConnectionTimeout, - 9 => ErrorCode::ConnectionReadTimeout, - 10 => ErrorCode::ConnectionWriteTimeout, - 11 => ErrorCode::ConnectionLimitReached, - 12 => ErrorCode::TlsProtocolError, - 13 => ErrorCode::TlsCertificateError, - 14 => { - let e69 = { - let l14 = i32::from(*ptr0.add(32).cast::()); - let l16 = i32::from( - *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - TlsAlertReceivedPayload { - alert_id: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = i32::from(*ptr0.add(33).cast::()); - l15 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l16 { - 0 => None, - 1 => { - let e = { - let l17 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l18 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len19 = l18; - let bytes19 = _rt::Vec::from_raw_parts( - l17.cast(), - len19, - len19, - ); - _rt::string_lift(bytes19) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e69) - } - 15 => ErrorCode::HttpRequestDenied, - 16 => ErrorCode::HttpRequestLengthRequired, - 17 => { - let e69 = { - let l20 = i32::from(*ptr0.add(32).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *ptr0.add(40).cast::(); - l21 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e69) - } - 18 => ErrorCode::HttpRequestMethodInvalid, - 19 => ErrorCode::HttpRequestUriInvalid, - 20 => ErrorCode::HttpRequestUriTooLong, - 21 => { - let e69 = { - let l22 = i32::from(*ptr0.add(32).cast::()); - match l22 { - 0 => None, - 1 => { - let e = { - let l23 = *ptr0.add(36).cast::(); - l23 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e69) - } - 22 => { - let e69 = { - let l24 = i32::from(*ptr0.add(32).cast::()); - match l24 { - 0 => None, - 1 => { - let e = { - let l25 = i32::from( - *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l29 = i32::from( - *ptr0 - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l25 { - 0 => None, - 1 => { - let e = { - let l26 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l27 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len28 = l27; - let bytes28 = _rt::Vec::from_raw_parts( - l26.cast(), - len28, - len28, - ); - _rt::string_lift(bytes28) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr0 - .add(36 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l30 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e69) - } - 23 => { - let e69 = { - let l31 = i32::from(*ptr0.add(32).cast::()); - match l31 { - 0 => None, - 1 => { - let e = { - let l32 = *ptr0.add(36).cast::(); - l32 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e69) - } - 24 => { - let e69 = { - let l33 = i32::from(*ptr0.add(32).cast::()); - let l37 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l33 { - 0 => None, - 1 => { - let e = { - let l34 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l35 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len36 = l35; - let bytes36 = _rt::Vec::from_raw_parts( - l34.cast(), - len36, - len36, - ); - _rt::string_lift(bytes36) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr0 - .add(36 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l38 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e69) - } - 25 => ErrorCode::HttpResponseIncomplete, - 26 => { - let e69 = { - let l39 = i32::from(*ptr0.add(32).cast::()); - match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *ptr0.add(36).cast::(); - l40 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e69) - } - 27 => { - let e69 = { - let l41 = i32::from(*ptr0.add(32).cast::()); - let l45 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l43 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len44 = l43; - let bytes44 = _rt::Vec::from_raw_parts( - l42.cast(), - len44, - len44, - ); - _rt::string_lift(bytes44) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr0 - .add(36 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l46 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e69) - } - 28 => { - let e69 = { - let l47 = i32::from(*ptr0.add(32).cast::()); - match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr0.add(40).cast::(); - l48 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e69) - } - 29 => { - let e69 = { - let l49 = i32::from(*ptr0.add(32).cast::()); - match l49 { - 0 => None, - 1 => { - let e = { - let l50 = *ptr0.add(36).cast::(); - l50 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e69) - } - 30 => { - let e69 = { - let l51 = i32::from(*ptr0.add(32).cast::()); - let l55 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l51 { - 0 => None, - 1 => { - let e = { - let l52 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l53 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len54 = l53; - let bytes54 = _rt::Vec::from_raw_parts( - l52.cast(), - len54, - len54, - ); - _rt::string_lift(bytes54) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l55 { - 0 => None, - 1 => { - let e = { - let l56 = *ptr0 - .add(36 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l56 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e69) - } - 31 => { - let e69 = { - let l57 = i32::from(*ptr0.add(32).cast::()); - match l57 { - 0 => None, - 1 => { - let e = { - let l58 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l59 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len60 = l59; - let bytes60 = _rt::Vec::from_raw_parts( - l58.cast(), - len60, - len60, - ); - _rt::string_lift(bytes60) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e69) - } - 32 => { - let e69 = { - let l61 = i32::from(*ptr0.add(32).cast::()); - match l61 { - 0 => None, - 1 => { - let e = { - let l62 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len64 = l63; - let bytes64 = _rt::Vec::from_raw_parts( - l62.cast(), - len64, - len64, - ); - _rt::string_lift(bytes64) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e69) - } - 33 => ErrorCode::HttpResponseTimeout, - 34 => ErrorCode::HttpUpgradeFailed, - 35 => ErrorCode::HttpProtocolError, - 36 => ErrorCode::LoopDetected, - 37 => ErrorCode::ConfigurationError, - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e69 = { - let l65 = i32::from(*ptr0.add(32).cast::()); - match l65 { - 0 => None, - 1 => { - let e = { - let l66 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l67 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len68 = l67; - let bytes68 = _rt::Vec::from_raw_parts( - l66.cast(), - len68, - len68, - ); - _rt::string_lift(bytes68) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e69) - } - }; - v69 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result70 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[constructor]outgoing-response"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((&headers).take_handle() as i32) - }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.status-code"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.set-status-code"] - fn wit_import0(_: i32, _: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.body"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { OutgoingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-body.write"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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< - u8, - >; 24 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 24 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "[static]outgoing-body.finish"] - fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (&this).take_handle() as i32, - result0_0, - result0_1, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result67 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(8).cast::()); - let v66 = match l4 { - 0 => ErrorCode::DnsTimeout, - 1 => { - let e66 = { - let l5 = i32::from(*ptr1.add(16).cast::()); - let l9 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l5 { - 0 => None, - 1 => { - let e = { - let l6 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = i32::from( - *ptr1 - .add(18 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - l10 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e66) - } - 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 e66 = { - let l11 = i32::from(*ptr1.add(16).cast::()); - let l13 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - TlsAlertReceivedPayload { - alert_id: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = i32::from(*ptr1.add(17).cast::()); - l12 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l15 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len16 = l15; - let bytes16 = _rt::Vec::from_raw_parts( - l14.cast(), - len16, - len16, - ); - _rt::string_lift(bytes16) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e66) - } - 15 => ErrorCode::HttpRequestDenied, - 16 => ErrorCode::HttpRequestLengthRequired, - 17 => { - let e66 = { - let l17 = i32::from(*ptr1.add(16).cast::()); - match l17 { - 0 => None, - 1 => { - let e = { - let l18 = *ptr1.add(24).cast::(); - l18 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e66) - } - 18 => ErrorCode::HttpRequestMethodInvalid, - 19 => ErrorCode::HttpRequestUriInvalid, - 20 => ErrorCode::HttpRequestUriTooLong, - 21 => { - let e66 = { - let l19 = i32::from(*ptr1.add(16).cast::()); - match l19 { - 0 => None, - 1 => { - let e = { - let l20 = *ptr1.add(20).cast::(); - l20 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e66) - } - 22 => { - let e66 = { - let l21 = i32::from(*ptr1.add(16).cast::()); - match l21 { - 0 => None, - 1 => { - let e = { - let l22 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l26 = i32::from( - *ptr1 - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l22 { - 0 => None, - 1 => { - let e = { - let l23 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l24 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len25 = l24; - let bytes25 = _rt::Vec::from_raw_parts( - l23.cast(), - len25, - len25, - ); - _rt::string_lift(bytes25) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l26 { - 0 => None, - 1 => { - let e = { - let l27 = *ptr1 - .add(20 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l27 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e66) - } - 23 => { - let e66 = { - let l28 = i32::from(*ptr1.add(16).cast::()); - match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *ptr1.add(20).cast::(); - l29 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e66) - } - 24 => { - let e66 = { - let l30 = i32::from(*ptr1.add(16).cast::()); - let l34 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l30 { - 0 => None, - 1 => { - let e = { - let l31 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l32 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len33 = l32; - let bytes33 = _rt::Vec::from_raw_parts( - l31.cast(), - len33, - len33, - ); - _rt::string_lift(bytes33) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e66) - } - 25 => ErrorCode::HttpResponseIncomplete, - 26 => { - let e66 = { - let l36 = i32::from(*ptr1.add(16).cast::()); - match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *ptr1.add(20).cast::(); - l37 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e66) - } - 27 => { - let e66 = { - let l38 = i32::from(*ptr1.add(16).cast::()); - let l42 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l38 { - 0 => None, - 1 => { - let e = { - let l39 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l40 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len41 = l40; - let bytes41 = _rt::Vec::from_raw_parts( - l39.cast(), - len41, - len41, - ); - _rt::string_lift(bytes41) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l42 { - 0 => None, - 1 => { - let e = { - let l43 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l43 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e66) - } - 28 => { - let e66 = { - let l44 = i32::from(*ptr1.add(16).cast::()); - match l44 { - 0 => None, - 1 => { - let e = { - let l45 = *ptr1.add(24).cast::(); - l45 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e66) - } - 29 => { - let e66 = { - let l46 = i32::from(*ptr1.add(16).cast::()); - match l46 { - 0 => None, - 1 => { - let e = { - let l47 = *ptr1.add(20).cast::(); - l47 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e66) - } - 30 => { - let e66 = { - let l48 = i32::from(*ptr1.add(16).cast::()); - let l52 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l50 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len51 = l50; - let bytes51 = _rt::Vec::from_raw_parts( - l49.cast(), - len51, - len51, - ); - _rt::string_lift(bytes51) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l52 { - 0 => None, - 1 => { - let e = { - let l53 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l53 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e66) - } - 31 => { - let e66 = { - let l54 = i32::from(*ptr1.add(16).cast::()); - match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l56 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len57 = l56; - let bytes57 = _rt::Vec::from_raw_parts( - l55.cast(), - len57, - len57, - ); - _rt::string_lift(bytes57) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e66) - } - 32 => { - let e66 = { - let l58 = i32::from(*ptr1.add(16).cast::()); - match l58 { - 0 => None, - 1 => { - let e = { - let l59 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts( - l59.cast(), - len61, - len61, - ); - _rt::string_lift(bytes61) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e66) - } - 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 e66 = { - let l62 = i32::from(*ptr1.add(16).cast::()); - match l62 { - 0 => None, - 1 => { - let e = { - let l63 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l64 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len65 = l64; - let bytes65 = _rt::Vec::from_raw_parts( - l63.cast(), - len65, - len65, - ); - _rt::string_lift(bytes65) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e66) - } - }; - v66 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result67 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]future-incoming-response.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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< - u8, - >; 40 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 40 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]future-incoming-response.get"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result69 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - match l3 { - 0 => { - let e = { - let l4 = i32::from(*ptr0.add(16).cast::()); - match l4 { - 0 => { - let e = { - let l5 = *ptr0.add(24).cast::(); - unsafe { IncomingResponse::from_handle(l5 as u32) } - }; - 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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(34 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .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(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l28 = i32::from( - *ptr0 - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l24 { - 0 => None, - 1 => { - let e = { - let l25 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l26 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .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(36 + 4 * ::core::mem::size_of::<*const u8>()) - .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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l34 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(36 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l40 { - 0 => None, - 1 => { - let e = { - let l41 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l42 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(36 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l50 { - 0 => None, - 1 => { - let e = { - let l51 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l52 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(36 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l58 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l62 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l66 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - }; - result69 - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn http_error_code(err: &IoError) -> Option { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 24 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 24 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "http-error-code"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((err).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result66 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v65 = match l3 { - 0 => ErrorCode::DnsTimeout, - 1 => { - let e65 = { - let l4 = i32::from(*ptr0.add(16).cast::()); - let l8 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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( - *ptr0 - .add(18 + 3 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - let l12 = i32::from( - *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - TlsAlertReceivedPayload { - alert_id: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from(*ptr0.add(17).cast::()); - l11 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l14 = *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l16 { - 0 => None, - 1 => { - let e = { - let l17 = *ptr0.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(*ptr0.add(16).cast::()); - match l18 { - 0 => None, - 1 => { - let e = { - let l19 = *ptr0.add(20).cast::(); - l19 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e65) - } - 22 => { - let e65 = { - let l20 = i32::from(*ptr0.add(16).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = i32::from( - *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l25 = i32::from( - *ptr0 - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l21 { - 0 => None, - 1 => { - let e = { - let l22 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l23 = *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 4 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l27 { - 0 => None, - 1 => { - let e = { - let l28 = *ptr0.add(20).cast::(); - l28 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e65) - } - 24 => { - let e65 = { - let l29 = i32::from(*ptr0.add(16).cast::()); - let l33 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l31 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l34 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e65) - } - 25 => ErrorCode::HttpResponseIncomplete, - 26 => { - let e65 = { - let l35 = i32::from(*ptr0.add(16).cast::()); - match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr0.add(20).cast::(); - l36 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e65) - } - 27 => { - let e65 = { - let l37 = i32::from(*ptr0.add(16).cast::()); - let l41 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l39 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l42 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e65) - } - 28 => { - let e65 = { - let l43 = i32::from(*ptr0.add(16).cast::()); - match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *ptr0.add(24).cast::(); - l44 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e65) - } - 29 => { - let e65 = { - let l45 = i32::from(*ptr0.add(16).cast::()); - match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr0.add(20).cast::(); - l46 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e65) - } - 30 => { - let e65 = { - let l47 = i32::from(*ptr0.add(16).cast::()); - let l51 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l49 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l52 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e65) - } - 31 => { - let e65 = { - let l53 = i32::from(*ptr0.add(16).cast::()); - match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l55 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l57 { - 0 => None, - 1 => { - let e = { - let l58 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l59 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l61 { - 0 => None, - 1 => { - let e = { - let l62 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result66 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod outgoing_handler { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type OutgoingRequest = super::super::super::wasi::http::types::OutgoingRequest; - pub type RequestOptions = super::super::super::wasi::http::types::RequestOptions; - pub type FutureIncomingResponse = super::super::super::wasi::http::types::FutureIncomingResponse; - pub type ErrorCode = super::super::super::wasi::http::types::ErrorCode; - #[allow(unused_unsafe, clippy::all)] - pub fn handle( - request: OutgoingRequest, - options: Option, - ) -> Result { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 24 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 24 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let (result0_0, result0_1) = match &options { - 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/outgoing-handler@0.2.0")] - unsafe extern "C" { - #[link_name = "handle"] - fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (&request).take_handle() as i32, - result0_0, - result0_1, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result68 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(8).cast::(); - unsafe { - super::super::super::wasi::http::types::FutureIncomingResponse::from_handle( - l4 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(8).cast::()); - use super::super::super::wasi::http::types::ErrorCode as V67; - let v67 = match l5 { - 0 => V67::DnsTimeout, - 1 => { - let e67 = { - let l6 = i32::from(*ptr1.add(16).cast::()); - let l10 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::DnsErrorPayload { - rcode: match l6 { - 0 => None, - 1 => { - let e = { - let l7 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts( - l7.cast(), - len9, - len9, - ); - _rt::string_lift(bytes9) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from( - *ptr1 - .add(18 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - l11 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::DnsError(e67) - } - 2 => V67::DestinationNotFound, - 3 => V67::DestinationUnavailable, - 4 => V67::DestinationIpProhibited, - 5 => V67::DestinationIpUnroutable, - 6 => V67::ConnectionRefused, - 7 => V67::ConnectionTerminated, - 8 => V67::ConnectionTimeout, - 9 => V67::ConnectionReadTimeout, - 10 => V67::ConnectionWriteTimeout, - 11 => V67::ConnectionLimitReached, - 12 => V67::TlsProtocolError, - 13 => V67::TlsCertificateError, - 14 => { - let e67 = { - let l12 = i32::from(*ptr1.add(16).cast::()); - let l14 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::TlsAlertReceivedPayload { - alert_id: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = i32::from(*ptr1.add(17).cast::()); - l13 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l16 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - } - }; - V67::TlsAlertReceived(e67) - } - 15 => V67::HttpRequestDenied, - 16 => V67::HttpRequestLengthRequired, - 17 => { - let e67 = { - let l18 = i32::from(*ptr1.add(16).cast::()); - match l18 { - 0 => None, - 1 => { - let e = { - let l19 = *ptr1.add(24).cast::(); - l19 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestBodySize(e67) - } - 18 => V67::HttpRequestMethodInvalid, - 19 => V67::HttpRequestUriInvalid, - 20 => V67::HttpRequestUriTooLong, - 21 => { - let e67 = { - let l20 = i32::from(*ptr1.add(16).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *ptr1.add(20).cast::(); - l21 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestHeaderSectionSize(e67) - } - 22 => { - let e67 = { - let l22 = i32::from(*ptr1.add(16).cast::()); - match l22 { - 0 => None, - 1 => { - let e = { - let l23 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l27 = i32::from( - *ptr1 - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l23 { - 0 => None, - 1 => { - let e = { - let l24 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l25 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len26 = l25; - let bytes26 = _rt::Vec::from_raw_parts( - l24.cast(), - len26, - len26, - ); - _rt::string_lift(bytes26) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l27 { - 0 => None, - 1 => { - let e = { - let l28 = *ptr1 - .add(20 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l28 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestHeaderSize(e67) - } - 23 => { - let e67 = { - let l29 = i32::from(*ptr1.add(16).cast::()); - match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr1.add(20).cast::(); - l30 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestTrailerSectionSize(e67) - } - 24 => { - let e67 = { - let l31 = i32::from(*ptr1.add(16).cast::()); - let l35 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l31 { - 0 => None, - 1 => { - let e = { - let l32 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l33 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len34 = l33; - let bytes34 = _rt::Vec::from_raw_parts( - l32.cast(), - len34, - len34, - ); - _rt::string_lift(bytes34) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l36 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::HttpRequestTrailerSize(e67) - } - 25 => V67::HttpResponseIncomplete, - 26 => { - let e67 = { - let l37 = i32::from(*ptr1.add(16).cast::()); - match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr1.add(20).cast::(); - l38 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpResponseHeaderSectionSize(e67) - } - 27 => { - let e67 = { - let l39 = i32::from(*ptr1.add(16).cast::()); - let l43 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l41 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len42 = l41; - let bytes42 = _rt::Vec::from_raw_parts( - l40.cast(), - len42, - len42, - ); - _rt::string_lift(bytes42) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l44 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::HttpResponseHeaderSize(e67) - } - 28 => { - let e67 = { - let l45 = i32::from(*ptr1.add(16).cast::()); - match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr1.add(24).cast::(); - l46 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpResponseBodySize(e67) - } - 29 => { - let e67 = { - let l47 = i32::from(*ptr1.add(16).cast::()); - match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr1.add(20).cast::(); - l48 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpResponseTrailerSectionSize(e67) - } - 30 => { - let e67 = { - let l49 = i32::from(*ptr1.add(16).cast::()); - let l53 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l49 { - 0 => None, - 1 => { - let e = { - let l50 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l51 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len52 = l51; - let bytes52 = _rt::Vec::from_raw_parts( - l50.cast(), - len52, - len52, - ); - _rt::string_lift(bytes52) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l54 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::HttpResponseTrailerSize(e67) - } - 31 => { - let e67 = { - let l55 = i32::from(*ptr1.add(16).cast::()); - match l55 { - 0 => None, - 1 => { - let e = { - let l56 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l57 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - } - }; - V67::HttpResponseTransferCoding(e67) - } - 32 => { - let e67 = { - let l59 = i32::from(*ptr1.add(16).cast::()); - match l59 { - 0 => None, - 1 => { - let e = { - let l60 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l61 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - } - }; - V67::HttpResponseContentCoding(e67) - } - 33 => V67::HttpResponseTimeout, - 34 => V67::HttpUpgradeFailed, - 35 => V67::HttpProtocolError, - 36 => V67::LoopDetected, - 37 => V67::ConfigurationError, - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e67 = { - let l63 = i32::from(*ptr1.add(16).cast::()); - match l63 { - 0 => None, - 1 => { - let e = { - let l64 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l65 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - } - }; - V67::InternalError(e67) - } - }; - v67 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result68 - } - } - } - } - pub mod io { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod poll { - #[used] - #[doc(hidden)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]pollable"] - fn drop(_: u32); - } - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]pollable.ready"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]pollable.block"] - fn wit_import0(_: i32); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) { - unreachable!() - } - unsafe { wit_import0((self).handle() as i32) }; - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn poll(in_: &[&Pollable]) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "poll"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(result0, len0, ptr1) }; - let l3 = *ptr1.add(0).cast::<*mut u8>(); - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let result6 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - if layout0.size() != 0 { - _rt::alloc::dealloc(result0.cast(), layout0); - } - result6 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod error { - #[used] - #[doc(hidden)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]error"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl Error { - #[allow(unused_unsafe, clippy::all)] - pub fn to_debug_string(&self) -> _rt::String { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/error@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]error.to-debug-string"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - let result5 = _rt::string_lift(bytes4); - result5 - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod streams { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Error = super::super::super::wasi::io::error::Error; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]input-stream"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]output-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl InputStream { - #[allow(unused_unsafe, clippy::all)] - pub fn read(&self, len: u64) -> Result<_rt::Vec, StreamError> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]input-stream.read"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result9 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - _rt::Vec::from_raw_parts(l3.cast(), len5, len5) - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v8 = match l6 { - 0 => { - let e8 = { - let l7 = *ptr0 - .add(4 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l7 as u32, - ) - } - }; - StreamError::LastOperationFailed(e8) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v8 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - impl InputStream { - #[allow(unused_unsafe, clippy::all)] - pub fn blocking_read( - &self, - len: u64, - ) -> Result<_rt::Vec, StreamError> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]input-stream.blocking-read"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result9 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - _rt::Vec::from_raw_parts(l3.cast(), len5, len5) - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v8 = match l6 { - 0 => { - let e8 = { - let l7 = *ptr0 - .add(4 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l7 as u32, - ) - } - }; - StreamError::LastOperationFailed(e8) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v8 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]input-stream.skip"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]input-stream.blocking-skip"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]input-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.check-write"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.write"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result7 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(4).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr1.add(8).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-write-and-flush"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result7 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(4).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr1.add(8).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.flush"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-flush"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.write-zeroes"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.splice"] - fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i32, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - (src).handle() as i32, - _rt::as_i64(&len), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-splice"] - fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i32, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - (src).handle() as i32, - _rt::as_i64(&len), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - } - } - pub mod keyvalue { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod store { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Clone)] - pub enum Error { - NoSuchStore, - AccessDenied, - Other(_rt::String), - } - impl ::core::fmt::Debug for Error { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - 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 {} - #[derive(Clone)] - pub struct KeyResponse { - pub keys: _rt::Vec<_rt::String>, - pub cursor: Option<_rt::String>, - } - impl ::core::fmt::Debug for KeyResponse { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("KeyResponse") - .field("keys", &self.keys) - .field("cursor", &self.cursor) - .finish() - } - } - #[derive(Debug)] - #[repr(transparent)] - pub struct Bucket { - handle: _rt::Resource, - } - impl Bucket { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _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 Bucket { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[resource-drop]bucket"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn get(&self, key: &str) -> Result>, Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.get"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result13 = match l3 { - 0 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - _rt::Vec::from_raw_parts(l5.cast(), len7, len7) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v12 = match l8 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e12 = { - let l9 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let bytes11 = _rt::Vec::from_raw_parts( - l9.cast(), - len11, - len11, - ); - _rt::string_lift(bytes11) - }; - Error::Other(e12) - } - }; - v12 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result13 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn set(&self, key: &str, value: &[u8]) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.set"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result10 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v9 = match l5 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Error::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn delete(&self, key: &str) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.delete"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result9 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v8 = match l4 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e8 = { - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts( - l5.cast(), - len7, - len7, - ); - _rt::string_lift(bytes7) - }; - Error::Other(e8) - } - }; - v8 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn exists(&self, key: &str) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.exists"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - _rt::bool_lift(l4 as u8) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v9 = match l5 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Error::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn list_keys( - &self, - cursor: Option<&str>, - ) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 6 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 6 - * ::core::mem::size_of::<*const u8>()], - ); - let (result1_0, result1_1, result1_2) = match cursor { - 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), - }; - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.list-keys"] - fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - result1_0, - result1_1, - result1_2, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result20 = match l4 { - 0 => { - let e = { - let l5 = *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base10 = l5; - let len10 = l6; - let mut result10 = _rt::Vec::with_capacity(len10); - for i in 0..len10 { - let base = base10 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e10 = { - let l7 = *base.add(0).cast::<*mut u8>(); - let l8 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts( - l7.cast(), - len9, - len9, - ); - _rt::string_lift(bytes9) - }; - result10.push(e10); - } - _rt::cabi_dealloc( - base10, - len10 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l11 = i32::from( - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - KeyResponse { - keys: result10, - cursor: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr2 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *ptr2 - .add(5 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - } - }; - Ok(e) - } - 1 => { - let e = { - let l15 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v19 = match l15 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e19 = { - let l16 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts( - l16.cast(), - len18, - len18, - ); - _rt::string_lift(bytes18) - }; - Error::Other(e19) - } - }; - v19 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result20 - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn open(identifier: &str) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = identifier; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "open"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { Bucket::from_handle(l4 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v9 = match l5 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Error::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod atomics { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Bucket = super::super::super::wasi::keyvalue::store::Bucket; - pub type Error = super::super::super::wasi::keyvalue::store::Error; - #[derive(Debug)] - #[repr(transparent)] - pub struct Cas { - handle: _rt::Resource, - } - impl Cas { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _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 Cas { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "wasi:keyvalue/atomics@0.2.0-draft2" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]cas"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - pub enum CasError { - StoreError(Error), - CasFailed(Cas), - } - impl ::core::fmt::Debug for CasError { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - CasError::StoreError(e) => { - f.debug_tuple("CasError::StoreError").field(e).finish() - } - CasError::CasFailed(e) => { - f.debug_tuple("CasError::CasFailed").field(e).finish() - } - } - } - } - impl ::core::fmt::Display for CasError { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - write!(f, "{:?}", self) - } - } - impl std::error::Error for CasError {} - impl Cas { - #[allow(unused_unsafe, clippy::all)] - pub fn new(bucket: &Bucket, key: &str) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/atomics@0.2.0-draft2" - )] - unsafe extern "C" { - #[link_name = "[static]cas.new"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (bucket).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { Cas::from_handle(l4 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl Cas { - #[allow(unused_unsafe, clippy::all)] - pub fn current(&self) -> Result>, Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link( - wasm_import_module = "wasi:keyvalue/atomics@0.2.0-draft2" - )] - unsafe extern "C" { - #[link_name = "[method]cas.current"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result12 = match l2 { - 0 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - _rt::Vec::from_raw_parts(l4.cast(), len6, len6) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V11; - let v11 = match l7 { - 0 => V11::NoSuchStore, - 1 => V11::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e11 = { - let l8 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts( - l8.cast(), - len10, - len10, - ); - _rt::string_lift(bytes10) - }; - V11::Other(e11) - } - }; - v11 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result12 - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn increment( - bucket: &Bucket, - key: &str, - delta: i64, - ) -> Result { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 16 + 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16 - + 2 * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/atomics@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "increment"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (bucket).handle() as i32, - ptr0.cast_mut(), - len0, - _rt::as_i64(&delta), - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(8).cast::(); - l4 - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(8).cast::()); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn swap(cas: Cas, value: &[u8]) -> Result<(), CasError> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 5 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 5 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = value; - 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:keyvalue/atomics@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "swap"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (&cas).take_handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result12 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v11 = match l4 { - 0 => { - let e11 = { - let l5 = i32::from( - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - CasError::StoreError(e11) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e11 = { - let l10 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { Cas::from_handle(l10 as u32) } - }; - CasError::CasFailed(e11) - } - }; - v11 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result12 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod batch { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Bucket = super::super::super::wasi::keyvalue::store::Bucket; - pub type Error = super::super::super::wasi::keyvalue::store::Error; - #[allow(unused_unsafe, clippy::all)] - pub fn get_many( - bucket: &Bucket, - keys: &[_rt::String], - ) -> Result<_rt::Vec)>>, Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec1 = keys; - let len1 = vec1.len(); - let layout1 = _rt::alloc::Layout::from_size_align_unchecked( - vec1.len() * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result1 = if layout1.size() != 0 { - let ptr = _rt::alloc::alloc(layout1).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout1); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec1.into_iter().enumerate() { - let base = result1 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - { - let vec0 = e; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .cast::() = len0; - *base.add(0).cast::<*mut u8>() = ptr0.cast_mut(); - } - } - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/batch@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "get-many"] - fn wit_import3(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3((bucket).handle() as i32, result1, len1, ptr2) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result20 = match l4 { - 0 => { - let e = { - let l5 = *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base14 = l5; - let len14 = l6; - let mut result14 = _rt::Vec::with_capacity(len14); - for i in 0..len14 { - let base = base14 - .add(i * (5 * ::core::mem::size_of::<*const u8>())); - let e14 = { - let l7 = i32::from(*base.add(0).cast::()); - match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts( - l8.cast(), - len10, - len10, - ); - let l11 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l12 = *base - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len13 = l12; - ( - _rt::string_lift(bytes10), - _rt::Vec::from_raw_parts(l11.cast(), len13, len13), - ) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - result14.push(e14); - } - _rt::cabi_dealloc( - base14, - len14 * (5 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result14 - }; - Ok(e) - } - 1 => { - let e = { - let l15 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V19; - let v19 = match l15 { - 0 => V19::NoSuchStore, - 1 => V19::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e19 = { - let l16 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts( - l16.cast(), - len18, - len18, - ); - _rt::string_lift(bytes18) - }; - V19::Other(e19) - } - }; - v19 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout1.size() != 0 { - _rt::alloc::dealloc(result1.cast(), layout1); - } - result20 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn set_many( - bucket: &Bucket, - key_values: &[(_rt::String, _rt::Vec)], - ) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec3 = key_values; - let len3 = vec3.len(); - let layout3 = _rt::alloc::Layout::from_size_align_unchecked( - vec3.len() * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - 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 * (4 * ::core::mem::size_of::<*const u8>())); - { - let (t0_0, t0_1) = e; - let vec1 = t0_0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .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(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len2; - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr2.cast_mut(); - } - } - let ptr4 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/batch@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "set-many"] - fn wit_import5(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import5((bucket).handle() as i32, result3, len3, ptr4) - }; - let l6 = i32::from(*ptr4.add(0).cast::()); - let result12 = match l6 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr4.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V11; - let v11 = match l7 { - 0 => V11::NoSuchStore, - 1 => V11::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e11 = { - let l8 = *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts( - l8.cast(), - len10, - len10, - ); - _rt::string_lift(bytes10) - }; - V11::Other(e11) - } - }; - v11 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout3.size() != 0 { - _rt::alloc::dealloc(result3.cast(), layout3); - } - result12 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn delete_many( - bucket: &Bucket, - keys: &[_rt::String], - ) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec1 = keys; - let len1 = vec1.len(); - let layout1 = _rt::alloc::Layout::from_size_align_unchecked( - vec1.len() * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result1 = if layout1.size() != 0 { - let ptr = _rt::alloc::alloc(layout1).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout1); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec1.into_iter().enumerate() { - let base = result1 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - { - let vec0 = e; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .cast::() = len0; - *base.add(0).cast::<*mut u8>() = ptr0.cast_mut(); - } - } - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/batch@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "delete-many"] - fn wit_import3(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3((bucket).handle() as i32, result1, len1, ptr2) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result10 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout1.size() != 0 { - _rt::alloc::dealloc(result1.cast(), layout1); - } - result10 - } - } - } - } - pub mod random { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod random { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn get_random_bytes(len: u64) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/random@0.2.0")] - unsafe extern "C" { - #[link_name = "get-random-bytes"] - fn wit_import1(_: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(_rt::as_i64(&len), ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len4 = l3; - let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - result5 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_random_u64() -> u64 { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/random@0.2.0")] - unsafe extern "C" { - #[link_name = "get-random-u64"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - ret as u64 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod insecure { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn get_insecure_random_bytes(len: u64) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] - unsafe extern "C" { - #[link_name = "get-insecure-random-bytes"] - fn wit_import1(_: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(_rt::as_i64(&len), ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len4 = l3; - let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - result5 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_insecure_random_u64() -> u64 { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] - unsafe extern "C" { - #[link_name = "get-insecure-random-u64"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - ret as u64 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod insecure_seed { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - #[allow(unused_unsafe, clippy::all)] - pub fn insecure_seed() -> (u64, u64) { - 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:random/insecure-seed@0.2.0")] - unsafe extern "C" { - #[link_name = "insecure-seed"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::(); - let l3 = *ptr0.add(8).cast::(); - let result4 = (l2 as u64, l3 as u64); - result4 - } - } - } - } - pub mod sockets { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod network { - #[used] - #[doc(hidden)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]network"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[repr(u8)] - #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] - 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, Ord, PartialEq, PartialOrd)] - 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, async_fn_in_trait, unused_imports, clippy::all)] - pub mod instance_network { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type Network = super::super::super::wasi::sockets::network::Network; - #[allow(unused_unsafe, clippy::all)] - pub fn instance_network() -> Network { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.0")] - unsafe extern "C" { - #[link_name = "instance-network"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::sockets::network::Network::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod udp { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type Network = super::super::super::wasi::sockets::network::Network; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpSocketAddress = super::super::super::wasi::sockets::network::IpSocketAddress; - pub type IpAddressFamily = super::super::super::wasi::sockets::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, - } - impl UdpSocket { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for UdpSocket { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]udp-socket"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[derive(Debug)] - #[repr(transparent)] - pub struct IncomingDatagramStream { - handle: _rt::Resource, - } - impl IncomingDatagramStream { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for IncomingDatagramStream { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-datagram-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[derive(Debug)] - #[repr(transparent)] - pub struct OutgoingDatagramStream { - handle: _rt::Resource, - } - impl OutgoingDatagramStream { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for OutgoingDatagramStream { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-datagram-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_bind( - &self, - network: &Network, - local_address: IpSocketAddress, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match local_address { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - let ptr6 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.start-bind"] - fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (self).handle() as i32, - (network).handle() as i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ptr6, - ) - }; - let l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l9 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_bind(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.finish-bind"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn stream( - &self, - remote_address: Option, - ) -> Result< - (IncomingDatagramStream, OutgoingDatagramStream), - ErrorCode, - > { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], - ); - let ( - result6_0, - result6_1, - result6_2, - result6_3, - result6_4, - result6_5, - result6_6, - result6_7, - result6_8, - result6_9, - result6_10, - result6_11, - result6_12, - ) = match remote_address { - Some(e) => { - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match e { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - ( - 1i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) - } - None => { - ( - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - }; - let ptr7 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.stream"] - fn wit_import8( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import8( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import8( - (self).handle() as i32, - result6_0, - result6_1, - result6_2, - result6_3, - result6_4, - result6_5, - result6_6, - result6_7, - result6_8, - result6_9, - result6_10, - result6_11, - result6_12, - ptr7, - ) - }; - let l9 = i32::from(*ptr7.add(0).cast::()); - let result13 = match l9 { - 0 => { - let e = { - let l10 = *ptr7.add(4).cast::(); - let l11 = *ptr7.add(8).cast::(); - ( - unsafe { IncomingDatagramStream::from_handle(l10 as u32) }, - unsafe { OutgoingDatagramStream::from_handle(l11 as u32) }, - ) - }; - Ok(e) - } - 1 => { - let e = { - let l12 = i32::from(*ptr7.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l12 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result13 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn local_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.local-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn remote_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.remote-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn address_family(&self) -> IpAddressFamily { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.address-family"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - super::super::super::wasi::sockets::network::IpAddressFamily::_lift( - ret as u8, - ) - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn unicast_hop_limit(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.unicast-hop-limit"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - l3 as u8 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.set-unicast-hop-limit"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i32(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn receive_buffer_size(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.receive-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_receive_buffer_size( - &self, - value: u64, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.set-receive-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn send_buffer_size(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.send-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.set-send-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - impl IncomingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn receive( - &self, - max_results: u64, - ) -> Result<_rt::Vec, ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-datagram-stream.receive"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&max_results), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result28 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base26 = l3; - let len26 = l4; - let mut result26 = _rt::Vec::with_capacity(len26); - for i in 0..len26 { - let base = base26 - .add(i * (32 + 2 * ::core::mem::size_of::<*const u8>())); - let e26 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let l8 = i32::from( - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V25; - let v25 = match l8 { - 0 => { - let e25 = { - let l9 = i32::from( - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l10 = i32::from( - *base - .add(6 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l11 = i32::from( - *base - .add(7 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l12 = i32::from( - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l13 = i32::from( - *base - .add(9 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l9 as u16, - address: (l10 as u8, l11 as u8, l12 as u8, l13 as u8), - } - }; - V25::Ipv4(e25) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e25 = { - let l14 = i32::from( - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l15 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l16 = i32::from( - *base - .add(12 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l17 = i32::from( - *base - .add(14 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l18 = i32::from( - *base - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l19 = i32::from( - *base - .add(18 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l20 = i32::from( - *base - .add(20 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l21 = i32::from( - *base - .add(22 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l22 = i32::from( - *base - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l23 = i32::from( - *base - .add(26 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l24 = *base - .add(28 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l14 as u16, - flow_info: l15 as u32, - address: ( - l16 as u16, - l17 as u16, - l18 as u16, - l19 as u16, - l20 as u16, - l21 as u16, - l22 as u16, - l23 as u16, - ), - scope_id: l24 as u32, - } - }; - V25::Ipv6(e25) - } - }; - IncomingDatagram { - data: _rt::Vec::from_raw_parts(l5.cast(), len7, len7), - remote_address: v25, - } - }; - result26.push(e26); - } - _rt::cabi_dealloc( - base26, - len26 * (32 + 2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result26 - }; - Ok(e) - } - 1 => { - let e = { - let l27 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l27 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result28 - } - } - } - impl IncomingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-datagram-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - impl OutgoingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn check_send(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-datagram-stream.check-send"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl OutgoingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn send( - &self, - datagrams: &[OutgoingDatagram], - ) -> Result { - unsafe { - #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], - ); - let vec7 = datagrams; - let len7 = vec7.len(); - let layout7 = _rt::alloc::Layout::from_size_align_unchecked( - vec7.len() * (32 + 3 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result7 = if layout7.size() != 0 { - let ptr = _rt::alloc::alloc(layout7).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout7); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec7.into_iter().enumerate() { - let base = result7 - .add(i * (32 + 3 * ::core::mem::size_of::<*const u8>())); - { - let OutgoingDatagram { - data: data0, - remote_address: remote_address0, - } = e; - let vec1 = data0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .cast::() = len1; - *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); - match remote_address0 { - Some(e) => { - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - use super::super::super::wasi::sockets::network::IpSocketAddress as V6; - match e { - V6::Ipv4(e) => { - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port2, - address: address2, - } = e; - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(port2)) as u16; - let (t3_0, t3_1, t3_2, t3_3) = address2; - *base - .add(10 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_0)) as u8; - *base - .add(11 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_1)) as u8; - *base - .add(12 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_2)) as u8; - *base - .add(13 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_3)) as u8; - } - V6::Ipv6(e) => { - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port4, - flow_info: flow_info4, - address: address4, - scope_id: scope_id4, - } = e; - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(port4)) as u16; - *base - .add(12 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i32(flow_info4); - let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; - *base - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_0)) as u16; - *base - .add(18 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_1)) as u16; - *base - .add(20 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_2)) as u16; - *base - .add(22 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_3)) as u16; - *base - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_4)) as u16; - *base - .add(26 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_5)) as u16; - *base - .add(28 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_6)) as u16; - *base - .add(30 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_7)) as u16; - *base - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i32(scope_id4); - } - } - } - None => { - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - } - }; - } - } - let ptr8 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-datagram-stream.send"] - fn wit_import9(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import9( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import9((self).handle() as i32, result7, len7, ptr8) - }; - let l10 = i32::from(*ptr8.add(0).cast::()); - let result13 = match l10 { - 0 => { - let e = { - let l11 = *ptr8.add(8).cast::(); - l11 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l12 = i32::from(*ptr8.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l12 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout7.size() != 0 { - _rt::alloc::dealloc(result7.cast(), layout7); - } - result13 - } - } - } - impl OutgoingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-datagram-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod udp_create_socket { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; - pub type UdpSocket = super::super::super::wasi::sockets::udp::UdpSocket; - #[allow(unused_unsafe, clippy::all)] - pub fn create_udp_socket( - address_family: IpAddressFamily, - ) -> 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:sockets/udp-create-socket@0.2.0")] - unsafe extern "C" { - #[link_name = "create-udp-socket"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(address_family.clone() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::sockets::udp::UdpSocket::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod tcp { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration; - pub type Network = super::super::super::wasi::sockets::network::Network; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpSocketAddress = super::super::super::wasi::sockets::network::IpSocketAddress; - pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; - #[repr(u8)] - #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] - 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, - } - impl TcpSocket { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for TcpSocket { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]tcp-socket"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_bind( - &self, - network: &Network, - local_address: IpSocketAddress, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match local_address { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - let ptr6 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.start-bind"] - fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (self).handle() as i32, - (network).handle() as i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ptr6, - ) - }; - let l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l9 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_bind(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.finish-bind"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_connect( - &self, - network: &Network, - remote_address: IpSocketAddress, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match remote_address { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - let ptr6 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.start-connect"] - fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (self).handle() as i32, - (network).handle() as i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ptr6, - ) - }; - let l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l9 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_connect( - &self, - ) -> Result<(InputStream, OutputStream), ErrorCode> { - 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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.finish-connect"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - let l4 = *ptr0.add(8).cast::(); - ( - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l3 as u32, - ) - }, - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l4 as u32, - ) - }, - ) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l5 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_listen(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.start-listen"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_listen(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.finish-listen"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn accept( - &self, - ) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.accept"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - let l4 = *ptr0.add(8).cast::(); - let l5 = *ptr0.add(12).cast::(); - ( - unsafe { TcpSocket::from_handle(l3 as u32) }, - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l4 as u32, - ) - }, - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l5 as u32, - ) - }, - ) - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l6 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn local_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.local-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn remote_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.remote-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn is_listening(&self) -> bool { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.is-listening"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - _rt::bool_lift(ret as u8) - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn address_family(&self) -> IpAddressFamily { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.address-family"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - super::super::super::wasi::sockets::network::IpAddressFamily::_lift( - ret as u8, - ) - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_listen_backlog_size( - &self, - value: u64, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-listen-backlog-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_enabled(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-enabled"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - _rt::bool_lift(l3 as u8) - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_enabled( - &self, - value: bool, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-enabled"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - match &value { - true => 1, - false => 0, - }, - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_idle_time(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-idle-time"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_idle_time( - &self, - value: Duration, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-idle-time"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_interval(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-interval"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_interval( - &self, - value: Duration, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-interval"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_count(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-count"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - l3 as u32 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-count"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i32(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn hop_limit(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.hop-limit"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - l3 as u8 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-hop-limit"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i32(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn receive_buffer_size(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.receive-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_receive_buffer_size( - &self, - value: u64, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-receive-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn send_buffer_size(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.send-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-send-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn shutdown( - &self, - shutdown_type: ShutdownType, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.shutdown"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - shutdown_type.clone() as i32, - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod tcp_create_socket { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; - pub type TcpSocket = super::super::super::wasi::sockets::tcp::TcpSocket; - #[allow(unused_unsafe, clippy::all)] - pub fn create_tcp_socket( - address_family: IpAddressFamily, - ) -> 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:sockets/tcp-create-socket@0.2.0")] - unsafe extern "C" { - #[link_name = "create-tcp-socket"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(address_family.clone() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::sockets::tcp::TcpSocket::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod ip_name_lookup { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type Network = super::super::super::wasi::sockets::network::Network; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpAddress = super::super::super::wasi::sockets::network::IpAddress; - #[derive(Debug)] - #[repr(transparent)] - pub struct ResolveAddressStream { - handle: _rt::Resource, - } - impl ResolveAddressStream { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for ResolveAddressStream { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]resolve-address-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl ResolveAddressStream { - #[allow(unused_unsafe, clippy::all)] - pub fn resolve_next_address( - &self, - ) -> Result, ErrorCode> { - unsafe { - #[repr(align(2))] - struct RetArea([::core::mem::MaybeUninit; 22]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 22], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]resolve-address-stream.resolve-next-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result19 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(2).cast::()); - match l3 { - 0 => None, - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpAddress as V17; - let v17 = match l4 { - 0 => { - let e17 = { - let l5 = i32::from(*ptr0.add(6).cast::()); - let l6 = i32::from(*ptr0.add(7).cast::()); - let l7 = i32::from(*ptr0.add(8).cast::()); - let l8 = i32::from(*ptr0.add(9).cast::()); - (l5 as u8, l6 as u8, l7 as u8, l8 as u8) - }; - V17::Ipv4(e17) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e17 = { - let l9 = i32::from(*ptr0.add(6).cast::()); - let l10 = i32::from(*ptr0.add(8).cast::()); - let l11 = i32::from(*ptr0.add(10).cast::()); - let l12 = i32::from(*ptr0.add(12).cast::()); - let l13 = i32::from(*ptr0.add(14).cast::()); - let l14 = i32::from(*ptr0.add(16).cast::()); - let l15 = i32::from(*ptr0.add(18).cast::()); - let l16 = i32::from(*ptr0.add(20).cast::()); - ( - l9 as u16, - l10 as u16, - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - ) - }; - V17::Ipv6(e17) - } - }; - v17 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l18 = i32::from(*ptr0.add(2).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l18 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result19 - } - } - } - impl ResolveAddressStream { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]resolve-address-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn resolve_addresses( - network: &Network, - name: &str, - ) -> Result { - 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:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "resolve-addresses"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (network).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result6 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(4).cast::(); - unsafe { ResolveAddressStream::from_handle(l4 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l5 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - } -} -#[rustfmt::skip] -#[allow(dead_code, clippy::all)] -pub mod wavs { - pub mod aggregator { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod aggregator { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Duration = super::super::super::wavs::types::core::Duration; - pub type U128 = super::super::super::wavs::types::core::U128; - pub type Service = super::super::super::wavs::types::service::Service; - pub type WorkflowId = super::super::super::wavs::types::service::WorkflowId; - pub type SignatureKind = super::super::super::wavs::types::service::SignatureKind; - pub type ChainKey = super::super::super::wavs::types::chain::ChainKey; - pub type EvmAddress = super::super::super::wavs::types::chain::EvmAddress; - pub type TriggerData = super::super::super::wavs::types::events::TriggerData; - pub type EventId = super::super::super::wavs::types::events::EventId; - #[derive(Clone)] - pub struct Envelope { - pub event_id: EventId, - pub ordering: _rt::Vec, - pub payload: _rt::Vec, - } - impl ::core::fmt::Debug for Envelope { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Envelope") - .field("event-id", &self.event_id) - .field("ordering", &self.ordering) - .field("payload", &self.payload) - .finish() - } - } - #[derive(Clone)] - pub struct EnvelopeSignature { - pub data: _rt::Vec, - pub kind: SignatureKind, - } - impl ::core::fmt::Debug for EnvelopeSignature { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EnvelopeSignature") - .field("data", &self.data) - .field("kind", &self.kind) - .finish() - } - } - #[derive(Clone)] - pub struct Packet { - pub service: Service, - pub workflow_id: WorkflowId, - pub envelope: Envelope, - pub signature: EnvelopeSignature, - pub trigger_data: TriggerData, - } - impl ::core::fmt::Debug for Packet { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Packet") - .field("service", &self.service) - .field("workflow-id", &self.workflow_id) - .field("envelope", &self.envelope) - .field("signature", &self.signature) - .field("trigger-data", &self.trigger_data) - .finish() - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct TimerAction { - pub delay: Duration, - } - impl ::core::fmt::Debug for TimerAction { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TimerAction").field("delay", &self.delay).finish() - } - } - #[derive(Clone)] - pub struct SubmitAction { - pub chain: ChainKey, - pub contract_address: EvmAddress, - pub gas_price: Option, - } - impl ::core::fmt::Debug for SubmitAction { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("SubmitAction") - .field("chain", &self.chain) - .field("contract-address", &self.contract_address) - .field("gas-price", &self.gas_price) - .finish() - } - } - #[derive(Clone)] - pub enum AggregatorAction { - Timer(TimerAction), - Submit(SubmitAction), - } - impl ::core::fmt::Debug for AggregatorAction { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - AggregatorAction::Timer(e) => { - f.debug_tuple("AggregatorAction::Timer").field(e).finish() - } - AggregatorAction::Submit(e) => { - f.debug_tuple("AggregatorAction::Submit").field(e).finish() - } - } - } - } - } - } - pub mod types { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod core { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Digest = _rt::String; - #[repr(C)] - #[derive(Clone, Copy)] - pub struct Timestamp { - pub nanos: u64, - } - impl ::core::fmt::Debug for Timestamp { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Timestamp").field("nanos", &self.nanos).finish() - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct Duration { - pub secs: u64, - } - impl ::core::fmt::Debug for Duration { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Duration").field("secs", &self.secs).finish() - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct U128 { - pub value: (u64, u64), - } - impl ::core::fmt::Debug for U128 { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("U128").field("value", &self.value).finish() - } - } - #[derive(Clone, Copy)] - pub enum LogLevel { - Error, - Warn, - Info, - Debug, - Trace, - } - impl ::core::fmt::Debug for LogLevel { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - LogLevel::Error => f.debug_tuple("LogLevel::Error").finish(), - LogLevel::Warn => f.debug_tuple("LogLevel::Warn").finish(), - LogLevel::Info => f.debug_tuple("LogLevel::Info").finish(), - LogLevel::Debug => f.debug_tuple("LogLevel::Debug").finish(), - LogLevel::Trace => f.debug_tuple("LogLevel::Trace").finish(), - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod chain { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ChainKey = _rt::String; - pub type EvmTxHash = _rt::Vec; - pub type CosmosTxHash = _rt::String; - #[derive(Clone)] - pub enum AnyTxHash { - Evm(EvmTxHash), - Cosmos(CosmosTxHash), - } - impl ::core::fmt::Debug for AnyTxHash { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - AnyTxHash::Evm(e) => { - f.debug_tuple("AnyTxHash::Evm").field(e).finish() - } - AnyTxHash::Cosmos(e) => { - f.debug_tuple("AnyTxHash::Cosmos").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub struct CosmosAddress { - pub bech32_addr: _rt::String, - pub prefix_len: u32, - } - impl ::core::fmt::Debug for CosmosAddress { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("CosmosAddress") - .field("bech32-addr", &self.bech32_addr) - .field("prefix-len", &self.prefix_len) - .finish() - } - } - #[derive(Clone)] - pub struct CosmosEvent { - pub ty: _rt::String, - pub attributes: _rt::Vec<(_rt::String, _rt::String)>, - } - impl ::core::fmt::Debug for CosmosEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("CosmosEvent") - .field("ty", &self.ty) - .field("attributes", &self.attributes) - .finish() - } - } - #[derive(Clone)] - pub struct CosmosChainConfig { - pub chain_id: _rt::String, - pub rpc_endpoint: Option<_rt::String>, - pub grpc_endpoint: Option<_rt::String>, - pub grpc_web_endpoint: Option<_rt::String>, - pub gas_price: f32, - pub gas_denom: _rt::String, - pub bech32_prefix: _rt::String, - } - impl ::core::fmt::Debug for CosmosChainConfig { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("CosmosChainConfig") - .field("chain-id", &self.chain_id) - .field("rpc-endpoint", &self.rpc_endpoint) - .field("grpc-endpoint", &self.grpc_endpoint) - .field("grpc-web-endpoint", &self.grpc_web_endpoint) - .field("gas-price", &self.gas_price) - .field("gas-denom", &self.gas_denom) - .field("bech32-prefix", &self.bech32_prefix) - .finish() - } - } - #[derive(Clone)] - pub struct EvmAddress { - pub raw_bytes: _rt::Vec, - } - impl ::core::fmt::Debug for EvmAddress { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmAddress") - .field("raw-bytes", &self.raw_bytes) - .finish() - } - } - #[derive(Clone)] - pub struct EvmEventLogData { - pub topics: _rt::Vec<_rt::Vec>, - pub data: _rt::Vec, - } - impl ::core::fmt::Debug for EvmEventLogData { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmEventLogData") - .field("topics", &self.topics) - .field("data", &self.data) - .finish() - } - } - #[derive(Clone)] - pub struct EvmEventLog { - pub address: EvmAddress, - pub data: EvmEventLogData, - pub tx_hash: EvmTxHash, - pub block_number: u64, - pub log_index: u64, - pub block_hash: _rt::Vec, - pub block_timestamp: Option, - pub tx_index: u64, - } - impl ::core::fmt::Debug for EvmEventLog { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmEventLog") - .field("address", &self.address) - .field("data", &self.data) - .field("tx-hash", &self.tx_hash) - .field("block-number", &self.block_number) - .field("log-index", &self.log_index) - .field("block-hash", &self.block_hash) - .field("block-timestamp", &self.block_timestamp) - .field("tx-index", &self.tx_index) - .finish() - } - } - #[derive(Clone)] - pub struct EvmChainConfig { - pub chain_id: _rt::String, - pub ws_endpoints: _rt::Vec<_rt::String>, - pub http_endpoint: Option<_rt::String>, - } - impl ::core::fmt::Debug for EvmChainConfig { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmChainConfig") - .field("chain-id", &self.chain_id) - .field("ws-endpoints", &self.ws_endpoints) - .field("http-endpoint", &self.http_endpoint) - .finish() - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod service { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Digest = super::super::super::wavs::types::core::Digest; - pub type Timestamp = super::super::super::wavs::types::core::Timestamp; - pub type ChainKey = super::super::super::wavs::types::chain::ChainKey; - pub type EvmAddress = super::super::super::wavs::types::chain::EvmAddress; - pub type CosmosAddress = super::super::super::wavs::types::chain::CosmosAddress; - pub type WorkflowId = _rt::String; - pub type PackageRef = _rt::String; - pub type SemverVersion = _rt::String; - #[derive(Clone, Copy)] - pub enum ServiceStatus { - Active, - Paused, - } - impl ::core::fmt::Debug for ServiceStatus { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ServiceStatus::Active => { - f.debug_tuple("ServiceStatus::Active").finish() - } - ServiceStatus::Paused => { - f.debug_tuple("ServiceStatus::Paused").finish() - } - } - } - } - #[derive(Clone)] - pub struct EvmManager { - pub chain: ChainKey, - pub address: EvmAddress, - } - impl ::core::fmt::Debug for EvmManager { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmManager") - .field("chain", &self.chain) - .field("address", &self.address) - .finish() - } - } - #[derive(Clone)] - pub enum ServiceManager { - Evm(EvmManager), - } - impl ::core::fmt::Debug for ServiceManager { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ServiceManager::Evm(e) => { - f.debug_tuple("ServiceManager::Evm").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub struct ComponentSourceDownload { - pub uri: _rt::String, - pub digest: Digest, - } - impl ::core::fmt::Debug for ComponentSourceDownload { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("ComponentSourceDownload") - .field("uri", &self.uri) - .field("digest", &self.digest) - .finish() - } - } - #[derive(Clone)] - pub struct Registry { - pub digest: Digest, - pub domain: Option<_rt::String>, - pub version: Option, - pub pkg: PackageRef, - } - impl ::core::fmt::Debug for Registry { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Registry") - .field("digest", &self.digest) - .field("domain", &self.domain) - .field("version", &self.version) - .field("pkg", &self.pkg) - .finish() - } - } - #[derive(Clone)] - pub enum ComponentSource { - Download(ComponentSourceDownload), - Registry(Registry), - Digest(Digest), - } - impl ::core::fmt::Debug for ComponentSource { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ComponentSource::Download(e) => { - f.debug_tuple("ComponentSource::Download").field(e).finish() - } - ComponentSource::Registry(e) => { - f.debug_tuple("ComponentSource::Registry").field(e).finish() - } - ComponentSource::Digest(e) => { - f.debug_tuple("ComponentSource::Digest").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub enum AllowedHostPermission { - All, - Only(_rt::Vec<_rt::String>), - None, - } - impl ::core::fmt::Debug for AllowedHostPermission { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - AllowedHostPermission::All => { - f.debug_tuple("AllowedHostPermission::All").finish() - } - AllowedHostPermission::Only(e) => { - f.debug_tuple("AllowedHostPermission::Only") - .field(e) - .finish() - } - AllowedHostPermission::None => { - f.debug_tuple("AllowedHostPermission::None").finish() - } - } - } - } - #[derive(Clone)] - pub struct Permissions { - pub allowed_http_hosts: AllowedHostPermission, - pub file_system: bool, - } - impl ::core::fmt::Debug for Permissions { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Permissions") - .field("allowed-http-hosts", &self.allowed_http_hosts) - .field("file-system", &self.file_system) - .finish() - } - } - #[derive(Clone)] - pub struct Component { - pub source: ComponentSource, - pub permissions: Permissions, - pub fuel_limit: Option, - pub time_limit_seconds: Option, - pub config: _rt::Vec<(_rt::String, _rt::String)>, - pub env_keys: _rt::Vec<_rt::String>, - } - impl ::core::fmt::Debug for Component { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Component") - .field("source", &self.source) - .field("permissions", &self.permissions) - .field("fuel-limit", &self.fuel_limit) - .field("time-limit-seconds", &self.time_limit_seconds) - .field("config", &self.config) - .field("env-keys", &self.env_keys) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerEvmContractEvent { - pub address: EvmAddress, - pub chain: ChainKey, - pub event_hash: _rt::Vec, - } - impl ::core::fmt::Debug for TriggerEvmContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerEvmContractEvent") - .field("address", &self.address) - .field("chain", &self.chain) - .field("event-hash", &self.event_hash) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerCosmosContractEvent { - pub address: CosmosAddress, - pub chain: ChainKey, - pub event_type: _rt::String, - } - impl ::core::fmt::Debug for TriggerCosmosContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerCosmosContractEvent") - .field("address", &self.address) - .field("chain", &self.chain) - .field("event-type", &self.event_type) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerBlockInterval { - pub chain: ChainKey, - pub n_blocks: u32, - pub start_block: Option, - pub end_block: Option, - } - impl ::core::fmt::Debug for TriggerBlockInterval { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerBlockInterval") - .field("chain", &self.chain) - .field("n-blocks", &self.n_blocks) - .field("start-block", &self.start_block) - .field("end-block", &self.end_block) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerCron { - pub schedule: _rt::String, - pub start_time: Option, - pub end_time: Option, - } - impl ::core::fmt::Debug for TriggerCron { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerCron") - .field("schedule", &self.schedule) - .field("start-time", &self.start_time) - .field("end-time", &self.end_time) - .finish() - } - } - #[derive(Clone)] - pub enum Trigger { - EvmContractEvent(TriggerEvmContractEvent), - CosmosContractEvent(TriggerCosmosContractEvent), - BlockInterval(TriggerBlockInterval), - Cron(TriggerCron), - Manual, - } - impl ::core::fmt::Debug for Trigger { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - Trigger::EvmContractEvent(e) => { - f.debug_tuple("Trigger::EvmContractEvent").field(e).finish() - } - Trigger::CosmosContractEvent(e) => { - f.debug_tuple("Trigger::CosmosContractEvent") - .field(e) - .finish() - } - Trigger::BlockInterval(e) => { - f.debug_tuple("Trigger::BlockInterval").field(e).finish() - } - Trigger::Cron(e) => { - f.debug_tuple("Trigger::Cron").field(e).finish() - } - Trigger::Manual => f.debug_tuple("Trigger::Manual").finish(), - } - } - } - #[derive(Clone, Copy)] - pub enum SignatureAlgorithm { - Secp256k1, - } - impl ::core::fmt::Debug for SignatureAlgorithm { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - SignatureAlgorithm::Secp256k1 => { - f.debug_tuple("SignatureAlgorithm::Secp256k1").finish() - } - } - } - } - #[derive(Clone, Copy)] - pub enum SignaturePrefix { - Eip191, - } - impl ::core::fmt::Debug for SignaturePrefix { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - SignaturePrefix::Eip191 => { - f.debug_tuple("SignaturePrefix::Eip191").finish() - } - } - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct SignatureKind { - pub algorithm: SignatureAlgorithm, - pub prefix: Option, - } - impl ::core::fmt::Debug for SignatureKind { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("SignatureKind") - .field("algorithm", &self.algorithm) - .field("prefix", &self.prefix) - .finish() - } - } - #[derive(Clone)] - pub struct AggregatorSubmit { - pub url: _rt::String, - pub component: Component, - pub signature_kind: SignatureKind, - } - impl ::core::fmt::Debug for AggregatorSubmit { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("AggregatorSubmit") - .field("url", &self.url) - .field("component", &self.component) - .field("signature-kind", &self.signature_kind) - .finish() - } - } - #[derive(Clone)] - pub enum Submit { - None, - Aggregator(AggregatorSubmit), - } - impl ::core::fmt::Debug for Submit { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - Submit::None => f.debug_tuple("Submit::None").finish(), - Submit::Aggregator(e) => { - f.debug_tuple("Submit::Aggregator").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub struct Workflow { - pub trigger: Trigger, - pub component: Component, - pub submit: Submit, - } - impl ::core::fmt::Debug for Workflow { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Workflow") - .field("trigger", &self.trigger) - .field("component", &self.component) - .field("submit", &self.submit) - .finish() - } - } - #[derive(Clone)] - pub struct Service { - pub name: _rt::String, - pub workflows: _rt::Vec<(WorkflowId, Workflow)>, - pub status: ServiceStatus, - pub manager: ServiceManager, - } - impl ::core::fmt::Debug for Service { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Service") - .field("name", &self.name) - .field("workflows", &self.workflows) - .field("status", &self.status) - .field("manager", &self.manager) - .finish() - } - } - #[derive(Clone)] - pub struct ServiceAndWorkflowId { - pub service: Service, - pub workflow_id: WorkflowId, - } - impl ::core::fmt::Debug for ServiceAndWorkflowId { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("ServiceAndWorkflowId") - .field("service", &self.service) - .field("workflow-id", &self.workflow_id) - .finish() - } - } - #[derive(Clone)] - pub struct WorkflowAndWorkflowId { - pub workflow: Workflow, - pub workflow_id: WorkflowId, - } - impl ::core::fmt::Debug for WorkflowAndWorkflowId { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("WorkflowAndWorkflowId") - .field("workflow", &self.workflow) - .field("workflow-id", &self.workflow_id) - .finish() - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod events { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ChainKey = super::super::super::wavs::types::chain::ChainKey; - pub type EvmEventLog = super::super::super::wavs::types::chain::EvmEventLog; - pub type CosmosAddress = super::super::super::wavs::types::chain::CosmosAddress; - pub type CosmosEvent = super::super::super::wavs::types::chain::CosmosEvent; - pub type Timestamp = super::super::super::wavs::types::core::Timestamp; - pub type EventId = _rt::Vec; - #[derive(Clone)] - pub struct TriggerDataEvmContractEvent { - pub chain: ChainKey, - pub log: EvmEventLog, - } - impl ::core::fmt::Debug for TriggerDataEvmContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataEvmContractEvent") - .field("chain", &self.chain) - .field("log", &self.log) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerDataCosmosContractEvent { - pub contract_address: CosmosAddress, - pub chain: ChainKey, - pub event: CosmosEvent, - pub event_index: u64, - pub block_height: u64, - } - impl ::core::fmt::Debug for TriggerDataCosmosContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataCosmosContractEvent") - .field("contract-address", &self.contract_address) - .field("chain", &self.chain) - .field("event", &self.event) - .field("event-index", &self.event_index) - .field("block-height", &self.block_height) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerDataBlockInterval { - pub chain: ChainKey, - pub block_height: u64, - } - impl ::core::fmt::Debug for TriggerDataBlockInterval { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataBlockInterval") - .field("chain", &self.chain) - .field("block-height", &self.block_height) - .finish() - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct TriggerDataCron { - pub trigger_time: Timestamp, - } - impl ::core::fmt::Debug for TriggerDataCron { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataCron") - .field("trigger-time", &self.trigger_time) - .finish() - } - } - #[derive(Clone)] - pub enum TriggerData { - EvmContractEvent(TriggerDataEvmContractEvent), - CosmosContractEvent(TriggerDataCosmosContractEvent), - BlockInterval(TriggerDataBlockInterval), - Cron(TriggerDataCron), - Raw(_rt::Vec), - } - impl ::core::fmt::Debug for TriggerData { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - TriggerData::EvmContractEvent(e) => { - f.debug_tuple("TriggerData::EvmContractEvent") - .field(e) - .finish() - } - TriggerData::CosmosContractEvent(e) => { - f.debug_tuple("TriggerData::CosmosContractEvent") - .field(e) - .finish() - } - TriggerData::BlockInterval(e) => { - f.debug_tuple("TriggerData::BlockInterval").field(e).finish() - } - TriggerData::Cron(e) => { - f.debug_tuple("TriggerData::Cron").field(e).finish() - } - TriggerData::Raw(e) => { - f.debug_tuple("TriggerData::Raw").field(e).finish() - } - } - } - } - } - } -} -#[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] -pub mod host { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::__link_custom_section_describing_imports; - use super::_rt; - pub type EvmChainConfig = super::wavs::types::chain::EvmChainConfig; - pub type CosmosChainConfig = super::wavs::types::chain::CosmosChainConfig; - pub type LogLevel = super::wavs::types::core::LogLevel; - pub type ServiceAndWorkflowId = super::wavs::types::service::ServiceAndWorkflowId; - pub type WorkflowAndWorkflowId = super::wavs::types::service::WorkflowAndWorkflowId; - pub type EventId = super::wavs::types::events::EventId; - #[allow(unused_unsafe, clippy::all)] - pub fn get_evm_chain_config(chain_key: &str) -> Option { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 8 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 8 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = chain_key; - 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 = "host")] - unsafe extern "C" { - #[link_name = "get-evm-chain-config"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result17 = match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *ptr1 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base12 = l7; - let len12 = l8; - let mut result12 = _rt::Vec::with_capacity(len12); - for i in 0..len12 { - let base = base12 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e12 = { - let l9 = *base.add(0).cast::<*mut u8>(); - let l10 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let bytes11 = _rt::Vec::from_raw_parts( - l9.cast(), - len11, - len11, - ); - _rt::string_lift(bytes11) - }; - result12.push(e12); - } - _rt::cabi_dealloc( - base12, - len12 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l13 = i32::from( - *ptr1 - .add(5 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::chain::EvmChainConfig { - chain_id: _rt::string_lift(bytes6), - ws_endpoints: result12, - http_endpoint: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = *ptr1 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l15 = *ptr1 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len16 = l15; - let bytes16 = _rt::Vec::from_raw_parts( - l14.cast(), - len16, - len16, - ); - _rt::string_lift(bytes16) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result17 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_cosmos_chain_config(chain_key: &str) -> Option { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 17 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 17 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = chain_key; - 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 = "host")] - unsafe extern "C" { - #[link_name = "get-cosmos-chain-config"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result26 = match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = i32::from( - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l11 = i32::from( - *ptr1 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l15 = i32::from( - *ptr1 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l19 = *ptr1 - .add(12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l20 = *ptr1 - .add(13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l21 = *ptr1 - .add(14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len22 = l21; - let bytes22 = _rt::Vec::from_raw_parts(l20.cast(), len22, len22); - let l23 = *ptr1 - .add(15 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l24 = *ptr1 - .add(16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len25 = l24; - let bytes25 = _rt::Vec::from_raw_parts(l23.cast(), len25, len25); - super::wavs::types::chain::CosmosChainConfig { - chain_id: _rt::string_lift(bytes6), - rpc_endpoint: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr1 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr1 - .add(5 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - grpc_endpoint: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr1 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *ptr1 - .add(8 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - grpc_web_endpoint: match l15 { - 0 => None, - 1 => { - let e = { - let l16 = *ptr1 - .add(10 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr1 - .add(11 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - gas_price: l19, - gas_denom: _rt::string_lift(bytes22), - bech32_prefix: _rt::string_lift(bytes25), - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result26 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn config_var(key: &str) -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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 = "host")] - unsafe extern "C" { - #[link_name = "config-var"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result7 = match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .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(), - }; - result7 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn log(level: LogLevel, message: &str) -> () { - unsafe { - use super::wavs::types::core::LogLevel as V0; - let result1 = match level { - V0::Error => 0i32, - V0::Warn => 1i32, - V0::Info => 2i32, - V0::Debug => 3i32, - V0::Trace => 4i32, - }; - let vec2 = message; - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "log"] - fn wit_import3(_: i32, _: *mut u8, _: usize); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3(_: i32, _: *mut u8, _: usize) { - unreachable!() - } - unsafe { wit_import3(result1, ptr2.cast_mut(), len2) }; - } - } - #[allow(unused_unsafe, clippy::all)] - /// gets the service and workflow id that called this component - pub fn get_service() -> ServiceAndWorkflowId { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 12 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "get-service"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - let l5 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr0.add(3 * ::core::mem::size_of::<*const u8>()).cast::(); - let base162 = l5; - let len162 = l6; - let mut result162 = _rt::Vec::with_capacity(len162); - for i in 0..len162 { - let base = base162 - .add(i * (144 + 42 * ::core::mem::size_of::<*const u8>())); - let e162 = { - let l7 = *base.add(0).cast::<*mut u8>(); - let l8 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - let l10 = i32::from( - *base.add(2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::Trigger as V45; - let v45 = match l10 { - 0 => { - let e45 = { - let l11 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l12 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len13 = l12; - let l14 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l15 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len16 = l15; - let bytes16 = _rt::Vec::from_raw_parts( - l14.cast(), - len16, - len16, - ); - let l17 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l18 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len19 = l18; - super::wavs::types::service::TriggerEvmContractEvent { - address: super::wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l11.cast(), - len13, - len13, - ), - }, - chain: _rt::string_lift(bytes16), - event_hash: _rt::Vec::from_raw_parts( - l17.cast(), - len19, - len19, - ), - } - }; - V45::EvmContractEvent(e45) - } - 1 => { - let e45 = { - let l20 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l21 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len22 = l21; - let bytes22 = _rt::Vec::from_raw_parts( - l20.cast(), - len22, - len22, - ); - let l23 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l24 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l25 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len26 = l25; - let bytes26 = _rt::Vec::from_raw_parts( - l24.cast(), - len26, - len26, - ); - let l27 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l28 = *base - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len29 = l28; - let bytes29 = _rt::Vec::from_raw_parts( - l27.cast(), - len29, - len29, - ); - super::wavs::types::service::TriggerCosmosContractEvent { - address: super::wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes22), - prefix_len: l23 as u32, - }, - chain: _rt::string_lift(bytes26), - event_type: _rt::string_lift(bytes29), - } - }; - V45::CosmosContractEvent(e45) - } - 2 => { - let e45 = { - let l30 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l31 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len32 = l31; - let bytes32 = _rt::Vec::from_raw_parts( - l30.cast(), - len32, - len32, - ); - let l33 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l34 = i32::from( - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l36 = i32::from( - *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes32), - n_blocks: l33 as u32, - start_block: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *base - .add(40 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l37 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V45::BlockInterval(e45) - } - 3 => { - let e45 = { - let l38 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l39 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len40 = l39; - let bytes40 = _rt::Vec::from_raw_parts( - l38.cast(), - len40, - len40, - ); - let l41 = i32::from( - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l43 = i32::from( - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes40), - start_time: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l42 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l44 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V45::Cron(e45) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V45::Manual - } - }; - let l46 = i32::from( - *base - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::ComponentSource as V70; - let v70 = match l46 { - 0 => { - let e70 = { - let l47 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l48 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len49 = l48; - let bytes49 = _rt::Vec::from_raw_parts( - l47.cast(), - len49, - len49, - ); - let l50 = *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l51 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len52 = l51; - let bytes52 = _rt::Vec::from_raw_parts( - l50.cast(), - len52, - len52, - ); - super::wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes49), - digest: _rt::string_lift(bytes52), - } - }; - V70::Download(e70) - } - 1 => { - let e70 = { - let l53 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l54 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len55 = l54; - let bytes55 = _rt::Vec::from_raw_parts( - l53.cast(), - len55, - len55, - ); - let l56 = i32::from( - *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l60 = i32::from( - *base - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l64 = *base - .add(48 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l65 = *base - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len66 = l65; - let bytes66 = _rt::Vec::from_raw_parts( - l64.cast(), - len66, - len66, - ); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes55), - domain: match l56 { - 0 => None, - 1 => { - let e = { - let l57 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l58 = *base - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - version: match l60 { - 0 => None, - 1 => { - let e = { - let l61 = *base - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l62 = *base - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - pkg: _rt::string_lift(bytes66), - } - }; - V70::Registry(e70) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e70 = { - let l67 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l68 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len69 = l68; - let bytes69 = _rt::Vec::from_raw_parts( - l67.cast(), - len69, - len69, - ); - _rt::string_lift(bytes69) - }; - V70::Digest(e70) - } - }; - let l71 = i32::from( - *base - .add(48 + 15 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V78; - let v78 = match l71 { - 0 => V78::All, - 1 => { - let e78 = { - let l72 = *base - .add(48 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l73 = *base - .add(48 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base77 = l72; - let len77 = l73; - let mut result77 = _rt::Vec::with_capacity(len77); - for i in 0..len77 { - let base = base77 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e77 = { - let l74 = *base.add(0).cast::<*mut u8>(); - let l75 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len76 = l75; - let bytes76 = _rt::Vec::from_raw_parts( - l74.cast(), - len76, - len76, - ); - _rt::string_lift(bytes76) - }; - result77.push(e77); - } - _rt::cabi_dealloc( - base77, - len77 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result77 - }; - V78::Only(e78) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V78::None - } - }; - let l79 = i32::from( - *base - .add(48 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l80 = i32::from( - *base - .add(56 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l82 = i32::from( - *base - .add(72 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l84 = *base - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l85 = *base - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base92 = l84; - let len92 = l85; - let mut result92 = _rt::Vec::with_capacity(len92); - for i in 0..len92 { - let base = base92 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e92 = { - let l86 = *base.add(0).cast::<*mut u8>(); - let l87 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len88 = l87; - let bytes88 = _rt::Vec::from_raw_parts( - l86.cast(), - len88, - len88, - ); - let l89 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l90 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len91 = l90; - let bytes91 = _rt::Vec::from_raw_parts( - l89.cast(), - len91, - len91, - ); - (_rt::string_lift(bytes88), _rt::string_lift(bytes91)) - }; - result92.push(e92); - } - _rt::cabi_dealloc( - base92, - len92 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l93 = *base - .add(88 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l94 = *base - .add(88 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base98 = l93; - let len98 = l94; - let mut result98 = _rt::Vec::with_capacity(len98); - for i in 0..len98 { - let base = base98 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e98 = { - let l95 = *base.add(0).cast::<*mut u8>(); - let l96 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len97 = l96; - let bytes97 = _rt::Vec::from_raw_parts( - l95.cast(), - len97, - len97, - ); - _rt::string_lift(bytes97) - }; - result98.push(e98); - } - _rt::cabi_dealloc( - base98, - len98 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l99 = i32::from( - *base - .add(88 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::Submit as V161; - let v161 = match l99 { - 0 => V161::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e161 = { - let l100 = *base - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l101 = *base - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len102 = l101; - let bytes102 = _rt::Vec::from_raw_parts( - l100.cast(), - len102, - len102, - ); - let l103 = i32::from( - *base - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::ComponentSource as V127; - let v127 = match l103 { - 0 => { - let e127 = { - let l104 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l105 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len106 = l105; - let bytes106 = _rt::Vec::from_raw_parts( - l104.cast(), - len106, - len106, - ); - let l107 = *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l108 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len109 = l108; - let bytes109 = _rt::Vec::from_raw_parts( - l107.cast(), - len109, - len109, - ); - super::wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes106), - digest: _rt::string_lift(bytes109), - } - }; - V127::Download(e127) - } - 1 => { - let e127 = { - let l110 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l111 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len112 = l111; - let bytes112 = _rt::Vec::from_raw_parts( - l110.cast(), - len112, - len112, - ); - let l113 = i32::from( - *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l117 = i32::from( - *base - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l121 = *base - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l122 = *base - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len123 = l122; - let bytes123 = _rt::Vec::from_raw_parts( - l121.cast(), - len123, - len123, - ); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes112), - domain: match l113 { - 0 => None, - 1 => { - let e = { - let l114 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l115 = *base - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len116 = l115; - let bytes116 = _rt::Vec::from_raw_parts( - l114.cast(), - len116, - len116, - ); - _rt::string_lift(bytes116) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l117 { - 0 => None, - 1 => { - let e = { - let l118 = *base - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l119 = *base - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len120 = l119; - let bytes120 = _rt::Vec::from_raw_parts( - l118.cast(), - len120, - len120, - ); - _rt::string_lift(bytes120) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes123), - } - }; - V127::Registry(e127) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e127 = { - let l124 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l125 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len126 = l125; - let bytes126 = _rt::Vec::from_raw_parts( - l124.cast(), - len126, - len126, - ); - _rt::string_lift(bytes126) - }; - V127::Digest(e127) - } - }; - let l128 = i32::from( - *base - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V135; - let v135 = match l128 { - 0 => V135::All, - 1 => { - let e135 = { - let l129 = *base - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l130 = *base - .add(96 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base134 = l129; - let len134 = l130; - let mut result134 = _rt::Vec::with_capacity(len134); - for i in 0..len134 { - let base = base134 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e134 = { - let l131 = *base.add(0).cast::<*mut u8>(); - let l132 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len133 = l132; - let bytes133 = _rt::Vec::from_raw_parts( - l131.cast(), - len133, - len133, - ); - _rt::string_lift(bytes133) - }; - result134.push(e134); - } - _rt::cabi_dealloc( - base134, - len134 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result134 - }; - V135::Only(e135) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V135::None - } - }; - let l136 = i32::from( - *base - .add(96 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l137 = i32::from( - *base - .add(104 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l139 = i32::from( - *base - .add(120 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l141 = *base - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l142 = *base - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base149 = l141; - let len149 = l142; - let mut result149 = _rt::Vec::with_capacity(len149); - for i in 0..len149 { - let base = base149 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e149 = { - let l143 = *base.add(0).cast::<*mut u8>(); - let l144 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len145 = l144; - let bytes145 = _rt::Vec::from_raw_parts( - l143.cast(), - len145, - len145, - ); - let l146 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l147 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len148 = l147; - let bytes148 = _rt::Vec::from_raw_parts( - l146.cast(), - len148, - len148, - ); - (_rt::string_lift(bytes145), _rt::string_lift(bytes148)) - }; - result149.push(e149); - } - _rt::cabi_dealloc( - base149, - len149 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l150 = *base - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l151 = *base - .add(136 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base155 = l150; - let len155 = l151; - let mut result155 = _rt::Vec::with_capacity(len155); - for i in 0..len155 { - let base = base155 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e155 = { - let l152 = *base.add(0).cast::<*mut u8>(); - let l153 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len154 = l153; - let bytes154 = _rt::Vec::from_raw_parts( - l152.cast(), - len154, - len154, - ); - _rt::string_lift(bytes154) - }; - result155.push(e155); - } - _rt::cabi_dealloc( - base155, - len155 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l156 = i32::from( - *base - .add(136 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignatureAlgorithm as V157; - let v157 = match l156 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V157::Secp256k1 - } - }; - let l158 = i32::from( - *base - .add(137 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes102), - component: super::wavs::types::service::Component { - source: v127, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v135, - file_system: _rt::bool_lift(l136 as u8), - }, - fuel_limit: match l137 { - 0 => None, - 1 => { - let e = { - let l138 = *base - .add(112 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l138 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l139 { - 0 => None, - 1 => { - let e = { - let l140 = *base - .add(128 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l140 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result149, - env_keys: result155, - }, - signature_kind: super::wavs::types::service::SignatureKind { - algorithm: v157, - prefix: match l158 { - 0 => None, - 1 => { - let e = { - let l159 = i32::from( - *base - .add(138 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignaturePrefix as V160; - let v160 = match l159 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V160::Eip191 - } - }; - v160 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V161::Aggregator(e161) - } - }; - ( - _rt::string_lift(bytes9), - super::wavs::types::service::Workflow { - trigger: v45, - component: super::wavs::types::service::Component { - source: v70, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v78, - file_system: _rt::bool_lift(l79 as u8), - }, - fuel_limit: match l80 { - 0 => None, - 1 => { - let e = { - let l81 = *base - .add(64 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l81 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l82 { - 0 => None, - 1 => { - let e = { - let l83 = *base - .add(80 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l83 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result92, - env_keys: result98, - }, - submit: v161, - }, - ) - }; - result162.push(e162); - } - _rt::cabi_dealloc( - base162, - len162 * (144 + 42 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let l163 = i32::from( - *ptr0.add(4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::ServiceStatus as V164; - let v164 = match l163 { - 0 => V164::Active, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - V164::Paused - } - }; - let l165 = i32::from( - *ptr0.add(5 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::ServiceManager as V172; - let v172 = match l165 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - let e172 = { - let l166 = *ptr0 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l167 = *ptr0 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len168 = l167; - let bytes168 = _rt::Vec::from_raw_parts( - l166.cast(), - len168, - len168, - ); - let l169 = *ptr0 - .add(8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l170 = *ptr0 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len171 = l170; - super::wavs::types::service::EvmManager { - chain: _rt::string_lift(bytes168), - address: super::wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l169.cast(), - len171, - len171, - ), - }, - } - }; - V172::Evm(e172) - } - }; - let l173 = *ptr0 - .add(10 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l174 = *ptr0 - .add(11 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len175 = l174; - let bytes175 = _rt::Vec::from_raw_parts(l173.cast(), len175, len175); - let result176 = super::wavs::types::service::ServiceAndWorkflowId { - service: super::wavs::types::service::Service { - name: _rt::string_lift(bytes4), - workflows: result162, - status: v164, - manager: v172, - }, - workflow_id: _rt::string_lift(bytes175), - }; - result176 - } - } - #[allow(unused_unsafe, clippy::all)] - /// convenience function to get the workflow without having to walk service.workflows - pub fn get_workflow() -> WorkflowAndWorkflowId { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 144 + 42 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 144 - + 42 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "get-workflow"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - use super::wavs::types::service::Trigger as V37; - let v37 = match l2 { - 0 => { - let e37 = { - let l3 = *ptr0.add(8).cast::<*mut u8>(); - let l4 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let l6 = *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr0 - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); - let l9 = *ptr0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *ptr0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - super::wavs::types::service::TriggerEvmContractEvent { - address: super::wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l3.cast(), len5, len5), - }, - chain: _rt::string_lift(bytes8), - event_hash: _rt::Vec::from_raw_parts(l9.cast(), len11, len11), - } - }; - V37::EvmContractEvent(e37) - } - 1 => { - let e37 = { - let l12 = *ptr0.add(8).cast::<*mut u8>(); - let l13 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len14 = l13; - let bytes14 = _rt::Vec::from_raw_parts(l12.cast(), len14, len14); - let l15 = *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l16 = *ptr0 - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); - let l19 = *ptr0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l20 = *ptr0 - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len21 = l20; - let bytes21 = _rt::Vec::from_raw_parts(l19.cast(), len21, len21); - super::wavs::types::service::TriggerCosmosContractEvent { - address: super::wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes14), - prefix_len: l15 as u32, - }, - chain: _rt::string_lift(bytes18), - event_type: _rt::string_lift(bytes21), - } - }; - V37::CosmosContractEvent(e37) - } - 2 => { - let e37 = { - let l22 = *ptr0.add(8).cast::<*mut u8>(); - let l23 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - let l25 = *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l26 = i32::from( - *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l28 = i32::from( - *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes24), - n_blocks: l25 as u32, - start_block: match l26 { - 0 => None, - 1 => { - let e = { - let l27 = *ptr0 - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l27 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *ptr0 - .add(40 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l29 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V37::BlockInterval(e37) - } - 3 => { - let e37 = { - let l30 = *ptr0.add(8).cast::<*mut u8>(); - let l31 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len32 = l31; - let bytes32 = _rt::Vec::from_raw_parts(l30.cast(), len32, len32); - let l33 = i32::from( - *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l35 = i32::from( - *ptr0 - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes32), - start_time: match l33 { - 0 => None, - 1 => { - let e = { - let l34 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l34 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l36 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V37::Cron(e37) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V37::Manual - } - }; - let l38 = i32::from( - *ptr0.add(48 + 2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::ComponentSource as V62; - let v62 = match l38 { - 0 => { - let e62 = { - let l39 = *ptr0 - .add(48 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l40 = *ptr0 - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len41 = l40; - let bytes41 = _rt::Vec::from_raw_parts(l39.cast(), len41, len41); - let l42 = *ptr0 - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l43 = *ptr0 - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len44 = l43; - let bytes44 = _rt::Vec::from_raw_parts(l42.cast(), len44, len44); - super::wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes41), - digest: _rt::string_lift(bytes44), - } - }; - V62::Download(e62) - } - 1 => { - let e62 = { - let l45 = *ptr0 - .add(48 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l46 = *ptr0 - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len47 = l46; - let bytes47 = _rt::Vec::from_raw_parts(l45.cast(), len47, len47); - let l48 = i32::from( - *ptr0 - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l52 = i32::from( - *ptr0 - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l56 = *ptr0 - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l57 = *ptr0 - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len58 = l57; - let bytes58 = _rt::Vec::from_raw_parts(l56.cast(), len58, len58); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes47), - domain: match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr0 - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l50 = *ptr0 - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len51 = l50; - let bytes51 = _rt::Vec::from_raw_parts( - l49.cast(), - len51, - len51, - ); - _rt::string_lift(bytes51) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l52 { - 0 => None, - 1 => { - let e = { - let l53 = *ptr0 - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l54 = *ptr0 - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - pkg: _rt::string_lift(bytes58), - } - }; - V62::Registry(e62) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e62 = { - let l59 = *ptr0 - .add(48 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *ptr0 - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts(l59.cast(), len61, len61); - _rt::string_lift(bytes61) - }; - V62::Digest(e62) - } - }; - let l63 = i32::from( - *ptr0.add(48 + 13 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V70; - let v70 = match l63 { - 0 => V70::All, - 1 => { - let e70 = { - let l64 = *ptr0 - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l65 = *ptr0 - .add(48 + 15 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base69 = l64; - let len69 = l65; - let mut result69 = _rt::Vec::with_capacity(len69); - for i in 0..len69 { - let base = base69 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e69 = { - let l66 = *base.add(0).cast::<*mut u8>(); - let l67 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len68 = l67; - let bytes68 = _rt::Vec::from_raw_parts( - l66.cast(), - len68, - len68, - ); - _rt::string_lift(bytes68) - }; - result69.push(e69); - } - _rt::cabi_dealloc( - base69, - len69 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result69 - }; - V70::Only(e70) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V70::None - } - }; - let l71 = i32::from( - *ptr0.add(48 + 16 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l72 = i32::from( - *ptr0.add(56 + 16 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l74 = i32::from( - *ptr0.add(72 + 16 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l76 = *ptr0 - .add(88 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l77 = *ptr0 - .add(88 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base84 = l76; - let len84 = l77; - let mut result84 = _rt::Vec::with_capacity(len84); - for i in 0..len84 { - let base = base84.add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e84 = { - let l78 = *base.add(0).cast::<*mut u8>(); - let l79 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len80 = l79; - let bytes80 = _rt::Vec::from_raw_parts(l78.cast(), len80, len80); - let l81 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l82 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len83 = l82; - let bytes83 = _rt::Vec::from_raw_parts(l81.cast(), len83, len83); - (_rt::string_lift(bytes80), _rt::string_lift(bytes83)) - }; - result84.push(e84); - } - _rt::cabi_dealloc( - base84, - len84 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l85 = *ptr0 - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l86 = *ptr0 - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base90 = l85; - let len90 = l86; - let mut result90 = _rt::Vec::with_capacity(len90); - for i in 0..len90 { - let base = base90.add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e90 = { - let l87 = *base.add(0).cast::<*mut u8>(); - let l88 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len89 = l88; - let bytes89 = _rt::Vec::from_raw_parts(l87.cast(), len89, len89); - _rt::string_lift(bytes89) - }; - result90.push(e90); - } - _rt::cabi_dealloc( - base90, - len90 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l91 = i32::from( - *ptr0.add(88 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::Submit as V153; - let v153 = match l91 { - 0 => V153::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e153 = { - let l92 = *ptr0 - .add(96 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l93 = *ptr0 - .add(96 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len94 = l93; - let bytes94 = _rt::Vec::from_raw_parts(l92.cast(), len94, len94); - let l95 = i32::from( - *ptr0 - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::ComponentSource as V119; - let v119 = match l95 { - 0 => { - let e119 = { - let l96 = *ptr0 - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l97 = *ptr0 - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len98 = l97; - let bytes98 = _rt::Vec::from_raw_parts( - l96.cast(), - len98, - len98, - ); - let l99 = *ptr0 - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l100 = *ptr0 - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len101 = l100; - let bytes101 = _rt::Vec::from_raw_parts( - l99.cast(), - len101, - len101, - ); - super::wavs::types::service::ComponentSourceDownload { - uri: _rt::string_lift(bytes98), - digest: _rt::string_lift(bytes101), - } - }; - V119::Download(e119) - } - 1 => { - let e119 = { - let l102 = *ptr0 - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l103 = *ptr0 - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len104 = l103; - let bytes104 = _rt::Vec::from_raw_parts( - l102.cast(), - len104, - len104, - ); - let l105 = i32::from( - *ptr0 - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l109 = i32::from( - *ptr0 - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l113 = *ptr0 - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l114 = *ptr0 - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len115 = l114; - let bytes115 = _rt::Vec::from_raw_parts( - l113.cast(), - len115, - len115, - ); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes104), - domain: match l105 { - 0 => None, - 1 => { - let e = { - let l106 = *ptr0 - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l107 = *ptr0 - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len108 = l107; - let bytes108 = _rt::Vec::from_raw_parts( - l106.cast(), - len108, - len108, - ); - _rt::string_lift(bytes108) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l109 { - 0 => None, - 1 => { - let e = { - let l110 = *ptr0 - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l111 = *ptr0 - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len112 = l111; - let bytes112 = _rt::Vec::from_raw_parts( - l110.cast(), - len112, - len112, - ); - _rt::string_lift(bytes112) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes115), - } - }; - V119::Registry(e119) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e119 = { - let l116 = *ptr0 - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l117 = *ptr0 - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len118 = l117; - let bytes118 = _rt::Vec::from_raw_parts( - l116.cast(), - len118, - len118, - ); - _rt::string_lift(bytes118) - }; - V119::Digest(e119) - } - }; - let l120 = i32::from( - *ptr0 - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V127; - let v127 = match l120 { - 0 => V127::All, - 1 => { - let e127 = { - let l121 = *ptr0 - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l122 = *ptr0 - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base126 = l121; - let len126 = l122; - let mut result126 = _rt::Vec::with_capacity(len126); - for i in 0..len126 { - let base = base126 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e126 = { - let l123 = *base.add(0).cast::<*mut u8>(); - let l124 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len125 = l124; - let bytes125 = _rt::Vec::from_raw_parts( - l123.cast(), - len125, - len125, - ); - _rt::string_lift(bytes125) - }; - result126.push(e126); - } - _rt::cabi_dealloc( - base126, - len126 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result126 - }; - V127::Only(e127) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V127::None - } - }; - let l128 = i32::from( - *ptr0 - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l129 = i32::from( - *ptr0 - .add(104 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l131 = i32::from( - *ptr0 - .add(120 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l133 = *ptr0 - .add(136 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l134 = *ptr0 - .add(136 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base141 = l133; - let len141 = l134; - let mut result141 = _rt::Vec::with_capacity(len141); - for i in 0..len141 { - let base = base141 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e141 = { - let l135 = *base.add(0).cast::<*mut u8>(); - let l136 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len137 = l136; - let bytes137 = _rt::Vec::from_raw_parts( - l135.cast(), - len137, - len137, - ); - let l138 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l139 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len140 = l139; - let bytes140 = _rt::Vec::from_raw_parts( - l138.cast(), - len140, - len140, - ); - (_rt::string_lift(bytes137), _rt::string_lift(bytes140)) - }; - result141.push(e141); - } - _rt::cabi_dealloc( - base141, - len141 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l142 = *ptr0 - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l143 = *ptr0 - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base147 = l142; - let len147 = l143; - let mut result147 = _rt::Vec::with_capacity(len147); - for i in 0..len147 { - let base = base147 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e147 = { - let l144 = *base.add(0).cast::<*mut u8>(); - let l145 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len146 = l145; - let bytes146 = _rt::Vec::from_raw_parts( - l144.cast(), - len146, - len146, - ); - _rt::string_lift(bytes146) - }; - result147.push(e147); - } - _rt::cabi_dealloc( - base147, - len147 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l148 = i32::from( - *ptr0 - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignatureAlgorithm as V149; - let v149 = match l148 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V149::Secp256k1 - } - }; - let l150 = i32::from( - *ptr0 - .add(137 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes94), - component: super::wavs::types::service::Component { - source: v119, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v127, - file_system: _rt::bool_lift(l128 as u8), - }, - fuel_limit: match l129 { - 0 => None, - 1 => { - let e = { - let l130 = *ptr0 - .add(112 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l130 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l131 { - 0 => None, - 1 => { - let e = { - let l132 = *ptr0 - .add(128 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l132 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result141, - env_keys: result147, - }, - signature_kind: super::wavs::types::service::SignatureKind { - algorithm: v149, - prefix: match l150 { - 0 => None, - 1 => { - let e = { - let l151 = i32::from( - *ptr0 - .add(138 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignaturePrefix as V152; - let v152 = match l151 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V152::Eip191 - } - }; - v152 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V153::Aggregator(e153) - } - }; - let l154 = *ptr0 - .add(144 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l155 = *ptr0 - .add(144 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len156 = l155; - let bytes156 = _rt::Vec::from_raw_parts(l154.cast(), len156, len156); - let result157 = super::wavs::types::service::WorkflowAndWorkflowId { - workflow: super::wavs::types::service::Workflow { - trigger: v37, - component: super::wavs::types::service::Component { - source: v62, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v70, - file_system: _rt::bool_lift(l71 as u8), - }, - fuel_limit: match l72 { - 0 => None, - 1 => { - let e = { - let l73 = *ptr0 - .add(64 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l73 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l74 { - 0 => None, - 1 => { - let e = { - let l75 = *ptr0 - .add(80 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l75 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result84, - env_keys: result90, - }, - submit: v153, - }, - workflow_id: _rt::string_lift(bytes156), - }; - result157 - } - } - #[allow(unused_unsafe, clippy::all)] - /// convenience function to get the event-id - pub fn get_event_id() -> EventId { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "get-event-id"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len4 = l3; - let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - result5 - } - } -} -#[rustfmt::skip] -mod _rt { - #![allow(dead_code, clippy::all)] - pub use alloc_crate::string::String; - pub use alloc_crate::vec::Vec; - 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 { - 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) { - u32::MAX => {} - other => T::drop(other), - } - } - } - } - pub unsafe fn bool_lift(val: u8) -> bool { - if cfg!(debug_assertions) { - match val { - 0 => false, - 1 => true, - _ => panic!("invalid bool discriminant"), - } - } else { - 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 string_lift(bytes: Vec) -> String { - if cfg!(debug_assertions) { - String::from_utf8(bytes).unwrap() - } else { - String::from_utf8_unchecked(bytes) - } - } - pub unsafe fn invalid_enum_discriminant() -> T { - if cfg!(debug_assertions) { - panic!("invalid enum discriminant") - } else { - unsafe { core::hint::unreachable_unchecked() } - } - } - pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { - if size == 0 { - return; - } - let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr, layout); - } - pub fn as_i32(t: T) -> i32 { - t.as_i32() - } - pub trait AsI32 { - fn as_i32(self) -> i32; - } - impl<'a, T: Copy + AsI32> AsI32 for &'a T { - fn as_i32(self) -> i32 { - (*self).as_i32() - } - } - impl AsI32 for i32 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u32 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for i16 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u16 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for i8 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u8 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for char { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for usize { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - #[cfg(target_arch = "wasm32")] - pub fn run_ctors_once() { - wit_bindgen_rt::run_ctors_once(); - } - extern crate alloc as alloc_crate; -} -/// Generates `#[unsafe(no_mangle)]` functions to export the specified type as -/// the root implementation of all generated traits. -/// -/// For more information see the documentation of `wit_bindgen::generate!`. -/// -/// ```rust -/// # macro_rules! export{ ($($t:tt)*) => (); } -/// # trait Guest {} -/// struct MyType; -/// -/// impl Guest for MyType { -/// // ... -/// } -/// -/// export!(MyType); -/// ``` -#[allow(unused_macros)] -#[doc(hidden)] -macro_rules! __export_aggregator_world_impl { - ($ty:ident) => { - self::export!($ty with_types_in self); - }; - ($ty:ident with_types_in $($path_to_types_root:tt)*) => { - $($path_to_types_root)*:: __export_world_aggregator_world_cabi!($ty with_types_in - $($path_to_types_root)*); - }; -} -#[doc(inline)] -pub(crate) use __export_aggregator_world_impl as export; -#[cfg(target_arch = "wasm32")] -#[unsafe( - link_section = "component-type:wit-bindgen:0.41.0:wavs:aggregator@1.3.0:aggregator-world:encoded world" -)] -#[doc(hidden)] -#[allow(clippy::octal_escapes)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 20948] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xcc\xa2\x01\x01A\x02\ -\x01A\x85\x01\x01B\x0b\x01s\x04\0\x06digest\x03\0\0\x01r\x01\x05nanosw\x04\0\x09\ -timestamp\x03\0\x02\x01r\x01\x04secsw\x04\0\x08duration\x03\0\x04\x01o\x02ww\x01\ -r\x01\x05value\x06\x04\0\x04u128\x03\0\x07\x01q\x05\x05error\0\0\x04warn\0\0\x04\ -info\0\0\x05debug\0\0\x05trace\0\0\x04\0\x09log-level\x03\0\x09\x03\0\x15wavs:ty\ -pes/core@1.3.0\x05\0\x01B\x1d\x01s\x04\0\x09chain-key\x03\0\0\x01p}\x04\0\x0bevm\ --tx-hash\x03\0\x02\x01s\x04\0\x0ecosmos-tx-hash\x03\0\x04\x01q\x02\x03evm\x01\x03\ -\0\x06cosmos\x01\x05\0\x04\0\x0bany-tx-hash\x03\0\x06\x01r\x02\x0bbech32-addrs\x0a\ -prefix-leny\x04\0\x0ecosmos-address\x03\0\x08\x01o\x02ss\x01p\x0a\x01r\x02\x02ty\ -s\x0aattributes\x0b\x04\0\x0ccosmos-event\x03\0\x0c\x01ks\x01r\x07\x08chain-ids\x0c\ -rpc-endpoint\x0e\x0dgrpc-endpoint\x0e\x11grpc-web-endpoint\x0e\x09gas-pricev\x09\ -gas-denoms\x0dbech32-prefixs\x04\0\x13cosmos-chain-config\x03\0\x0f\x01p}\x01r\x01\ -\x09raw-bytes\x11\x04\0\x0bevm-address\x03\0\x12\x01p\x11\x01r\x02\x06topics\x14\ -\x04data\x11\x04\0\x12evm-event-log-data\x03\0\x15\x01kw\x01r\x08\x07address\x13\ -\x04data\x16\x07tx-hash\x03\x0cblock-numberw\x09log-indexw\x0ablock-hash\x11\x0f\ -block-timestamp\x17\x08tx-indexw\x04\0\x0devm-event-log\x03\0\x18\x01ps\x01r\x03\ -\x08chain-ids\x0cws-endpoints\x1a\x0dhttp-endpoint\x0e\x04\0\x10evm-chain-config\ -\x03\0\x1b\x03\0\x16wavs:types/chain@1.3.0\x05\x01\x02\x03\0\0\x06digest\x02\x03\ -\0\0\x09timestamp\x02\x03\0\x01\x09chain-key\x02\x03\0\x01\x0bevm-address\x02\x03\ -\0\x01\x0ecosmos-address\x01BO\x02\x03\x02\x01\x02\x04\0\x06digest\x03\0\0\x02\x03\ -\x02\x01\x03\x04\0\x09timestamp\x03\0\x02\x02\x03\x02\x01\x04\x04\0\x09chain-key\ -\x03\0\x04\x02\x03\x02\x01\x05\x04\0\x0bevm-address\x03\0\x06\x02\x03\x02\x01\x06\ -\x04\0\x0ecosmos-address\x03\0\x08\x01s\x04\0\x0aservice-id\x03\0\x0a\x01s\x04\0\ -\x0bworkflow-id\x03\0\x0c\x01s\x04\0\x0bpackage-ref\x03\0\x0e\x01s\x04\0\x0esemv\ -er-version\x03\0\x10\x01q\x02\x06active\0\0\x06paused\0\0\x04\0\x0eservice-statu\ -s\x03\0\x12\x01r\x02\x05chain\x05\x07address\x07\x04\0\x0bevm-manager\x03\0\x14\x01\ -q\x01\x03evm\x01\x15\0\x04\0\x0fservice-manager\x03\0\x16\x01r\x02\x03uris\x06di\ -gest\x01\x04\0\x19component-source-download\x03\0\x18\x01ks\x01k\x11\x01r\x04\x06\ -digest\x01\x06domain\x1a\x07version\x1b\x03pkg\x0f\x04\0\x08registry\x03\0\x1c\x01\ -q\x03\x08download\x01\x19\0\x08registry\x01\x1d\0\x06digest\x01\x01\0\x04\0\x10c\ -omponent-source\x03\0\x1e\x01ps\x01q\x03\x03all\0\0\x04only\x01\x20\0\x04none\0\0\ -\x04\0\x17allowed-host-permission\x03\0!\x01r\x02\x12allowed-http-hosts\"\x0bfil\ -e-system\x7f\x04\0\x0bpermissions\x03\0#\x01kw\x01o\x02ss\x01p&\x01r\x06\x06sour\ -ce\x1f\x0bpermissions$\x0afuel-limit%\x12time-limit-seconds%\x06config'\x08env-k\ -eys\x20\x04\0\x09component\x03\0(\x01p}\x01r\x03\x07address\x07\x05chain\x05\x0a\ -event-hash*\x04\0\x1atrigger-evm-contract-event\x03\0+\x01r\x03\x07address\x09\x05\ -chain\x05\x0aevent-types\x04\0\x1dtrigger-cosmos-contract-event\x03\0-\x01r\x04\x05\ -chain\x05\x08n-blocksy\x0bstart-block%\x09end-block%\x04\0\x16trigger-block-inte\ -rval\x03\0/\x01k\x03\x01r\x03\x08schedules\x0astart-time1\x08end-time1\x04\0\x0c\ -trigger-cron\x03\02\x01q\x05\x12evm-contract-event\x01,\0\x15cosmos-contract-eve\ -nt\x01.\0\x0eblock-interval\x010\0\x04cron\x013\0\x06manual\0\0\x04\0\x07trigger\ -\x03\04\x01q\x01\x09secp256k1\0\0\x04\0\x13signature-algorithm\x03\06\x01q\x01\x06\ -eip191\0\0\x04\0\x10signature-prefix\x03\08\x01k9\x01r\x02\x09algorithm7\x06pref\ -ix:\x04\0\x0esignature-kind\x03\0;\x01r\x03\x03urls\x09component)\x0esignature-k\ -ind<\x04\0\x11aggregator-submit\x03\0=\x01q\x02\x04none\0\0\x0aaggregator\x01>\0\ -\x04\0\x06submit\x03\0?\x01r\x03\x07trigger5\x09component)\x06submit\xc0\0\x04\0\ -\x08workflow\x03\0A\x01o\x02\x0d\xc2\0\x01p\xc3\0\x01r\x04\x04names\x09workflows\ -\xc4\0\x06status\x13\x07manager\x17\x04\0\x07service\x03\0E\x01r\x03\x05chain\x05\ -\x07address\x07\x07max-gas%\x04\0\x17evm-contract-submission\x03\0G\x01q\x01\x03\ -evm\x01\xc8\0\0\x04\0\x0aaggregator\x03\0I\x01r\x02\x07service\xc6\0\x0bworkflow\ --id\x0d\x04\0\x17service-and-workflow-id\x03\0K\x01r\x02\x08workflow\xc2\0\x0bwo\ -rkflow-id\x0d\x04\0\x18workflow-and-workflow-id\x03\0M\x03\0\x18wavs:types/servi\ -ce@1.3.0\x05\x07\x02\x03\0\x01\x0devm-event-log\x02\x03\0\x01\x0ccosmos-event\x01\ -B\x19\x02\x03\x02\x01\x04\x04\0\x09chain-key\x03\0\0\x02\x03\x02\x01\x05\x04\0\x0b\ -evm-address\x03\0\x02\x02\x03\x02\x01\x08\x04\0\x0devm-event-log\x03\0\x04\x02\x03\ -\x02\x01\x06\x04\0\x0ecosmos-address\x03\0\x06\x02\x03\x02\x01\x09\x04\0\x0ccosm\ -os-event\x03\0\x08\x02\x03\x02\x01\x03\x04\0\x09timestamp\x03\0\x0a\x01p}\x04\0\x08\ -event-id\x03\0\x0c\x01r\x02\x05chain\x01\x03log\x05\x04\0\x1ftrigger-data-evm-co\ -ntract-event\x03\0\x0e\x01r\x05\x10contract-address\x07\x05chain\x01\x05event\x09\ -\x0bevent-indexw\x0cblock-heightw\x04\0\"trigger-data-cosmos-contract-event\x03\0\ -\x10\x01r\x02\x05chain\x01\x0cblock-heightw\x04\0\x1btrigger-data-block-interval\ -\x03\0\x12\x01r\x01\x0ctrigger-time\x0b\x04\0\x11trigger-data-cron\x03\0\x14\x01\ -p}\x01q\x05\x12evm-contract-event\x01\x0f\0\x15cosmos-contract-event\x01\x11\0\x0e\ -block-interval\x01\x13\0\x04cron\x01\x15\0\x03raw\x01\x16\0\x04\0\x0ctrigger-dat\ -a\x03\0\x17\x03\0\x17wavs:types/events@1.3.0\x05\x0a\x02\x03\0\0\x08duration\x02\ -\x03\0\0\x04u128\x02\x03\0\x02\x07service\x02\x03\0\x02\x0bworkflow-id\x02\x03\0\ -\x02\x0esignature-kind\x02\x03\0\x03\x0ctrigger-data\x02\x03\0\x03\x08event-id\x01\ -B\x20\x02\x03\x02\x01\x0b\x04\0\x08duration\x03\0\0\x02\x03\x02\x01\x0c\x04\0\x04\ -u128\x03\0\x02\x02\x03\x02\x01\x0d\x04\0\x07service\x03\0\x04\x02\x03\x02\x01\x0e\ -\x04\0\x0bworkflow-id\x03\0\x06\x02\x03\x02\x01\x0f\x04\0\x0esignature-kind\x03\0\ -\x08\x02\x03\x02\x01\x04\x04\0\x09chain-key\x03\0\x0a\x02\x03\x02\x01\x05\x04\0\x0b\ -evm-address\x03\0\x0c\x02\x03\x02\x01\x10\x04\0\x0ctrigger-data\x03\0\x0e\x02\x03\ -\x02\x01\x11\x04\0\x08event-id\x03\0\x10\x01p}\x01r\x03\x08event-id\x11\x08order\ -ing\x12\x07payload\x12\x04\0\x08envelope\x03\0\x13\x01r\x02\x04data\x12\x04kind\x09\ -\x04\0\x12envelope-signature\x03\0\x15\x01r\x05\x07service\x05\x0bworkflow-id\x07\ -\x08envelope\x14\x09signature\x16\x0ctrigger-data\x0f\x04\0\x06packet\x03\0\x17\x01\ -r\x01\x05delay\x01\x04\0\x0ctimer-action\x03\0\x19\x01k\x03\x01r\x03\x05chain\x0b\ -\x10contract-address\x0d\x09gas-price\x1b\x04\0\x0dsubmit-action\x03\0\x1c\x01q\x02\ -\x05timer\x01\x1a\0\x06submit\x01\x1d\0\x04\0\x11aggregator-action\x03\0\x1e\x03\ -\0\x20wavs:aggregator/aggregator@1.3.0\x05\x12\x02\x03\0\x04\x06packet\x03\0\x06\ -packet\x03\0\x13\x02\x03\0\x04\x11aggregator-action\x03\0\x11aggregator-action\x03\ -\0\x15\x02\x03\0\x01\x0bany-tx-hash\x03\0\x0bany-tx-hash\x03\0\x17\x01B\x0a\x04\0\ -\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\0\x16[method]pollable\ -.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method]pollable.block\x01\x03\ -\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\x06\x03\0\x12wasi:io/\ -poll@0.2.0\x05\x19\x02\x03\0\x05\x08pollable\x01B\x0f\x02\x03\x02\x01\x1a\x04\0\x08\ -pollable\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\x04w\ -hen\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wasi:clocks/monotonic-cl\ -ock@0.2.0\x05\x1b\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01@\x01\x04self\x01\0s\ -\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13wasi:io/error@0.2.0\x05\ -\x1c\x02\x03\0\x07\x05error\x01B(\x02\x03\x02\x01\x1d\x04\0\x05error\x03\0\0\x02\ -\x03\x02\x01\x1a\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15last-operation\ --failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\0\x0cinput-s\ -tream\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\x04sel\ -f\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\"[method]in\ -put-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\x04\0\x1e[m\ -ethod]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\x0d\x04\0![\ -method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04self\x11\x08\ -contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0.[method]ou\ -tput-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\x04\0\x1b\ -[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocking-flush\x01\ -\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subscribe\x01\x16\ -\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.write-zeroes\x01\ -\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\x17\x01@\x03\ -\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-stream.splice\x01\x18\ -\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wasi:io/streams@0.\ -2.0\x05\x1e\x02\x03\0\x06\x08duration\x02\x03\0\x08\x0cinput-stream\x02\x03\0\x08\ -\x0doutput-stream\x01B\xc0\x01\x02\x03\x02\x01\x1f\x04\0\x08duration\x03\0\0\x02\ -\x03\x02\x01\x20\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01!\x04\0\x0doutpu\ -t-stream\x03\0\x04\x02\x03\x02\x01\x1d\x04\0\x08io-error\x03\0\x06\x02\x03\x02\x01\ -\x1a\x04\0\x08pollable\x03\0\x08\x01q\x0a\x03get\0\0\x04head\0\0\x04post\0\0\x03\ -put\0\0\x06delete\0\0\x07connect\0\0\x07options\0\0\x05trace\0\0\x05patch\0\0\x05\ -other\x01s\0\x04\0\x06method\x03\0\x0a\x01q\x03\x04HTTP\0\0\x05HTTPS\0\0\x05othe\ -r\x01s\0\x04\0\x06scheme\x03\0\x0c\x01ks\x01k{\x01r\x02\x05rcode\x0e\x09info-cod\ -e\x0f\x04\0\x11DNS-error-payload\x03\0\x10\x01k}\x01r\x02\x08alert-id\x12\x0dale\ -rt-message\x0e\x04\0\x1aTLS-alert-received-payload\x03\0\x13\x01ky\x01r\x02\x0af\ -ield-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\x15destination-not-found\0\0\ -\x17destination-unavailable\0\0\x19destination-IP-prohibited\0\0\x19destination-\ -IP-unroutable\0\0\x12connection-refused\0\0\x15connection-terminated\0\0\x12conn\ -ection-timeout\0\0\x17connection-read-timeout\0\0\x18connection-write-timeout\0\0\ -\x18connection-limit-reached\0\0\x12TLS-protocol-error\0\0\x15TLS-certificate-er\ -ror\0\0\x12TLS-alert-received\x01\x14\0\x13HTTP-request-denied\0\0\x1cHTTP-reque\ -st-length-required\0\0\x16HTTP-request-body-size\x01\x18\0\x1bHTTP-request-metho\ -d-invalid\0\0\x18HTTP-request-URI-invalid\0\0\x19HTTP-request-URI-too-long\0\0\x20\ -HTTP-request-header-section-size\x01\x15\0\x18HTTP-request-header-size\x01\x19\0\ -!HTTP-request-trailer-section-size\x01\x15\0\x19HTTP-request-trailer-size\x01\x17\ -\0\x18HTTP-response-incomplete\0\0!HTTP-response-header-section-size\x01\x15\0\x19\ -HTTP-response-header-size\x01\x17\0\x17HTTP-response-body-size\x01\x18\0\"HTTP-r\ -esponse-trailer-section-size\x01\x15\0\x1aHTTP-response-trailer-size\x01\x17\0\x1d\ -HTTP-response-transfer-coding\x01\x0e\0\x1cHTTP-response-content-coding\x01\x0e\0\ -\x15HTTP-response-timeout\0\0\x13HTTP-upgrade-failed\0\0\x13HTTP-protocol-error\0\ -\0\x0dloop-detected\0\0\x13configuration-error\0\0\x0einternal-error\x01\x0e\0\x04\ -\0\x0aerror-code\x03\0\x1a\x01q\x03\x0einvalid-syntax\0\0\x09forbidden\0\0\x09im\ -mutable\0\0\x04\0\x0cheader-error\x03\0\x1c\x01s\x04\0\x09field-key\x03\0\x1e\x01\ -p}\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-request\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\x11incoming-response\x03\x01\x04\0\x0d\ -incoming-body\x03\x01\x04\0\x0ffuture-trailers\x03\x01\x04\0\x11outgoing-respons\ -e\x03\x01\x04\0\x0doutgoing-body\x03\x01\x04\0\x18future-incoming-response\x03\x01\ -\x01i\"\x01@\0\01\x04\0\x13[constructor]fields\x012\x01o\x02\x1f!\x01p3\x01j\x01\ -1\x01\x1d\x01@\x01\x07entries4\05\x04\0\x18[static]fields.from-list\x016\x01h\"\x01\ -p!\x01@\x02\x04self7\x04name\x1f\08\x04\0\x12[method]fields.get\x019\x01@\x02\x04\ -self7\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\x04\ -self7\x04name\x1f\0;\x04\0\x15[method]fields.delete\x01=\x01@\x03\x04self7\x04na\ -me\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.c\ -lone\x01@\x01h%\x01@\x01\x04self\xc1\0\0\x0b\x04\0\x1f[method]incoming-request.m\ -ethod\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-re\ -quest.scheme\x01E\x04\0\"[method]incoming-request.authority\x01C\x01i#\x01@\x01\x04\ -self\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[method]incoming-request.consum\ -e\x01J\x01i&\x01@\x01\x07headers\xc6\0\0\xcb\0\x04\0\x1d[constructor]outgoing-re\ -quest\x01L\x01h&\x01i/\x01j\x01\xce\0\0\x01@\x01\x04self\xcd\0\0\xcf\0\x04\0\x1d\ -[method]outgoing-request.body\x01P\x01@\x01\x04self\xcd\0\0\x0b\x04\0\x1f[method\ -]outgoing-request.method\x01Q\x01j\0\0\x01@\x02\x04self\xcd\0\x06method\x0b\0\xd2\ -\0\x04\0#[method]outgoing-request.set-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-request.set-path-with-query\x01U\x01\ -@\x01\x04self\xcd\0\0\xc4\0\x04\0\x1f[method]outgoing-request.scheme\x01V\x01@\x02\ -\x04self\xcd\0\x06scheme\xc4\0\0\xd2\0\x04\0#[method]outgoing-request.set-scheme\ -\x01W\x04\0\"[method]outgoing-request.authority\x01T\x01@\x02\x04self\xcd\0\x09a\ -uthority\x0e\0\xd2\0\x04\0&[method]outgoing-request.set-authority\x01X\x01@\x01\x04\ -self\xcd\0\0\xc6\0\x04\0\x20[method]outgoing-request.headers\x01Y\x01i'\x01@\0\0\ -\xda\0\x04\0\x1c[constructor]request-options\x01[\x01h'\x01k\x01\x01@\x01\x04sel\ -f\xdc\0\0\xdd\0\x04\0'[method]request-options.connect-timeout\x01^\x01@\x02\x04s\ -elf\xdc\0\x08duration\xdd\0\0\xd2\0\x04\0+[method]request-options.set-connect-ti\ -meout\x01_\x04\0*[method]request-options.first-byte-timeout\x01^\x04\0.[method]r\ -equest-options.set-first-byte-timeout\x01_\x04\0-[method]request-options.between\ --bytes-timeout\x01^\x04\01[method]request-options.set-between-bytes-timeout\x01_\ -\x01i(\x01i.\x01j\x01\xe1\0\x01\x1b\x01@\x02\x05param\xe0\0\x08response\xe2\0\x01\ -\0\x04\0\x1d[static]response-outparam.set\x01c\x01h+\x01@\x01\x04self\xe4\0\0*\x04\ -\0\x20[method]incoming-response.status\x01e\x01@\x01\x04self\xe4\0\0\xc6\0\x04\0\ -![method]incoming-response.headers\x01f\x01@\x01\x04self\xe4\0\0\xc9\0\x04\0![me\ -thod]incoming-response.consume\x01g\x01h,\x01i\x03\x01j\x01\xe9\0\0\x01@\x01\x04\ -self\xe8\0\0\xea\0\x04\0\x1c[method]incoming-body.stream\x01k\x01i-\x01@\x01\x04\ -this\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-trailers.subscribe\x01p\x01i$\x01\ -k\xf1\0\x01j\x01\xf2\0\x01\x1b\x01j\x01\xf3\0\0\x01k\xf4\0\x01@\x01\x04self\xee\0\ -\0\xf5\0\x04\0\x1b[method]future-trailers.get\x01v\x01@\x01\x07headers\xc6\0\0\xe1\ -\0\x04\0\x1e[constructor]outgoing-response\x01w\x01h.\x01@\x01\x04self\xf8\0\0*\x04\ -\0%[method]outgoing-response.status-code\x01y\x01@\x02\x04self\xf8\0\x0bstatus-c\ -ode*\0\xd2\0\x04\0)[method]outgoing-response.set-status-code\x01z\x01@\x01\x04se\ -lf\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.body\x01|\x01h/\x01i\x05\x01j\x01\xfe\ -\0\0\x01@\x01\x04self\xfd\0\0\xff\0\x04\0\x1b[method]outgoing-body.write\x01\x80\ -\x01\x01j\0\x01\x1b\x01@\x02\x04this\xce\0\x08trailers\xf2\0\0\x81\x01\x04\0\x1c\ -[static]outgoing-body.finish\x01\x82\x01\x01h0\x01@\x01\x04self\x83\x01\0\xef\0\x04\ -\0*[method]future-incoming-response.subscribe\x01\x84\x01\x01i+\x01j\x01\x85\x01\ -\x01\x1b\x01j\x01\x86\x01\0\x01k\x87\x01\x01@\x01\x04self\x83\x01\0\x88\x01\x04\0\ -$[method]future-incoming-response.get\x01\x89\x01\x01h\x07\x01k\x1b\x01@\x01\x03\ -err\x8a\x01\0\x8b\x01\x04\0\x0fhttp-error-code\x01\x8c\x01\x03\0\x15wasi:http/ty\ -pes@0.2.0\x05\"\x02\x03\0\x09\x10outgoing-request\x02\x03\0\x09\x0frequest-optio\ -ns\x02\x03\0\x09\x18future-incoming-response\x02\x03\0\x09\x0aerror-code\x01B\x0f\ -\x02\x03\x02\x01#\x04\0\x10outgoing-request\x03\0\0\x02\x03\x02\x01$\x04\0\x0fre\ -quest-options\x03\0\x02\x02\x03\x02\x01%\x04\0\x18future-incoming-response\x03\0\ -\x04\x02\x03\x02\x01&\x04\0\x0aerror-code\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01\ -i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07request\x08\x07options\x0a\0\x0c\x04\0\x06\ -handle\x01\x0d\x03\0\x20wasi:http/outgoing-handler@0.2.0\x05'\x02\x03\0\x01\x10e\ -vm-chain-config\x02\x03\0\x01\x13cosmos-chain-config\x02\x03\0\0\x09log-level\x02\ -\x03\0\x02\x17service-and-workflow-id\x02\x03\0\x02\x18workflow-and-workflow-id\x01\ -B\x1d\x02\x03\x02\x01(\x04\0\x10evm-chain-config\x03\0\0\x02\x03\x02\x01)\x04\0\x13\ -cosmos-chain-config\x03\0\x02\x02\x03\x02\x01*\x04\0\x09log-level\x03\0\x04\x02\x03\ -\x02\x01+\x04\0\x17service-and-workflow-id\x03\0\x06\x02\x03\x02\x01,\x04\0\x18w\ -orkflow-and-workflow-id\x03\0\x08\x02\x03\x02\x01\x11\x04\0\x08event-id\x03\0\x0a\ -\x01k\x01\x01@\x01\x09chain-keys\0\x0c\x04\0\x14get-evm-chain-config\x01\x0d\x01\ -k\x03\x01@\x01\x09chain-keys\0\x0e\x04\0\x17get-cosmos-chain-config\x01\x0f\x01k\ -s\x01@\x01\x03keys\0\x10\x04\0\x0aconfig-var\x01\x11\x01@\x02\x05level\x05\x07me\ -ssages\x01\0\x04\0\x03log\x01\x12\x01@\0\0\x07\x04\0\x0bget-service\x01\x13\x01@\ -\0\0\x09\x04\0\x0cget-workflow\x01\x14\x01@\0\0\x0b\x04\0\x0cget-event-id\x01\x15\ -\x03\0\x04host\x05-\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environ\ -ment\x01\x02\x01ps\x01@\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\ -\x04\0\x0binitial-cwd\x01\x06\x03\0\x1awasi:cli/environment@0.2.0\x05.\x01B\x03\x01\ -j\0\0\x01@\x01\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\0\x13wasi:cli/exit@0.\ -2.0\x05/\x01B\x05\x02\x03\x02\x01\x20\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01\ -@\0\0\x02\x04\0\x09get-stdin\x01\x03\x03\0\x14wasi:cli/stdin@0.2.0\x050\x01B\x05\ -\x02\x03\x02\x01!\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0a\ -get-stdout\x01\x03\x03\0\x15wasi:cli/stdout@0.2.0\x051\x01B\x05\x02\x03\x02\x01!\ -\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\ -\x03\0\x15wasi:cli/stderr@0.2.0\x052\x01B\x01\x04\0\x0eterminal-input\x03\x01\x03\ -\0\x1dwasi:cli/terminal-input@0.2.0\x053\x01B\x01\x04\0\x0fterminal-output\x03\x01\ -\x03\0\x1ewasi:cli/terminal-output@0.2.0\x054\x02\x03\0\x11\x0eterminal-input\x01\ -B\x06\x02\x03\x02\x015\x04\0\x0eterminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\ -\x03\x04\0\x12get-terminal-stdin\x01\x04\x03\0\x1dwasi:cli/terminal-stdin@0.2.0\x05\ -6\x02\x03\0\x12\x0fterminal-output\x01B\x06\x02\x03\x02\x017\x04\0\x0fterminal-o\ -utput\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\ -\x03\0\x1ewasi:cli/terminal-stdout@0.2.0\x058\x01B\x06\x02\x03\x02\x017\x04\0\x0f\ -terminal-output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-std\ -err\x01\x04\x03\0\x1ewasi:cli/terminal-stderr@0.2.0\x059\x01B\x05\x01r\x02\x07se\ -condsw\x0bnanosecondsy\x04\0\x08datetime\x03\0\0\x01@\0\0\x01\x04\0\x03now\x01\x02\ -\x04\0\x0aresolution\x01\x02\x03\0\x1cwasi:clocks/wall-clock@0.2.0\x05:\x02\x03\0\ -\x08\x05error\x02\x03\0\x16\x08datetime\x01Br\x02\x03\x02\x01\x20\x04\0\x0cinput\ --stream\x03\0\0\x02\x03\x02\x01!\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x01\ -;\x04\0\x05error\x03\0\x04\x02\x03\x02\x01<\x04\0\x08datetime\x03\0\x06\x01w\x04\ -\0\x08filesize\x03\0\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\ -\x09directory\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescri\ -ptor-type\x03\0\x0a\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-int\ -egrity-sync\x14requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flag\ -s\x03\0\x0c\x01n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06\ -create\x09directory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\ -\0\x0alink-count\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04si\ -ze\x09\x15data-access-timestamp\x14\x1bdata-modification-timestamp\x14\x17status\ --change-timestamp\x14\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\ -\0\x03now\0\0\x09timestamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04\ -type\x0b\x04names\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-bl\ -ock\x07already\x0ebad-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-t\ -oo-large\x15illegal-byte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\ -\x0cis-directory\x04loop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09n\ -o-device\x08no-entry\x07no-lock\x13insufficient-memory\x12insufficient-space\x0d\ -not-directory\x09not-empty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-suc\ -h-device\x08overflow\x0dnot-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0ete\ -xt-file-busy\x0ccross-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0a\ -sequential\x06random\x09will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\ -\x1d\x01r\x02\x05lowerw\x05upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0a\ -descriptor\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.write-via-stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]desc\ -riptor.append-via-stream\x01*\x01j\0\x01\x1c\x01@\x04\x04self#\x06offset\x09\x06\ -length\x09\x06advice\x1e\0+\x04\0\x19[method]descriptor.advise\x01,\x01@\x01\x04\ -self#\0+\x04\0\x1c[method]descriptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\ -\x04self#\0.\x04\0\x1c[method]descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01\ -@\x01\x04self#\00\x04\0\x1b[method]descriptor.get-type\x011\x01@\x02\x04self#\x04\ -size\x09\0+\x04\0\x1b[method]descriptor.set-size\x012\x01@\x03\x04self#\x15data-\ -access-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1c[method]desc\ -riptor.set-times\x013\x01p}\x01o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\x04self#\x06\ -length\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.w\ -rite\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#\x04\ -paths\0+\x04\0&[method]descriptor.create-directory-at\x01=\x01j\x01\x16\x01\x1c\x01\ -@\x01\x04self#\0>\x04\0\x17[method]descriptor.stat\x01?\x01@\x03\x04self#\x0apat\ -h-flags\x0f\x04paths\0>\x04\0\x1a[method]descriptor.stat-at\x01@\x01@\x05\x04sel\ -f#\x0apath-flags\x0f\x04paths\x15data-access-timestamp\x18\x1bdata-modification-\ -timestamp\x18\0+\x04\0\x1f[method]descriptor.set-times-at\x01A\x01@\x05\x04self#\ -\x0eold-path-flags\x0f\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a\ -[method]descriptor.link-at\x01B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0a\ -path-flags\x0f\x04paths\x0aopen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]\ -descriptor.open-at\x01E\x01j\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\ -\0\x1e[method]descriptor.readlink-at\x01G\x04\0&[method]descriptor.remove-direct\ -ory-at\x01=\x01@\x04\x04self#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\ -\0\x1c[method]descriptor.rename-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-pa\ -ths\0+\x04\0\x1d[method]descriptor.symlink-at\x01I\x04\0![method]descriptor.unli\ -nk-file-at\x01=\x01@\x02\x04self#\x05other#\0\x7f\x04\0![method]descriptor.is-sa\ -me-object\x01J\x01j\x01\x20\x01\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\x20[method]d\ -escriptor.metadata-hash\x01L\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\ -\x04\0#[method]descriptor.metadata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\ -\x1c\x01@\x01\x04self\xce\0\0\xd0\0\x04\03[method]directory-entry-stream.read-di\ -rectory-entry\x01Q\x01h\x05\x01k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15file\ -system-error-code\x01T\x03\0\x1bwasi:filesystem/types@0.2.0\x05=\x02\x03\0\x17\x0a\ -descriptor\x01B\x07\x02\x03\x02\x01>\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\ -\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\x03\0\x1ewasi:files\ -ystem/preopens@0.2.0\x05?\x01B\x11\x04\0\x07network\x03\x01\x01m\x15\x07unknown\x0d\ -access-denied\x0dnot-supported\x10invalid-argument\x0dout-of-memory\x07timeout\x14\ -concurrency-conflict\x0fnot-in-progress\x0bwould-block\x0dinvalid-state\x10new-s\ -ocket-limit\x14address-not-bindable\x0eaddress-in-use\x12remote-unreachable\x12c\ -onnection-refused\x10connection-reset\x12connection-aborted\x12datagram-too-larg\ -e\x11name-unresolvable\x1atemporary-resolver-failure\x1apermanent-resolver-failu\ -re\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04ipv4\x04ipv6\x04\0\x11ip-address-fa\ -mily\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-address\x03\0\x05\x01o\x08{{{{{{{{\x04\ -\0\x0cipv6-address\x03\0\x07\x01q\x02\x04ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0a\ -ip-address\x03\0\x09\x01r\x02\x04port{\x07address\x06\x04\0\x13ipv4-socket-addre\ -ss\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07address\x08\x08scope-idy\x04\0\x13\ -ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\ -\x11ip-socket-address\x03\0\x0f\x03\0\x1awasi:sockets/network@0.2.0\x05@\x02\x03\ -\0\x19\x07network\x01B\x05\x02\x03\x02\x01A\x04\0\x07network\x03\0\0\x01i\x01\x01\ -@\0\0\x02\x04\0\x10instance-network\x01\x03\x03\0#wasi:sockets/instance-network@\ -0.2.0\x05B\x02\x03\0\x19\x0aerror-code\x02\x03\0\x19\x11ip-socket-address\x02\x03\ -\0\x19\x11ip-address-family\x01BD\x02\x03\x02\x01\x1a\x04\0\x08pollable\x03\0\0\x02\ -\x03\x02\x01A\x04\0\x07network\x03\0\x02\x02\x03\x02\x01C\x04\0\x0aerror-code\x03\ -\0\x04\x02\x03\x02\x01D\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01E\x04\ -\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-address\x07\ -\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0eremote-ad\ -dress\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\x01\ -h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dlocal-addre\ -ss\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\ -\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\x01o\x02\ -\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\0\x1b\x04\ -\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04self\x13\ -\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]udp-socke\ -t.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-socket.add\ -ress-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[method]u\ -dp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\0([met\ -hod]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04self\x13\ -\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\x05va\ -luew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[method]u\ -dp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-size\x01\ -%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01'\x01\ -h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0([met\ -hod]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[method]inc\ -oming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[method\ -]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09datagram\ -s/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\x04\0\ -*[method]outgoing-datagram-stream.subscribe\x011\x03\0\x16wasi:sockets/udp@0.2.0\ -\x05F\x02\x03\0\x1b\x0audp-socket\x01B\x0c\x02\x03\x02\x01A\x04\0\x07network\x03\ -\0\0\x02\x03\x02\x01C\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01E\x04\0\x11ip\ --address-family\x03\0\x04\x02\x03\x02\x01G\x04\0\x0audp-socket\x03\0\x06\x01i\x07\ -\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-udp-s\ -ocket\x01\x0a\x03\0$wasi:sockets/udp-create-socket@0.2.0\x05H\x01BT\x02\x03\x02\x01\ -\x20\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01!\x04\0\x0doutput-stream\x03\0\ -\x02\x02\x03\x02\x01\x1a\x04\0\x08pollable\x03\0\x04\x02\x03\x02\x01\x1f\x04\0\x08\ -duration\x03\0\x06\x02\x03\x02\x01A\x04\0\x07network\x03\0\x08\x02\x03\x02\x01C\x04\ -\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01D\x04\0\x11ip-socket-address\x03\0\x0c\ -\x02\x03\x02\x01E\x04\0\x11ip-address-family\x03\0\x0e\x01m\x03\x07receive\x04se\ -nd\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\0\x0atcp-socket\x03\x01\x01h\x12\ -\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07network\x14\x0dlocal-address\x0d\ -\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\ -\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01@\x03\x04self\x13\x07network\ -\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]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.sta\ -rt-listen\x01\x17\x04\0\x20[method]tcp-socket.finish-listen\x01\x17\x01i\x12\x01\ -o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04self\x13\0\x20\x04\0\x19[meth\ -od]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]tcp-socket.address-family\x01%\x01@\x02\x04self\ -\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-listen-backlog-size\x01&\x01j\x01\ -\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[method]tcp-socket.keep-alive-enabled\ -\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\0)[method]tcp-socket.set-keep-\ -alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04self\x13\0*\x04\0'[method]tc\ -p-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\x05value\x07\0\x15\x04\0\ -+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0&[method]tcp-socket.keep-\ -alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-alive-interval\x01,\x01j\x01\ -y\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-co\ -unt\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\0\x1c[method]tcp-socket.h\ -op-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\0\x20[method]tcp-socket.s\ -et-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\03\x04\0&[method]tcp-so\ -cket.receive-buffer-size\x014\x04\0*[method]tcp-socket.set-receive-buffer-size\x01\ -&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0'[method]tcp-socket.set-se\ -nd-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\0\x1c[method]tcp-socket\ -.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\0\x15\x04\0\x1b[method\ -]tcp-socket.shutdown\x017\x03\0\x16wasi:sockets/tcp@0.2.0\x05I\x02\x03\0\x1d\x0a\ -tcp-socket\x01B\x0c\x02\x03\x02\x01A\x04\0\x07network\x03\0\0\x02\x03\x02\x01C\x04\ -\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01E\x04\0\x11ip-address-family\x03\0\x04\ -\x02\x03\x02\x01J\x04\0\x0atcp-socket\x03\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01\ -@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-tcp-socket\x01\x0a\x03\0$wasi:\ -sockets/tcp-create-socket@0.2.0\x05K\x02\x03\0\x19\x0aip-address\x01B\x16\x02\x03\ -\x02\x01\x1a\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01A\x04\0\x07network\x03\0\x02\ -\x02\x03\x02\x01C\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01L\x04\0\x0aip-add\ -ress\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.res\ -olve-next-address\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]reso\ -lve-address-stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\ -\x02\x07network\x0f\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x03\0!wasi\ -:sockets/ip-name-lookup@0.2.0\x05M\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x10\ -get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\0\x18wasi\ -:random/random@0.2.0\x05N\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x19get-insec\ -ure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure-random-u64\x01\x02\x03\0\ -\x1awasi:random/insecure@0.2.0\x05O\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\0\x0dinse\ -cure-seed\x01\x01\x03\0\x1fwasi:random/insecure-seed@0.2.0\x05P\x01B\x1c\x01q\x03\ -\x0dno-such-store\0\0\x0daccess-denied\0\0\x05other\x01s\0\x04\0\x05error\x03\0\0\ -\x01ps\x01ks\x01r\x02\x04keys\x02\x06cursor\x03\x04\0\x0ckey-response\x03\0\x04\x04\ -\0\x06bucket\x03\x01\x01h\x06\x01p}\x01k\x08\x01j\x01\x09\x01\x01\x01@\x02\x04se\ -lf\x07\x03keys\0\x0a\x04\0\x12[method]bucket.get\x01\x0b\x01j\0\x01\x01\x01@\x03\ -\x04self\x07\x03keys\x05value\x08\0\x0c\x04\0\x12[method]bucket.set\x01\x0d\x01@\ -\x02\x04self\x07\x03keys\0\x0c\x04\0\x15[method]bucket.delete\x01\x0e\x01j\x01\x7f\ -\x01\x01\x01@\x02\x04self\x07\x03keys\0\x0f\x04\0\x15[method]bucket.exists\x01\x10\ -\x01j\x01\x05\x01\x01\x01@\x02\x04self\x07\x06cursor\x03\0\x11\x04\0\x18[method]\ -bucket.list-keys\x01\x12\x01i\x06\x01j\x01\x13\x01\x01\x01@\x01\x0aidentifiers\0\ -\x14\x04\0\x04open\x01\x15\x03\0\x20wasi:keyvalue/store@0.2.0-draft2\x05Q\x02\x03\ -\0#\x06bucket\x02\x03\0#\x05error\x01B\x18\x02\x03\x02\x01R\x04\0\x06bucket\x03\0\ -\0\x02\x03\x02\x01S\x04\0\x05error\x03\0\x02\x04\0\x03cas\x03\x01\x01i\x04\x01q\x02\ -\x0bstore-error\x01\x03\0\x0acas-failed\x01\x05\0\x04\0\x09cas-error\x03\0\x06\x01\ -h\x01\x01j\x01\x05\x01\x03\x01@\x02\x06bucket\x08\x03keys\0\x09\x04\0\x0f[static\ -]cas.new\x01\x0a\x01h\x04\x01p}\x01k\x0c\x01j\x01\x0d\x01\x03\x01@\x01\x04self\x0b\ -\0\x0e\x04\0\x13[method]cas.current\x01\x0f\x01j\x01x\x01\x03\x01@\x03\x06bucket\ -\x08\x03keys\x05deltax\0\x10\x04\0\x09increment\x01\x11\x01j\0\x01\x07\x01@\x02\x03\ -cas\x05\x05value\x0c\0\x12\x04\0\x04swap\x01\x13\x03\0\"wasi:keyvalue/atomics@0.\ -2.0-draft2\x05T\x01B\x13\x02\x03\x02\x01R\x04\0\x06bucket\x03\0\0\x02\x03\x02\x01\ -S\x04\0\x05error\x03\0\x02\x01h\x01\x01ps\x01p}\x01o\x02s\x06\x01k\x07\x01p\x08\x01\ -j\x01\x09\x01\x03\x01@\x02\x06bucket\x04\x04keys\x05\0\x0a\x04\0\x08get-many\x01\ -\x0b\x01p\x07\x01j\0\x01\x03\x01@\x02\x06bucket\x04\x0akey-values\x0c\0\x0d\x04\0\ -\x08set-many\x01\x0e\x01@\x02\x06bucket\x04\x04keys\x05\0\x0d\x04\0\x0bdelete-ma\ -ny\x01\x0f\x03\0\x20wasi:keyvalue/batch@0.2.0-draft2\x05U\x01p\x16\x01j\x01\xd6\0\ -\x01s\x01@\x01\x06packet\x14\0\xd7\0\x04\0\x0eprocess-packet\x01X\x04\0\x15handl\ -e-timer-callback\x01X\x01j\x01\x18\x01s\x01j\0\x01s\x01@\x02\x06packet\x14\x09tx\ --result\xd9\0\0\xda\0\x04\0\x16handle-submit-callback\x01[\x04\0&wavs:aggregator\ -/aggregator-world@1.3.0\x04\0\x0b\x16\x01\0\x10aggregator-world\x03\0\0\0G\x09pr\ -oducers\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\x06\ -0.41.0"; -#[inline(never)] -#[doc(hidden)] -pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); -} +wit_bindgen::generate!({ + world: "aggregator-world", + path: "../../wit-aggregator", + pub_export_macro: true, + generate_all, + features: ["tls"], +}); diff --git a/components/aggregator/src/lib.rs b/components/aggregator/src/lib.rs index db6429b2..d30972b1 100644 --- a/components/aggregator/src/lib.rs +++ b/components/aggregator/src/lib.rs @@ -10,10 +10,17 @@ use wavs_wasi_utils::impl_u128_conversions; use crate::bindings::{ export, host, wavs::{ - aggregator::aggregator::{EvmAddress, SubmitAction, TimerAction, U128}, - types::{core::Duration, service::Submit}, + aggregator::{ + input::AggregatorInput, + output::{AggregatorAction, EvmAddress, EvmSubmitAction, SubmitAction, TimerAction}, + }, + types::{ + chain::AnyTxHash, + core::{Duration, U128}, + service::Submit, + }, }, - AggregatorAction, AnyTxHash, Guest, Packet, + Guest, }; impl_u128_conversions!(U128); @@ -21,7 +28,7 @@ impl_u128_conversions!(U128); struct Component; impl Guest for Component { - fn process_packet(packet: Packet) -> Result, String> { + fn process_input(input: AggregatorInput) -> Result, String> { let timer_delay_secs = host::config_var("timer_delay_secs") .map(|delay_str| { delay_str.parse().map_err(|e| format!("Failed to parse timer_delay_secs: {e}")) @@ -36,17 +43,17 @@ impl Guest for Component { } None => { // No timer delay - process immediately (skip tx validation) - process_submission(packet, false) + process_submission(input, false) } } } - fn handle_timer_callback(packet: Packet) -> Result, String> { - process_submission(packet, true) + fn handle_timer_callback(input: AggregatorInput) -> Result, String> { + process_submission(input, true) } fn handle_submit_callback( - _packet: Packet, + _input: AggregatorInput, tx_result: Result, ) -> Result<(), String> { match tx_result { @@ -56,7 +63,10 @@ impl Guest for Component { } } -fn process_submission(packet: Packet, validate_tx: bool) -> Result, String> { +fn process_submission( + input: AggregatorInput, + validate_tx: bool, +) -> Result, String> { let workflow = host::get_workflow().workflow; let submit_config = match workflow.submit { @@ -70,7 +80,7 @@ fn process_submission(packet: Packet, validate_tx: bool) -> Result Result Result { diff --git a/components/evm-price-oracle/Cargo.toml b/components/evm-price-oracle/Cargo.toml index d62bcfb6..89ebea00 100644 --- a/components/evm-price-oracle/Cargo.toml +++ b/components/evm-price-oracle/Cargo.toml @@ -7,7 +7,7 @@ rust-version.workspace = true repository.workspace = true [dependencies] -wit-bindgen-rt ={ workspace = true } +wit-bindgen = { workspace = true } wavs-wasi-utils = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } @@ -28,4 +28,3 @@ lto = true [package.metadata.component] package = "component:evm-price-oracle" -target = "wavs:operator@=1.2.0" diff --git a/components/evm-price-oracle/src/bindings.rs b/components/evm-price-oracle/src/bindings.rs index 085beeea..c48d018c 100644 --- a/components/evm-price-oracle/src/bindings.rs +++ b/components/evm-price-oracle/src/bindings.rs @@ -1,20829 +1,8 @@ -// Generated by `wit-bindgen` 0.41.0. DO NOT EDIT! -// Options used: -// * runtime_path: "wit_bindgen_rt" -pub type TriggerAction = wavs::operator::input::TriggerAction; -pub type WasmResponse = wavs::operator::output::WasmResponse; -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn _export_run_cabi(arg0: *mut u8) -> *mut u8 { - #[cfg(target_arch = "wasm32")] _rt::run_ctors_once(); - let l0 = *arg0.add(0).cast::<*mut u8>(); - let l1 = *arg0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len2 = l1; - let bytes2 = _rt::Vec::from_raw_parts(l0.cast(), len2, len2); - let l3 = *arg0.add(2 * ::core::mem::size_of::<*const u8>()).cast::<*mut u8>(); - let l4 = *arg0.add(3 * ::core::mem::size_of::<*const u8>()).cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - let l6 = i32::from(*arg0.add(4 * ::core::mem::size_of::<*const u8>()).cast::()); - use wavs::types::service::Trigger as V41; - let v41 = match l6 { - 0 => { - let e41 = { - let l7 = *arg0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *arg0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let l10 = *arg0 - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l11 = *arg0 - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len12 = l11; - let bytes12 = _rt::Vec::from_raw_parts(l10.cast(), len12, len12); - let l13 = *arg0 - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l14 = *arg0 - .add(8 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len15 = l14; - wavs::types::service::TriggerEvmContractEvent { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l7.cast(), len9, len9), - }, - chain: _rt::string_lift(bytes12), - event_hash: _rt::Vec::from_raw_parts(l13.cast(), len15, len15), - } - }; - V41::EvmContractEvent(e41) - } - 1 => { - let e41 = { - let l16 = *arg0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *arg0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); - let l19 = *arg0 - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l20 = *arg0 - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l21 = *arg0 - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len22 = l21; - let bytes22 = _rt::Vec::from_raw_parts(l20.cast(), len22, len22); - let l23 = *arg0 - .add(8 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l24 = *arg0 - .add(8 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len25 = l24; - let bytes25 = _rt::Vec::from_raw_parts(l23.cast(), len25, len25); - wavs::types::service::TriggerCosmosContractEvent { - address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes18), - prefix_len: l19 as u32, - }, - chain: _rt::string_lift(bytes22), - event_type: _rt::string_lift(bytes25), - } - }; - V41::CosmosContractEvent(e41) - } - 2 => { - let e41 = { - let l26 = *arg0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l27 = *arg0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len28 = l27; - let bytes28 = _rt::Vec::from_raw_parts(l26.cast(), len28, len28); - let l29 = *arg0 - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l30 = i32::from( - *arg0.add(16 + 6 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l32 = i32::from( - *arg0.add(32 + 6 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes28), - n_blocks: l29 as u32, - start_block: match l30 { - 0 => None, - 1 => { - let e = { - let l31 = *arg0 - .add(24 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l31 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *arg0 - .add(40 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l33 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V41::BlockInterval(e41) - } - 3 => { - let e41 = { - let l34 = *arg0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l35 = *arg0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len36 = l35; - let bytes36 = _rt::Vec::from_raw_parts(l34.cast(), len36, len36); - let l37 = i32::from( - *arg0.add(8 + 6 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l39 = i32::from( - *arg0.add(24 + 6 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes36), - start_time: match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *arg0 - .add(16 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l38 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *arg0 - .add(32 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::core::Timestamp { - nanos: l40 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V41::Cron(e41) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V41::Manual - } - }; - let l42 = i32::from( - *arg0.add(48 + 6 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use wavs::types::events::TriggerData as V98; - let v98 = match l42 { - 0 => { - let e98 = { - let l43 = *arg0 - .add(56 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l44 = *arg0 - .add(56 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len45 = l44; - let bytes45 = _rt::Vec::from_raw_parts(l43.cast(), len45, len45); - let l46 = *arg0 - .add(56 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l47 = *arg0 - .add(56 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len48 = l47; - let l49 = *arg0 - .add(56 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l50 = *arg0 - .add(56 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base54 = l49; - let len54 = l50; - let mut result54 = _rt::Vec::with_capacity(len54); - for i in 0..len54 { - let base = base54.add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e54 = { - let l51 = *base.add(0).cast::<*mut u8>(); - let l52 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len53 = l52; - _rt::Vec::from_raw_parts(l51.cast(), len53, len53) - }; - result54.push(e54); - } - _rt::cabi_dealloc( - base54, - len54 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l55 = *arg0 - .add(56 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l56 = *arg0 - .add(56 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len57 = l56; - let l58 = *arg0 - .add(56 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l59 = *arg0 - .add(56 + 15 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len60 = l59; - let l61 = *arg0 - .add(56 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l62 = *arg0 - .add(64 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l63 = *arg0 - .add(72 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l64 = *arg0 - .add(72 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len65 = l64; - let l66 = i32::from( - *arg0.add(72 + 18 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l68 = *arg0 - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataEvmContractEvent { - chain: _rt::string_lift(bytes45), - log: wavs::types::chain::EvmEventLog { - address: wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l46.cast(), len48, len48), - }, - data: wavs::types::chain::EvmEventLogData { - topics: result54, - data: _rt::Vec::from_raw_parts(l55.cast(), len57, len57), - }, - tx_hash: _rt::Vec::from_raw_parts(l58.cast(), len60, len60), - block_number: l61 as u64, - log_index: l62 as u64, - block_hash: _rt::Vec::from_raw_parts(l63.cast(), len65, len65), - block_timestamp: match l66 { - 0 => None, - 1 => { - let e = { - let l67 = *arg0 - .add(80 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l67 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - tx_index: l68 as u64, - }, - } - }; - V98::EvmContractEvent(e98) - } - 1 => { - let e98 = { - let l69 = *arg0 - .add(56 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l70 = *arg0 - .add(56 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len71 = l70; - let bytes71 = _rt::Vec::from_raw_parts(l69.cast(), len71, len71); - let l72 = *arg0 - .add(56 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l73 = *arg0 - .add(56 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l74 = *arg0 - .add(56 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len75 = l74; - let bytes75 = _rt::Vec::from_raw_parts(l73.cast(), len75, len75); - let l76 = *arg0 - .add(56 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l77 = *arg0 - .add(56 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len78 = l77; - let bytes78 = _rt::Vec::from_raw_parts(l76.cast(), len78, len78); - let l79 = *arg0 - .add(56 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l80 = *arg0 - .add(56 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base87 = l79; - let len87 = l80; - let mut result87 = _rt::Vec::with_capacity(len87); - for i in 0..len87 { - let base = base87.add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e87 = { - let l81 = *base.add(0).cast::<*mut u8>(); - let l82 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len83 = l82; - let bytes83 = _rt::Vec::from_raw_parts(l81.cast(), len83, len83); - let l84 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l85 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len86 = l85; - let bytes86 = _rt::Vec::from_raw_parts(l84.cast(), len86, len86); - (_rt::string_lift(bytes83), _rt::string_lift(bytes86)) - }; - result87.push(e87); - } - _rt::cabi_dealloc( - base87, - len87 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l88 = *arg0 - .add(64 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l89 = *arg0 - .add(72 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCosmosContractEvent { - contract_address: wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes71), - prefix_len: l72 as u32, - }, - chain: _rt::string_lift(bytes75), - event: wavs::types::chain::CosmosEvent { - ty: _rt::string_lift(bytes78), - attributes: result87, - }, - event_index: l88 as u64, - block_height: l89 as u64, - } - }; - V98::CosmosContractEvent(e98) - } - 2 => { - let e98 = { - let l90 = *arg0 - .add(56 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l91 = *arg0 - .add(56 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len92 = l91; - let bytes92 = _rt::Vec::from_raw_parts(l90.cast(), len92, len92); - let l93 = *arg0 - .add(56 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataBlockInterval { - chain: _rt::string_lift(bytes92), - block_height: l93 as u64, - } - }; - V98::BlockInterval(e98) - } - 3 => { - let e98 = { - let l94 = *arg0 - .add(56 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - wavs::types::events::TriggerDataCron { - trigger_time: wavs::types::core::Timestamp { - nanos: l94 as u64, - }, - } - }; - V98::Cron(e98) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - let e98 = { - let l95 = *arg0 - .add(56 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l96 = *arg0 - .add(56 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len97 = l96; - _rt::Vec::from_raw_parts(l95.cast(), len97, len97) - }; - V98::Raw(e98) - } - }; - let result99 = T::run(wavs::operator::input::TriggerAction { - config: wavs::operator::input::TriggerConfig { - service_id: _rt::string_lift(bytes2), - workflow_id: _rt::string_lift(bytes5), - trigger: v41, - }, - data: v98, - }); - _rt::cabi_dealloc(arg0, 96 + 18 * ::core::mem::size_of::<*const u8>(), 8); - let ptr100 = (&raw mut _RET_AREA.0).cast::(); - match result99 { - Ok(e) => { - *ptr100.add(0).cast::() = (0i32) as u8; - match e { - Some(e) => { - *ptr100.add(8).cast::() = (1i32) as u8; - let wavs::operator::output::WasmResponse { - payload: payload101, - ordering: ordering101, - } = e; - let vec102 = (payload101).into_boxed_slice(); - let ptr102 = vec102.as_ptr().cast::(); - let len102 = vec102.len(); - ::core::mem::forget(vec102); - *ptr100 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::() = len102; - *ptr100.add(16).cast::<*mut u8>() = ptr102.cast_mut(); - match ordering101 { - Some(e) => { - *ptr100 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - *ptr100 - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i64(e); - } - None => { - *ptr100 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - } - }; - } - None => { - *ptr100.add(8).cast::() = (0i32) as u8; - } - }; - } - Err(e) => { - *ptr100.add(0).cast::() = (1i32) as u8; - let vec103 = (e.into_bytes()).into_boxed_slice(); - let ptr103 = vec103.as_ptr().cast::(); - let len103 = vec103.len(); - ::core::mem::forget(vec103); - *ptr100.add(8 + 1 * ::core::mem::size_of::<*const u8>()).cast::() = len103; - *ptr100.add(8).cast::<*mut u8>() = ptr103.cast_mut(); - } - }; - ptr100 -} -#[doc(hidden)] -#[allow(non_snake_case)] -pub unsafe fn __post_return_run(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(16).cast::<*mut u8>(); - let l3 = *arg0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base4 = l2; - let len4 = l3; - _rt::cabi_dealloc(base4, len4 * 1, 1); - } - } - } - _ => { - let l5 = *arg0.add(8).cast::<*mut u8>(); - let l6 = *arg0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - _rt::cabi_dealloc(l5, l6, 1); - } - } -} -pub trait Guest { - fn run(trigger_action: TriggerAction) -> Result, _rt::String>; -} -#[doc(hidden)] -macro_rules! __export_world_wavs_world_cabi { - ($ty:ident with_types_in $($path_to_types:tt)*) => { - const _ : () = { #[unsafe (export_name = "run")] unsafe extern "C" fn - export_run(arg0 : * mut u8,) -> * mut u8 { unsafe { $($path_to_types)*:: - _export_run_cabi::<$ty > (arg0) } } #[unsafe (export_name = "cabi_post_run")] - unsafe extern "C" fn _post_return_run(arg0 : * mut u8,) { unsafe { - $($path_to_types)*:: __post_return_run::<$ty > (arg0) } } }; - }; -} -#[doc(hidden)] -pub(crate) use __export_world_wavs_world_cabi; -#[repr(align(8))] -struct _RetArea( - [::core::mem::MaybeUninit; 32 + 2 * ::core::mem::size_of::<*const u8>()], -); -static mut _RET_AREA: _RetArea = _RetArea( - [::core::mem::MaybeUninit::uninit(); 32 + 2 * ::core::mem::size_of::<*const u8>()], -); #[rustfmt::skip] -#[allow(dead_code, clippy::all)] -pub mod wasi { - pub mod cli { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod environment { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn get_environment() -> _rt::Vec<(_rt::String, _rt::String)> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] - unsafe extern "C" { - #[link_name = "get-environment"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base10 = l2; - let len10 = l3; - let mut result10 = _rt::Vec::with_capacity(len10); - for i in 0..len10 { - let base = base10 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e10 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - (_rt::string_lift(bytes6), _rt::string_lift(bytes9)) - }; - result10.push(e10); - } - _rt::cabi_dealloc( - base10, - len10 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result11 = result10; - result11 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_arguments() -> _rt::Vec<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] - unsafe extern "C" { - #[link_name = "get-arguments"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .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 * (2 * ::core::mem::size_of::<*const u8>())); - let e7 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - _rt::string_lift(bytes6) - }; - result7.push(e7); - } - _rt::cabi_dealloc( - base7, - len7 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result8 = result7; - result8 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn initial_cwd() -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/environment@0.2.0")] - unsafe extern "C" { - #[link_name = "initial-cwd"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod exit { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - #[allow(unused_unsafe, clippy::all)] - pub fn exit(status: Result<(), ()>) -> () { - unsafe { - let result0 = match status { - Ok(_) => 0i32, - Err(_) => 1i32, - }; - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/exit@0.2.0")] - unsafe extern "C" { - #[link_name = "exit"] - fn wit_import1(_: i32); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32) { - unreachable!() - } - unsafe { wit_import1(result0) }; - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod stdin { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - #[allow(unused_unsafe, clippy::all)] - pub fn get_stdin() -> InputStream { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stdin@0.2.0")] - unsafe extern "C" { - #[link_name = "get-stdin"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod stdout { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - #[allow(unused_unsafe, clippy::all)] - pub fn get_stdout() -> OutputStream { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stdout@0.2.0")] - unsafe extern "C" { - #[link_name = "get-stdout"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod stderr { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - #[allow(unused_unsafe, clippy::all)] - pub fn get_stderr() -> OutputStream { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:cli/stderr@0.2.0")] - unsafe extern "C" { - #[link_name = "get-stderr"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_input { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Debug)] - #[repr(transparent)] - pub struct TerminalInput { - handle: _rt::Resource, - } - impl TerminalInput { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for TerminalInput { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:cli/terminal-input@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]terminal-input"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_output { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Debug)] - #[repr(transparent)] - pub struct TerminalOutput { - handle: _rt::Resource, - } - impl TerminalOutput { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for TerminalOutput { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:cli/terminal-output@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]terminal-output"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_stdin { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type TerminalInput = super::super::super::wasi::cli::terminal_input::TerminalInput; - #[allow(unused_unsafe, clippy::all)] - pub fn get_terminal_stdin() -> Option { - 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:cli/terminal-stdin@0.2.0")] - unsafe extern "C" { - #[link_name = "get-terminal-stdin"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::cli::terminal_input::TerminalInput::from_handle( - l3 as u32, - ) - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_stdout { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput; - #[allow(unused_unsafe, clippy::all)] - pub fn get_terminal_stdout() -> Option { - 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:cli/terminal-stdout@0.2.0")] - unsafe extern "C" { - #[link_name = "get-terminal-stdout"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( - l3 as u32, - ) - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod terminal_stderr { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type TerminalOutput = super::super::super::wasi::cli::terminal_output::TerminalOutput; - #[allow(unused_unsafe, clippy::all)] - pub fn get_terminal_stderr() -> Option { - 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:cli/terminal-stderr@0.2.0")] - unsafe extern "C" { - #[link_name = "get-terminal-stderr"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::cli::terminal_output::TerminalOutput::from_handle( - l3 as u32, - ) - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - } - pub mod clocks { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod monotonic_clock { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type 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")] - unsafe extern "C" { - #[link_name = "now"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - 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")] - unsafe extern "C" { - #[link_name = "resolution"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - 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")] - unsafe extern "C" { - #[link_name = "subscribe-instant"] - fn wit_import0(_: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i64) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0(_rt::as_i64(when)) }; - unsafe { - super::super::super::wasi::io::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")] - unsafe extern "C" { - #[link_name = "subscribe-duration"] - fn wit_import0(_: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i64) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0(_rt::as_i64(when)) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod wall_clock { - #[used] - #[doc(hidden)] - 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")] - unsafe extern "C" { - #[link_name = "now"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::(); - let l3 = *ptr0.add(8).cast::(); - let result4 = Datetime { - seconds: l2 as u64, - nanoseconds: l3 as u32, - }; - result4 - } - } - #[allow(unused_unsafe, clippy::all)] - 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")] - unsafe extern "C" { - #[link_name = "resolution"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::(); - let l3 = *ptr0.add(8).cast::(); - let result4 = Datetime { - seconds: l2 as u64, - nanoseconds: l3 as u32, - }; - result4 - } - } - } - } - pub mod filesystem { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - pub type Error = super::super::super::wasi::io::streams::Error; - pub type Datetime = super::super::super::wasi::clocks::wall_clock::Datetime; - pub type Filesize = u64; - #[repr(u8)] - #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] - 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, Ord, PartialEq, PartialOrd)] - 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, Ord, PartialEq, PartialOrd)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]descriptor"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]directory-entry-stream"] - fn drop(_: u32); - } - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.read-via-stream"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(offset), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.write-via-stream"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(offset), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.append-via-stream"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.advise"] - fn wit_import1(_: i32, _: i64, _: i64, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i64, - _: i64, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(offset), - _rt::as_i64(length), - advice.clone() as i32, - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.sync-data"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.get-flags"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - DescriptorFlags::empty() - | DescriptorFlags::from_bits_retain(((l3 as u8) << 0) as _) - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.get-type"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - DescriptorType::_lift(l3 as u8) - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.set-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(size), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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::clocks::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::clocks::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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.set-times"] - fn wit_import5( - _: i32, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: i32, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import5( - (self).handle() as i32, - result1_0, - result1_1, - result1_2, - result3_0, - result3_1, - result3_2, - ptr4, - ) - }; - let l6 = i32::from(*ptr4.add(0).cast::()); - let result8 = match l6 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from(*ptr4.add(1).cast::()); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - impl Descriptor { - #[allow(unused_unsafe, clippy::all)] - pub fn read( - &self, - length: Filesize, - offset: Filesize, - ) -> Result<(_rt::Vec, bool), ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]descriptor.read"] - fn wit_import1(_: i32, _: i64, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i64, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(length), - _rt::as_i64(offset), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result8 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let l6 = i32::from( - *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - ( - _rt::Vec::from_raw_parts(l3.cast(), len5, len5), - _rt::bool_lift(l6 as u8), - ) - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.write"] - fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: i64, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - _rt::as_i64(offset), - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result6 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(8).cast::(); - l4 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(8).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.read-directory"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { DirectoryEntryStream::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.sync"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.create-directory-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result5 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.stat"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result16 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let l4 = *ptr0.add(16).cast::(); - let l5 = *ptr0.add(24).cast::(); - let l6 = i32::from(*ptr0.add(32).cast::()); - let l9 = i32::from(*ptr0.add(56).cast::()); - let l12 = i32::from(*ptr0.add(80).cast::()); - DescriptorStat { - type_: DescriptorType::_lift(l3 as u8), - link_count: l4 as u64, - size: l5 as u64, - data_access_timestamp: match l6 { - 0 => None, - 1 => { - let e = { - let l7 = *ptr0.add(40).cast::(); - let l8 = *ptr0.add(48).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l7 as u64, - nanoseconds: l8 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - data_modification_timestamp: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = *ptr0.add(64).cast::(); - let l11 = *ptr0.add(72).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l10 as u64, - nanoseconds: l11 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - status_change_timestamp: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = *ptr0.add(88).cast::(); - let l14 = *ptr0.add(96).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l13 as u64, - nanoseconds: l14 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Ok(e) - } - 1 => { - let e = { - let l15 = i32::from(*ptr0.add(8).cast::()); - ErrorCode::_lift(l15 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result16 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.stat-at"] - fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - (flags0.bits() >> 0) as i32, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result18 = match l4 { - 0 => { - let e = { - let l5 = i32::from(*ptr2.add(8).cast::()); - let l6 = *ptr2.add(16).cast::(); - let l7 = *ptr2.add(24).cast::(); - let l8 = i32::from(*ptr2.add(32).cast::()); - let l11 = i32::from(*ptr2.add(56).cast::()); - let l14 = i32::from(*ptr2.add(80).cast::()); - DescriptorStat { - type_: DescriptorType::_lift(l5 as u8), - link_count: l6 as u64, - size: l7 as u64, - data_access_timestamp: match l8 { - 0 => None, - 1 => { - let e = { - let l9 = *ptr2.add(40).cast::(); - let l10 = *ptr2.add(48).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l9 as u64, - nanoseconds: l10 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - data_modification_timestamp: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr2.add(64).cast::(); - let l13 = *ptr2.add(72).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l12 as u64, - nanoseconds: l13 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - status_change_timestamp: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = *ptr2.add(88).cast::(); - let l16 = *ptr2.add(96).cast::(); - super::super::super::wasi::clocks::wall_clock::Datetime { - seconds: l15 as u64, - nanoseconds: l16 as u32, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Ok(e) - } - 1 => { - let e = { - let l17 = i32::from(*ptr2.add(8).cast::()); - ErrorCode::_lift(l17 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result18 - } - } - } - 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::clocks::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::clocks::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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.set-times-at"] - fn wit_import7( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i64, - _: i32, - _: i32, - _: i64, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (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 l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - ErrorCode::_lift(l9 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.link-at"] - fn wit_import4( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import4( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import4( - (self).handle() as i32, - (flags0.bits() >> 0) as i32, - ptr1.cast_mut(), - len1, - (new_descriptor).handle() as i32, - ptr2.cast_mut(), - len2, - ptr3, - ) - }; - let l5 = i32::from(*ptr3.add(0).cast::()); - let result7 = match l5 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*ptr3.add(1).cast::()); - ErrorCode::_lift(l6 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.open-at"] - fn wit_import5( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import5( - (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 l6 = i32::from(*ptr4.add(0).cast::()); - let result9 = match l6 { - 0 => { - let e = { - let l7 = *ptr4.add(4).cast::(); - unsafe { Descriptor::from_handle(l7 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from(*ptr4.add(4).cast::()); - ErrorCode::_lift(l8 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - impl Descriptor { - #[allow(unused_unsafe, clippy::all)] - pub fn readlink_at(&self, path: &str) -> Result<_rt::String, ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.readlink-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result8 = match l3 { - 0 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - _rt::string_lift(bytes6) - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.remove-directory-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result5 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.rename-at"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - (new_descriptor).handle() as i32, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result6 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr2.add(1).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.symlink-at"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result6 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr2.add(1).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.unlink-file-at"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result5 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(1).cast::()); - ErrorCode::_lift(l4 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.is-same-object"] - fn wit_import0(_: i32, _: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.metadata-hash"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - let l4 = *ptr0.add(16).cast::(); - MetadataHashValue { - lower: l3 as u64, - upper: l4 as u64, - } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr0.add(8).cast::()); - ErrorCode::_lift(l5 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]descriptor.metadata-hash-at"] - fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - (flags0.bits() >> 0) as i32, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result8 = match l4 { - 0 => { - let e = { - let l5 = *ptr2.add(8).cast::(); - let l6 = *ptr2.add(16).cast::(); - MetadataHashValue { - lower: l5 as u64, - upper: l6 as u64, - } - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from(*ptr2.add(8).cast::()); - ErrorCode::_lift(l7 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - impl DirectoryEntryStream { - #[allow(unused_unsafe, clippy::all)] - pub fn read_directory_entry( - &self, - ) -> Result, ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 5 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 5 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]directory-entry-stream.read-directory-entry"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result9 = match l2 { - 0 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => None, - 1 => { - let e = { - let l4 = i32::from( - *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr0 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts( - l5.cast(), - len7, - len7, - ); - DirectoryEntry { - type_: DescriptorType::_lift(l4 as u8), - name: _rt::string_lift(bytes7), - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - ErrorCode::_lift(l8 as u8) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - #[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")] - unsafe extern "C" { - #[link_name = "filesystem-error-code"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((err).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - ErrorCode::_lift(l3 as u8) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod preopens { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Descriptor = super::super::super::wasi::filesystem::types::Descriptor; - #[allow(unused_unsafe, clippy::all)] - pub fn get_directories() -> _rt::Vec<(Descriptor, _rt::String)> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:filesystem/preopens@0.2.0")] - unsafe extern "C" { - #[link_name = "get-directories"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base8 = l2; - let len8 = l3; - let mut result8 = _rt::Vec::with_capacity(len8); - for i in 0..len8 { - let base = base8 - .add(i * (3 * ::core::mem::size_of::<*const u8>())); - let e8 = { - let l4 = *base.add(0).cast::(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts(l5.cast(), len7, len7); - ( - unsafe { - super::super::super::wasi::filesystem::types::Descriptor::from_handle( - l4 as u32, - ) - }, - _rt::string_lift(bytes7), - ) - }; - result8.push(e8); - } - _rt::cabi_dealloc( - base8, - len8 * (3 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result9 = result8; - result9 - } - } - } - } - pub mod http { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod types { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - pub type IoError = super::super::super::wasi::io::error::Error; - pub type Pollable = super::super::super::wasi::io::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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]fields"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-request"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-request"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]request-options"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]response-outparam"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-response"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-body"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]future-trailers"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-response"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-body"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]future-incoming-response"] - fn drop(_: u32); - } - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[constructor]fields"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { 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() * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - 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 * (4 * ::core::mem::size_of::<*const u8>())); - { - let (t0_0, t0_1) = e; - let vec1 = t0_0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .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(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len2; - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .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")] - unsafe extern "C" { - #[link_name = "[static]fields.from-list"] - fn wit_import5(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { wit_import5(result3, len3, ptr4) }; - let l6 = i32::from(*ptr4.add(0).cast::()); - let result10 = match l6 { - 0 => { - let e = { - let l7 = *ptr4.add(4).cast::(); - unsafe { Fields::from_handle(l7 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from(*ptr4.add(4).cast::()); - let v9 = match l8 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout3.size() != 0 { - _rt::alloc::dealloc(result3.cast(), layout3); - } - result10 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn get(&self, name: &str) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "[method]fields.get"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = *ptr1.add(0).cast::<*mut u8>(); - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base8 = l3; - let len8 = l4; - let mut result8 = _rt::Vec::with_capacity(len8); - for i in 0..len8 { - let base = base8 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e8 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - _rt::Vec::from_raw_parts(l5.cast(), len7, len7) - }; - result8.push(e8); - } - _rt::cabi_dealloc( - base8, - len8 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result9 = result8; - result9 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn has(&self, name: &str) -> bool { - unsafe { - let vec0 = name; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]fields.has"] - fn wit_import1(_: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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: &str, - value: &[FieldValue], - ) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let 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() * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - 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 * (2 * ::core::mem::size_of::<*const u8>())); - { - let vec1 = e; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .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")] - unsafe extern "C" { - #[link_name = "[method]fields.set"] - fn wit_import4( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import4( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import4( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - result2, - len2, - ptr3, - ) - }; - let l5 = i32::from(*ptr3.add(0).cast::()); - let result8 = match l5 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*ptr3.add(1).cast::()); - let v7 = match l6 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - v7 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout2.size() != 0 { - _rt::alloc::dealloc(result2.cast(), layout2); - } - result8 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn delete(&self, name: &str) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let 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")] - unsafe extern "C" { - #[link_name = "[method]fields.delete"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result6 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.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(), - }; - result6 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn append( - &self, - name: &str, - value: &[u8], - ) -> Result<(), HeaderError> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let vec0 = name; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - let vec1 = value; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]fields.append"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result7 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr2.add(1).cast::()); - let v6 = match l5 { - 0 => HeaderError::InvalidSyntax, - 1 => HeaderError::Forbidden, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - HeaderError::Immutable - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - impl Fields { - #[allow(unused_unsafe, clippy::all)] - pub fn entries(&self) -> _rt::Vec<(FieldKey, FieldValue)> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]fields.entries"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let base10 = l2; - let len10 = l3; - let mut result10 = _rt::Vec::with_capacity(len10); - for i in 0..len10 { - let base = base10 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e10 = { - let l4 = *base.add(0).cast::<*mut u8>(); - let l5 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - let l7 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - ( - _rt::string_lift(bytes6), - _rt::Vec::from_raw_parts(l7.cast(), len9, len9), - ) - }; - result10.push(e10); - } - _rt::cabi_dealloc( - base10, - len10 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result11 = result10; - result11 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]fields.clone"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { Fields::from_handle(ret as u32) } - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn method(&self) -> Method { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.method"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let v6 = match l2 { - 0 => Method::Get, - 1 => Method::Head, - 2 => Method::Post, - 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 e6 = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Method::Other(e6) - } - }; - let result7 = v6; - result7 - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn path_with_query(&self) -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.path-with-query"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn scheme(&self) -> Option { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.scheme"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result8 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v7 = match l3 { - 0 => Scheme::Http, - 1 => Scheme::Https, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e7 = { - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - _rt::string_lift(bytes6) - }; - Scheme::Other(e7) - } - }; - v7 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - impl IncomingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn authority(&self) -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.authority"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-request.consume"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { IncomingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[constructor]outgoing-request"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((&headers).take_handle() as i32) - }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.body"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { OutgoingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl OutgoingRequest { - #[allow(unused_unsafe, clippy::all)] - pub fn method(&self) -> Method { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.method"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let v6 = match l2 { - 0 => Method::Get, - 1 => Method::Head, - 2 => Method::Post, - 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 e6 = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Method::Other(e6) - } - }; - let result7 = v6; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-method"] - fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import2( - (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 { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.path-with-query"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl OutgoingRequest { - #[allow(unused_unsafe, clippy::all)] - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-path-with-query"] - fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import2( - (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 { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.scheme"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result8 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v7 = match l3 { - 0 => Scheme::Http, - 1 => Scheme::Https, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e7 = { - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts( - l4.cast(), - len6, - len6, - ); - _rt::string_lift(bytes6) - }; - Scheme::Other(e7) - } - }; - v7 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result8 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-scheme"] - fn wit_import3( - _: i32, - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import3( - (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 { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.authority"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let bytes5 = _rt::Vec::from_raw_parts( - l3.cast(), - len5, - len5, - ); - _rt::string_lift(bytes5) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl OutgoingRequest { - #[allow(unused_unsafe, clippy::all)] - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.set-authority"] - fn wit_import2(_: i32, _: i32, _: *mut u8, _: usize) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: *mut u8, - _: usize, - ) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import2( - (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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-request.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[constructor]request-options"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.connect-timeout"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.set-connect-timeout"] - fn wit_import1(_: i32, _: i32, _: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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")] - unsafe extern "C" { - #[link_name = "[method]request-options.first-byte-timeout"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.set-first-byte-timeout"] - fn wit_import1(_: i32, _: i32, _: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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")] - unsafe extern "C" { - #[link_name = "[method]request-options.between-bytes-timeout"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]request-options.set-between-bytes-timeout"] - fn wit_import1(_: i32, _: i32, _: i64) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: i64) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import1((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")] - unsafe extern "C" { - #[link_name = "[static]response-outparam.set"] - fn wit_import39( - _: i32, - _: i32, - _: i32, - _: i32, - _: ::core::mem::MaybeUninit, - _: *mut u8, - _: *mut u8, - _: usize, - _: i32, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import39( - _: i32, - _: i32, - _: i32, - _: i32, - _: ::core::mem::MaybeUninit, - _: *mut u8, - _: *mut u8, - _: usize, - _: i32, - ) { - unreachable!() - } - unsafe { - wit_import39( - (¶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")] - unsafe extern "C" { - #[link_name = "[method]incoming-response.status"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]incoming-response.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-response.consume"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { IncomingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]incoming-body.stream"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[static]incoming-body.finish"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((&this).take_handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]future-trailers.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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< - u8, - >; 40 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 40 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]future-trailers.get"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result70 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - match l3 { - 0 => { - let e = { - let l4 = i32::from(*ptr0.add(16).cast::()); - match l4 { - 0 => { - let e = { - let l5 = i32::from(*ptr0.add(24).cast::()); - match l5 { - 0 => None, - 1 => { - let e = { - let l6 = *ptr0.add(28).cast::(); - unsafe { Fields::from_handle(l6 as u32) } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from(*ptr0.add(24).cast::()); - let v69 = match l7 { - 0 => ErrorCode::DnsTimeout, - 1 => { - let e69 = { - let l8 = i32::from(*ptr0.add(32).cast::()); - let l12 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l8 { - 0 => None, - 1 => { - let e = { - let l9 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let bytes11 = _rt::Vec::from_raw_parts( - l9.cast(), - len11, - len11, - ); - _rt::string_lift(bytes11) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = i32::from( - *ptr0 - .add(34 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - l13 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e69) - } - 2 => ErrorCode::DestinationNotFound, - 3 => ErrorCode::DestinationUnavailable, - 4 => ErrorCode::DestinationIpProhibited, - 5 => ErrorCode::DestinationIpUnroutable, - 6 => ErrorCode::ConnectionRefused, - 7 => ErrorCode::ConnectionTerminated, - 8 => ErrorCode::ConnectionTimeout, - 9 => ErrorCode::ConnectionReadTimeout, - 10 => ErrorCode::ConnectionWriteTimeout, - 11 => ErrorCode::ConnectionLimitReached, - 12 => ErrorCode::TlsProtocolError, - 13 => ErrorCode::TlsCertificateError, - 14 => { - let e69 = { - let l14 = i32::from(*ptr0.add(32).cast::()); - let l16 = i32::from( - *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - TlsAlertReceivedPayload { - alert_id: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = i32::from(*ptr0.add(33).cast::()); - l15 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l16 { - 0 => None, - 1 => { - let e = { - let l17 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l18 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len19 = l18; - let bytes19 = _rt::Vec::from_raw_parts( - l17.cast(), - len19, - len19, - ); - _rt::string_lift(bytes19) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e69) - } - 15 => ErrorCode::HttpRequestDenied, - 16 => ErrorCode::HttpRequestLengthRequired, - 17 => { - let e69 = { - let l20 = i32::from(*ptr0.add(32).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *ptr0.add(40).cast::(); - l21 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e69) - } - 18 => ErrorCode::HttpRequestMethodInvalid, - 19 => ErrorCode::HttpRequestUriInvalid, - 20 => ErrorCode::HttpRequestUriTooLong, - 21 => { - let e69 = { - let l22 = i32::from(*ptr0.add(32).cast::()); - match l22 { - 0 => None, - 1 => { - let e = { - let l23 = *ptr0.add(36).cast::(); - l23 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e69) - } - 22 => { - let e69 = { - let l24 = i32::from(*ptr0.add(32).cast::()); - match l24 { - 0 => None, - 1 => { - let e = { - let l25 = i32::from( - *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l29 = i32::from( - *ptr0 - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l25 { - 0 => None, - 1 => { - let e = { - let l26 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l27 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len28 = l27; - let bytes28 = _rt::Vec::from_raw_parts( - l26.cast(), - len28, - len28, - ); - _rt::string_lift(bytes28) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr0 - .add(36 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l30 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e69) - } - 23 => { - let e69 = { - let l31 = i32::from(*ptr0.add(32).cast::()); - match l31 { - 0 => None, - 1 => { - let e = { - let l32 = *ptr0.add(36).cast::(); - l32 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e69) - } - 24 => { - let e69 = { - let l33 = i32::from(*ptr0.add(32).cast::()); - let l37 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l33 { - 0 => None, - 1 => { - let e = { - let l34 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l35 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len36 = l35; - let bytes36 = _rt::Vec::from_raw_parts( - l34.cast(), - len36, - len36, - ); - _rt::string_lift(bytes36) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr0 - .add(36 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l38 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e69) - } - 25 => ErrorCode::HttpResponseIncomplete, - 26 => { - let e69 = { - let l39 = i32::from(*ptr0.add(32).cast::()); - match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *ptr0.add(36).cast::(); - l40 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e69) - } - 27 => { - let e69 = { - let l41 = i32::from(*ptr0.add(32).cast::()); - let l45 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l43 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len44 = l43; - let bytes44 = _rt::Vec::from_raw_parts( - l42.cast(), - len44, - len44, - ); - _rt::string_lift(bytes44) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr0 - .add(36 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l46 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e69) - } - 28 => { - let e69 = { - let l47 = i32::from(*ptr0.add(32).cast::()); - match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr0.add(40).cast::(); - l48 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e69) - } - 29 => { - let e69 = { - let l49 = i32::from(*ptr0.add(32).cast::()); - match l49 { - 0 => None, - 1 => { - let e = { - let l50 = *ptr0.add(36).cast::(); - l50 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e69) - } - 30 => { - let e69 = { - let l51 = i32::from(*ptr0.add(32).cast::()); - let l55 = i32::from( - *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l51 { - 0 => None, - 1 => { - let e = { - let l52 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l53 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len54 = l53; - let bytes54 = _rt::Vec::from_raw_parts( - l52.cast(), - len54, - len54, - ); - _rt::string_lift(bytes54) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l55 { - 0 => None, - 1 => { - let e = { - let l56 = *ptr0 - .add(36 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l56 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e69) - } - 31 => { - let e69 = { - let l57 = i32::from(*ptr0.add(32).cast::()); - match l57 { - 0 => None, - 1 => { - let e = { - let l58 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l59 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len60 = l59; - let bytes60 = _rt::Vec::from_raw_parts( - l58.cast(), - len60, - len60, - ); - _rt::string_lift(bytes60) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e69) - } - 32 => { - let e69 = { - let l61 = i32::from(*ptr0.add(32).cast::()); - match l61 { - 0 => None, - 1 => { - let e = { - let l62 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len64 = l63; - let bytes64 = _rt::Vec::from_raw_parts( - l62.cast(), - len64, - len64, - ); - _rt::string_lift(bytes64) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e69) - } - 33 => ErrorCode::HttpResponseTimeout, - 34 => ErrorCode::HttpUpgradeFailed, - 35 => ErrorCode::HttpProtocolError, - 36 => ErrorCode::LoopDetected, - 37 => ErrorCode::ConfigurationError, - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e69 = { - let l65 = i32::from(*ptr0.add(32).cast::()); - match l65 { - 0 => None, - 1 => { - let e = { - let l66 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l67 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len68 = l67; - let bytes68 = _rt::Vec::from_raw_parts( - l66.cast(), - len68, - len68, - ); - _rt::string_lift(bytes68) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e69) - } - }; - v69 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result70 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[constructor]outgoing-response"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((&headers).take_handle() as i32) - }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.status-code"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.set-status-code"] - fn wit_import0(_: i32, _: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32, _: i32) -> i32 { - unreachable!() - } - let ret = unsafe { - wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.headers"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-response.body"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { OutgoingBody::from_handle(l3 as u32) } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]outgoing-body.write"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = (); - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - 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< - u8, - >; 24 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 24 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "[static]outgoing-body.finish"] - fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (&this).take_handle() as i32, - result0_0, - result0_1, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result67 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(8).cast::()); - let v66 = match l4 { - 0 => ErrorCode::DnsTimeout, - 1 => { - let e66 = { - let l5 = i32::from(*ptr1.add(16).cast::()); - let l9 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l5 { - 0 => None, - 1 => { - let e = { - let l6 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l9 { - 0 => None, - 1 => { - let e = { - let l10 = i32::from( - *ptr1 - .add(18 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - l10 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::DnsError(e66) - } - 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 e66 = { - let l11 = i32::from(*ptr1.add(16).cast::()); - let l13 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - TlsAlertReceivedPayload { - alert_id: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = i32::from(*ptr1.add(17).cast::()); - l12 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l13 { - 0 => None, - 1 => { - let e = { - let l14 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l15 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len16 = l15; - let bytes16 = _rt::Vec::from_raw_parts( - l14.cast(), - len16, - len16, - ); - _rt::string_lift(bytes16) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::TlsAlertReceived(e66) - } - 15 => ErrorCode::HttpRequestDenied, - 16 => ErrorCode::HttpRequestLengthRequired, - 17 => { - let e66 = { - let l17 = i32::from(*ptr1.add(16).cast::()); - match l17 { - 0 => None, - 1 => { - let e = { - let l18 = *ptr1.add(24).cast::(); - l18 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestBodySize(e66) - } - 18 => ErrorCode::HttpRequestMethodInvalid, - 19 => ErrorCode::HttpRequestUriInvalid, - 20 => ErrorCode::HttpRequestUriTooLong, - 21 => { - let e66 = { - let l19 = i32::from(*ptr1.add(16).cast::()); - match l19 { - 0 => None, - 1 => { - let e = { - let l20 = *ptr1.add(20).cast::(); - l20 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e66) - } - 22 => { - let e66 = { - let l21 = i32::from(*ptr1.add(16).cast::()); - match l21 { - 0 => None, - 1 => { - let e = { - let l22 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l26 = i32::from( - *ptr1 - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l22 { - 0 => None, - 1 => { - let e = { - let l23 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l24 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len25 = l24; - let bytes25 = _rt::Vec::from_raw_parts( - l23.cast(), - len25, - len25, - ); - _rt::string_lift(bytes25) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l26 { - 0 => None, - 1 => { - let e = { - let l27 = *ptr1 - .add(20 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l27 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSize(e66) - } - 23 => { - let e66 = { - let l28 = i32::from(*ptr1.add(16).cast::()); - match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *ptr1.add(20).cast::(); - l29 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e66) - } - 24 => { - let e66 = { - let l30 = i32::from(*ptr1.add(16).cast::()); - let l34 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l30 { - 0 => None, - 1 => { - let e = { - let l31 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l32 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len33 = l32; - let bytes33 = _rt::Vec::from_raw_parts( - l31.cast(), - len33, - len33, - ); - _rt::string_lift(bytes33) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e66) - } - 25 => ErrorCode::HttpResponseIncomplete, - 26 => { - let e66 = { - let l36 = i32::from(*ptr1.add(16).cast::()); - match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *ptr1.add(20).cast::(); - l37 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e66) - } - 27 => { - let e66 = { - let l38 = i32::from(*ptr1.add(16).cast::()); - let l42 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l38 { - 0 => None, - 1 => { - let e = { - let l39 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l40 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len41 = l40; - let bytes41 = _rt::Vec::from_raw_parts( - l39.cast(), - len41, - len41, - ); - _rt::string_lift(bytes41) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l42 { - 0 => None, - 1 => { - let e = { - let l43 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l43 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e66) - } - 28 => { - let e66 = { - let l44 = i32::from(*ptr1.add(16).cast::()); - match l44 { - 0 => None, - 1 => { - let e = { - let l45 = *ptr1.add(24).cast::(); - l45 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e66) - } - 29 => { - let e66 = { - let l46 = i32::from(*ptr1.add(16).cast::()); - match l46 { - 0 => None, - 1 => { - let e = { - let l47 = *ptr1.add(20).cast::(); - l47 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e66) - } - 30 => { - let e66 = { - let l48 = i32::from(*ptr1.add(16).cast::()); - let l52 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l50 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len51 = l50; - let bytes51 = _rt::Vec::from_raw_parts( - l49.cast(), - len51, - len51, - ); - _rt::string_lift(bytes51) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l52 { - 0 => None, - 1 => { - let e = { - let l53 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l53 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e66) - } - 31 => { - let e66 = { - let l54 = i32::from(*ptr1.add(16).cast::()); - match l54 { - 0 => None, - 1 => { - let e = { - let l55 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l56 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len57 = l56; - let bytes57 = _rt::Vec::from_raw_parts( - l55.cast(), - len57, - len57, - ); - _rt::string_lift(bytes57) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTransferCoding(e66) - } - 32 => { - let e66 = { - let l58 = i32::from(*ptr1.add(16).cast::()); - match l58 { - 0 => None, - 1 => { - let e = { - let l59 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts( - l59.cast(), - len61, - len61, - ); - _rt::string_lift(bytes61) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseContentCoding(e66) - } - 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 e66 = { - let l62 = i32::from(*ptr1.add(16).cast::()); - match l62 { - 0 => None, - 1 => { - let e = { - let l63 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l64 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len65 = l64; - let bytes65 = _rt::Vec::from_raw_parts( - l63.cast(), - len65, - len65, - ); - _rt::string_lift(bytes65) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::InternalError(e66) - } - }; - v66 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result67 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]future-incoming-response.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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< - u8, - >; 40 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 40 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]future-incoming-response.get"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result69 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - match l3 { - 0 => { - let e = { - let l4 = i32::from(*ptr0.add(16).cast::()); - match l4 { - 0 => { - let e = { - let l5 = *ptr0.add(24).cast::(); - unsafe { IncomingResponse::from_handle(l5 as u32) } - }; - 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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(34 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .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(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l28 = i32::from( - *ptr0 - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l24 { - 0 => None, - 1 => { - let e = { - let l25 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l26 = *ptr0 - .add(32 + 3 * ::core::mem::size_of::<*const u8>()) - .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(36 + 4 * ::core::mem::size_of::<*const u8>()) - .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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l32 { - 0 => None, - 1 => { - let e = { - let l33 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l34 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(36 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l40 { - 0 => None, - 1 => { - let e = { - let l41 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l42 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(36 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l50 { - 0 => None, - 1 => { - let e = { - let l51 = *ptr0 - .add(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l52 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(36 + 3 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l58 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l62 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(32 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l66 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - }; - result69 - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn http_error_code(err: &IoError) -> Option { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 24 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 24 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:http/types@0.2.0")] - unsafe extern "C" { - #[link_name = "http-error-code"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((err).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result66 = match l2 { - 0 => None, - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(8).cast::()); - let v65 = match l3 { - 0 => ErrorCode::DnsTimeout, - 1 => { - let e65 = { - let l4 = i32::from(*ptr0.add(16).cast::()); - let l8 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - DnsErrorPayload { - rcode: match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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( - *ptr0 - .add(18 + 3 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - let l12 = i32::from( - *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - TlsAlertReceivedPayload { - alert_id: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from(*ptr0.add(17).cast::()); - l11 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l14 = *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l16 { - 0 => None, - 1 => { - let e = { - let l17 = *ptr0.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(*ptr0.add(16).cast::()); - match l18 { - 0 => None, - 1 => { - let e = { - let l19 = *ptr0.add(20).cast::(); - l19 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestHeaderSectionSize(e65) - } - 22 => { - let e65 = { - let l20 = i32::from(*ptr0.add(16).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = i32::from( - *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l25 = i32::from( - *ptr0 - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l21 { - 0 => None, - 1 => { - let e = { - let l22 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l23 = *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 4 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l27 { - 0 => None, - 1 => { - let e = { - let l28 = *ptr0.add(20).cast::(); - l28 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpRequestTrailerSectionSize(e65) - } - 24 => { - let e65 = { - let l29 = i32::from(*ptr0.add(16).cast::()); - let l33 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l31 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l34 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpRequestTrailerSize(e65) - } - 25 => ErrorCode::HttpResponseIncomplete, - 26 => { - let e65 = { - let l35 = i32::from(*ptr0.add(16).cast::()); - match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr0.add(20).cast::(); - l36 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseHeaderSectionSize(e65) - } - 27 => { - let e65 = { - let l37 = i32::from(*ptr0.add(16).cast::()); - let l41 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l39 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l42 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseHeaderSize(e65) - } - 28 => { - let e65 = { - let l43 = i32::from(*ptr0.add(16).cast::()); - match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *ptr0.add(24).cast::(); - l44 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseBodySize(e65) - } - 29 => { - let e65 = { - let l45 = i32::from(*ptr0.add(16).cast::()); - match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr0.add(20).cast::(); - l46 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - ErrorCode::HttpResponseTrailerSectionSize(e65) - } - 30 => { - let e65 = { - let l47 = i32::from(*ptr0.add(16).cast::()); - let l51 = i32::from( - *ptr0 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - FieldSizePayload { - field_name: match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l49 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 = *ptr0 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l52 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - ErrorCode::HttpResponseTrailerSize(e65) - } - 31 => { - let e65 = { - let l53 = i32::from(*ptr0.add(16).cast::()); - match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l55 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l57 { - 0 => None, - 1 => { - let e = { - let l58 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l59 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(*ptr0.add(16).cast::()); - match l61 { - 0 => None, - 1 => { - let e = { - let l62 = *ptr0 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l63 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result66 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod outgoing_handler { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type OutgoingRequest = super::super::super::wasi::http::types::OutgoingRequest; - pub type RequestOptions = super::super::super::wasi::http::types::RequestOptions; - pub type FutureIncomingResponse = super::super::super::wasi::http::types::FutureIncomingResponse; - pub type ErrorCode = super::super::super::wasi::http::types::ErrorCode; - #[allow(unused_unsafe, clippy::all)] - pub fn handle( - request: OutgoingRequest, - options: Option, - ) -> Result { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 24 + 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 24 - + 4 * ::core::mem::size_of::<*const u8>()], - ); - let (result0_0, result0_1) = match &options { - 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/outgoing-handler@0.2.0")] - unsafe extern "C" { - #[link_name = "handle"] - fn wit_import2(_: i32, _: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (&request).take_handle() as i32, - result0_0, - result0_1, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result68 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(8).cast::(); - unsafe { - super::super::super::wasi::http::types::FutureIncomingResponse::from_handle( - l4 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(8).cast::()); - use super::super::super::wasi::http::types::ErrorCode as V67; - let v67 = match l5 { - 0 => V67::DnsTimeout, - 1 => { - let e67 = { - let l6 = i32::from(*ptr1.add(16).cast::()); - let l10 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::DnsErrorPayload { - rcode: match l6 { - 0 => None, - 1 => { - let e = { - let l7 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l8 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts( - l7.cast(), - len9, - len9, - ); - _rt::string_lift(bytes9) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - info_code: match l10 { - 0 => None, - 1 => { - let e = { - let l11 = i32::from( - *ptr1 - .add(18 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - l11 as u16 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::DnsError(e67) - } - 2 => V67::DestinationNotFound, - 3 => V67::DestinationUnavailable, - 4 => V67::DestinationIpProhibited, - 5 => V67::DestinationIpUnroutable, - 6 => V67::ConnectionRefused, - 7 => V67::ConnectionTerminated, - 8 => V67::ConnectionTimeout, - 9 => V67::ConnectionReadTimeout, - 10 => V67::ConnectionWriteTimeout, - 11 => V67::ConnectionLimitReached, - 12 => V67::TlsProtocolError, - 13 => V67::TlsCertificateError, - 14 => { - let e67 = { - let l12 = i32::from(*ptr1.add(16).cast::()); - let l14 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::TlsAlertReceivedPayload { - alert_id: match l12 { - 0 => None, - 1 => { - let e = { - let l13 = i32::from(*ptr1.add(17).cast::()); - l13 as u8 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - alert_message: match l14 { - 0 => None, - 1 => { - let e = { - let l15 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l16 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - } - }; - V67::TlsAlertReceived(e67) - } - 15 => V67::HttpRequestDenied, - 16 => V67::HttpRequestLengthRequired, - 17 => { - let e67 = { - let l18 = i32::from(*ptr1.add(16).cast::()); - match l18 { - 0 => None, - 1 => { - let e = { - let l19 = *ptr1.add(24).cast::(); - l19 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestBodySize(e67) - } - 18 => V67::HttpRequestMethodInvalid, - 19 => V67::HttpRequestUriInvalid, - 20 => V67::HttpRequestUriTooLong, - 21 => { - let e67 = { - let l20 = i32::from(*ptr1.add(16).cast::()); - match l20 { - 0 => None, - 1 => { - let e = { - let l21 = *ptr1.add(20).cast::(); - l21 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestHeaderSectionSize(e67) - } - 22 => { - let e67 = { - let l22 = i32::from(*ptr1.add(16).cast::()); - match l22 { - 0 => None, - 1 => { - let e = { - let l23 = i32::from( - *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l27 = i32::from( - *ptr1 - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l23 { - 0 => None, - 1 => { - let e = { - let l24 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l25 = *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len26 = l25; - let bytes26 = _rt::Vec::from_raw_parts( - l24.cast(), - len26, - len26, - ); - _rt::string_lift(bytes26) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l27 { - 0 => None, - 1 => { - let e = { - let l28 = *ptr1 - .add(20 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l28 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestHeaderSize(e67) - } - 23 => { - let e67 = { - let l29 = i32::from(*ptr1.add(16).cast::()); - match l29 { - 0 => None, - 1 => { - let e = { - let l30 = *ptr1.add(20).cast::(); - l30 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpRequestTrailerSectionSize(e67) - } - 24 => { - let e67 = { - let l31 = i32::from(*ptr1.add(16).cast::()); - let l35 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l31 { - 0 => None, - 1 => { - let e = { - let l32 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l33 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len34 = l33; - let bytes34 = _rt::Vec::from_raw_parts( - l32.cast(), - len34, - len34, - ); - _rt::string_lift(bytes34) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l36 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::HttpRequestTrailerSize(e67) - } - 25 => V67::HttpResponseIncomplete, - 26 => { - let e67 = { - let l37 = i32::from(*ptr1.add(16).cast::()); - match l37 { - 0 => None, - 1 => { - let e = { - let l38 = *ptr1.add(20).cast::(); - l38 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpResponseHeaderSectionSize(e67) - } - 27 => { - let e67 = { - let l39 = i32::from(*ptr1.add(16).cast::()); - let l43 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l39 { - 0 => None, - 1 => { - let e = { - let l40 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l41 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len42 = l41; - let bytes42 = _rt::Vec::from_raw_parts( - l40.cast(), - len42, - len42, - ); - _rt::string_lift(bytes42) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l44 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::HttpResponseHeaderSize(e67) - } - 28 => { - let e67 = { - let l45 = i32::from(*ptr1.add(16).cast::()); - match l45 { - 0 => None, - 1 => { - let e = { - let l46 = *ptr1.add(24).cast::(); - l46 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpResponseBodySize(e67) - } - 29 => { - let e67 = { - let l47 = i32::from(*ptr1.add(16).cast::()); - match l47 { - 0 => None, - 1 => { - let e = { - let l48 = *ptr1.add(20).cast::(); - l48 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - V67::HttpResponseTrailerSectionSize(e67) - } - 30 => { - let e67 = { - let l49 = i32::from(*ptr1.add(16).cast::()); - let l53 = i32::from( - *ptr1 - .add(16 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::http::types::FieldSizePayload { - field_name: match l49 { - 0 => None, - 1 => { - let e = { - let l50 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l51 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len52 = l51; - let bytes52 = _rt::Vec::from_raw_parts( - l50.cast(), - len52, - len52, - ); - _rt::string_lift(bytes52) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - field_size: match l53 { - 0 => None, - 1 => { - let e = { - let l54 = *ptr1 - .add(20 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l54 as u32 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V67::HttpResponseTrailerSize(e67) - } - 31 => { - let e67 = { - let l55 = i32::from(*ptr1.add(16).cast::()); - match l55 { - 0 => None, - 1 => { - let e = { - let l56 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l57 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - } - }; - V67::HttpResponseTransferCoding(e67) - } - 32 => { - let e67 = { - let l59 = i32::from(*ptr1.add(16).cast::()); - match l59 { - 0 => None, - 1 => { - let e = { - let l60 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l61 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - } - }; - V67::HttpResponseContentCoding(e67) - } - 33 => V67::HttpResponseTimeout, - 34 => V67::HttpUpgradeFailed, - 35 => V67::HttpProtocolError, - 36 => V67::LoopDetected, - 37 => V67::ConfigurationError, - n => { - debug_assert_eq!(n, 38, "invalid enum discriminant"); - let e67 = { - let l63 = i32::from(*ptr1.add(16).cast::()); - match l63 { - 0 => None, - 1 => { - let e = { - let l64 = *ptr1 - .add(16 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l65 = *ptr1 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .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(), - } - }; - V67::InternalError(e67) - } - }; - v67 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result68 - } - } - } - } - pub mod io { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod poll { - #[used] - #[doc(hidden)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]pollable"] - fn drop(_: u32); - } - unsafe { 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")] - unsafe extern "C" { - #[link_name = "[method]pollable.ready"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((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")] - unsafe extern "C" { - #[link_name = "[method]pollable.block"] - fn wit_import0(_: i32); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) { - unreachable!() - } - unsafe { wit_import0((self).handle() as i32) }; - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn poll(in_: &[&Pollable]) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - 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")] - unsafe extern "C" { - #[link_name = "poll"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(result0, len0, ptr1) }; - let l3 = *ptr1.add(0).cast::<*mut u8>(); - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let result6 = _rt::Vec::from_raw_parts(l3.cast(), len5, len5); - if layout0.size() != 0 { - _rt::alloc::dealloc(result0.cast(), layout0); - } - result6 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod error { - #[used] - #[doc(hidden)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]error"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl Error { - #[allow(unused_unsafe, clippy::all)] - pub fn to_debug_string(&self) -> _rt::String { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/error@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]error.to-debug-string"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - let result5 = _rt::string_lift(bytes4); - result5 - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod streams { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Error = super::super::super::wasi::io::error::Error; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]input-stream"] - fn drop(_: u32); - } - unsafe { 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]output-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl InputStream { - #[allow(unused_unsafe, clippy::all)] - pub fn read(&self, len: u64) -> Result<_rt::Vec, StreamError> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]input-stream.read"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result9 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - _rt::Vec::from_raw_parts(l3.cast(), len5, len5) - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v8 = match l6 { - 0 => { - let e8 = { - let l7 = *ptr0 - .add(4 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l7 as u32, - ) - } - }; - StreamError::LastOperationFailed(e8) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v8 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - impl InputStream { - #[allow(unused_unsafe, clippy::all)] - pub fn blocking_read( - &self, - len: u64, - ) -> Result<_rt::Vec, StreamError> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:io/streams@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]input-stream.blocking-read"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result9 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - _rt::Vec::from_raw_parts(l3.cast(), len5, len5) - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v8 = match l6 { - 0 => { - let e8 = { - let l7 = *ptr0 - .add(4 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l7 as u32, - ) - } - }; - StreamError::LastOperationFailed(e8) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v8 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]input-stream.skip"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]input-stream.blocking-skip"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]input-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.check-write"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.write"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result7 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(4).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr1.add(8).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-write-and-flush"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result7 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr1.add(4).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr1.add(8).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.flush"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-flush"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.write-zeroes"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-write-zeroes-and-flush"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(&len), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - let v5 = match l3 { - 0 => { - let e5 = { - let l4 = *ptr0.add(8).cast::(); - unsafe { - super::super::super::wasi::io::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(), - }; - result6 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.splice"] - fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i32, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - (src).handle() as i32, - _rt::as_i64(&len), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - 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")] - unsafe extern "C" { - #[link_name = "[method]output-stream.blocking-splice"] - fn wit_import1(_: i32, _: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1( - _: i32, - _: i32, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - (src).handle() as i32, - _rt::as_i64(&len), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let v6 = match l4 { - 0 => { - let e6 = { - let l5 = *ptr0.add(12).cast::(); - unsafe { - super::super::super::wasi::io::error::Error::from_handle( - l5 as u32, - ) - } - }; - StreamError::LastOperationFailed(e6) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - StreamError::Closed - } - }; - v6 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - } - } - pub mod keyvalue { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod store { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Clone)] - pub enum Error { - NoSuchStore, - AccessDenied, - Other(_rt::String), - } - impl ::core::fmt::Debug for Error { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - 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 {} - #[derive(Clone)] - pub struct KeyResponse { - pub keys: _rt::Vec<_rt::String>, - pub cursor: Option<_rt::String>, - } - impl ::core::fmt::Debug for KeyResponse { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("KeyResponse") - .field("keys", &self.keys) - .field("cursor", &self.cursor) - .finish() - } - } - #[derive(Debug)] - #[repr(transparent)] - pub struct Bucket { - handle: _rt::Resource, - } - impl Bucket { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _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 Bucket { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[resource-drop]bucket"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn get(&self, key: &str) -> Result>, Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.get"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result13 = match l3 { - 0 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l4 { - 0 => None, - 1 => { - let e = { - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - _rt::Vec::from_raw_parts(l5.cast(), len7, len7) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l8 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v12 = match l8 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e12 = { - let l9 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - let bytes11 = _rt::Vec::from_raw_parts( - l9.cast(), - len11, - len11, - ); - _rt::string_lift(bytes11) - }; - Error::Other(e12) - } - }; - v12 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result13 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn set(&self, key: &str, value: &[u8]) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.set"] - fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1.cast_mut(), - len1, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result10 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v9 = match l5 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Error::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn delete(&self, key: &str) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.delete"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result9 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v8 = match l4 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e8 = { - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let bytes7 = _rt::Vec::from_raw_parts( - l5.cast(), - len7, - len7, - ); - _rt::string_lift(bytes7) - }; - Error::Other(e8) - } - }; - v8 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result9 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn exists(&self, key: &str) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.exists"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (self).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - _rt::bool_lift(l4 as u8) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v9 = match l5 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Error::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl Bucket { - #[allow(unused_unsafe, clippy::all)] - pub fn list_keys( - &self, - cursor: Option<&str>, - ) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 6 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 6 - * ::core::mem::size_of::<*const u8>()], - ); - let (result1_0, result1_1, result1_2) = match cursor { - 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), - }; - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "[method]bucket.list-keys"] - fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3( - (self).handle() as i32, - result1_0, - result1_1, - result1_2, - ptr2, - ) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result20 = match l4 { - 0 => { - let e = { - let l5 = *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base10 = l5; - let len10 = l6; - let mut result10 = _rt::Vec::with_capacity(len10); - for i in 0..len10 { - let base = base10 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e10 = { - let l7 = *base.add(0).cast::<*mut u8>(); - let l8 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts( - l7.cast(), - len9, - len9, - ); - _rt::string_lift(bytes9) - }; - result10.push(e10); - } - _rt::cabi_dealloc( - base10, - len10 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l11 = i32::from( - *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - KeyResponse { - keys: result10, - cursor: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr2 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *ptr2 - .add(5 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - } - }; - Ok(e) - } - 1 => { - let e = { - let l15 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v19 = match l15 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e19 = { - let l16 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts( - l16.cast(), - len18, - len18, - ); - _rt::string_lift(bytes18) - }; - Error::Other(e19) - } - }; - v19 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result20 - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn open(identifier: &str) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = identifier; - 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:keyvalue/store@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "open"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { Bucket::from_handle(l4 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v9 = match l5 { - 0 => Error::NoSuchStore, - 1 => Error::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - Error::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod atomics { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Bucket = super::super::super::wasi::keyvalue::store::Bucket; - pub type Error = super::super::super::wasi::keyvalue::store::Error; - #[derive(Debug)] - #[repr(transparent)] - pub struct Cas { - handle: _rt::Resource, - } - impl Cas { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _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 Cas { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link( - wasm_import_module = "wasi:keyvalue/atomics@0.2.0-draft2" - )] - unsafe extern "C" { - #[link_name = "[resource-drop]cas"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - pub enum CasError { - StoreError(Error), - CasFailed(Cas), - } - impl ::core::fmt::Debug for CasError { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - CasError::StoreError(e) => { - f.debug_tuple("CasError::StoreError").field(e).finish() - } - CasError::CasFailed(e) => { - f.debug_tuple("CasError::CasFailed").field(e).finish() - } - } - } - } - impl ::core::fmt::Display for CasError { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - write!(f, "{:?}", self) - } - } - impl std::error::Error for CasError {} - impl Cas { - #[allow(unused_unsafe, clippy::all)] - pub fn new(bucket: &Bucket, key: &str) -> Result { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/atomics@0.2.0-draft2" - )] - unsafe extern "C" { - #[link_name = "[static]cas.new"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (bucket).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { Cas::from_handle(l4 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl Cas { - #[allow(unused_unsafe, clippy::all)] - pub fn current(&self) -> Result>, Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link( - wasm_import_module = "wasi:keyvalue/atomics@0.2.0-draft2" - )] - unsafe extern "C" { - #[link_name = "[method]cas.current"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result12 = match l2 { - 0 => { - let e = { - let l3 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - _rt::Vec::from_raw_parts(l4.cast(), len6, len6) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V11; - let v11 = match l7 { - 0 => V11::NoSuchStore, - 1 => V11::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e11 = { - let l8 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr0 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts( - l8.cast(), - len10, - len10, - ); - _rt::string_lift(bytes10) - }; - V11::Other(e11) - } - }; - v11 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result12 - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn increment( - bucket: &Bucket, - key: &str, - delta: i64, - ) -> Result { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 16 + 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16 - + 2 * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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:keyvalue/atomics@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "increment"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: i64, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (bucket).handle() as i32, - ptr0.cast_mut(), - len0, - _rt::as_i64(&delta), - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result10 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(8).cast::(); - l4 - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(8).cast::()); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn swap(cas: Cas, value: &[u8]) -> Result<(), CasError> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 5 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 5 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = value; - 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:keyvalue/atomics@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "swap"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (&cas).take_handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result12 = match l3 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from( - *ptr1.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - let v11 = match l4 { - 0 => { - let e11 = { - let l5 = i32::from( - *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr1 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - CasError::StoreError(e11) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e11 = { - let l10 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - unsafe { Cas::from_handle(l10 as u32) } - }; - CasError::CasFailed(e11) - } - }; - v11 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result12 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod batch { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Bucket = super::super::super::wasi::keyvalue::store::Bucket; - pub type Error = super::super::super::wasi::keyvalue::store::Error; - #[allow(unused_unsafe, clippy::all)] - pub fn get_many( - bucket: &Bucket, - keys: &[_rt::String], - ) -> Result<_rt::Vec)>>, Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec1 = keys; - let len1 = vec1.len(); - let layout1 = _rt::alloc::Layout::from_size_align_unchecked( - vec1.len() * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result1 = if layout1.size() != 0 { - let ptr = _rt::alloc::alloc(layout1).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout1); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec1.into_iter().enumerate() { - let base = result1 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - { - let vec0 = e; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .cast::() = len0; - *base.add(0).cast::<*mut u8>() = ptr0.cast_mut(); - } - } - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/batch@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "get-many"] - fn wit_import3(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3((bucket).handle() as i32, result1, len1, ptr2) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result20 = match l4 { - 0 => { - let e = { - let l5 = *ptr2 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base14 = l5; - let len14 = l6; - let mut result14 = _rt::Vec::with_capacity(len14); - for i in 0..len14 { - let base = base14 - .add(i * (5 * ::core::mem::size_of::<*const u8>())); - let e14 = { - let l7 = i32::from(*base.add(0).cast::()); - match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts( - l8.cast(), - len10, - len10, - ); - let l11 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l12 = *base - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len13 = l12; - ( - _rt::string_lift(bytes10), - _rt::Vec::from_raw_parts(l11.cast(), len13, len13), - ) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - result14.push(e14); - } - _rt::cabi_dealloc( - base14, - len14 * (5 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result14 - }; - Ok(e) - } - 1 => { - let e = { - let l15 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V19; - let v19 = match l15 { - 0 => V19::NoSuchStore, - 1 => V19::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e19 = { - let l16 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts( - l16.cast(), - len18, - len18, - ); - _rt::string_lift(bytes18) - }; - V19::Other(e19) - } - }; - v19 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout1.size() != 0 { - _rt::alloc::dealloc(result1.cast(), layout1); - } - result20 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn set_many( - bucket: &Bucket, - key_values: &[(_rt::String, _rt::Vec)], - ) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec3 = key_values; - let len3 = vec3.len(); - let layout3 = _rt::alloc::Layout::from_size_align_unchecked( - vec3.len() * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - 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 * (4 * ::core::mem::size_of::<*const u8>())); - { - let (t0_0, t0_1) = e; - let vec1 = t0_0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .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(3 * ::core::mem::size_of::<*const u8>()) - .cast::() = len2; - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>() = ptr2.cast_mut(); - } - } - let ptr4 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/batch@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "set-many"] - fn wit_import5(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import5( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import5((bucket).handle() as i32, result3, len3, ptr4) - }; - let l6 = i32::from(*ptr4.add(0).cast::()); - let result12 = match l6 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l7 = i32::from( - *ptr4.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V11; - let v11 = match l7 { - 0 => V11::NoSuchStore, - 1 => V11::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e11 = { - let l8 = *ptr4 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr4 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len10 = l9; - let bytes10 = _rt::Vec::from_raw_parts( - l8.cast(), - len10, - len10, - ); - _rt::string_lift(bytes10) - }; - V11::Other(e11) - } - }; - v11 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout3.size() != 0 { - _rt::alloc::dealloc(result3.cast(), layout3); - } - result12 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn delete_many( - bucket: &Bucket, - keys: &[_rt::String], - ) -> Result<(), Error> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 4 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 4 - * ::core::mem::size_of::<*const u8>()], - ); - let vec1 = keys; - let len1 = vec1.len(); - let layout1 = _rt::alloc::Layout::from_size_align_unchecked( - vec1.len() * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result1 = if layout1.size() != 0 { - let ptr = _rt::alloc::alloc(layout1).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout1); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec1.into_iter().enumerate() { - let base = result1 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - { - let vec0 = e; - let ptr0 = vec0.as_ptr().cast::(); - let len0 = vec0.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .cast::() = len0; - *base.add(0).cast::<*mut u8>() = ptr0.cast_mut(); - } - } - let ptr2 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:keyvalue/batch@0.2.0-draft2")] - unsafe extern "C" { - #[link_name = "delete-many"] - fn wit_import3(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import3((bucket).handle() as i32, result1, len1, ptr2) - }; - let l4 = i32::from(*ptr2.add(0).cast::()); - let result10 = match l4 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from( - *ptr2.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::super::super::wasi::keyvalue::store::Error as V9; - let v9 = match l5 { - 0 => V9::NoSuchStore, - 1 => V9::AccessDenied, - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e9 = { - let l6 = *ptr2 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr2 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts( - l6.cast(), - len8, - len8, - ); - _rt::string_lift(bytes8) - }; - V9::Other(e9) - } - }; - v9 - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout1.size() != 0 { - _rt::alloc::dealloc(result1.cast(), layout1); - } - result10 - } - } - } - } - pub mod random { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod random { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn get_random_bytes(len: u64) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/random@0.2.0")] - unsafe extern "C" { - #[link_name = "get-random-bytes"] - fn wit_import1(_: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(_rt::as_i64(&len), ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len4 = l3; - let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - result5 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_random_u64() -> u64 { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/random@0.2.0")] - unsafe extern "C" { - #[link_name = "get-random-u64"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - ret as u64 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod insecure { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[allow(unused_unsafe, clippy::all)] - pub fn get_insecure_random_bytes(len: u64) -> _rt::Vec { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] - unsafe extern "C" { - #[link_name = "get-insecure-random-bytes"] - fn wit_import1(_: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i64, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(_rt::as_i64(&len), ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len4 = l3; - let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - result5 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_insecure_random_u64() -> u64 { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:random/insecure@0.2.0")] - unsafe extern "C" { - #[link_name = "get-insecure-random-u64"] - fn wit_import0() -> i64; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i64 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - ret as u64 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod insecure_seed { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - #[allow(unused_unsafe, clippy::all)] - pub fn insecure_seed() -> (u64, u64) { - 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:random/insecure-seed@0.2.0")] - unsafe extern "C" { - #[link_name = "insecure-seed"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::(); - let l3 = *ptr0.add(8).cast::(); - let result4 = (l2 as u64, l3 as u64); - result4 - } - } - } - } - pub mod sockets { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod network { - #[used] - #[doc(hidden)] - 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: unsafe { _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")] - unsafe extern "C" { - #[link_name = "[resource-drop]network"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[repr(u8)] - #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] - 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, Ord, PartialEq, PartialOrd)] - 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, async_fn_in_trait, unused_imports, clippy::all)] - pub mod instance_network { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type Network = super::super::super::wasi::sockets::network::Network; - #[allow(unused_unsafe, clippy::all)] - pub fn instance_network() -> Network { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/instance-network@0.2.0")] - unsafe extern "C" { - #[link_name = "instance-network"] - fn wit_import0() -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0() -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0() }; - unsafe { - super::super::super::wasi::sockets::network::Network::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod udp { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type Network = super::super::super::wasi::sockets::network::Network; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpSocketAddress = super::super::super::wasi::sockets::network::IpSocketAddress; - pub type IpAddressFamily = super::super::super::wasi::sockets::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, - } - impl UdpSocket { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for UdpSocket { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]udp-socket"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[derive(Debug)] - #[repr(transparent)] - pub struct IncomingDatagramStream { - handle: _rt::Resource, - } - impl IncomingDatagramStream { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for IncomingDatagramStream { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]incoming-datagram-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - #[derive(Debug)] - #[repr(transparent)] - pub struct OutgoingDatagramStream { - handle: _rt::Resource, - } - impl OutgoingDatagramStream { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for OutgoingDatagramStream { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]outgoing-datagram-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_bind( - &self, - network: &Network, - local_address: IpSocketAddress, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match local_address { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - let ptr6 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.start-bind"] - fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (self).handle() as i32, - (network).handle() as i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ptr6, - ) - }; - let l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l9 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_bind(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.finish-bind"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn stream( - &self, - remote_address: Option, - ) -> Result< - (IncomingDatagramStream, OutgoingDatagramStream), - ErrorCode, - > { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 12]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12], - ); - let ( - result6_0, - result6_1, - result6_2, - result6_3, - result6_4, - result6_5, - result6_6, - result6_7, - result6_8, - result6_9, - result6_10, - result6_11, - result6_12, - ) = match remote_address { - Some(e) => { - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match e { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - ( - 1i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) - } - None => { - ( - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - }; - let ptr7 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.stream"] - fn wit_import8( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import8( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import8( - (self).handle() as i32, - result6_0, - result6_1, - result6_2, - result6_3, - result6_4, - result6_5, - result6_6, - result6_7, - result6_8, - result6_9, - result6_10, - result6_11, - result6_12, - ptr7, - ) - }; - let l9 = i32::from(*ptr7.add(0).cast::()); - let result13 = match l9 { - 0 => { - let e = { - let l10 = *ptr7.add(4).cast::(); - let l11 = *ptr7.add(8).cast::(); - ( - unsafe { IncomingDatagramStream::from_handle(l10 as u32) }, - unsafe { OutgoingDatagramStream::from_handle(l11 as u32) }, - ) - }; - Ok(e) - } - 1 => { - let e = { - let l12 = i32::from(*ptr7.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l12 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result13 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn local_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.local-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn remote_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.remote-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn address_family(&self) -> IpAddressFamily { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.address-family"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - super::super::super::wasi::sockets::network::IpAddressFamily::_lift( - ret as u8, - ) - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn unicast_hop_limit(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.unicast-hop-limit"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - l3 as u8 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_unicast_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.set-unicast-hop-limit"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i32(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn receive_buffer_size(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.receive-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_receive_buffer_size( - &self, - value: u64, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.set-receive-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn send_buffer_size(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.send-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.set-send-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl UdpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]udp-socket.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - impl IncomingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn receive( - &self, - max_results: u64, - ) -> Result<_rt::Vec, ErrorCode> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-datagram-stream.receive"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&max_results), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result28 = match l2 { - 0 => { - let e = { - let l3 = *ptr0 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l4 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base26 = l3; - let len26 = l4; - let mut result26 = _rt::Vec::with_capacity(len26); - for i in 0..len26 { - let base = base26 - .add(i * (32 + 2 * ::core::mem::size_of::<*const u8>())); - let e26 = { - let l5 = *base.add(0).cast::<*mut u8>(); - let l6 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len7 = l6; - let l8 = i32::from( - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V25; - let v25 = match l8 { - 0 => { - let e25 = { - let l9 = i32::from( - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l10 = i32::from( - *base - .add(6 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l11 = i32::from( - *base - .add(7 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l12 = i32::from( - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l13 = i32::from( - *base - .add(9 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l9 as u16, - address: (l10 as u8, l11 as u8, l12 as u8, l13 as u8), - } - }; - V25::Ipv4(e25) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e25 = { - let l14 = i32::from( - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l15 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l16 = i32::from( - *base - .add(12 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l17 = i32::from( - *base - .add(14 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l18 = i32::from( - *base - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l19 = i32::from( - *base - .add(18 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l20 = i32::from( - *base - .add(20 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l21 = i32::from( - *base - .add(22 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l22 = i32::from( - *base - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l23 = i32::from( - *base - .add(26 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l24 = *base - .add(28 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l14 as u16, - flow_info: l15 as u32, - address: ( - l16 as u16, - l17 as u16, - l18 as u16, - l19 as u16, - l20 as u16, - l21 as u16, - l22 as u16, - l23 as u16, - ), - scope_id: l24 as u32, - } - }; - V25::Ipv6(e25) - } - }; - IncomingDatagram { - data: _rt::Vec::from_raw_parts(l5.cast(), len7, len7), - remote_address: v25, - } - }; - result26.push(e26); - } - _rt::cabi_dealloc( - base26, - len26 * (32 + 2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result26 - }; - Ok(e) - } - 1 => { - let e = { - let l27 = i32::from( - *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(), - ); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l27 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result28 - } - } - } - impl IncomingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]incoming-datagram-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - impl OutgoingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn check_send(&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:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-datagram-stream.check-send"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl OutgoingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn send( - &self, - datagrams: &[OutgoingDatagram], - ) -> Result { - unsafe { - #[repr(align(8))] - struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], - ); - let vec7 = datagrams; - let len7 = vec7.len(); - let layout7 = _rt::alloc::Layout::from_size_align_unchecked( - vec7.len() * (32 + 3 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let result7 = if layout7.size() != 0 { - let ptr = _rt::alloc::alloc(layout7).cast::(); - if ptr.is_null() { - _rt::alloc::handle_alloc_error(layout7); - } - ptr - } else { - ::core::ptr::null_mut() - }; - for (i, e) in vec7.into_iter().enumerate() { - let base = result7 - .add(i * (32 + 3 * ::core::mem::size_of::<*const u8>())); - { - let OutgoingDatagram { - data: data0, - remote_address: remote_address0, - } = e; - let vec1 = data0; - let ptr1 = vec1.as_ptr().cast::(); - let len1 = vec1.len(); - *base - .add(::core::mem::size_of::<*const u8>()) - .cast::() = len1; - *base.add(0).cast::<*mut u8>() = ptr1.cast_mut(); - match remote_address0 { - Some(e) => { - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - use super::super::super::wasi::sockets::network::IpSocketAddress as V6; - match e { - V6::Ipv4(e) => { - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port2, - address: address2, - } = e; - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(port2)) as u16; - let (t3_0, t3_1, t3_2, t3_3) = address2; - *base - .add(10 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_0)) as u8; - *base - .add(11 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_1)) as u8; - *base - .add(12 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_2)) as u8; - *base - .add(13 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t3_3)) as u8; - } - V6::Ipv6(e) => { - *base - .add(4 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (1i32) as u8; - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port4, - flow_info: flow_info4, - address: address4, - scope_id: scope_id4, - } = e; - *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(port4)) as u16; - *base - .add(12 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i32(flow_info4); - let (t5_0, t5_1, t5_2, t5_3, t5_4, t5_5, t5_6, t5_7) = address4; - *base - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_0)) as u16; - *base - .add(18 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_1)) as u16; - *base - .add(20 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_2)) as u16; - *base - .add(22 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_3)) as u16; - *base - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_4)) as u16; - *base - .add(26 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_5)) as u16; - *base - .add(28 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_6)) as u16; - *base - .add(30 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (_rt::as_i32(t5_7)) as u16; - *base - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::() = _rt::as_i32(scope_id4); - } - } - } - None => { - *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::() = (0i32) as u8; - } - }; - } - } - let ptr8 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-datagram-stream.send"] - fn wit_import9(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import9( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import9((self).handle() as i32, result7, len7, ptr8) - }; - let l10 = i32::from(*ptr8.add(0).cast::()); - let result13 = match l10 { - 0 => { - let e = { - let l11 = *ptr8.add(8).cast::(); - l11 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l12 = i32::from(*ptr8.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l12 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - if layout7.size() != 0 { - _rt::alloc::dealloc(result7.cast(), layout7); - } - result13 - } - } - } - impl OutgoingDatagramStream { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/udp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]outgoing-datagram-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod udp_create_socket { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; - pub type UdpSocket = super::super::super::wasi::sockets::udp::UdpSocket; - #[allow(unused_unsafe, clippy::all)] - pub fn create_udp_socket( - address_family: IpAddressFamily, - ) -> 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:sockets/udp-create-socket@0.2.0")] - unsafe extern "C" { - #[link_name = "create-udp-socket"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(address_family.clone() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::sockets::udp::UdpSocket::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod tcp { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type InputStream = super::super::super::wasi::io::streams::InputStream; - pub type OutputStream = super::super::super::wasi::io::streams::OutputStream; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type Duration = super::super::super::wasi::clocks::monotonic_clock::Duration; - pub type Network = super::super::super::wasi::sockets::network::Network; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpSocketAddress = super::super::super::wasi::sockets::network::IpSocketAddress; - pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; - #[repr(u8)] - #[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] - 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, - } - impl TcpSocket { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for TcpSocket { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]tcp-socket"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_bind( - &self, - network: &Network, - local_address: IpSocketAddress, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match local_address { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - let ptr6 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.start-bind"] - fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (self).handle() as i32, - (network).handle() as i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ptr6, - ) - }; - let l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l9 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_bind(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.finish-bind"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_connect( - &self, - network: &Network, - remote_address: IpSocketAddress, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - use super::super::super::wasi::sockets::network::IpSocketAddress as V4; - let ( - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ) = match remote_address { - V4::Ipv4(e) => { - let super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: port0, - address: address0, - } = e; - let (t1_0, t1_1, t1_2, t1_3) = address0; - ( - 0i32, - _rt::as_i32(port0), - _rt::as_i32(t1_0), - _rt::as_i32(t1_1), - _rt::as_i32(t1_2), - _rt::as_i32(t1_3), - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - 0i32, - ) - } - V4::Ipv6(e) => { - let super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: port2, - flow_info: flow_info2, - address: address2, - scope_id: scope_id2, - } = e; - let (t3_0, t3_1, t3_2, t3_3, t3_4, t3_5, t3_6, t3_7) = address2; - ( - 1i32, - _rt::as_i32(port2), - _rt::as_i32(flow_info2), - _rt::as_i32(t3_0), - _rt::as_i32(t3_1), - _rt::as_i32(t3_2), - _rt::as_i32(t3_3), - _rt::as_i32(t3_4), - _rt::as_i32(t3_5), - _rt::as_i32(t3_6), - _rt::as_i32(t3_7), - _rt::as_i32(scope_id2), - ) - } - }; - let ptr6 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.start-connect"] - fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import7( - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: i32, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import7( - (self).handle() as i32, - (network).handle() as i32, - result5_0, - result5_1, - result5_2, - result5_3, - result5_4, - result5_5, - result5_6, - result5_7, - result5_8, - result5_9, - result5_10, - result5_11, - ptr6, - ) - }; - let l8 = i32::from(*ptr6.add(0).cast::()); - let result10 = match l8 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l9 = i32::from(*ptr6.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l9 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result10 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_connect( - &self, - ) -> Result<(InputStream, OutputStream), ErrorCode> { - 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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.finish-connect"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result6 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - let l4 = *ptr0.add(8).cast::(); - ( - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l3 as u32, - ) - }, - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l4 as u32, - ) - }, - ) - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l5 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn start_listen(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.start-listen"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn finish_listen(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.finish-listen"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn accept( - &self, - ) -> Result<(TcpSocket, InputStream, OutputStream), ErrorCode> { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 16]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 16], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.accept"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result7 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - let l4 = *ptr0.add(8).cast::(); - let l5 = *ptr0.add(12).cast::(); - ( - unsafe { TcpSocket::from_handle(l3 as u32) }, - unsafe { - super::super::super::wasi::io::streams::InputStream::from_handle( - l4 as u32, - ) - }, - unsafe { - super::super::super::wasi::io::streams::OutputStream::from_handle( - l5 as u32, - ) - }, - ) - }; - Ok(e) - } - 1 => { - let e = { - let l6 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l6 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result7 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn local_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.local-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn remote_address(&self) -> Result { - unsafe { - #[repr(align(4))] - struct RetArea([::core::mem::MaybeUninit; 36]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 36], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.remote-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result22 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpSocketAddress as V20; - let v20 = match l3 { - 0 => { - let e20 = { - let l4 = i32::from(*ptr0.add(8).cast::()); - let l5 = i32::from(*ptr0.add(10).cast::()); - let l6 = i32::from(*ptr0.add(11).cast::()); - let l7 = i32::from(*ptr0.add(12).cast::()); - let l8 = i32::from(*ptr0.add(13).cast::()); - super::super::super::wasi::sockets::network::Ipv4SocketAddress { - port: l4 as u16, - address: (l5 as u8, l6 as u8, l7 as u8, l8 as u8), - } - }; - V20::Ipv4(e20) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e20 = { - let l9 = i32::from(*ptr0.add(8).cast::()); - let l10 = *ptr0.add(12).cast::(); - let l11 = i32::from(*ptr0.add(16).cast::()); - let l12 = i32::from(*ptr0.add(18).cast::()); - let l13 = i32::from(*ptr0.add(20).cast::()); - let l14 = i32::from(*ptr0.add(22).cast::()); - let l15 = i32::from(*ptr0.add(24).cast::()); - let l16 = i32::from(*ptr0.add(26).cast::()); - let l17 = i32::from(*ptr0.add(28).cast::()); - let l18 = i32::from(*ptr0.add(30).cast::()); - let l19 = *ptr0.add(32).cast::(); - super::super::super::wasi::sockets::network::Ipv6SocketAddress { - port: l9 as u16, - flow_info: l10 as u32, - address: ( - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - l17 as u16, - l18 as u16, - ), - scope_id: l19 as u32, - } - }; - V20::Ipv6(e20) - } - }; - v20 - }; - Ok(e) - } - 1 => { - let e = { - let l21 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l21 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result22 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn is_listening(&self) -> bool { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.is-listening"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - _rt::bool_lift(ret as u8) - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn address_family(&self) -> IpAddressFamily { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.address-family"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - super::super::super::wasi::sockets::network::IpAddressFamily::_lift( - ret as u8, - ) - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_listen_backlog_size( - &self, - value: u64, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-listen-backlog-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_enabled(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-enabled"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - _rt::bool_lift(l3 as u8) - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_enabled( - &self, - value: bool, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-enabled"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - match &value { - true => 1, - false => 0, - }, - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_idle_time(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-idle-time"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_idle_time( - &self, - value: Duration, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-idle-time"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_interval(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-interval"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_interval( - &self, - value: Duration, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-interval"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1((self).handle() as i32, _rt::as_i64(value), ptr0) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn keep_alive_count(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.keep-alive-count"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - l3 as u32 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_keep_alive_count(&self, value: u32) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-keep-alive-count"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i32(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn hop_limit(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.hop-limit"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - l3 as u8 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_hop_limit(&self, value: u8) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-hop-limit"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i32(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn receive_buffer_size(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.receive-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_receive_buffer_size( - &self, - value: u64, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-receive-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn send_buffer_size(&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:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.send-buffer-size"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(8).cast::(); - l3 as u64 - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(8).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn set_send_buffer_size(&self, value: u64) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.set-send-buffer-size"] - fn wit_import1(_: i32, _: i64, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i64, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - _rt::as_i64(&value), - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - impl TcpSocket { - #[allow(unused_unsafe, clippy::all)] - pub fn shutdown( - &self, - shutdown_type: ShutdownType, - ) -> Result<(), ErrorCode> { - unsafe { - #[repr(align(1))] - struct RetArea([::core::mem::MaybeUninit; 2]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/tcp@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]tcp-socket.shutdown"] - fn wit_import1(_: i32, _: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: i32, _: *mut u8) { - unreachable!() - } - unsafe { - wit_import1( - (self).handle() as i32, - shutdown_type.clone() as i32, - ptr0, - ) - }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result4 = match l2 { - 0 => { - let e = (); - Ok(e) - } - 1 => { - let e = { - let l3 = i32::from(*ptr0.add(1).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l3 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result4 - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod tcp_create_socket { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpAddressFamily = super::super::super::wasi::sockets::network::IpAddressFamily; - pub type TcpSocket = super::super::super::wasi::sockets::tcp::TcpSocket; - #[allow(unused_unsafe, clippy::all)] - pub fn create_tcp_socket( - address_family: IpAddressFamily, - ) -> 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:sockets/tcp-create-socket@0.2.0")] - unsafe extern "C" { - #[link_name = "create-tcp-socket"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1(address_family.clone() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result5 = match l2 { - 0 => { - let e = { - let l3 = *ptr0.add(4).cast::(); - unsafe { - super::super::super::wasi::sockets::tcp::TcpSocket::from_handle( - l3 as u32, - ) - } - }; - Ok(e) - } - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l4 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result5 - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod ip_name_lookup { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Pollable = super::super::super::wasi::io::poll::Pollable; - pub type Network = super::super::super::wasi::sockets::network::Network; - pub type ErrorCode = super::super::super::wasi::sockets::network::ErrorCode; - pub type IpAddress = super::super::super::wasi::sockets::network::IpAddress; - #[derive(Debug)] - #[repr(transparent)] - pub struct ResolveAddressStream { - handle: _rt::Resource, - } - impl ResolveAddressStream { - #[doc(hidden)] - pub unsafe fn from_handle(handle: u32) -> Self { - Self { - handle: unsafe { _rt::Resource::from_handle(handle) }, - } - } - #[doc(hidden)] - pub fn take_handle(&self) -> u32 { - _rt::Resource::take_handle(&self.handle) - } - #[doc(hidden)] - pub fn handle(&self) -> u32 { - _rt::Resource::handle(&self.handle) - } - } - unsafe impl _rt::WasmResource for ResolveAddressStream { - #[inline] - unsafe fn drop(_handle: u32) { - #[cfg(not(target_arch = "wasm32"))] - unreachable!(); - #[cfg(target_arch = "wasm32")] - { - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "[resource-drop]resolve-address-stream"] - fn drop(_: u32); - } - unsafe { drop(_handle) }; - } - } - } - impl ResolveAddressStream { - #[allow(unused_unsafe, clippy::all)] - pub fn resolve_next_address( - &self, - ) -> Result, ErrorCode> { - unsafe { - #[repr(align(2))] - struct RetArea([::core::mem::MaybeUninit; 22]); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 22], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]resolve-address-stream.resolve-next-address"] - fn wit_import1(_: i32, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: i32, _: *mut u8) { - unreachable!() - } - unsafe { wit_import1((self).handle() as i32, ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - let result19 = match l2 { - 0 => { - let e = { - let l3 = i32::from(*ptr0.add(2).cast::()); - match l3 { - 0 => None, - 1 => { - let e = { - let l4 = i32::from(*ptr0.add(4).cast::()); - use super::super::super::wasi::sockets::network::IpAddress as V17; - let v17 = match l4 { - 0 => { - let e17 = { - let l5 = i32::from(*ptr0.add(6).cast::()); - let l6 = i32::from(*ptr0.add(7).cast::()); - let l7 = i32::from(*ptr0.add(8).cast::()); - let l8 = i32::from(*ptr0.add(9).cast::()); - (l5 as u8, l6 as u8, l7 as u8, l8 as u8) - }; - V17::Ipv4(e17) - } - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e17 = { - let l9 = i32::from(*ptr0.add(6).cast::()); - let l10 = i32::from(*ptr0.add(8).cast::()); - let l11 = i32::from(*ptr0.add(10).cast::()); - let l12 = i32::from(*ptr0.add(12).cast::()); - let l13 = i32::from(*ptr0.add(14).cast::()); - let l14 = i32::from(*ptr0.add(16).cast::()); - let l15 = i32::from(*ptr0.add(18).cast::()); - let l16 = i32::from(*ptr0.add(20).cast::()); - ( - l9 as u16, - l10 as u16, - l11 as u16, - l12 as u16, - l13 as u16, - l14 as u16, - l15 as u16, - l16 as u16, - ) - }; - V17::Ipv6(e17) - } - }; - v17 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - } - }; - Ok(e) - } - 1 => { - let e = { - let l18 = i32::from(*ptr0.add(2).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l18 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result19 - } - } - } - impl ResolveAddressStream { - #[allow(unused_unsafe, clippy::all)] - pub fn subscribe(&self) -> Pollable { - unsafe { - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "wasi:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "[method]resolve-address-stream.subscribe"] - fn wit_import0(_: i32) -> i32; - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import0(_: i32) -> i32 { - unreachable!() - } - let ret = unsafe { wit_import0((self).handle() as i32) }; - unsafe { - super::super::super::wasi::io::poll::Pollable::from_handle( - ret as u32, - ) - } - } - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn resolve_addresses( - network: &Network, - name: &str, - ) -> Result { - 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:sockets/ip-name-lookup@0.2.0")] - unsafe extern "C" { - #[link_name = "resolve-addresses"] - fn wit_import2(_: i32, _: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2( - _: i32, - _: *mut u8, - _: usize, - _: *mut u8, - ) { - unreachable!() - } - unsafe { - wit_import2( - (network).handle() as i32, - ptr0.cast_mut(), - len0, - ptr1, - ) - }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result6 = match l3 { - 0 => { - let e = { - let l4 = *ptr1.add(4).cast::(); - unsafe { ResolveAddressStream::from_handle(l4 as u32) } - }; - Ok(e) - } - 1 => { - let e = { - let l5 = i32::from(*ptr1.add(4).cast::()); - super::super::super::wasi::sockets::network::ErrorCode::_lift( - l5 as u8, - ) - }; - Err(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result6 - } - } - } - } -} -#[rustfmt::skip] -#[allow(dead_code, clippy::all)] -pub mod wavs { - pub mod operator { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod input { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - pub type ServiceId = super::super::super::wavs::types::service::ServiceId; - pub type WorkflowId = super::super::super::wavs::types::service::WorkflowId; - pub type Trigger = super::super::super::wavs::types::service::Trigger; - pub type TriggerData = super::super::super::wavs::types::events::TriggerData; - #[derive(Clone)] - pub struct TriggerConfig { - pub service_id: ServiceId, - pub workflow_id: WorkflowId, - pub trigger: Trigger, - } - impl ::core::fmt::Debug for TriggerConfig { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerConfig") - .field("service-id", &self.service_id) - .field("workflow-id", &self.workflow_id) - .field("trigger", &self.trigger) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerAction { - pub config: TriggerConfig, - pub data: TriggerData, - } - impl ::core::fmt::Debug for TriggerAction { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerAction") - .field("config", &self.config) - .field("data", &self.data) - .finish() - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod output { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - #[derive(Clone)] - pub struct WasmResponse { - pub payload: _rt::Vec, - pub ordering: Option, - } - impl ::core::fmt::Debug for WasmResponse { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("WasmResponse") - .field("payload", &self.payload) - .field("ordering", &self.ordering) - .finish() - } - } - } - } - pub mod types { - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod core { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Digest = _rt::String; - #[repr(C)] - #[derive(Clone, Copy)] - pub struct Timestamp { - pub nanos: u64, - } - impl ::core::fmt::Debug for Timestamp { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Timestamp").field("nanos", &self.nanos).finish() - } - } - #[derive(Clone, Copy)] - pub enum LogLevel { - Error, - Warn, - Info, - Debug, - Trace, - } - impl ::core::fmt::Debug for LogLevel { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - LogLevel::Error => f.debug_tuple("LogLevel::Error").finish(), - LogLevel::Warn => f.debug_tuple("LogLevel::Warn").finish(), - LogLevel::Info => f.debug_tuple("LogLevel::Info").finish(), - LogLevel::Debug => f.debug_tuple("LogLevel::Debug").finish(), - LogLevel::Trace => f.debug_tuple("LogLevel::Trace").finish(), - } - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod chain { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ChainKey = _rt::String; - pub type EvmTxHash = _rt::Vec; - #[derive(Clone)] - pub struct CosmosAddress { - pub bech32_addr: _rt::String, - pub prefix_len: u32, - } - impl ::core::fmt::Debug for CosmosAddress { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("CosmosAddress") - .field("bech32-addr", &self.bech32_addr) - .field("prefix-len", &self.prefix_len) - .finish() - } - } - #[derive(Clone)] - pub struct CosmosEvent { - pub ty: _rt::String, - pub attributes: _rt::Vec<(_rt::String, _rt::String)>, - } - impl ::core::fmt::Debug for CosmosEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("CosmosEvent") - .field("ty", &self.ty) - .field("attributes", &self.attributes) - .finish() - } - } - #[derive(Clone)] - pub struct CosmosChainConfig { - pub chain_id: _rt::String, - pub rpc_endpoint: Option<_rt::String>, - pub grpc_endpoint: Option<_rt::String>, - pub grpc_web_endpoint: Option<_rt::String>, - pub gas_price: f32, - pub gas_denom: _rt::String, - pub bech32_prefix: _rt::String, - } - impl ::core::fmt::Debug for CosmosChainConfig { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("CosmosChainConfig") - .field("chain-id", &self.chain_id) - .field("rpc-endpoint", &self.rpc_endpoint) - .field("grpc-endpoint", &self.grpc_endpoint) - .field("grpc-web-endpoint", &self.grpc_web_endpoint) - .field("gas-price", &self.gas_price) - .field("gas-denom", &self.gas_denom) - .field("bech32-prefix", &self.bech32_prefix) - .finish() - } - } - #[derive(Clone)] - pub struct EvmAddress { - pub raw_bytes: _rt::Vec, - } - impl ::core::fmt::Debug for EvmAddress { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmAddress") - .field("raw-bytes", &self.raw_bytes) - .finish() - } - } - #[derive(Clone)] - pub struct EvmEventLogData { - pub topics: _rt::Vec<_rt::Vec>, - pub data: _rt::Vec, - } - impl ::core::fmt::Debug for EvmEventLogData { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmEventLogData") - .field("topics", &self.topics) - .field("data", &self.data) - .finish() - } - } - #[derive(Clone)] - pub struct EvmEventLog { - pub address: EvmAddress, - pub data: EvmEventLogData, - pub tx_hash: EvmTxHash, - pub block_number: u64, - pub log_index: u64, - pub block_hash: _rt::Vec, - pub block_timestamp: Option, - pub tx_index: u64, - } - impl ::core::fmt::Debug for EvmEventLog { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmEventLog") - .field("address", &self.address) - .field("data", &self.data) - .field("tx-hash", &self.tx_hash) - .field("block-number", &self.block_number) - .field("log-index", &self.log_index) - .field("block-hash", &self.block_hash) - .field("block-timestamp", &self.block_timestamp) - .field("tx-index", &self.tx_index) - .finish() - } - } - #[derive(Clone)] - pub struct EvmChainConfig { - pub chain_id: _rt::String, - pub ws_endpoint: Option<_rt::String>, - pub http_endpoint: Option<_rt::String>, - } - impl ::core::fmt::Debug for EvmChainConfig { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmChainConfig") - .field("chain-id", &self.chain_id) - .field("ws-endpoint", &self.ws_endpoint) - .field("http-endpoint", &self.http_endpoint) - .finish() - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod service { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type Digest = super::super::super::wavs::types::core::Digest; - pub type Timestamp = super::super::super::wavs::types::core::Timestamp; - pub type ChainKey = super::super::super::wavs::types::chain::ChainKey; - pub type EvmAddress = super::super::super::wavs::types::chain::EvmAddress; - pub type CosmosAddress = super::super::super::wavs::types::chain::CosmosAddress; - pub type ServiceId = _rt::String; - pub type WorkflowId = _rt::String; - pub type PackageRef = _rt::String; - pub type SemverVersion = _rt::String; - #[derive(Clone, Copy)] - pub enum ServiceStatus { - Active, - Paused, - } - impl ::core::fmt::Debug for ServiceStatus { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ServiceStatus::Active => { - f.debug_tuple("ServiceStatus::Active").finish() - } - ServiceStatus::Paused => { - f.debug_tuple("ServiceStatus::Paused").finish() - } - } - } - } - #[derive(Clone)] - pub struct EvmManager { - pub chain: ChainKey, - pub address: EvmAddress, - } - impl ::core::fmt::Debug for EvmManager { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("EvmManager") - .field("chain", &self.chain) - .field("address", &self.address) - .finish() - } - } - #[derive(Clone)] - pub enum ServiceManager { - Evm(EvmManager), - } - impl ::core::fmt::Debug for ServiceManager { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ServiceManager::Evm(e) => { - f.debug_tuple("ServiceManager::Evm").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub struct ComponentSourceDownload { - pub url: _rt::String, - pub digest: Digest, - } - impl ::core::fmt::Debug for ComponentSourceDownload { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("ComponentSourceDownload") - .field("url", &self.url) - .field("digest", &self.digest) - .finish() - } - } - #[derive(Clone)] - pub struct Registry { - pub digest: Digest, - pub domain: Option<_rt::String>, - pub version: Option, - pub pkg: PackageRef, - } - impl ::core::fmt::Debug for Registry { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Registry") - .field("digest", &self.digest) - .field("domain", &self.domain) - .field("version", &self.version) - .field("pkg", &self.pkg) - .finish() - } - } - #[derive(Clone)] - pub enum ComponentSource { - Download(ComponentSourceDownload), - Registry(Registry), - Digest(Digest), - } - impl ::core::fmt::Debug for ComponentSource { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - ComponentSource::Download(e) => { - f.debug_tuple("ComponentSource::Download").field(e).finish() - } - ComponentSource::Registry(e) => { - f.debug_tuple("ComponentSource::Registry").field(e).finish() - } - ComponentSource::Digest(e) => { - f.debug_tuple("ComponentSource::Digest").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub enum AllowedHostPermission { - All, - Only(_rt::Vec<_rt::String>), - None, - } - impl ::core::fmt::Debug for AllowedHostPermission { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - AllowedHostPermission::All => { - f.debug_tuple("AllowedHostPermission::All").finish() - } - AllowedHostPermission::Only(e) => { - f.debug_tuple("AllowedHostPermission::Only") - .field(e) - .finish() - } - AllowedHostPermission::None => { - f.debug_tuple("AllowedHostPermission::None").finish() - } - } - } - } - #[derive(Clone)] - pub struct Permissions { - pub allowed_http_hosts: AllowedHostPermission, - pub file_system: bool, - } - impl ::core::fmt::Debug for Permissions { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Permissions") - .field("allowed-http-hosts", &self.allowed_http_hosts) - .field("file-system", &self.file_system) - .finish() - } - } - #[derive(Clone)] - pub struct Component { - pub source: ComponentSource, - pub permissions: Permissions, - pub fuel_limit: Option, - pub time_limit_seconds: Option, - pub config: _rt::Vec<(_rt::String, _rt::String)>, - pub env_keys: _rt::Vec<_rt::String>, - } - impl ::core::fmt::Debug for Component { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Component") - .field("source", &self.source) - .field("permissions", &self.permissions) - .field("fuel-limit", &self.fuel_limit) - .field("time-limit-seconds", &self.time_limit_seconds) - .field("config", &self.config) - .field("env-keys", &self.env_keys) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerEvmContractEvent { - pub address: EvmAddress, - pub chain: ChainKey, - pub event_hash: _rt::Vec, - } - impl ::core::fmt::Debug for TriggerEvmContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerEvmContractEvent") - .field("address", &self.address) - .field("chain", &self.chain) - .field("event-hash", &self.event_hash) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerCosmosContractEvent { - pub address: CosmosAddress, - pub chain: ChainKey, - pub event_type: _rt::String, - } - impl ::core::fmt::Debug for TriggerCosmosContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerCosmosContractEvent") - .field("address", &self.address) - .field("chain", &self.chain) - .field("event-type", &self.event_type) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerBlockInterval { - pub chain: ChainKey, - pub n_blocks: u32, - pub start_block: Option, - pub end_block: Option, - } - impl ::core::fmt::Debug for TriggerBlockInterval { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerBlockInterval") - .field("chain", &self.chain) - .field("n-blocks", &self.n_blocks) - .field("start-block", &self.start_block) - .field("end-block", &self.end_block) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerCron { - pub schedule: _rt::String, - pub start_time: Option, - pub end_time: Option, - } - impl ::core::fmt::Debug for TriggerCron { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerCron") - .field("schedule", &self.schedule) - .field("start-time", &self.start_time) - .field("end-time", &self.end_time) - .finish() - } - } - #[derive(Clone)] - pub enum Trigger { - EvmContractEvent(TriggerEvmContractEvent), - CosmosContractEvent(TriggerCosmosContractEvent), - BlockInterval(TriggerBlockInterval), - Cron(TriggerCron), - Manual, - } - impl ::core::fmt::Debug for Trigger { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - Trigger::EvmContractEvent(e) => { - f.debug_tuple("Trigger::EvmContractEvent").field(e).finish() - } - Trigger::CosmosContractEvent(e) => { - f.debug_tuple("Trigger::CosmosContractEvent") - .field(e) - .finish() - } - Trigger::BlockInterval(e) => { - f.debug_tuple("Trigger::BlockInterval").field(e).finish() - } - Trigger::Cron(e) => { - f.debug_tuple("Trigger::Cron").field(e).finish() - } - Trigger::Manual => f.debug_tuple("Trigger::Manual").finish(), - } - } - } - #[derive(Clone, Copy)] - pub enum SignatureAlgorithm { - Secp256k1, - } - impl ::core::fmt::Debug for SignatureAlgorithm { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - SignatureAlgorithm::Secp256k1 => { - f.debug_tuple("SignatureAlgorithm::Secp256k1").finish() - } - } - } - } - #[derive(Clone, Copy)] - pub enum SignaturePrefix { - Eip191, - } - impl ::core::fmt::Debug for SignaturePrefix { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - SignaturePrefix::Eip191 => { - f.debug_tuple("SignaturePrefix::Eip191").finish() - } - } - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct SignatureKind { - pub algorithm: SignatureAlgorithm, - pub prefix: Option, - } - impl ::core::fmt::Debug for SignatureKind { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("SignatureKind") - .field("algorithm", &self.algorithm) - .field("prefix", &self.prefix) - .finish() - } - } - #[derive(Clone)] - pub struct AggregatorSubmit { - pub url: _rt::String, - pub component: Component, - pub signature_kind: SignatureKind, - } - impl ::core::fmt::Debug for AggregatorSubmit { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("AggregatorSubmit") - .field("url", &self.url) - .field("component", &self.component) - .field("signature-kind", &self.signature_kind) - .finish() - } - } - #[derive(Clone)] - pub enum Submit { - None, - Aggregator(AggregatorSubmit), - } - impl ::core::fmt::Debug for Submit { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - Submit::None => f.debug_tuple("Submit::None").finish(), - Submit::Aggregator(e) => { - f.debug_tuple("Submit::Aggregator").field(e).finish() - } - } - } - } - #[derive(Clone)] - pub struct Workflow { - pub trigger: Trigger, - pub component: Component, - pub submit: Submit, - } - impl ::core::fmt::Debug for Workflow { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Workflow") - .field("trigger", &self.trigger) - .field("component", &self.component) - .field("submit", &self.submit) - .finish() - } - } - #[derive(Clone)] - pub struct Service { - pub name: _rt::String, - pub workflows: _rt::Vec<(WorkflowId, Workflow)>, - pub status: ServiceStatus, - pub manager: ServiceManager, - } - impl ::core::fmt::Debug for Service { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("Service") - .field("name", &self.name) - .field("workflows", &self.workflows) - .field("status", &self.status) - .field("manager", &self.manager) - .finish() - } - } - #[derive(Clone)] - pub struct ServiceAndWorkflowId { - pub service: Service, - pub workflow_id: WorkflowId, - } - impl ::core::fmt::Debug for ServiceAndWorkflowId { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("ServiceAndWorkflowId") - .field("service", &self.service) - .field("workflow-id", &self.workflow_id) - .finish() - } - } - #[derive(Clone)] - pub struct WorkflowAndWorkflowId { - pub workflow: Workflow, - pub workflow_id: WorkflowId, - } - impl ::core::fmt::Debug for WorkflowAndWorkflowId { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("WorkflowAndWorkflowId") - .field("workflow", &self.workflow) - .field("workflow-id", &self.workflow_id) - .finish() - } - } - } - #[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] - pub mod events { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::super::super::__link_custom_section_describing_imports; - use super::super::super::_rt; - pub type ChainKey = super::super::super::wavs::types::chain::ChainKey; - pub type EvmEventLog = super::super::super::wavs::types::chain::EvmEventLog; - pub type CosmosAddress = super::super::super::wavs::types::chain::CosmosAddress; - pub type CosmosEvent = super::super::super::wavs::types::chain::CosmosEvent; - pub type Timestamp = super::super::super::wavs::types::core::Timestamp; - pub type EventId = _rt::Vec; - #[derive(Clone)] - pub struct TriggerDataEvmContractEvent { - pub chain: ChainKey, - pub log: EvmEventLog, - } - impl ::core::fmt::Debug for TriggerDataEvmContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataEvmContractEvent") - .field("chain", &self.chain) - .field("log", &self.log) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerDataCosmosContractEvent { - pub contract_address: CosmosAddress, - pub chain: ChainKey, - pub event: CosmosEvent, - pub event_index: u64, - pub block_height: u64, - } - impl ::core::fmt::Debug for TriggerDataCosmosContractEvent { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataCosmosContractEvent") - .field("contract-address", &self.contract_address) - .field("chain", &self.chain) - .field("event", &self.event) - .field("event-index", &self.event_index) - .field("block-height", &self.block_height) - .finish() - } - } - #[derive(Clone)] - pub struct TriggerDataBlockInterval { - pub chain: ChainKey, - pub block_height: u64, - } - impl ::core::fmt::Debug for TriggerDataBlockInterval { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataBlockInterval") - .field("chain", &self.chain) - .field("block-height", &self.block_height) - .finish() - } - } - #[repr(C)] - #[derive(Clone, Copy)] - pub struct TriggerDataCron { - pub trigger_time: Timestamp, - } - impl ::core::fmt::Debug for TriggerDataCron { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - f.debug_struct("TriggerDataCron") - .field("trigger-time", &self.trigger_time) - .finish() - } - } - #[derive(Clone)] - pub enum TriggerData { - EvmContractEvent(TriggerDataEvmContractEvent), - CosmosContractEvent(TriggerDataCosmosContractEvent), - BlockInterval(TriggerDataBlockInterval), - Cron(TriggerDataCron), - Raw(_rt::Vec), - } - impl ::core::fmt::Debug for TriggerData { - fn fmt( - &self, - f: &mut ::core::fmt::Formatter<'_>, - ) -> ::core::fmt::Result { - match self { - TriggerData::EvmContractEvent(e) => { - f.debug_tuple("TriggerData::EvmContractEvent") - .field(e) - .finish() - } - TriggerData::CosmosContractEvent(e) => { - f.debug_tuple("TriggerData::CosmosContractEvent") - .field(e) - .finish() - } - TriggerData::BlockInterval(e) => { - f.debug_tuple("TriggerData::BlockInterval").field(e).finish() - } - TriggerData::Cron(e) => { - f.debug_tuple("TriggerData::Cron").field(e).finish() - } - TriggerData::Raw(e) => { - f.debug_tuple("TriggerData::Raw").field(e).finish() - } - } - } - } - } - } -} -#[allow(dead_code, async_fn_in_trait, unused_imports, clippy::all)] -pub mod host { - #[used] - #[doc(hidden)] - static __FORCE_SECTION_REF: fn() = super::__link_custom_section_describing_imports; - use super::_rt; - pub type EvmChainConfig = super::wavs::types::chain::EvmChainConfig; - pub type CosmosChainConfig = super::wavs::types::chain::CosmosChainConfig; - pub type ServiceAndWorkflowId = super::wavs::types::service::ServiceAndWorkflowId; - pub type WorkflowAndWorkflowId = super::wavs::types::service::WorkflowAndWorkflowId; - pub type LogLevel = super::wavs::types::core::LogLevel; - pub type EventId = super::wavs::types::events::EventId; - #[allow(unused_unsafe, clippy::all)] - pub fn get_evm_chain_config(chain_key: &str) -> Option { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 9 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 9 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = chain_key; - 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 = "host")] - unsafe extern "C" { - #[link_name = "get-evm-chain-config"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result15 = match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = i32::from( - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l11 = i32::from( - *ptr1 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::chain::EvmChainConfig { - chain_id: _rt::string_lift(bytes6), - ws_endpoint: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr1 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr1 - .add(5 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - http_endpoint: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr1 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *ptr1 - .add(8 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result15 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn get_cosmos_chain_config(chain_key: &str) -> Option { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 17 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 17 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = chain_key; - 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 = "host")] - unsafe extern "C" { - #[link_name = "get-cosmos-chain-config"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result26 = match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len6 = l5; - let bytes6 = _rt::Vec::from_raw_parts(l4.cast(), len6, len6); - let l7 = i32::from( - *ptr1 - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l11 = i32::from( - *ptr1 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l15 = i32::from( - *ptr1 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l19 = *ptr1 - .add(12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l20 = *ptr1 - .add(13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l21 = *ptr1 - .add(14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len22 = l21; - let bytes22 = _rt::Vec::from_raw_parts(l20.cast(), len22, len22); - let l23 = *ptr1 - .add(15 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l24 = *ptr1 - .add(16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len25 = l24; - let bytes25 = _rt::Vec::from_raw_parts(l23.cast(), len25, len25); - super::wavs::types::chain::CosmosChainConfig { - chain_id: _rt::string_lift(bytes6), - rpc_endpoint: match l7 { - 0 => None, - 1 => { - let e = { - let l8 = *ptr1 - .add(4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l9 = *ptr1 - .add(5 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - grpc_endpoint: match l11 { - 0 => None, - 1 => { - let e = { - let l12 = *ptr1 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l13 = *ptr1 - .add(8 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - grpc_web_endpoint: match l15 { - 0 => None, - 1 => { - let e = { - let l16 = *ptr1 - .add(10 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr1 - .add(11 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - gas_price: l19, - gas_denom: _rt::string_lift(bytes22), - bech32_prefix: _rt::string_lift(bytes25), - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }; - result26 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn config_var(key: &str) -> Option<_rt::String> { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 3 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 3 - * ::core::mem::size_of::<*const u8>()], - ); - let vec0 = key; - 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 = "host")] - unsafe extern "C" { - #[link_name = "config-var"] - fn wit_import2(_: *mut u8, _: usize, _: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import2(_: *mut u8, _: usize, _: *mut u8) { - unreachable!() - } - unsafe { wit_import2(ptr0.cast_mut(), len0, ptr1) }; - let l3 = i32::from(*ptr1.add(0).cast::()); - let result7 = match l3 { - 0 => None, - 1 => { - let e = { - let l4 = *ptr1 - .add(::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l5 = *ptr1 - .add(2 * ::core::mem::size_of::<*const u8>()) - .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(), - }; - result7 - } - } - #[allow(unused_unsafe, clippy::all)] - pub fn log(level: LogLevel, message: &str) -> () { - unsafe { - use super::wavs::types::core::LogLevel as V0; - let result1 = match level { - V0::Error => 0i32, - V0::Warn => 1i32, - V0::Info => 2i32, - V0::Debug => 3i32, - V0::Trace => 4i32, - }; - let vec2 = message; - let ptr2 = vec2.as_ptr().cast::(); - let len2 = vec2.len(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "log"] - fn wit_import3(_: i32, _: *mut u8, _: usize); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import3(_: i32, _: *mut u8, _: usize) { - unreachable!() - } - unsafe { wit_import3(result1, ptr2.cast_mut(), len2) }; - } - } - #[allow(unused_unsafe, clippy::all)] - /// gets the service and workflow id that called this component - pub fn get_service() -> ServiceAndWorkflowId { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 12 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 12 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "get-service"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len4 = l3; - let bytes4 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - let l5 = *ptr0 - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l6 = *ptr0.add(3 * ::core::mem::size_of::<*const u8>()).cast::(); - let base162 = l5; - let len162 = l6; - let mut result162 = _rt::Vec::with_capacity(len162); - for i in 0..len162 { - let base = base162 - .add(i * (144 + 42 * ::core::mem::size_of::<*const u8>())); - let e162 = { - let l7 = *base.add(0).cast::<*mut u8>(); - let l8 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len9 = l8; - let bytes9 = _rt::Vec::from_raw_parts(l7.cast(), len9, len9); - let l10 = i32::from( - *base.add(2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::Trigger as V45; - let v45 = match l10 { - 0 => { - let e45 = { - let l11 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l12 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len13 = l12; - let l14 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l15 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len16 = l15; - let bytes16 = _rt::Vec::from_raw_parts( - l14.cast(), - len16, - len16, - ); - let l17 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l18 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len19 = l18; - super::wavs::types::service::TriggerEvmContractEvent { - address: super::wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l11.cast(), - len13, - len13, - ), - }, - chain: _rt::string_lift(bytes16), - event_hash: _rt::Vec::from_raw_parts( - l17.cast(), - len19, - len19, - ), - } - }; - V45::EvmContractEvent(e45) - } - 1 => { - let e45 = { - let l20 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l21 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len22 = l21; - let bytes22 = _rt::Vec::from_raw_parts( - l20.cast(), - len22, - len22, - ); - let l23 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l24 = *base - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l25 = *base - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len26 = l25; - let bytes26 = _rt::Vec::from_raw_parts( - l24.cast(), - len26, - len26, - ); - let l27 = *base - .add(8 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l28 = *base - .add(8 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len29 = l28; - let bytes29 = _rt::Vec::from_raw_parts( - l27.cast(), - len29, - len29, - ); - super::wavs::types::service::TriggerCosmosContractEvent { - address: super::wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes22), - prefix_len: l23 as u32, - }, - chain: _rt::string_lift(bytes26), - event_type: _rt::string_lift(bytes29), - } - }; - V45::CosmosContractEvent(e45) - } - 2 => { - let e45 = { - let l30 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l31 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len32 = l31; - let bytes32 = _rt::Vec::from_raw_parts( - l30.cast(), - len32, - len32, - ); - let l33 = *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l34 = i32::from( - *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l36 = i32::from( - *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes32), - n_blocks: l33 as u32, - start_block: match l34 { - 0 => None, - 1 => { - let e = { - let l35 = *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l35 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l36 { - 0 => None, - 1 => { - let e = { - let l37 = *base - .add(40 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l37 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V45::BlockInterval(e45) - } - 3 => { - let e45 = { - let l38 = *base - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l39 = *base - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len40 = l39; - let bytes40 = _rt::Vec::from_raw_parts( - l38.cast(), - len40, - len40, - ); - let l41 = i32::from( - *base - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l43 = i32::from( - *base - .add(24 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes40), - start_time: match l41 { - 0 => None, - 1 => { - let e = { - let l42 = *base - .add(16 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l42 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l43 { - 0 => None, - 1 => { - let e = { - let l44 = *base - .add(32 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l44 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V45::Cron(e45) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V45::Manual - } - }; - let l46 = i32::from( - *base - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::ComponentSource as V70; - let v70 = match l46 { - 0 => { - let e70 = { - let l47 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l48 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len49 = l48; - let bytes49 = _rt::Vec::from_raw_parts( - l47.cast(), - len49, - len49, - ); - let l50 = *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l51 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len52 = l51; - let bytes52 = _rt::Vec::from_raw_parts( - l50.cast(), - len52, - len52, - ); - super::wavs::types::service::ComponentSourceDownload { - url: _rt::string_lift(bytes49), - digest: _rt::string_lift(bytes52), - } - }; - V70::Download(e70) - } - 1 => { - let e70 = { - let l53 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l54 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len55 = l54; - let bytes55 = _rt::Vec::from_raw_parts( - l53.cast(), - len55, - len55, - ); - let l56 = i32::from( - *base - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l60 = i32::from( - *base - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l64 = *base - .add(48 + 13 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l65 = *base - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len66 = l65; - let bytes66 = _rt::Vec::from_raw_parts( - l64.cast(), - len66, - len66, - ); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes55), - domain: match l56 { - 0 => None, - 1 => { - let e = { - let l57 = *base - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l58 = *base - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - version: match l60 { - 0 => None, - 1 => { - let e = { - let l61 = *base - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l62 = *base - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - pkg: _rt::string_lift(bytes66), - } - }; - V70::Registry(e70) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e70 = { - let l67 = *base - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l68 = *base - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len69 = l68; - let bytes69 = _rt::Vec::from_raw_parts( - l67.cast(), - len69, - len69, - ); - _rt::string_lift(bytes69) - }; - V70::Digest(e70) - } - }; - let l71 = i32::from( - *base - .add(48 + 15 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V78; - let v78 = match l71 { - 0 => V78::All, - 1 => { - let e78 = { - let l72 = *base - .add(48 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l73 = *base - .add(48 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base77 = l72; - let len77 = l73; - let mut result77 = _rt::Vec::with_capacity(len77); - for i in 0..len77 { - let base = base77 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e77 = { - let l74 = *base.add(0).cast::<*mut u8>(); - let l75 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len76 = l75; - let bytes76 = _rt::Vec::from_raw_parts( - l74.cast(), - len76, - len76, - ); - _rt::string_lift(bytes76) - }; - result77.push(e77); - } - _rt::cabi_dealloc( - base77, - len77 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result77 - }; - V78::Only(e78) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V78::None - } - }; - let l79 = i32::from( - *base - .add(48 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l80 = i32::from( - *base - .add(56 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l82 = i32::from( - *base - .add(72 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l84 = *base - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l85 = *base - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base92 = l84; - let len92 = l85; - let mut result92 = _rt::Vec::with_capacity(len92); - for i in 0..len92 { - let base = base92 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e92 = { - let l86 = *base.add(0).cast::<*mut u8>(); - let l87 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len88 = l87; - let bytes88 = _rt::Vec::from_raw_parts( - l86.cast(), - len88, - len88, - ); - let l89 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l90 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len91 = l90; - let bytes91 = _rt::Vec::from_raw_parts( - l89.cast(), - len91, - len91, - ); - (_rt::string_lift(bytes88), _rt::string_lift(bytes91)) - }; - result92.push(e92); - } - _rt::cabi_dealloc( - base92, - len92 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l93 = *base - .add(88 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l94 = *base - .add(88 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base98 = l93; - let len98 = l94; - let mut result98 = _rt::Vec::with_capacity(len98); - for i in 0..len98 { - let base = base98 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e98 = { - let l95 = *base.add(0).cast::<*mut u8>(); - let l96 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len97 = l96; - let bytes97 = _rt::Vec::from_raw_parts( - l95.cast(), - len97, - len97, - ); - _rt::string_lift(bytes97) - }; - result98.push(e98); - } - _rt::cabi_dealloc( - base98, - len98 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l99 = i32::from( - *base - .add(88 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::Submit as V161; - let v161 = match l99 { - 0 => V161::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e161 = { - let l100 = *base - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l101 = *base - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len102 = l101; - let bytes102 = _rt::Vec::from_raw_parts( - l100.cast(), - len102, - len102, - ); - let l103 = i32::from( - *base - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::ComponentSource as V127; - let v127 = match l103 { - 0 => { - let e127 = { - let l104 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l105 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len106 = l105; - let bytes106 = _rt::Vec::from_raw_parts( - l104.cast(), - len106, - len106, - ); - let l107 = *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l108 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len109 = l108; - let bytes109 = _rt::Vec::from_raw_parts( - l107.cast(), - len109, - len109, - ); - super::wavs::types::service::ComponentSourceDownload { - url: _rt::string_lift(bytes106), - digest: _rt::string_lift(bytes109), - } - }; - V127::Download(e127) - } - 1 => { - let e127 = { - let l110 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l111 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len112 = l111; - let bytes112 = _rt::Vec::from_raw_parts( - l110.cast(), - len112, - len112, - ); - let l113 = i32::from( - *base - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l117 = i32::from( - *base - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l121 = *base - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l122 = *base - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len123 = l122; - let bytes123 = _rt::Vec::from_raw_parts( - l121.cast(), - len123, - len123, - ); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes112), - domain: match l113 { - 0 => None, - 1 => { - let e = { - let l114 = *base - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l115 = *base - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len116 = l115; - let bytes116 = _rt::Vec::from_raw_parts( - l114.cast(), - len116, - len116, - ); - _rt::string_lift(bytes116) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l117 { - 0 => None, - 1 => { - let e = { - let l118 = *base - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l119 = *base - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len120 = l119; - let bytes120 = _rt::Vec::from_raw_parts( - l118.cast(), - len120, - len120, - ); - _rt::string_lift(bytes120) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes123), - } - }; - V127::Registry(e127) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e127 = { - let l124 = *base - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l125 = *base - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len126 = l125; - let bytes126 = _rt::Vec::from_raw_parts( - l124.cast(), - len126, - len126, - ); - _rt::string_lift(bytes126) - }; - V127::Digest(e127) - } - }; - let l128 = i32::from( - *base - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V135; - let v135 = match l128 { - 0 => V135::All, - 1 => { - let e135 = { - let l129 = *base - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l130 = *base - .add(96 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base134 = l129; - let len134 = l130; - let mut result134 = _rt::Vec::with_capacity(len134); - for i in 0..len134 { - let base = base134 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e134 = { - let l131 = *base.add(0).cast::<*mut u8>(); - let l132 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len133 = l132; - let bytes133 = _rt::Vec::from_raw_parts( - l131.cast(), - len133, - len133, - ); - _rt::string_lift(bytes133) - }; - result134.push(e134); - } - _rt::cabi_dealloc( - base134, - len134 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result134 - }; - V135::Only(e135) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V135::None - } - }; - let l136 = i32::from( - *base - .add(96 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l137 = i32::from( - *base - .add(104 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l139 = i32::from( - *base - .add(120 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l141 = *base - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l142 = *base - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base149 = l141; - let len149 = l142; - let mut result149 = _rt::Vec::with_capacity(len149); - for i in 0..len149 { - let base = base149 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e149 = { - let l143 = *base.add(0).cast::<*mut u8>(); - let l144 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len145 = l144; - let bytes145 = _rt::Vec::from_raw_parts( - l143.cast(), - len145, - len145, - ); - let l146 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l147 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len148 = l147; - let bytes148 = _rt::Vec::from_raw_parts( - l146.cast(), - len148, - len148, - ); - (_rt::string_lift(bytes145), _rt::string_lift(bytes148)) - }; - result149.push(e149); - } - _rt::cabi_dealloc( - base149, - len149 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l150 = *base - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l151 = *base - .add(136 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base155 = l150; - let len155 = l151; - let mut result155 = _rt::Vec::with_capacity(len155); - for i in 0..len155 { - let base = base155 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e155 = { - let l152 = *base.add(0).cast::<*mut u8>(); - let l153 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len154 = l153; - let bytes154 = _rt::Vec::from_raw_parts( - l152.cast(), - len154, - len154, - ); - _rt::string_lift(bytes154) - }; - result155.push(e155); - } - _rt::cabi_dealloc( - base155, - len155 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l156 = i32::from( - *base - .add(136 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignatureAlgorithm as V157; - let v157 = match l156 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V157::Secp256k1 - } - }; - let l158 = i32::from( - *base - .add(137 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes102), - component: super::wavs::types::service::Component { - source: v127, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v135, - file_system: _rt::bool_lift(l136 as u8), - }, - fuel_limit: match l137 { - 0 => None, - 1 => { - let e = { - let l138 = *base - .add(112 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l138 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l139 { - 0 => None, - 1 => { - let e = { - let l140 = *base - .add(128 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l140 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result149, - env_keys: result155, - }, - signature_kind: super::wavs::types::service::SignatureKind { - algorithm: v157, - prefix: match l158 { - 0 => None, - 1 => { - let e = { - let l159 = i32::from( - *base - .add(138 + 42 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignaturePrefix as V160; - let v160 = match l159 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V160::Eip191 - } - }; - v160 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V161::Aggregator(e161) - } - }; - ( - _rt::string_lift(bytes9), - super::wavs::types::service::Workflow { - trigger: v45, - component: super::wavs::types::service::Component { - source: v70, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v78, - file_system: _rt::bool_lift(l79 as u8), - }, - fuel_limit: match l80 { - 0 => None, - 1 => { - let e = { - let l81 = *base - .add(64 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l81 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l82 { - 0 => None, - 1 => { - let e = { - let l83 = *base - .add(80 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l83 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result92, - env_keys: result98, - }, - submit: v161, - }, - ) - }; - result162.push(e162); - } - _rt::cabi_dealloc( - base162, - len162 * (144 + 42 * ::core::mem::size_of::<*const u8>()), - 8, - ); - let l163 = i32::from( - *ptr0.add(4 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::ServiceStatus as V164; - let v164 = match l163 { - 0 => V164::Active, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - V164::Paused - } - }; - let l165 = i32::from( - *ptr0.add(5 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::ServiceManager as V172; - let v172 = match l165 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - let e172 = { - let l166 = *ptr0 - .add(6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l167 = *ptr0 - .add(7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len168 = l167; - let bytes168 = _rt::Vec::from_raw_parts( - l166.cast(), - len168, - len168, - ); - let l169 = *ptr0 - .add(8 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l170 = *ptr0 - .add(9 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len171 = l170; - super::wavs::types::service::EvmManager { - chain: _rt::string_lift(bytes168), - address: super::wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts( - l169.cast(), - len171, - len171, - ), - }, - } - }; - V172::Evm(e172) - } - }; - let l173 = *ptr0 - .add(10 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l174 = *ptr0 - .add(11 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len175 = l174; - let bytes175 = _rt::Vec::from_raw_parts(l173.cast(), len175, len175); - let result176 = super::wavs::types::service::ServiceAndWorkflowId { - service: super::wavs::types::service::Service { - name: _rt::string_lift(bytes4), - workflows: result162, - status: v164, - manager: v172, - }, - workflow_id: _rt::string_lift(bytes175), - }; - result176 - } - } - #[allow(unused_unsafe, clippy::all)] - /// convenience function to get the workflow without having to walk service.workflows - pub fn get_workflow() -> WorkflowAndWorkflowId { - unsafe { - #[repr(align(8))] - struct RetArea( - [::core::mem::MaybeUninit< - u8, - >; 144 + 42 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 144 - + 42 * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "get-workflow"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = i32::from(*ptr0.add(0).cast::()); - use super::wavs::types::service::Trigger as V37; - let v37 = match l2 { - 0 => { - let e37 = { - let l3 = *ptr0.add(8).cast::<*mut u8>(); - let l4 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len5 = l4; - let l6 = *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l7 = *ptr0 - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len8 = l7; - let bytes8 = _rt::Vec::from_raw_parts(l6.cast(), len8, len8); - let l9 = *ptr0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l10 = *ptr0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len11 = l10; - super::wavs::types::service::TriggerEvmContractEvent { - address: super::wavs::types::chain::EvmAddress { - raw_bytes: _rt::Vec::from_raw_parts(l3.cast(), len5, len5), - }, - chain: _rt::string_lift(bytes8), - event_hash: _rt::Vec::from_raw_parts(l9.cast(), len11, len11), - } - }; - V37::EvmContractEvent(e37) - } - 1 => { - let e37 = { - let l12 = *ptr0.add(8).cast::<*mut u8>(); - let l13 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len14 = l13; - let bytes14 = _rt::Vec::from_raw_parts(l12.cast(), len14, len14); - let l15 = *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l16 = *ptr0 - .add(8 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l17 = *ptr0 - .add(8 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len18 = l17; - let bytes18 = _rt::Vec::from_raw_parts(l16.cast(), len18, len18); - let l19 = *ptr0 - .add(8 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l20 = *ptr0 - .add(8 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len21 = l20; - let bytes21 = _rt::Vec::from_raw_parts(l19.cast(), len21, len21); - super::wavs::types::service::TriggerCosmosContractEvent { - address: super::wavs::types::chain::CosmosAddress { - bech32_addr: _rt::string_lift(bytes14), - prefix_len: l15 as u32, - }, - chain: _rt::string_lift(bytes18), - event_type: _rt::string_lift(bytes21), - } - }; - V37::CosmosContractEvent(e37) - } - 2 => { - let e37 = { - let l22 = *ptr0.add(8).cast::<*mut u8>(); - let l23 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len24 = l23; - let bytes24 = _rt::Vec::from_raw_parts(l22.cast(), len24, len24); - let l25 = *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let l26 = i32::from( - *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l28 = i32::from( - *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerBlockInterval { - chain: _rt::string_lift(bytes24), - n_blocks: l25 as u32, - start_block: match l26 { - 0 => None, - 1 => { - let e = { - let l27 = *ptr0 - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l27 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_block: match l28 { - 0 => None, - 1 => { - let e = { - let l29 = *ptr0 - .add(40 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l29 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V37::BlockInterval(e37) - } - 3 => { - let e37 = { - let l30 = *ptr0.add(8).cast::<*mut u8>(); - let l31 = *ptr0 - .add(8 + 1 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len32 = l31; - let bytes32 = _rt::Vec::from_raw_parts(l30.cast(), len32, len32); - let l33 = i32::from( - *ptr0 - .add(8 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l35 = i32::from( - *ptr0 - .add(24 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::TriggerCron { - schedule: _rt::string_lift(bytes32), - start_time: match l33 { - 0 => None, - 1 => { - let e = { - let l34 = *ptr0 - .add(16 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l34 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - end_time: match l35 { - 0 => None, - 1 => { - let e = { - let l36 = *ptr0 - .add(32 + 2 * ::core::mem::size_of::<*const u8>()) - .cast::(); - super::wavs::types::core::Timestamp { - nanos: l36 as u64, - } - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - } - }; - V37::Cron(e37) - } - n => { - debug_assert_eq!(n, 4, "invalid enum discriminant"); - V37::Manual - } - }; - let l38 = i32::from( - *ptr0.add(48 + 2 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::ComponentSource as V62; - let v62 = match l38 { - 0 => { - let e62 = { - let l39 = *ptr0 - .add(48 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l40 = *ptr0 - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len41 = l40; - let bytes41 = _rt::Vec::from_raw_parts(l39.cast(), len41, len41); - let l42 = *ptr0 - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l43 = *ptr0 - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len44 = l43; - let bytes44 = _rt::Vec::from_raw_parts(l42.cast(), len44, len44); - super::wavs::types::service::ComponentSourceDownload { - url: _rt::string_lift(bytes41), - digest: _rt::string_lift(bytes44), - } - }; - V62::Download(e62) - } - 1 => { - let e62 = { - let l45 = *ptr0 - .add(48 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l46 = *ptr0 - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len47 = l46; - let bytes47 = _rt::Vec::from_raw_parts(l45.cast(), len47, len47); - let l48 = i32::from( - *ptr0 - .add(48 + 5 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l52 = i32::from( - *ptr0 - .add(48 + 8 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l56 = *ptr0 - .add(48 + 11 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l57 = *ptr0 - .add(48 + 12 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len58 = l57; - let bytes58 = _rt::Vec::from_raw_parts(l56.cast(), len58, len58); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes47), - domain: match l48 { - 0 => None, - 1 => { - let e = { - let l49 = *ptr0 - .add(48 + 6 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l50 = *ptr0 - .add(48 + 7 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len51 = l50; - let bytes51 = _rt::Vec::from_raw_parts( - l49.cast(), - len51, - len51, - ); - _rt::string_lift(bytes51) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l52 { - 0 => None, - 1 => { - let e = { - let l53 = *ptr0 - .add(48 + 9 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l54 = *ptr0 - .add(48 + 10 * ::core::mem::size_of::<*const u8>()) - .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(), - }, - pkg: _rt::string_lift(bytes58), - } - }; - V62::Registry(e62) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e62 = { - let l59 = *ptr0 - .add(48 + 3 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l60 = *ptr0 - .add(48 + 4 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len61 = l60; - let bytes61 = _rt::Vec::from_raw_parts(l59.cast(), len61, len61); - _rt::string_lift(bytes61) - }; - V62::Digest(e62) - } - }; - let l63 = i32::from( - *ptr0.add(48 + 13 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V70; - let v70 = match l63 { - 0 => V70::All, - 1 => { - let e70 = { - let l64 = *ptr0 - .add(48 + 14 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l65 = *ptr0 - .add(48 + 15 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base69 = l64; - let len69 = l65; - let mut result69 = _rt::Vec::with_capacity(len69); - for i in 0..len69 { - let base = base69 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e69 = { - let l66 = *base.add(0).cast::<*mut u8>(); - let l67 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len68 = l67; - let bytes68 = _rt::Vec::from_raw_parts( - l66.cast(), - len68, - len68, - ); - _rt::string_lift(bytes68) - }; - result69.push(e69); - } - _rt::cabi_dealloc( - base69, - len69 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result69 - }; - V70::Only(e70) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V70::None - } - }; - let l71 = i32::from( - *ptr0.add(48 + 16 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l72 = i32::from( - *ptr0.add(56 + 16 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l74 = i32::from( - *ptr0.add(72 + 16 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - let l76 = *ptr0 - .add(88 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l77 = *ptr0 - .add(88 + 17 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base84 = l76; - let len84 = l77; - let mut result84 = _rt::Vec::with_capacity(len84); - for i in 0..len84 { - let base = base84.add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e84 = { - let l78 = *base.add(0).cast::<*mut u8>(); - let l79 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len80 = l79; - let bytes80 = _rt::Vec::from_raw_parts(l78.cast(), len80, len80); - let l81 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l82 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len83 = l82; - let bytes83 = _rt::Vec::from_raw_parts(l81.cast(), len83, len83); - (_rt::string_lift(bytes80), _rt::string_lift(bytes83)) - }; - result84.push(e84); - } - _rt::cabi_dealloc( - base84, - len84 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l85 = *ptr0 - .add(88 + 18 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l86 = *ptr0 - .add(88 + 19 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base90 = l85; - let len90 = l86; - let mut result90 = _rt::Vec::with_capacity(len90); - for i in 0..len90 { - let base = base90.add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e90 = { - let l87 = *base.add(0).cast::<*mut u8>(); - let l88 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len89 = l88; - let bytes89 = _rt::Vec::from_raw_parts(l87.cast(), len89, len89); - _rt::string_lift(bytes89) - }; - result90.push(e90); - } - _rt::cabi_dealloc( - base90, - len90 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l91 = i32::from( - *ptr0.add(88 + 20 * ::core::mem::size_of::<*const u8>()).cast::(), - ); - use super::wavs::types::service::Submit as V153; - let v153 = match l91 { - 0 => V153::None, - n => { - debug_assert_eq!(n, 1, "invalid enum discriminant"); - let e153 = { - let l92 = *ptr0 - .add(96 + 20 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l93 = *ptr0 - .add(96 + 21 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len94 = l93; - let bytes94 = _rt::Vec::from_raw_parts(l92.cast(), len94, len94); - let l95 = i32::from( - *ptr0 - .add(96 + 22 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::ComponentSource as V119; - let v119 = match l95 { - 0 => { - let e119 = { - let l96 = *ptr0 - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l97 = *ptr0 - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len98 = l97; - let bytes98 = _rt::Vec::from_raw_parts( - l96.cast(), - len98, - len98, - ); - let l99 = *ptr0 - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l100 = *ptr0 - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len101 = l100; - let bytes101 = _rt::Vec::from_raw_parts( - l99.cast(), - len101, - len101, - ); - super::wavs::types::service::ComponentSourceDownload { - url: _rt::string_lift(bytes98), - digest: _rt::string_lift(bytes101), - } - }; - V119::Download(e119) - } - 1 => { - let e119 = { - let l102 = *ptr0 - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l103 = *ptr0 - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len104 = l103; - let bytes104 = _rt::Vec::from_raw_parts( - l102.cast(), - len104, - len104, - ); - let l105 = i32::from( - *ptr0 - .add(96 + 25 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l109 = i32::from( - *ptr0 - .add(96 + 28 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l113 = *ptr0 - .add(96 + 31 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l114 = *ptr0 - .add(96 + 32 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len115 = l114; - let bytes115 = _rt::Vec::from_raw_parts( - l113.cast(), - len115, - len115, - ); - super::wavs::types::service::Registry { - digest: _rt::string_lift(bytes104), - domain: match l105 { - 0 => None, - 1 => { - let e = { - let l106 = *ptr0 - .add(96 + 26 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l107 = *ptr0 - .add(96 + 27 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len108 = l107; - let bytes108 = _rt::Vec::from_raw_parts( - l106.cast(), - len108, - len108, - ); - _rt::string_lift(bytes108) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - version: match l109 { - 0 => None, - 1 => { - let e = { - let l110 = *ptr0 - .add(96 + 29 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l111 = *ptr0 - .add(96 + 30 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len112 = l111; - let bytes112 = _rt::Vec::from_raw_parts( - l110.cast(), - len112, - len112, - ); - _rt::string_lift(bytes112) - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - pkg: _rt::string_lift(bytes115), - } - }; - V119::Registry(e119) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - let e119 = { - let l116 = *ptr0 - .add(96 + 23 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l117 = *ptr0 - .add(96 + 24 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len118 = l117; - let bytes118 = _rt::Vec::from_raw_parts( - l116.cast(), - len118, - len118, - ); - _rt::string_lift(bytes118) - }; - V119::Digest(e119) - } - }; - let l120 = i32::from( - *ptr0 - .add(96 + 33 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::AllowedHostPermission as V127; - let v127 = match l120 { - 0 => V127::All, - 1 => { - let e127 = { - let l121 = *ptr0 - .add(96 + 34 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l122 = *ptr0 - .add(96 + 35 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base126 = l121; - let len126 = l122; - let mut result126 = _rt::Vec::with_capacity(len126); - for i in 0..len126 { - let base = base126 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e126 = { - let l123 = *base.add(0).cast::<*mut u8>(); - let l124 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len125 = l124; - let bytes125 = _rt::Vec::from_raw_parts( - l123.cast(), - len125, - len125, - ); - _rt::string_lift(bytes125) - }; - result126.push(e126); - } - _rt::cabi_dealloc( - base126, - len126 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - result126 - }; - V127::Only(e127) - } - n => { - debug_assert_eq!(n, 2, "invalid enum discriminant"); - V127::None - } - }; - let l128 = i32::from( - *ptr0 - .add(96 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l129 = i32::from( - *ptr0 - .add(104 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l131 = i32::from( - *ptr0 - .add(120 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - let l133 = *ptr0 - .add(136 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l134 = *ptr0 - .add(136 + 37 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base141 = l133; - let len141 = l134; - let mut result141 = _rt::Vec::with_capacity(len141); - for i in 0..len141 { - let base = base141 - .add(i * (4 * ::core::mem::size_of::<*const u8>())); - let e141 = { - let l135 = *base.add(0).cast::<*mut u8>(); - let l136 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len137 = l136; - let bytes137 = _rt::Vec::from_raw_parts( - l135.cast(), - len137, - len137, - ); - let l138 = *base - .add(2 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l139 = *base - .add(3 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len140 = l139; - let bytes140 = _rt::Vec::from_raw_parts( - l138.cast(), - len140, - len140, - ); - (_rt::string_lift(bytes137), _rt::string_lift(bytes140)) - }; - result141.push(e141); - } - _rt::cabi_dealloc( - base141, - len141 * (4 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l142 = *ptr0 - .add(136 + 38 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l143 = *ptr0 - .add(136 + 39 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let base147 = l142; - let len147 = l143; - let mut result147 = _rt::Vec::with_capacity(len147); - for i in 0..len147 { - let base = base147 - .add(i * (2 * ::core::mem::size_of::<*const u8>())); - let e147 = { - let l144 = *base.add(0).cast::<*mut u8>(); - let l145 = *base - .add(::core::mem::size_of::<*const u8>()) - .cast::(); - let len146 = l145; - let bytes146 = _rt::Vec::from_raw_parts( - l144.cast(), - len146, - len146, - ); - _rt::string_lift(bytes146) - }; - result147.push(e147); - } - _rt::cabi_dealloc( - base147, - len147 * (2 * ::core::mem::size_of::<*const u8>()), - ::core::mem::size_of::<*const u8>(), - ); - let l148 = i32::from( - *ptr0 - .add(136 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignatureAlgorithm as V149; - let v149 = match l148 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V149::Secp256k1 - } - }; - let l150 = i32::from( - *ptr0 - .add(137 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - super::wavs::types::service::AggregatorSubmit { - url: _rt::string_lift(bytes94), - component: super::wavs::types::service::Component { - source: v119, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v127, - file_system: _rt::bool_lift(l128 as u8), - }, - fuel_limit: match l129 { - 0 => None, - 1 => { - let e = { - let l130 = *ptr0 - .add(112 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l130 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l131 { - 0 => None, - 1 => { - let e = { - let l132 = *ptr0 - .add(128 + 36 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l132 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result141, - env_keys: result147, - }, - signature_kind: super::wavs::types::service::SignatureKind { - algorithm: v149, - prefix: match l150 { - 0 => None, - 1 => { - let e = { - let l151 = i32::from( - *ptr0 - .add(138 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::(), - ); - use super::wavs::types::service::SignaturePrefix as V152; - let v152 = match l151 { - n => { - debug_assert_eq!(n, 0, "invalid enum discriminant"); - V152::Eip191 - } - }; - v152 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - }, - } - }; - V153::Aggregator(e153) - } - }; - let l154 = *ptr0 - .add(144 + 40 * ::core::mem::size_of::<*const u8>()) - .cast::<*mut u8>(); - let l155 = *ptr0 - .add(144 + 41 * ::core::mem::size_of::<*const u8>()) - .cast::(); - let len156 = l155; - let bytes156 = _rt::Vec::from_raw_parts(l154.cast(), len156, len156); - let result157 = super::wavs::types::service::WorkflowAndWorkflowId { - workflow: super::wavs::types::service::Workflow { - trigger: v37, - component: super::wavs::types::service::Component { - source: v62, - permissions: super::wavs::types::service::Permissions { - allowed_http_hosts: v70, - file_system: _rt::bool_lift(l71 as u8), - }, - fuel_limit: match l72 { - 0 => None, - 1 => { - let e = { - let l73 = *ptr0 - .add(64 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l73 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - time_limit_seconds: match l74 { - 0 => None, - 1 => { - let e = { - let l75 = *ptr0 - .add(80 + 16 * ::core::mem::size_of::<*const u8>()) - .cast::(); - l75 as u64 - }; - Some(e) - } - _ => _rt::invalid_enum_discriminant(), - }, - config: result84, - env_keys: result90, - }, - submit: v153, - }, - workflow_id: _rt::string_lift(bytes156), - }; - result157 - } - } - #[allow(unused_unsafe, clippy::all)] - /// convenience function to get the event-id - pub fn get_event_id() -> EventId { - unsafe { - #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - #[cfg_attr(target_pointer_width = "32", repr(align(4)))] - struct RetArea( - [::core::mem::MaybeUninit; 2 * ::core::mem::size_of::<*const u8>()], - ); - let mut ret_area = RetArea( - [::core::mem::MaybeUninit::uninit(); 2 - * ::core::mem::size_of::<*const u8>()], - ); - let ptr0 = ret_area.0.as_mut_ptr().cast::(); - #[cfg(target_arch = "wasm32")] - #[link(wasm_import_module = "host")] - unsafe extern "C" { - #[link_name = "get-event-id"] - fn wit_import1(_: *mut u8); - } - #[cfg(not(target_arch = "wasm32"))] - unsafe extern "C" fn wit_import1(_: *mut u8) { - unreachable!() - } - unsafe { wit_import1(ptr0) }; - let l2 = *ptr0.add(0).cast::<*mut u8>(); - let l3 = *ptr0.add(::core::mem::size_of::<*const u8>()).cast::(); - let len4 = l3; - let result5 = _rt::Vec::from_raw_parts(l2.cast(), len4, len4); - result5 - } - } -} -#[rustfmt::skip] -mod _rt { - #![allow(dead_code, clippy::all)] - pub use alloc_crate::string::String; - pub use alloc_crate::vec::Vec; - 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 { - 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) { - u32::MAX => {} - other => T::drop(other), - } - } - } - } - pub unsafe fn bool_lift(val: u8) -> bool { - if cfg!(debug_assertions) { - match val { - 0 => false, - 1 => true, - _ => panic!("invalid bool discriminant"), - } - } else { - 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 string_lift(bytes: Vec) -> String { - if cfg!(debug_assertions) { - String::from_utf8(bytes).unwrap() - } else { - String::from_utf8_unchecked(bytes) - } - } - pub unsafe fn invalid_enum_discriminant() -> T { - if cfg!(debug_assertions) { - panic!("invalid enum discriminant") - } else { - unsafe { core::hint::unreachable_unchecked() } - } - } - pub unsafe fn cabi_dealloc(ptr: *mut u8, size: usize, align: usize) { - if size == 0 { - return; - } - let layout = alloc::Layout::from_size_align_unchecked(size, align); - alloc::dealloc(ptr, layout); - } - pub fn as_i32(t: T) -> i32 { - t.as_i32() - } - pub trait AsI32 { - fn as_i32(self) -> i32; - } - impl<'a, T: Copy + AsI32> AsI32 for &'a T { - fn as_i32(self) -> i32 { - (*self).as_i32() - } - } - impl AsI32 for i32 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u32 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for i16 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u16 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for i8 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for u8 { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for char { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - impl AsI32 for usize { - #[inline] - fn as_i32(self) -> i32 { - self as i32 - } - } - #[cfg(target_arch = "wasm32")] - pub fn run_ctors_once() { - wit_bindgen_rt::run_ctors_once(); - } - extern crate alloc as alloc_crate; -} -/// Generates `#[unsafe(no_mangle)]` functions to export the specified type as -/// the root implementation of all generated traits. -/// -/// For more information see the documentation of `wit_bindgen::generate!`. -/// -/// ```rust -/// # macro_rules! export{ ($($t:tt)*) => (); } -/// # trait Guest {} -/// struct MyType; -/// -/// impl Guest for MyType { -/// // ... -/// } -/// -/// export!(MyType); -/// ``` -#[allow(unused_macros)] -#[doc(hidden)] -macro_rules! __export_wavs_world_impl { - ($ty:ident) => { - self::export!($ty with_types_in self); - }; - ($ty:ident with_types_in $($path_to_types_root:tt)*) => { - $($path_to_types_root)*:: __export_world_wavs_world_cabi!($ty with_types_in - $($path_to_types_root)*); - }; -} -#[doc(inline)] -pub(crate) use __export_wavs_world_impl as export; -#[cfg(target_arch = "wasm32")] -#[unsafe( - link_section = "component-type:wit-bindgen:0.41.0:wavs:operator@1.2.0:wavs-world:encoded world" -)] -#[doc(hidden)] -#[allow(clippy::octal_escapes)] -pub static __WIT_BINDGEN_COMPONENT_TYPE: [u8; 20560] = *b"\ -\0asm\x0d\0\x01\0\0\x19\x16wit-component-encoding\x04\0\x07\xce\x9f\x01\x01A\x02\ -\x01A~\x01B\x0b\x01s\x04\0\x06digest\x03\0\0\x01r\x01\x05nanosw\x04\0\x09timesta\ -mp\x03\0\x02\x01r\x01\x04secsw\x04\0\x08duration\x03\0\x04\x01o\x02ww\x01r\x01\x05\ -value\x06\x04\0\x04u128\x03\0\x07\x01q\x05\x05error\0\0\x04warn\0\0\x04info\0\0\x05\ -debug\0\0\x05trace\0\0\x04\0\x09log-level\x03\0\x09\x03\0\x15wavs:types/core@1.2\ -.0\x05\0\x01B\x1c\x01s\x04\0\x09chain-key\x03\0\0\x01p}\x04\0\x0bevm-tx-hash\x03\ -\0\x02\x01s\x04\0\x0ecosmos-tx-hash\x03\0\x04\x01q\x02\x03evm\x01\x03\0\x06cosmo\ -s\x01\x05\0\x04\0\x0bany-tx-hash\x03\0\x06\x01r\x02\x0bbech32-addrs\x0aprefix-le\ -ny\x04\0\x0ecosmos-address\x03\0\x08\x01o\x02ss\x01p\x0a\x01r\x02\x02tys\x0aattr\ -ibutes\x0b\x04\0\x0ccosmos-event\x03\0\x0c\x01ks\x01r\x07\x08chain-ids\x0crpc-en\ -dpoint\x0e\x0dgrpc-endpoint\x0e\x11grpc-web-endpoint\x0e\x09gas-pricev\x09gas-de\ -noms\x0dbech32-prefixs\x04\0\x13cosmos-chain-config\x03\0\x0f\x01p}\x01r\x01\x09\ -raw-bytes\x11\x04\0\x0bevm-address\x03\0\x12\x01p\x11\x01r\x02\x06topics\x14\x04\ -data\x11\x04\0\x12evm-event-log-data\x03\0\x15\x01kw\x01r\x08\x07address\x13\x04\ -data\x16\x07tx-hash\x03\x0cblock-numberw\x09log-indexw\x0ablock-hash\x11\x0fbloc\ -k-timestamp\x17\x08tx-indexw\x04\0\x0devm-event-log\x03\0\x18\x01r\x03\x08chain-\ -ids\x0bws-endpoint\x0e\x0dhttp-endpoint\x0e\x04\0\x10evm-chain-config\x03\0\x1a\x03\ -\0\x16wavs:types/chain@1.2.0\x05\x01\x02\x03\0\0\x06digest\x02\x03\0\0\x09timest\ -amp\x02\x03\0\x01\x09chain-key\x02\x03\0\x01\x0bevm-address\x02\x03\0\x01\x0ecos\ -mos-address\x01BO\x02\x03\x02\x01\x02\x04\0\x06digest\x03\0\0\x02\x03\x02\x01\x03\ -\x04\0\x09timestamp\x03\0\x02\x02\x03\x02\x01\x04\x04\0\x09chain-key\x03\0\x04\x02\ -\x03\x02\x01\x05\x04\0\x0bevm-address\x03\0\x06\x02\x03\x02\x01\x06\x04\0\x0ecos\ -mos-address\x03\0\x08\x01s\x04\0\x0aservice-id\x03\0\x0a\x01s\x04\0\x0bworkflow-\ -id\x03\0\x0c\x01s\x04\0\x0bpackage-ref\x03\0\x0e\x01s\x04\0\x0esemver-version\x03\ -\0\x10\x01q\x02\x06active\0\0\x06paused\0\0\x04\0\x0eservice-status\x03\0\x12\x01\ -r\x02\x05chain\x05\x07address\x07\x04\0\x0bevm-manager\x03\0\x14\x01q\x01\x03evm\ -\x01\x15\0\x04\0\x0fservice-manager\x03\0\x16\x01r\x02\x03urls\x06digest\x01\x04\ -\0\x19component-source-download\x03\0\x18\x01ks\x01k\x11\x01r\x04\x06digest\x01\x06\ -domain\x1a\x07version\x1b\x03pkg\x0f\x04\0\x08registry\x03\0\x1c\x01q\x03\x08dow\ -nload\x01\x19\0\x08registry\x01\x1d\0\x06digest\x01\x01\0\x04\0\x10component-sou\ -rce\x03\0\x1e\x01ps\x01q\x03\x03all\0\0\x04only\x01\x20\0\x04none\0\0\x04\0\x17a\ -llowed-host-permission\x03\0!\x01r\x02\x12allowed-http-hosts\"\x0bfile-system\x7f\ -\x04\0\x0bpermissions\x03\0#\x01kw\x01o\x02ss\x01p&\x01r\x06\x06source\x1f\x0bpe\ -rmissions$\x0afuel-limit%\x12time-limit-seconds%\x06config'\x08env-keys\x20\x04\0\ -\x09component\x03\0(\x01p}\x01r\x03\x07address\x07\x05chain\x05\x0aevent-hash*\x04\ -\0\x1atrigger-evm-contract-event\x03\0+\x01r\x03\x07address\x09\x05chain\x05\x0a\ -event-types\x04\0\x1dtrigger-cosmos-contract-event\x03\0-\x01r\x04\x05chain\x05\x08\ -n-blocksy\x0bstart-block%\x09end-block%\x04\0\x16trigger-block-interval\x03\0/\x01\ -k\x03\x01r\x03\x08schedules\x0astart-time1\x08end-time1\x04\0\x0ctrigger-cron\x03\ -\02\x01q\x05\x12evm-contract-event\x01,\0\x15cosmos-contract-event\x01.\0\x0eblo\ -ck-interval\x010\0\x04cron\x013\0\x06manual\0\0\x04\0\x07trigger\x03\04\x01q\x01\ -\x09secp256k1\0\0\x04\0\x13signature-algorithm\x03\06\x01q\x01\x06eip191\0\0\x04\ -\0\x10signature-prefix\x03\08\x01k9\x01r\x02\x09algorithm7\x06prefix:\x04\0\x0es\ -ignature-kind\x03\0;\x01r\x03\x03urls\x09component)\x0esignature-kind<\x04\0\x11\ -aggregator-submit\x03\0=\x01q\x02\x04none\0\0\x0aaggregator\x01>\0\x04\0\x06subm\ -it\x03\0?\x01r\x03\x07trigger5\x09component)\x06submit\xc0\0\x04\0\x08workflow\x03\ -\0A\x01o\x02\x0d\xc2\0\x01p\xc3\0\x01r\x04\x04names\x09workflows\xc4\0\x06status\ -\x13\x07manager\x17\x04\0\x07service\x03\0E\x01r\x03\x05chain\x05\x07address\x07\ -\x07max-gas%\x04\0\x17evm-contract-submission\x03\0G\x01q\x01\x03evm\x01\xc8\0\0\ -\x04\0\x0aaggregator\x03\0I\x01r\x02\x07service\xc6\0\x0bworkflow-id\x0d\x04\0\x17\ -service-and-workflow-id\x03\0K\x01r\x02\x08workflow\xc2\0\x0bworkflow-id\x0d\x04\ -\0\x18workflow-and-workflow-id\x03\0M\x03\0\x18wavs:types/service@1.2.0\x05\x07\x02\ -\x03\0\x01\x0devm-event-log\x02\x03\0\x01\x0ccosmos-event\x01B\x19\x02\x03\x02\x01\ -\x04\x04\0\x09chain-key\x03\0\0\x02\x03\x02\x01\x05\x04\0\x0bevm-address\x03\0\x02\ -\x02\x03\x02\x01\x08\x04\0\x0devm-event-log\x03\0\x04\x02\x03\x02\x01\x06\x04\0\x0e\ -cosmos-address\x03\0\x06\x02\x03\x02\x01\x09\x04\0\x0ccosmos-event\x03\0\x08\x02\ -\x03\x02\x01\x03\x04\0\x09timestamp\x03\0\x0a\x01p}\x04\0\x08event-id\x03\0\x0c\x01\ -r\x02\x05chain\x01\x03log\x05\x04\0\x1ftrigger-data-evm-contract-event\x03\0\x0e\ -\x01r\x05\x10contract-address\x07\x05chain\x01\x05event\x09\x0bevent-indexw\x0cb\ -lock-heightw\x04\0\"trigger-data-cosmos-contract-event\x03\0\x10\x01r\x02\x05cha\ -in\x01\x0cblock-heightw\x04\0\x1btrigger-data-block-interval\x03\0\x12\x01r\x01\x0c\ -trigger-time\x0b\x04\0\x11trigger-data-cron\x03\0\x14\x01p}\x01q\x05\x12evm-cont\ -ract-event\x01\x0f\0\x15cosmos-contract-event\x01\x11\0\x0eblock-interval\x01\x13\ -\0\x04cron\x01\x15\0\x03raw\x01\x16\0\x04\0\x0ctrigger-data\x03\0\x17\x03\0\x17w\ -avs:types/events@1.2.0\x05\x0a\x02\x03\0\x02\x0aservice-id\x02\x03\0\x02\x0bwork\ -flow-id\x02\x03\0\x02\x07trigger\x02\x03\0\x03\x0ctrigger-data\x01B\x0c\x02\x03\x02\ -\x01\x0b\x04\0\x0aservice-id\x03\0\0\x02\x03\x02\x01\x0c\x04\0\x0bworkflow-id\x03\ -\0\x02\x02\x03\x02\x01\x0d\x04\0\x07trigger\x03\0\x04\x02\x03\x02\x01\x0e\x04\0\x0c\ -trigger-data\x03\0\x06\x01r\x03\x0aservice-id\x01\x0bworkflow-id\x03\x07trigger\x05\ -\x04\0\x0etrigger-config\x03\0\x08\x01r\x02\x06config\x09\x04data\x07\x04\0\x0et\ -rigger-action\x03\0\x0a\x03\0\x19wavs:operator/input@1.2.0\x05\x0f\x02\x03\0\x04\ -\x0etrigger-action\x03\0\x0etrigger-action\x03\0\x10\x01B\x04\x01p}\x01kw\x01r\x02\ -\x07payload\0\x08ordering\x01\x04\0\x0dwasm-response\x03\0\x02\x03\0\x1awavs:ope\ -rator/output@1.2.0\x05\x12\x02\x03\0\x05\x0dwasm-response\x03\0\x0dwasm-response\ -\x03\0\x13\x01B\x0a\x04\0\x08pollable\x03\x01\x01h\0\x01@\x01\x04self\x01\0\x7f\x04\ -\0\x16[method]pollable.ready\x01\x02\x01@\x01\x04self\x01\x01\0\x04\0\x16[method\ -]pollable.block\x01\x03\x01p\x01\x01py\x01@\x01\x02in\x04\0\x05\x04\0\x04poll\x01\ -\x06\x03\0\x12wasi:io/poll@0.2.0\x05\x15\x02\x03\0\x06\x08pollable\x01B\x0f\x02\x03\ -\x02\x01\x16\x04\0\x08pollable\x03\0\0\x01w\x04\0\x07instant\x03\0\x02\x01w\x04\0\ -\x08duration\x03\0\x04\x01@\0\0\x03\x04\0\x03now\x01\x06\x01@\0\0\x05\x04\0\x0ar\ -esolution\x01\x07\x01i\x01\x01@\x01\x04when\x03\0\x08\x04\0\x11subscribe-instant\ -\x01\x09\x01@\x01\x04when\x05\0\x08\x04\0\x12subscribe-duration\x01\x0a\x03\0!wa\ -si:clocks/monotonic-clock@0.2.0\x05\x17\x01B\x04\x04\0\x05error\x03\x01\x01h\0\x01\ -@\x01\x04self\x01\0s\x04\0\x1d[method]error.to-debug-string\x01\x02\x03\0\x13was\ -i:io/error@0.2.0\x05\x18\x02\x03\0\x08\x05error\x01B(\x02\x03\x02\x01\x19\x04\0\x05\ -error\x03\0\0\x02\x03\x02\x01\x16\x04\0\x08pollable\x03\0\x02\x01i\x01\x01q\x02\x15\ -last-operation-failed\x01\x04\0\x06closed\0\0\x04\0\x0cstream-error\x03\0\x05\x04\ -\0\x0cinput-stream\x03\x01\x04\0\x0doutput-stream\x03\x01\x01h\x07\x01p}\x01j\x01\ -\x0a\x01\x06\x01@\x02\x04self\x09\x03lenw\0\x0b\x04\0\x19[method]input-stream.re\ -ad\x01\x0c\x04\0\"[method]input-stream.blocking-read\x01\x0c\x01j\x01w\x01\x06\x01\ -@\x02\x04self\x09\x03lenw\0\x0d\x04\0\x19[method]input-stream.skip\x01\x0e\x04\0\ -\"[method]input-stream.blocking-skip\x01\x0e\x01i\x03\x01@\x01\x04self\x09\0\x0f\ -\x04\0\x1e[method]input-stream.subscribe\x01\x10\x01h\x08\x01@\x01\x04self\x11\0\ -\x0d\x04\0![method]output-stream.check-write\x01\x12\x01j\0\x01\x06\x01@\x02\x04\ -self\x11\x08contents\x0a\0\x13\x04\0\x1b[method]output-stream.write\x01\x14\x04\0\ -.[method]output-stream.blocking-write-and-flush\x01\x14\x01@\x01\x04self\x11\0\x13\ -\x04\0\x1b[method]output-stream.flush\x01\x15\x04\0$[method]output-stream.blocki\ -ng-flush\x01\x15\x01@\x01\x04self\x11\0\x0f\x04\0\x1f[method]output-stream.subsc\ -ribe\x01\x16\x01@\x02\x04self\x11\x03lenw\0\x13\x04\0\"[method]output-stream.wri\ -te-zeroes\x01\x17\x04\05[method]output-stream.blocking-write-zeroes-and-flush\x01\ -\x17\x01@\x03\x04self\x11\x03src\x09\x03lenw\0\x0d\x04\0\x1c[method]output-strea\ -m.splice\x01\x18\x04\0%[method]output-stream.blocking-splice\x01\x18\x03\0\x15wa\ -si:io/streams@0.2.0\x05\x1a\x02\x03\0\x07\x08duration\x02\x03\0\x09\x0cinput-str\ -eam\x02\x03\0\x09\x0doutput-stream\x01B\xc0\x01\x02\x03\x02\x01\x1b\x04\0\x08dur\ -ation\x03\0\0\x02\x03\x02\x01\x1c\x04\0\x0cinput-stream\x03\0\x02\x02\x03\x02\x01\ -\x1d\x04\0\x0doutput-stream\x03\0\x04\x02\x03\x02\x01\x19\x04\0\x08io-error\x03\0\ -\x06\x02\x03\x02\x01\x16\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\0\x15wasi:http/types@0.2.0\x05\x1e\x02\x03\0\x0a\x10outgoing-r\ -equest\x02\x03\0\x0a\x0frequest-options\x02\x03\0\x0a\x18future-incoming-respons\ -e\x02\x03\0\x0a\x0aerror-code\x01B\x0f\x02\x03\x02\x01\x1f\x04\0\x10outgoing-req\ -uest\x03\0\0\x02\x03\x02\x01\x20\x04\0\x0frequest-options\x03\0\x02\x02\x03\x02\x01\ -!\x04\0\x18future-incoming-response\x03\0\x04\x02\x03\x02\x01\"\x04\0\x0aerror-c\ -ode\x03\0\x06\x01i\x01\x01i\x03\x01k\x09\x01i\x05\x01j\x01\x0b\x01\x07\x01@\x02\x07\ -request\x08\x07options\x0a\0\x0c\x04\0\x06handle\x01\x0d\x03\0\x20wasi:http/outg\ -oing-handler@0.2.0\x05#\x02\x03\0\x01\x10evm-chain-config\x02\x03\0\x01\x13cosmo\ -s-chain-config\x02\x03\0\x02\x17service-and-workflow-id\x02\x03\0\x02\x18workflo\ -w-and-workflow-id\x02\x03\0\0\x09log-level\x02\x03\0\x03\x08event-id\x01B\x1d\x02\ -\x03\x02\x01$\x04\0\x10evm-chain-config\x03\0\0\x02\x03\x02\x01%\x04\0\x13cosmos\ --chain-config\x03\0\x02\x02\x03\x02\x01&\x04\0\x17service-and-workflow-id\x03\0\x04\ -\x02\x03\x02\x01'\x04\0\x18workflow-and-workflow-id\x03\0\x06\x02\x03\x02\x01(\x04\ -\0\x09log-level\x03\0\x08\x02\x03\x02\x01)\x04\0\x08event-id\x03\0\x0a\x01k\x01\x01\ -@\x01\x09chain-keys\0\x0c\x04\0\x14get-evm-chain-config\x01\x0d\x01k\x03\x01@\x01\ -\x09chain-keys\0\x0e\x04\0\x17get-cosmos-chain-config\x01\x0f\x01ks\x01@\x01\x03\ -keys\0\x10\x04\0\x0aconfig-var\x01\x11\x01@\x02\x05level\x09\x07messages\x01\0\x04\ -\0\x03log\x01\x12\x01@\0\0\x05\x04\0\x0bget-service\x01\x13\x01@\0\0\x07\x04\0\x0c\ -get-workflow\x01\x14\x01@\0\0\x0b\x04\0\x0cget-event-id\x01\x15\x03\0\x04host\x05\ -*\x01B\x0a\x01o\x02ss\x01p\0\x01@\0\0\x01\x04\0\x0fget-environment\x01\x02\x01ps\ -\x01@\0\0\x03\x04\0\x0dget-arguments\x01\x04\x01ks\x01@\0\0\x05\x04\0\x0binitial\ --cwd\x01\x06\x03\0\x1awasi:cli/environment@0.2.0\x05+\x01B\x03\x01j\0\0\x01@\x01\ -\x06status\0\x01\0\x04\0\x04exit\x01\x01\x03\0\x13wasi:cli/exit@0.2.0\x05,\x01B\x05\ -\x02\x03\x02\x01\x1c\x04\0\x0cinput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x09\ -get-stdin\x01\x03\x03\0\x14wasi:cli/stdin@0.2.0\x05-\x01B\x05\x02\x03\x02\x01\x1d\ -\x04\0\x0doutput-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stdout\x01\x03\ -\x03\0\x15wasi:cli/stdout@0.2.0\x05.\x01B\x05\x02\x03\x02\x01\x1d\x04\0\x0doutpu\ -t-stream\x03\0\0\x01i\x01\x01@\0\0\x02\x04\0\x0aget-stderr\x01\x03\x03\0\x15wasi\ -:cli/stderr@0.2.0\x05/\x01B\x01\x04\0\x0eterminal-input\x03\x01\x03\0\x1dwasi:cl\ -i/terminal-input@0.2.0\x050\x01B\x01\x04\0\x0fterminal-output\x03\x01\x03\0\x1ew\ -asi:cli/terminal-output@0.2.0\x051\x02\x03\0\x12\x0eterminal-input\x01B\x06\x02\x03\ -\x02\x012\x04\0\x0eterminal-input\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x12\ -get-terminal-stdin\x01\x04\x03\0\x1dwasi:cli/terminal-stdin@0.2.0\x053\x02\x03\0\ -\x13\x0fterminal-output\x01B\x06\x02\x03\x02\x014\x04\0\x0fterminal-output\x03\0\ -\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stdout\x01\x04\x03\0\x1e\ -wasi:cli/terminal-stdout@0.2.0\x055\x01B\x06\x02\x03\x02\x014\x04\0\x0fterminal-\ -output\x03\0\0\x01i\x01\x01k\x02\x01@\0\0\x03\x04\0\x13get-terminal-stderr\x01\x04\ -\x03\0\x1ewasi:cli/terminal-stderr@0.2.0\x056\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\0\x1cwasi:clocks/wall-clock@0.2.0\x057\x02\x03\0\x09\x05e\ -rror\x02\x03\0\x17\x08datetime\x01Br\x02\x03\x02\x01\x1c\x04\0\x0cinput-stream\x03\ -\0\0\x02\x03\x02\x01\x1d\x04\0\x0doutput-stream\x03\0\x02\x02\x03\x02\x018\x04\0\ -\x05error\x03\0\x04\x02\x03\x02\x019\x04\0\x08datetime\x03\0\x06\x01w\x04\0\x08f\ -ilesize\x03\0\x08\x01m\x08\x07unknown\x0cblock-device\x10character-device\x09dir\ -ectory\x04fifo\x0dsymbolic-link\x0cregular-file\x06socket\x04\0\x0fdescriptor-ty\ -pe\x03\0\x0a\x01n\x06\x04read\x05write\x13file-integrity-sync\x13data-integrity-\ -sync\x14requested-write-sync\x10mutate-directory\x04\0\x10descriptor-flags\x03\0\ -\x0c\x01n\x01\x0esymlink-follow\x04\0\x0apath-flags\x03\0\x0e\x01n\x04\x06create\ -\x09directory\x09exclusive\x08truncate\x04\0\x0aopen-flags\x03\0\x10\x01w\x04\0\x0a\ -link-count\x03\0\x12\x01k\x07\x01r\x06\x04type\x0b\x0alink-count\x13\x04size\x09\ -\x15data-access-timestamp\x14\x1bdata-modification-timestamp\x14\x17status-chang\ -e-timestamp\x14\x04\0\x0fdescriptor-stat\x03\0\x15\x01q\x03\x09no-change\0\0\x03\ -now\0\0\x09timestamp\x01\x07\0\x04\0\x0dnew-timestamp\x03\0\x17\x01r\x02\x04type\ -\x0b\x04names\x04\0\x0fdirectory-entry\x03\0\x19\x01m%\x06access\x0bwould-block\x07\ -already\x0ebad-descriptor\x04busy\x08deadlock\x05quota\x05exist\x0efile-too-larg\ -e\x15illegal-byte-sequence\x0bin-progress\x0binterrupted\x07invalid\x02io\x0cis-\ -directory\x04loop\x0etoo-many-links\x0cmessage-size\x0dname-too-long\x09no-devic\ -e\x08no-entry\x07no-lock\x13insufficient-memory\x12insufficient-space\x0dnot-dir\ -ectory\x09not-empty\x0fnot-recoverable\x0bunsupported\x06no-tty\x0eno-such-devic\ -e\x08overflow\x0dnot-permitted\x04pipe\x09read-only\x0cinvalid-seek\x0etext-file\ --busy\x0ccross-device\x04\0\x0aerror-code\x03\0\x1b\x01m\x06\x06normal\x0asequen\ -tial\x06random\x09will-need\x09dont-need\x08no-reuse\x04\0\x06advice\x03\0\x1d\x01\ -r\x02\x05lowerw\x05upperw\x04\0\x13metadata-hash-value\x03\0\x1f\x04\0\x0adescri\ -ptor\x03\x01\x04\0\x16directory-entry-stream\x03\x01\x01h!\x01i\x01\x01j\x01$\x01\ -\x1c\x01@\x02\x04self#\x06offset\x09\0%\x04\0\"[method]descriptor.read-via-strea\ -m\x01&\x01i\x03\x01j\x01'\x01\x1c\x01@\x02\x04self#\x06offset\x09\0(\x04\0#[meth\ -od]descriptor.write-via-stream\x01)\x01@\x01\x04self#\0(\x04\0$[method]descripto\ -r.append-via-stream\x01*\x01j\0\x01\x1c\x01@\x04\x04self#\x06offset\x09\x06lengt\ -h\x09\x06advice\x1e\0+\x04\0\x19[method]descriptor.advise\x01,\x01@\x01\x04self#\ -\0+\x04\0\x1c[method]descriptor.sync-data\x01-\x01j\x01\x0d\x01\x1c\x01@\x01\x04\ -self#\0.\x04\0\x1c[method]descriptor.get-flags\x01/\x01j\x01\x0b\x01\x1c\x01@\x01\ -\x04self#\00\x04\0\x1b[method]descriptor.get-type\x011\x01@\x02\x04self#\x04size\ -\x09\0+\x04\0\x1b[method]descriptor.set-size\x012\x01@\x03\x04self#\x15data-acce\ -ss-timestamp\x18\x1bdata-modification-timestamp\x18\0+\x04\0\x1c[method]descript\ -or.set-times\x013\x01p}\x01o\x024\x7f\x01j\x015\x01\x1c\x01@\x03\x04self#\x06len\ -gth\x09\x06offset\x09\06\x04\0\x17[method]descriptor.read\x017\x01j\x01\x09\x01\x1c\ -\x01@\x03\x04self#\x06buffer4\x06offset\x09\08\x04\0\x18[method]descriptor.write\ -\x019\x01i\"\x01j\x01:\x01\x1c\x01@\x01\x04self#\0;\x04\0![method]descriptor.rea\ -d-directory\x01<\x04\0\x17[method]descriptor.sync\x01-\x01@\x02\x04self#\x04path\ -s\0+\x04\0&[method]descriptor.create-directory-at\x01=\x01j\x01\x16\x01\x1c\x01@\ -\x01\x04self#\0>\x04\0\x17[method]descriptor.stat\x01?\x01@\x03\x04self#\x0apath\ --flags\x0f\x04paths\0>\x04\0\x1a[method]descriptor.stat-at\x01@\x01@\x05\x04self\ -#\x0apath-flags\x0f\x04paths\x15data-access-timestamp\x18\x1bdata-modification-t\ -imestamp\x18\0+\x04\0\x1f[method]descriptor.set-times-at\x01A\x01@\x05\x04self#\x0e\ -old-path-flags\x0f\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\x1a[met\ -hod]descriptor.link-at\x01B\x01i!\x01j\x01\xc3\0\x01\x1c\x01@\x05\x04self#\x0apa\ -th-flags\x0f\x04paths\x0aopen-flags\x11\x05flags\x0d\0\xc4\0\x04\0\x1a[method]de\ -scriptor.open-at\x01E\x01j\x01s\x01\x1c\x01@\x02\x04self#\x04paths\0\xc6\0\x04\0\ -\x1e[method]descriptor.readlink-at\x01G\x04\0&[method]descriptor.remove-director\ -y-at\x01=\x01@\x04\x04self#\x08old-paths\x0enew-descriptor#\x08new-paths\0+\x04\0\ -\x1c[method]descriptor.rename-at\x01H\x01@\x03\x04self#\x08old-paths\x08new-path\ -s\0+\x04\0\x1d[method]descriptor.symlink-at\x01I\x04\0![method]descriptor.unlink\ --file-at\x01=\x01@\x02\x04self#\x05other#\0\x7f\x04\0![method]descriptor.is-same\ --object\x01J\x01j\x01\x20\x01\x1c\x01@\x01\x04self#\0\xcb\0\x04\0\x20[method]des\ -criptor.metadata-hash\x01L\x01@\x03\x04self#\x0apath-flags\x0f\x04paths\0\xcb\0\x04\ -\0#[method]descriptor.metadata-hash-at\x01M\x01h\"\x01k\x1a\x01j\x01\xcf\0\x01\x1c\ -\x01@\x01\x04self\xce\0\0\xd0\0\x04\03[method]directory-entry-stream.read-direct\ -ory-entry\x01Q\x01h\x05\x01k\x1c\x01@\x01\x03err\xd2\0\0\xd3\0\x04\0\x15filesyst\ -em-error-code\x01T\x03\0\x1bwasi:filesystem/types@0.2.0\x05:\x02\x03\0\x18\x0ade\ -scriptor\x01B\x07\x02\x03\x02\x01;\x04\0\x0adescriptor\x03\0\0\x01i\x01\x01o\x02\ -\x02s\x01p\x03\x01@\0\0\x04\x04\0\x0fget-directories\x01\x05\x03\0\x1ewasi:files\ -ystem/preopens@0.2.0\x05<\x01B\x11\x04\0\x07network\x03\x01\x01m\x15\x07unknown\x0d\ -access-denied\x0dnot-supported\x10invalid-argument\x0dout-of-memory\x07timeout\x14\ -concurrency-conflict\x0fnot-in-progress\x0bwould-block\x0dinvalid-state\x10new-s\ -ocket-limit\x14address-not-bindable\x0eaddress-in-use\x12remote-unreachable\x12c\ -onnection-refused\x10connection-reset\x12connection-aborted\x12datagram-too-larg\ -e\x11name-unresolvable\x1atemporary-resolver-failure\x1apermanent-resolver-failu\ -re\x04\0\x0aerror-code\x03\0\x01\x01m\x02\x04ipv4\x04ipv6\x04\0\x11ip-address-fa\ -mily\x03\0\x03\x01o\x04}}}}\x04\0\x0cipv4-address\x03\0\x05\x01o\x08{{{{{{{{\x04\ -\0\x0cipv6-address\x03\0\x07\x01q\x02\x04ipv4\x01\x06\0\x04ipv6\x01\x08\0\x04\0\x0a\ -ip-address\x03\0\x09\x01r\x02\x04port{\x07address\x06\x04\0\x13ipv4-socket-addre\ -ss\x03\0\x0b\x01r\x04\x04port{\x09flow-infoy\x07address\x08\x08scope-idy\x04\0\x13\ -ipv6-socket-address\x03\0\x0d\x01q\x02\x04ipv4\x01\x0c\0\x04ipv6\x01\x0e\0\x04\0\ -\x11ip-socket-address\x03\0\x0f\x03\0\x1awasi:sockets/network@0.2.0\x05=\x02\x03\ -\0\x1a\x07network\x01B\x05\x02\x03\x02\x01>\x04\0\x07network\x03\0\0\x01i\x01\x01\ -@\0\0\x02\x04\0\x10instance-network\x01\x03\x03\0#wasi:sockets/instance-network@\ -0.2.0\x05?\x02\x03\0\x1a\x0aerror-code\x02\x03\0\x1a\x11ip-socket-address\x02\x03\ -\0\x1a\x11ip-address-family\x01BD\x02\x03\x02\x01\x16\x04\0\x08pollable\x03\0\0\x02\ -\x03\x02\x01>\x04\0\x07network\x03\0\x02\x02\x03\x02\x01@\x04\0\x0aerror-code\x03\ -\0\x04\x02\x03\x02\x01A\x04\0\x11ip-socket-address\x03\0\x06\x02\x03\x02\x01B\x04\ -\0\x11ip-address-family\x03\0\x08\x01p}\x01r\x02\x04data\x0a\x0eremote-address\x07\ -\x04\0\x11incoming-datagram\x03\0\x0b\x01k\x07\x01r\x02\x04data\x0a\x0eremote-ad\ -dress\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\x01\ -h\x10\x01h\x03\x01j\0\x01\x05\x01@\x03\x04self\x13\x07network\x14\x0dlocal-addre\ -ss\x07\0\x15\x04\0\x1d[method]udp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\ -\0\x15\x04\0\x1e[method]udp-socket.finish-bind\x01\x17\x01i\x11\x01i\x12\x01o\x02\ -\x18\x19\x01j\x01\x1a\x01\x05\x01@\x02\x04self\x13\x0eremote-address\x0d\0\x1b\x04\ -\0\x19[method]udp-socket.stream\x01\x1c\x01j\x01\x07\x01\x05\x01@\x01\x04self\x13\ -\0\x1d\x04\0\x20[method]udp-socket.local-address\x01\x1e\x04\0![method]udp-socke\ -t.remote-address\x01\x1e\x01@\x01\x04self\x13\0\x09\x04\0![method]udp-socket.add\ -ress-family\x01\x1f\x01j\x01}\x01\x05\x01@\x01\x04self\x13\0\x20\x04\0$[method]u\ -dp-socket.unicast-hop-limit\x01!\x01@\x02\x04self\x13\x05value}\0\x15\x04\0([met\ -hod]udp-socket.set-unicast-hop-limit\x01\"\x01j\x01w\x01\x05\x01@\x01\x04self\x13\ -\0#\x04\0&[method]udp-socket.receive-buffer-size\x01$\x01@\x02\x04self\x13\x05va\ -luew\0\x15\x04\0*[method]udp-socket.set-receive-buffer-size\x01%\x04\0#[method]u\ -dp-socket.send-buffer-size\x01$\x04\0'[method]udp-socket.set-send-buffer-size\x01\ -%\x01i\x01\x01@\x01\x04self\x13\0&\x04\0\x1c[method]udp-socket.subscribe\x01'\x01\ -h\x11\x01p\x0c\x01j\x01)\x01\x05\x01@\x02\x04self(\x0bmax-resultsw\0*\x04\0([met\ -hod]incoming-datagram-stream.receive\x01+\x01@\x01\x04self(\0&\x04\0*[method]inc\ -oming-datagram-stream.subscribe\x01,\x01h\x12\x01@\x01\x04self-\0#\x04\0+[method\ -]outgoing-datagram-stream.check-send\x01.\x01p\x0f\x01@\x02\x04self-\x09datagram\ -s/\0#\x04\0%[method]outgoing-datagram-stream.send\x010\x01@\x01\x04self-\0&\x04\0\ -*[method]outgoing-datagram-stream.subscribe\x011\x03\0\x16wasi:sockets/udp@0.2.0\ -\x05C\x02\x03\0\x1c\x0audp-socket\x01B\x0c\x02\x03\x02\x01>\x04\0\x07network\x03\ -\0\0\x02\x03\x02\x01@\x04\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01B\x04\0\x11ip\ --address-family\x03\0\x04\x02\x03\x02\x01D\x04\0\x0audp-socket\x03\0\x06\x01i\x07\ -\x01j\x01\x08\x01\x03\x01@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-udp-s\ -ocket\x01\x0a\x03\0$wasi:sockets/udp-create-socket@0.2.0\x05E\x01BT\x02\x03\x02\x01\ -\x1c\x04\0\x0cinput-stream\x03\0\0\x02\x03\x02\x01\x1d\x04\0\x0doutput-stream\x03\ -\0\x02\x02\x03\x02\x01\x16\x04\0\x08pollable\x03\0\x04\x02\x03\x02\x01\x1b\x04\0\ -\x08duration\x03\0\x06\x02\x03\x02\x01>\x04\0\x07network\x03\0\x08\x02\x03\x02\x01\ -@\x04\0\x0aerror-code\x03\0\x0a\x02\x03\x02\x01A\x04\0\x11ip-socket-address\x03\0\ -\x0c\x02\x03\x02\x01B\x04\0\x11ip-address-family\x03\0\x0e\x01m\x03\x07receive\x04\ -send\x04both\x04\0\x0dshutdown-type\x03\0\x10\x04\0\x0atcp-socket\x03\x01\x01h\x12\ -\x01h\x09\x01j\0\x01\x0b\x01@\x03\x04self\x13\x07network\x14\x0dlocal-address\x0d\ -\0\x15\x04\0\x1d[method]tcp-socket.start-bind\x01\x16\x01@\x01\x04self\x13\0\x15\ -\x04\0\x1e[method]tcp-socket.finish-bind\x01\x17\x01@\x03\x04self\x13\x07network\ -\x14\x0eremote-address\x0d\0\x15\x04\0\x20[method]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.sta\ -rt-listen\x01\x17\x04\0\x20[method]tcp-socket.finish-listen\x01\x17\x01i\x12\x01\ -o\x03\x1e\x19\x1a\x01j\x01\x1f\x01\x0b\x01@\x01\x04self\x13\0\x20\x04\0\x19[meth\ -od]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]tcp-socket.address-family\x01%\x01@\x02\x04self\ -\x13\x05valuew\0\x15\x04\0*[method]tcp-socket.set-listen-backlog-size\x01&\x01j\x01\ -\x7f\x01\x0b\x01@\x01\x04self\x13\0'\x04\0%[method]tcp-socket.keep-alive-enabled\ -\x01(\x01@\x02\x04self\x13\x05value\x7f\0\x15\x04\0)[method]tcp-socket.set-keep-\ -alive-enabled\x01)\x01j\x01\x07\x01\x0b\x01@\x01\x04self\x13\0*\x04\0'[method]tc\ -p-socket.keep-alive-idle-time\x01+\x01@\x02\x04self\x13\x05value\x07\0\x15\x04\0\ -+[method]tcp-socket.set-keep-alive-idle-time\x01,\x04\0&[method]tcp-socket.keep-\ -alive-interval\x01+\x04\0*[method]tcp-socket.set-keep-alive-interval\x01,\x01j\x01\ -y\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-co\ -unt\x01/\x01j\x01}\x01\x0b\x01@\x01\x04self\x13\00\x04\0\x1c[method]tcp-socket.h\ -op-limit\x011\x01@\x02\x04self\x13\x05value}\0\x15\x04\0\x20[method]tcp-socket.s\ -et-hop-limit\x012\x01j\x01w\x01\x0b\x01@\x01\x04self\x13\03\x04\0&[method]tcp-so\ -cket.receive-buffer-size\x014\x04\0*[method]tcp-socket.set-receive-buffer-size\x01\ -&\x04\0#[method]tcp-socket.send-buffer-size\x014\x04\0'[method]tcp-socket.set-se\ -nd-buffer-size\x01&\x01i\x05\x01@\x01\x04self\x13\05\x04\0\x1c[method]tcp-socket\ -.subscribe\x016\x01@\x02\x04self\x13\x0dshutdown-type\x11\0\x15\x04\0\x1b[method\ -]tcp-socket.shutdown\x017\x03\0\x16wasi:sockets/tcp@0.2.0\x05F\x02\x03\0\x1e\x0a\ -tcp-socket\x01B\x0c\x02\x03\x02\x01>\x04\0\x07network\x03\0\0\x02\x03\x02\x01@\x04\ -\0\x0aerror-code\x03\0\x02\x02\x03\x02\x01B\x04\0\x11ip-address-family\x03\0\x04\ -\x02\x03\x02\x01G\x04\0\x0atcp-socket\x03\0\x06\x01i\x07\x01j\x01\x08\x01\x03\x01\ -@\x01\x0eaddress-family\x05\0\x09\x04\0\x11create-tcp-socket\x01\x0a\x03\0$wasi:\ -sockets/tcp-create-socket@0.2.0\x05H\x02\x03\0\x1a\x0aip-address\x01B\x16\x02\x03\ -\x02\x01\x16\x04\0\x08pollable\x03\0\0\x02\x03\x02\x01>\x04\0\x07network\x03\0\x02\ -\x02\x03\x02\x01@\x04\0\x0aerror-code\x03\0\x04\x02\x03\x02\x01I\x04\0\x0aip-add\ -ress\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.res\ -olve-next-address\x01\x0c\x01i\x01\x01@\x01\x04self\x09\0\x0d\x04\0([method]reso\ -lve-address-stream.subscribe\x01\x0e\x01h\x03\x01i\x08\x01j\x01\x10\x01\x05\x01@\ -\x02\x07network\x0f\x04names\0\x11\x04\0\x11resolve-addresses\x01\x12\x03\0!wasi\ -:sockets/ip-name-lookup@0.2.0\x05J\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x10\ -get-random-bytes\x01\x01\x01@\0\0w\x04\0\x0eget-random-u64\x01\x02\x03\0\x18wasi\ -:random/random@0.2.0\x05K\x01B\x05\x01p}\x01@\x01\x03lenw\0\0\x04\0\x19get-insec\ -ure-random-bytes\x01\x01\x01@\0\0w\x04\0\x17get-insecure-random-u64\x01\x02\x03\0\ -\x1awasi:random/insecure@0.2.0\x05L\x01B\x03\x01o\x02ww\x01@\0\0\0\x04\0\x0dinse\ -cure-seed\x01\x01\x03\0\x1fwasi:random/insecure-seed@0.2.0\x05M\x01B\x1c\x01q\x03\ -\x0dno-such-store\0\0\x0daccess-denied\0\0\x05other\x01s\0\x04\0\x05error\x03\0\0\ -\x01ps\x01ks\x01r\x02\x04keys\x02\x06cursor\x03\x04\0\x0ckey-response\x03\0\x04\x04\ -\0\x06bucket\x03\x01\x01h\x06\x01p}\x01k\x08\x01j\x01\x09\x01\x01\x01@\x02\x04se\ -lf\x07\x03keys\0\x0a\x04\0\x12[method]bucket.get\x01\x0b\x01j\0\x01\x01\x01@\x03\ -\x04self\x07\x03keys\x05value\x08\0\x0c\x04\0\x12[method]bucket.set\x01\x0d\x01@\ -\x02\x04self\x07\x03keys\0\x0c\x04\0\x15[method]bucket.delete\x01\x0e\x01j\x01\x7f\ -\x01\x01\x01@\x02\x04self\x07\x03keys\0\x0f\x04\0\x15[method]bucket.exists\x01\x10\ -\x01j\x01\x05\x01\x01\x01@\x02\x04self\x07\x06cursor\x03\0\x11\x04\0\x18[method]\ -bucket.list-keys\x01\x12\x01i\x06\x01j\x01\x13\x01\x01\x01@\x01\x0aidentifiers\0\ -\x14\x04\0\x04open\x01\x15\x03\0\x20wasi:keyvalue/store@0.2.0-draft2\x05N\x02\x03\ -\0$\x06bucket\x02\x03\0$\x05error\x01B\x18\x02\x03\x02\x01O\x04\0\x06bucket\x03\0\ -\0\x02\x03\x02\x01P\x04\0\x05error\x03\0\x02\x04\0\x03cas\x03\x01\x01i\x04\x01q\x02\ -\x0bstore-error\x01\x03\0\x0acas-failed\x01\x05\0\x04\0\x09cas-error\x03\0\x06\x01\ -h\x01\x01j\x01\x05\x01\x03\x01@\x02\x06bucket\x08\x03keys\0\x09\x04\0\x0f[static\ -]cas.new\x01\x0a\x01h\x04\x01p}\x01k\x0c\x01j\x01\x0d\x01\x03\x01@\x01\x04self\x0b\ -\0\x0e\x04\0\x13[method]cas.current\x01\x0f\x01j\x01x\x01\x03\x01@\x03\x06bucket\ -\x08\x03keys\x05deltax\0\x10\x04\0\x09increment\x01\x11\x01j\0\x01\x07\x01@\x02\x03\ -cas\x05\x05value\x0c\0\x12\x04\0\x04swap\x01\x13\x03\0\"wasi:keyvalue/atomics@0.\ -2.0-draft2\x05Q\x01B\x13\x02\x03\x02\x01O\x04\0\x06bucket\x03\0\0\x02\x03\x02\x01\ -P\x04\0\x05error\x03\0\x02\x01h\x01\x01ps\x01p}\x01o\x02s\x06\x01k\x07\x01p\x08\x01\ -j\x01\x09\x01\x03\x01@\x02\x06bucket\x04\x04keys\x05\0\x0a\x04\0\x08get-many\x01\ -\x0b\x01p\x07\x01j\0\x01\x03\x01@\x02\x06bucket\x04\x0akey-values\x0c\0\x0d\x04\0\ -\x08set-many\x01\x0e\x01@\x02\x06bucket\x04\x04keys\x05\0\x0d\x04\0\x0bdelete-ma\ -ny\x01\x0f\x03\0\x20wasi:keyvalue/batch@0.2.0-draft2\x05R\x01k\x14\x01j\x01\xd3\0\ -\x01s\x01@\x01\x0etrigger-action\x11\0\xd4\0\x04\0\x03run\x01U\x04\0\x1ewavs:ope\ -rator/wavs-world@1.2.0\x04\0\x0b\x10\x01\0\x0awavs-world\x03\0\0\0G\x09producers\ -\x01\x0cprocessed-by\x02\x0dwit-component\x070.227.1\x10wit-bindgen-rust\x060.41\ -.0"; -#[inline(never)] -#[doc(hidden)] -pub fn __link_custom_section_describing_imports() { - wit_bindgen_rt::maybe_link_cabi_realloc(); -} +wit_bindgen::generate!({ + world: "wavs-world", + path: "../../wit", + pub_export_macro: true, + generate_all, + features: ["tls"], +}); diff --git a/components/evm-price-oracle/src/lib.rs b/components/evm-price-oracle/src/lib.rs index 2b0554c6..2ec348dc 100644 --- a/components/evm-price-oracle/src/lib.rs +++ b/components/evm-price-oracle/src/lib.rs @@ -18,7 +18,7 @@ struct Component; export!(Component with_types_in bindings); impl Guest for Component { - fn run(action: TriggerAction) -> Result, String> { + fn run(action: TriggerAction) -> Result, String> { let (trigger_id, req, dest) = decode_trigger_event(action.data).map_err(|e| e.to_string())?; @@ -49,8 +49,10 @@ impl Guest for Component { })?; let output = match dest { - Destination::Ethereum => Some(encode_trigger_output(trigger_id, &res)), - Destination::CliOutput => Some(WasmResponse { payload: res.into(), ordering: None }), + Destination::Ethereum => vec![encode_trigger_output(trigger_id, &res)], + Destination::CliOutput => { + vec![WasmResponse { payload: res.into(), ordering: None, event_id_salt: None }] + } }; Ok(output) } diff --git a/components/evm-price-oracle/src/trigger.rs b/components/evm-price-oracle/src/trigger.rs index 546697ae..59128bce 100644 --- a/components/evm-price-oracle/src/trigger.rs +++ b/components/evm-price-oracle/src/trigger.rs @@ -60,5 +60,6 @@ pub fn encode_trigger_output(trigger_id: u64, output: impl AsRef<[u8]>) -> WasmR } .abi_encode(), ordering: None, + event_id_salt: None, } } diff --git a/deploy/build-service.ts b/deploy/build-service.ts index 62851416..fe6b1305 100644 --- a/deploy/build-service.ts +++ b/deploy/build-service.ts @@ -55,11 +55,6 @@ const program = new Command('build-service') '-s, --service-manager-address ', 'The WAVS service manager address (defaults to addresses.POAStakeRegistry from .nodes/poa_deploy.json)' ) - .option( - '-a, --aggregator-url ', - 'The aggregator URL for the service', - 'http://127.0.0.1:8040' - ) .option( '--fuel-limit ', 'The fuel limit for the service', @@ -73,7 +68,6 @@ const main = async () => { componentConfigFile, output, serviceManagerAddress, - aggregatorUrl, fuelLimit, }, } = initProgram(program) @@ -322,13 +316,9 @@ const main = async () => { 'submit', '--id', workflowId, - 'set-aggregator', - '--url', - aggregatorUrl + 'set-aggregator' ) - console.log(chalk.greenBright(` Aggregator URL: ${aggregatorUrl}`)) - await execSilently( ...BASE_CMD, 'workflow', diff --git a/deploy/constants.ts b/deploy/constants.ts index a33da105..eead5780 100644 --- a/deploy/constants.ts +++ b/deploy/constants.ts @@ -1,14 +1,14 @@ /** * Deployment summary JSON file. */ -export const DEPLOYMENT_SUMMARY_FILE = '.docker/deployment_summary.json' +export const DEPLOYMENT_SUMMARY_FILE = ".docker/deployment_summary.json"; /** * The WAVS Docker image. */ -export const WAVS_DOCKER_IMAGE = 'ghcr.io/lay3rlabs/wavs:1.5.1' +export const WAVS_DOCKER_IMAGE = "ghcr.io/lay3rlabs/wavs:216aa67"; /** * The POA Middleware Docker image. */ -export const POA_MIDDLEWARE_IMAGE = 'ghcr.io/lay3rlabs/poa-middleware:1.0.1' +export const POA_MIDDLEWARE_IMAGE = "ghcr.io/lay3rlabs/poa-middleware:1.0.1"; diff --git a/deploy/deploy-contracts.ts b/deploy/deploy-contracts.ts index 019def4e..b426c7c4 100644 --- a/deploy/deploy-contracts.ts +++ b/deploy/deploy-contracts.ts @@ -35,6 +35,15 @@ const program = new Command('deploy-contracts') 'The RPC URL for the chain (default: $RPC_URL from .env)' ) +const extractJson = (output: string): string => { + const start = output.indexOf('{') + const end = output.lastIndexOf('}') + if (start === -1 || end === -1) { + throw new Error(`No JSON object found in forge output:\n${output}`) + } + return output.slice(start, end + 1) +} + const main = async () => { const { env, @@ -80,7 +89,7 @@ const main = async () => { env: { FUNDED_KEY: fundedKey }, }) - const submitJson = JSON.parse(submitOutput.trim()) + const submitJson = JSON.parse(extractJson(submitOutput)) fs.writeFileSync('.docker/submit.json', JSON.stringify(submitJson, null, 2)) console.log( chalk.greenBright(`✅ SimpleSubmit deployed to ${submitJson.deployedTo}`) @@ -99,15 +108,13 @@ const main = async () => { env.rpcUrl, '--private-key', '"$FUNDED_KEY"', - '--constructor-args', - serviceManagerAddress, ], log: 'cmd', shell: true, env: { FUNDED_KEY: fundedKey }, }) - const triggerJson = JSON.parse(triggerOutput.trim()) + const triggerJson = JSON.parse(extractJson(triggerOutput)) fs.writeFileSync('.docker/trigger.json', JSON.stringify(triggerJson, null, 2)) console.log( chalk.greenBright(`✅ SimpleTrigger deployed to ${triggerJson.deployedTo}`) diff --git a/deploy/deploy-script.ts b/deploy/deploy-script.ts index 50f209db..d7bfb78a 100644 --- a/deploy/deploy-script.ts +++ b/deploy/deploy-script.ts @@ -16,7 +16,7 @@ import { Command } from 'commander' import { DEPLOYMENT_SUMMARY_FILE, POA_MIDDLEWARE_IMAGE } from './constants' import { DEFAULT_OPTIONS, initProgram } from './env' -import { exec, execFull, loadDotenv, readJson, sleep } from './utils' +import { exec, execFull, execSilently, loadDotenv, readJson, sleep } from './utils' const program = new Command('deploy-script') .description('Deploy the entire WAVS stack.') @@ -35,11 +35,6 @@ const program = new Command('deploy-script') 'The WAVS operator URL for the service', 'http://127.0.0.1:8041' ) - .option( - '-a, --aggregator-url ', - 'The aggregator URL for the service', - 'http://127.0.0.1:8040' - ) .option( '-t, --stake-threshold ', 'The POA stake weight threshold', @@ -62,7 +57,6 @@ const main = async () => { contractUpload, rpcUrl, wavsUrl, - aggregatorUrl, stakeThreshold, quorum: _quorum, }, @@ -212,37 +206,6 @@ const main = async () => { ) } - // Create and start aggregator - await exec('pnpm', 'deploy:create-aggregator', '1', '-f') - await execFull({ - cmd: ['bash', './infra/aggregator-1/start.sh'], - env: { - IPFS_GATEWAY: env.ipfs.gateway, - }, - }) - await sleep(3) - - // Register service on aggregator - const res = await fetch(aggregatorUrl + '/services', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - service_manager: { - evm: { - chain: env.submitChain, - address: serviceManagerAddress, - }, - }, - }), - }) - if (!res.ok) { - throw new Error( - `❌ Failed to register service on aggregator: ${res.statusText} (${(await res.text().catch(() => '')) || ''})` - ) - } - // Create and start operator await exec('pnpm', 'deploy:create-operator', '1', '-f') await execFull({ @@ -253,6 +216,34 @@ const main = async () => { }) await sleep(3) + // Fund aggregator account on local network + if (envName === 'dev') { + console.log(chalk.blueBright('💰 Funding aggregator account on local network...')) + const aggAddress = ( + await execSilently( + 'cast', + 'wallet', + 'address', + '--mnemonic', + 'domain velvet noodle derive dumb table hello prosper crop next unable salt task cement tilt mouse body father renew battle brain try broom trip', + '--mnemonic-index', + '0' + ) + ).trim() + const hexBalance = ( + await execSilently('cast', 'to-hex', '10000000000000000000') + ).trim() + await exec( + 'cast', + 'rpc', + 'anvil_setBalance', + aggAddress, + hexBalance, + '--rpc-url', + rpcUrl + ) + } + // Deploy the service.json to WAVS await execFull({ cmd: ['task', 'deploy:service'], diff --git a/deploy/templates/operator.env b/deploy/templates/operator.env index 3c63d558..a2b079f6 100644 --- a/deploy/templates/operator.env +++ b/deploy/templates/operator.env @@ -4,8 +4,8 @@ WAVS_ENV_YOURKEYHERE="00000000000000000000000000000000" # WAVS WAVS_DATA=~/wavs/data WAVS_LOG_LEVEL="info, wavs_aggregator=debug" -WAVS_SUBMISSION_MNEMONIC="INSERT_MNEMONIC_HERE" -#WAVS_COSMOS_SUBMISSION_MNEMONIC="cosmos mnemonic here" +WAVS_SIGNING_MNEMONIC="INSERT_MNEMONIC_HERE" +#WAVS_COSMOS_SIGNING_MNEMONIC="cosmos mnemonic here" # WAVS CLI WAVS_CLI_DATA=~/wavs/cli diff --git a/claude.md b/old-wavs-skill-claude.md similarity index 100% rename from claude.md rename to old-wavs-skill-claude.md diff --git a/script/template/.env.example.operator b/script/template/.env.example.operator index 1a9efffa..03bfb88c 100644 --- a/script/template/.env.example.operator +++ b/script/template/.env.example.operator @@ -4,8 +4,8 @@ WAVS_ENV_YOURKEYHERE="00000000000000000000000000000000" # WAVS WAVS_DATA=~/wavs/data WAVS_LOG_LEVEL="info, wavs_aggregator=debug" -WAVS_SUBMISSION_MNEMONIC="" -#WAVS_COSMOS_SUBMISSION_MNEMONIC="cosmos mnemonic here" +WAVS_SIGNING_MNEMONIC="" +#WAVS_COSMOS_SIGNING_MNEMONIC="cosmos mnemonic here" # WAVS CLI WAVS_CLI_DATA=~/wavs/cli diff --git a/taskfile/config.yml b/taskfile/config.yml index 4fb23d8c..af236da0 100644 --- a/taskfile/config.yml +++ b/taskfile/config.yml @@ -36,7 +36,7 @@ vars: sh: test -n "{{.FUNDED_KEY}}" && cast wallet address "{{.FUNDED_KEY}}" 2>/dev/null || echo "" # Docker images - WAVS_DOCKER_IMAGE: "ghcr.io/lay3rlabs/wavs:1.5.1" + WAVS_DOCKER_IMAGE: "ghcr.io/lay3rlabs/wavs:216aa67" MIDDLEWARE_DOCKER_IMAGE: "ghcr.io/lay3rlabs/wavs-middleware:0.5.0-beta.10" # Service endpoints diff --git a/taskfile/env.yml b/taskfile/env.yml index 280b18b9..0896dfd8 100644 --- a/taskfile/env.yml +++ b/taskfile/env.yml @@ -4,7 +4,7 @@ includes: config: ./config.yml vars: - DEPLOY_SUMMARY: '.docker/deployment_summary.json' + DEPLOY_SUMMARY: ".docker/deployment_summary.json" tasks: get-rpc: @@ -64,7 +64,7 @@ tasks: get-wasi-namespace: desc: "Get WASI package namespace" vars: - REGISTRY: '{{.REGISTRY}}' + REGISTRY: "{{.REGISTRY}}" cmds: - | # Auto-get registry if not provided @@ -124,8 +124,8 @@ tasks: HD_INDEX={{.HD_INDEX}} source {{.DEFAULT_ENV_FILE}} - export OPERATOR_PRIVATE_KEY=`cast wallet private-key --mnemonic "$WAVS_SUBMISSION_MNEMONIC" --mnemonic-index 0` - export AVS_SIGNING_ADDRESS=`cast wallet address --mnemonic-path "$WAVS_SUBMISSION_MNEMONIC" --mnemonic-index ${HD_INDEX}` + export OPERATOR_PRIVATE_KEY=`cast wallet private-key --mnemonic "$WAVS_SIGNING_MNEMONIC" --mnemonic-index 0` + export AVS_SIGNING_ADDRESS=`cast wallet address --mnemonic-path "$WAVS_SIGNING_MNEMONIC" --mnemonic-index ${HD_INDEX}` echo "HD_INDEX=${HD_INDEX}" echo "SERVICE_ID=${SERVICE_ID}" diff --git a/taskfile/poa-operator.yml b/taskfile/poa-operator.yml new file mode 100644 index 00000000..f535d3f0 --- /dev/null +++ b/taskfile/poa-operator.yml @@ -0,0 +1,102 @@ +version: "3" + +silent: true + +vars: + RPC_URL: '{{.RPC_URL | default "http://localhost:8545"}}' + OPERATOR_NUM: '{{.OPERATOR_NUM}}' + OPERATOR_WEIGHT: '{{.OPERATOR_WEIGHT | default "1000"}}' + WAVS_ENV_FILE: 'infra/wavs-{{.OPERATOR_NUM}}/.env' + + # Common shell script snippets + VALIDATE_INPUTS: | + if [ -z "{{.OPERATOR_NUM}}" ]; then + echo "❌ Error: OPERATOR_NUM is required" + echo "Usage: task operator: OPERATOR_NUM=1" + exit 1 + fi + if [ ! -f "{{.WAVS_ENV_FILE}}" ]; then + echo "❌ Error: Environment file {{.WAVS_ENV_FILE}} not found" + exit 1 + fi + echo "📝 Loading operator {{.OPERATOR_NUM}} configuration from {{.WAVS_ENV_FILE}}" + + LOAD_ENV_AND_KEYS: | + source {{.WAVS_ENV_FILE}} + OPERATOR_KEY=$(cast wallet private-key --mnemonic "$WAVS_SIGNING_MNEMONIC" --mnemonic-index 0) + OPERATOR_ADDRESS=$(cast wallet address ${OPERATOR_KEY}) + OPERATOR_MNEMONIC="$WAVS_SIGNING_MNEMONIC" + WAVS_SIGNING_KEY=$(cast wallet address --mnemonic "$WAVS_SIGNING_MNEMONIC" --mnemonic-index 1) + +tasks: + register: + desc: "Register an operator with WAVS Service Manager" + cmds: + - | + {{.VALIDATE_INPUTS}} + {{.LOAD_ENV_AND_KEYS}} + + echo "🔑 Operator Address: ${OPERATOR_ADDRESS}" + + # Fund operator if on local network + if [[ "{{.RPC_URL}}" == *"localhost"* ]] || [[ "{{.RPC_URL}}" == *"127.0.0.1"* ]]; then + echo "💰 Funding operator on local network..." + cast rpc anvil_setBalance ${OPERATOR_ADDRESS} $(cast to-hex 100000000000000000) --rpc-url {{.RPC_URL}} + fi + + echo "📝 Whitelisting (registering) operator in WAVS Service Manager..." + cast send {{.WAVS_SERVICE_MANAGER_ADDRESS}} "registerOperator(address,uint256)" ${OPERATOR_ADDRESS} {{.OPERATOR_WEIGHT}} \ + --private-key ${PRIVATE_KEY} \ + --rpc-url {{.RPC_URL}} + + echo "⚖️ Checking operator weight..." + cast call {{.WAVS_SERVICE_MANAGER_ADDRESS}} "getOperatorWeight(address)" ${OPERATOR_ADDRESS} \ + --rpc-url {{.RPC_URL}} + + echo "✅ Registration complete!" + + update-signing-key: + desc: "Update operator's signing key with WAVS Service Manager" + cmds: + - | + {{.VALIDATE_INPUTS}} + {{.LOAD_ENV_AND_KEYS}} + + echo "🔑 Operator Address: ${OPERATOR_ADDRESS}" + echo "🔑 New Signing Key: ${WAVS_SIGNING_KEY}" + + encoded_operator_address=$(cast abi-encode "f(address)" "$OPERATOR_ADDRESS") + signing_message=$(cast keccak "$encoded_operator_address") + signing_signature=$(cast wallet sign --no-hash --mnemonic "$OPERATOR_MNEMONIC" --mnemonic-index 1 "$signing_message") + echo "Signing signature: $signing_signature" + + echo "🔐 Updating signing key..." + cast send {{.WAVS_SERVICE_MANAGER_ADDRESS}} "updateOperatorSigningKey(address,bytes)" ${WAVS_SIGNING_KEY} ${signing_signature} \ + --private-key ${OPERATOR_KEY} \ + --rpc-url {{.RPC_URL}} + + echo "✅ Signing key update complete!" + + verify: + desc: "Verify operator registration status" + cmds: + - | + {{.VALIDATE_INPUTS}} + {{.LOAD_ENV_AND_KEYS}} + + echo "🔍 Verifying operator {{.OPERATOR_NUM}} registration..." + + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "Operator Address: ${OPERATOR_ADDRESS}" + + echo -n "Operator Signing Key: " + cast call {{.WAVS_SERVICE_MANAGER_ADDRESS}} "getLatestOperatorSigningKey(address)" ${OPERATOR_ADDRESS} \ + --rpc-url {{.RPC_URL}} + + echo -n "Signing Key -> Operator: " + cast call {{.WAVS_SERVICE_MANAGER_ADDRESS}} "getLatestOperatorForSigningKey(address)" ${WAVS_SIGNING_KEY} \ + --rpc-url {{.RPC_URL}} + + echo -n "Operator Weight: " + cast call {{.WAVS_SERVICE_MANAGER_ADDRESS}} "getOperatorWeight(address)" ${OPERATOR_ADDRESS} \ + --rpc-url {{.RPC_URL}} diff --git a/taskfile/services.yml b/taskfile/services.yml index 5861a0c7..a7283dc7 100644 --- a/taskfile/services.yml +++ b/taskfile/services.yml @@ -38,7 +38,7 @@ tasks: FILES="-f docker-compose.yml" # -f telemetry/docker-compose.yml docker compose ${FILES} pull docker compose ${FILES} up --force-recreate -d - trap "docker compose ${FILES} down --remove-orphans && docker kill wavs-1 wavs-aggregator-1 > /dev/null 2>&1 && echo -e '\nKilled IPFS + Local WARG, and wavs instances'" EXIT + trap "docker compose ${FILES} down --remove-orphans && docker kill wavs-1 > /dev/null 2>&1 && echo -e '\nKilled IPFS + Local WARG, and wavs instances'" EXIT echo "Started..." wait @@ -51,6 +51,6 @@ tasks: echo "Stopping all services..." FILES="-f docker-compose.yml -f telemetry/docker-compose.yml" docker compose ${FILES} down --remove-orphans || true - docker kill wavs-1 wavs-aggregator-1 > /dev/null 2>&1 || true + docker kill wavs-1 > /dev/null 2>&1 || true pkill -f anvil || true echo "All services stopped" diff --git a/wavs.toml b/wavs.toml index 47ebdd1f..08574467 100644 --- a/wavs.toml +++ b/wavs.toml @@ -80,7 +80,8 @@ poll_interval_ms = 7000 [wavs] # The directory to store the data. Default is "/var/wavs" -data = "~/wavs" +data = "~/.wavs/data" +dev_endpoints_enabled = true # Optional bearer token to protect mutating HTTP endpoints # If set here or via env var `WAVS_BEARER_TOKEN`, POST/DELETE endpoints require `Authorization: Bearer ` @@ -96,6 +97,10 @@ cors_allowed_origins = [ # The port on which the server will listen. port = 8041 +chain_write_credential = "domain velvet noodle derive dumb table hello prosper crop next unable salt task cement tilt mouse body father renew battle brain try broom trip" +# signing_mnemonic is intentionally not set here - it comes from .env (WAVS_SIGNING_MNEMONIC) +aggregator_evm_credential = "domain velvet noodle derive dumb table hello prosper crop next unable salt task cement tilt mouse body father renew battle brain try broom trip" + # The host to serve on. Default is localhost # host = "localhost" diff --git a/wit-aggregator/aggregator.wit b/wit-aggregator/aggregator.wit new file mode 100644 index 00000000..bdbf5b88 --- /dev/null +++ b/wit-aggregator/aggregator.wit @@ -0,0 +1,100 @@ +package wavs:aggregator@2.7.0; + +use wavs:types/core@2.7.0 as core-types; +use wavs:types/service@2.7.0 as service-types; +use wavs:types/chain@2.7.0 as chain-types; +use wavs:types/events@2.7.0 as event-types; +use wavs:operator/input@2.7.0 as operator-input; +use wavs:operator/output@2.7.0 as operator-output; + +interface input { + use operator-input.{trigger-action}; + use operator-output.{wasm-response}; + + record aggregator-input { + trigger-action: trigger-action, + operator-response: wasm-response + } +} + +interface output { + use core-types.{duration, u128}; + use chain-types.{chain-key, evm-address, cosmos-address}; + + variant aggregator-action { + timer(timer-action), + submit(submit-action), + } + + record timer-action { + delay: duration, + } + + variant submit-action { + evm(evm-submit-action), + cosmos(cosmos-submit-action), + } + + record evm-submit-action { + chain: chain-key, + address: evm-address, + gas-price: option, + } + + record cosmos-submit-action { + chain: chain-key, + address: cosmos-address, + gas-price: option, + } +} + +world aggregator-world { + // include needed for golang support + include wasi:cli/imports@0.2.0; + + // wasi:http 0.2.6 uses the `imports` style, but for now import each interface separately + import wasi:http/types@0.2.0; + import wasi:http/outgoing-handler@0.2.0; + + // for key-value store support + include wasi:keyvalue/imports@0.2.0-draft2; + + // for raw socket support + include wasi:sockets/imports@0.2.0; + + // for tls support + include wasi:tls/imports@0.2.0-draft; + + import host: interface { + use chain-types.{evm-chain-config, cosmos-chain-config}; + use core-types.{log-level}; + use service-types.{service-and-workflow-id, workflow-and-workflow-id}; + use event-types.{event-id}; + + get-evm-chain-config: func(chain-key: string) -> option; + get-cosmos-chain-config: func(chain-key: string) -> option; + + config-var: func(key: string) -> option; + + log: func(level: log-level, message: string); + + // gets the service and workflow id that called this component + get-service: func() -> service-and-workflow-id; + + // convenience function to get the workflow without having to walk service.workflows + get-workflow: func() -> workflow-and-workflow-id; + + // convenience function to get the event-id + get-event-id: func() -> event-id; + } + + use input.{aggregator-input}; + use output.{aggregator-action}; + use chain-types.{any-tx-hash}; + + export process-input: func(input: aggregator-input) -> result, string>; + + export handle-timer-callback: func(input: aggregator-input) -> result, string>; + + export handle-submit-callback: func(input: aggregator-input, tx-result: result) -> result<_, string>; +} diff --git a/wit-aggregator/deps/wasi-cli-0.2.0/package.wit b/wit-aggregator/deps/wasi-cli-0.2.0/package.wit new file mode 100644 index 00000000..0a2737b7 --- /dev/null +++ b/wit-aggregator/deps/wasi-cli-0.2.0/package.wit @@ -0,0 +1,159 @@ +package wasi:cli@0.2.0; + +interface environment { + /// Get the POSIX-style environment variables. + /// + /// Each environment variable is provided as a pair of string variable names + /// and string value. + /// + /// Morally, these are a value import, but until value imports are available + /// in the component model, this import function should return the same + /// values each time it is called. + get-environment: func() -> list>; + + /// Get the POSIX-style arguments to the program. + get-arguments: func() -> list; + + /// Return a path that programs should use as their initial current working + /// directory, interpreting `.` as shorthand for this. + initial-cwd: func() -> option; +} + +interface exit { + /// Exit the current instance and any linked instances. + exit: func(status: result); +} + +interface run { + /// Run the program. + run: func() -> result; +} + +interface stdin { + use wasi:io/streams@0.2.0.{input-stream}; + + get-stdin: func() -> input-stream; +} + +interface stdout { + use wasi:io/streams@0.2.0.{output-stream}; + + get-stdout: func() -> output-stream; +} + +interface stderr { + use wasi:io/streams@0.2.0.{output-stream}; + + get-stderr: func() -> output-stream; +} + +/// Terminal input. +/// +/// In the future, this may include functions for disabling echoing, +/// disabling input buffering so that keyboard events are sent through +/// immediately, querying supported features, and so on. +interface terminal-input { + /// The input side of a terminal. + resource terminal-input; +} + +/// Terminal output. +/// +/// In the future, this may include functions for querying the terminal +/// size, being notified of terminal size changes, querying supported +/// features, and so on. +interface terminal-output { + /// The output side of a terminal. + resource terminal-output; +} + +/// An interface providing an optional `terminal-input` for stdin as a +/// link-time authority. +interface terminal-stdin { + use terminal-input.{terminal-input}; + + /// If stdin is connected to a terminal, return a `terminal-input` handle + /// allowing further interaction with it. + get-terminal-stdin: func() -> option; +} + +/// An interface providing an optional `terminal-output` for stdout as a +/// link-time authority. +interface terminal-stdout { + use terminal-output.{terminal-output}; + + /// If stdout is connected to a terminal, return a `terminal-output` handle + /// allowing further interaction with it. + get-terminal-stdout: func() -> option; +} + +/// An interface providing an optional `terminal-output` for stderr as a +/// link-time authority. +interface terminal-stderr { + use terminal-output.{terminal-output}; + + /// If stderr is connected to a terminal, return a `terminal-output` handle + /// allowing further interaction with it. + get-terminal-stderr: func() -> option; +} + +world imports { + import environment; + import exit; + import wasi:io/error@0.2.0; + import wasi:io/poll@0.2.0; + import wasi:io/streams@0.2.0; + import stdin; + import stdout; + import stderr; + import terminal-input; + import terminal-output; + import terminal-stdin; + import terminal-stdout; + import terminal-stderr; + import wasi:clocks/monotonic-clock@0.2.0; + import wasi:clocks/wall-clock@0.2.0; + import wasi:filesystem/types@0.2.0; + import wasi:filesystem/preopens@0.2.0; + import wasi:sockets/network@0.2.0; + import wasi:sockets/instance-network@0.2.0; + import wasi:sockets/udp@0.2.0; + import wasi:sockets/udp-create-socket@0.2.0; + import wasi:sockets/tcp@0.2.0; + import wasi:sockets/tcp-create-socket@0.2.0; + import wasi:sockets/ip-name-lookup@0.2.0; + import wasi:random/random@0.2.0; + import wasi:random/insecure@0.2.0; + import wasi:random/insecure-seed@0.2.0; +} +world command { + import environment; + import exit; + import wasi:io/error@0.2.0; + import wasi:io/poll@0.2.0; + import wasi:io/streams@0.2.0; + import stdin; + import stdout; + import stderr; + import terminal-input; + import terminal-output; + import terminal-stdin; + import terminal-stdout; + import terminal-stderr; + import wasi:clocks/monotonic-clock@0.2.0; + import wasi:clocks/wall-clock@0.2.0; + import wasi:filesystem/types@0.2.0; + import wasi:filesystem/preopens@0.2.0; + import wasi:sockets/network@0.2.0; + import wasi:sockets/instance-network@0.2.0; + import wasi:sockets/udp@0.2.0; + import wasi:sockets/udp-create-socket@0.2.0; + import wasi:sockets/tcp@0.2.0; + import wasi:sockets/tcp-create-socket@0.2.0; + import wasi:sockets/ip-name-lookup@0.2.0; + import wasi:random/random@0.2.0; + import wasi:random/insecure@0.2.0; + import wasi:random/insecure-seed@0.2.0; + + export run; +} diff --git a/wit-aggregator/deps/wasi-clocks-0.2.0/package.wit b/wit-aggregator/deps/wasi-clocks-0.2.0/package.wit new file mode 100644 index 00000000..9e0ba3dc --- /dev/null +++ b/wit-aggregator/deps/wasi-clocks-0.2.0/package.wit @@ -0,0 +1,29 @@ +package wasi:clocks@0.2.0; + +interface monotonic-clock { + use wasi:io/poll@0.2.0.{pollable}; + + type instant = u64; + + type duration = u64; + + now: func() -> instant; + + resolution: func() -> duration; + + subscribe-instant: func(when: instant) -> pollable; + + subscribe-duration: func(when: duration) -> pollable; +} + +interface wall-clock { + record datetime { + seconds: u64, + nanoseconds: u32, + } + + now: func() -> datetime; + + resolution: func() -> datetime; +} + diff --git a/wit-aggregator/deps/wasi-filesystem-0.2.0/package.wit b/wit-aggregator/deps/wasi-filesystem-0.2.0/package.wit new file mode 100644 index 00000000..cb6a2beb --- /dev/null +++ b/wit-aggregator/deps/wasi-filesystem-0.2.0/package.wit @@ -0,0 +1,158 @@ +package wasi:filesystem@0.2.0; + +interface types { + use wasi:io/streams@0.2.0.{input-stream, output-stream, error}; + use wasi:clocks/wall-clock@0.2.0.{datetime}; + + type filesize = u64; + + enum descriptor-type { + unknown, + block-device, + character-device, + directory, + fifo, + symbolic-link, + regular-file, + socket, + } + + flags descriptor-flags { + read, + write, + file-integrity-sync, + data-integrity-sync, + requested-write-sync, + mutate-directory, + } + + flags path-flags { + symlink-follow, + } + + flags open-flags { + create, + directory, + exclusive, + truncate, + } + + type link-count = u64; + + record descriptor-stat { + %type: descriptor-type, + link-count: link-count, + size: filesize, + data-access-timestamp: option, + data-modification-timestamp: option, + status-change-timestamp: option, + } + + variant new-timestamp { + no-change, + now, + timestamp(datetime), + } + + record directory-entry { + %type: descriptor-type, + name: string, + } + + enum error-code { + access, + would-block, + already, + bad-descriptor, + busy, + deadlock, + quota, + exist, + file-too-large, + illegal-byte-sequence, + in-progress, + interrupted, + invalid, + io, + is-directory, + loop, + too-many-links, + message-size, + name-too-long, + no-device, + no-entry, + no-lock, + insufficient-memory, + insufficient-space, + not-directory, + not-empty, + not-recoverable, + unsupported, + no-tty, + no-such-device, + overflow, + not-permitted, + pipe, + read-only, + invalid-seek, + text-file-busy, + cross-device, + } + + enum advice { + normal, + sequential, + random, + will-need, + dont-need, + no-reuse, + } + + record metadata-hash-value { + lower: u64, + upper: u64, + } + + resource descriptor { + read-via-stream: func(offset: filesize) -> result; + write-via-stream: func(offset: filesize) -> result; + append-via-stream: func() -> result; + advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; + sync-data: func() -> result<_, error-code>; + get-flags: func() -> result; + get-type: func() -> result; + set-size: func(size: filesize) -> result<_, error-code>; + set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; + read: func(length: filesize, offset: filesize) -> result, bool>, error-code>; + write: func(buffer: list, offset: filesize) -> result; + read-directory: func() -> result; + sync: func() -> result<_, error-code>; + create-directory-at: func(path: string) -> result<_, error-code>; + stat: func() -> result; + stat-at: func(path-flags: path-flags, path: string) -> result; + set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; + link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; + open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; + readlink-at: func(path: string) -> result; + remove-directory-at: func(path: string) -> result<_, error-code>; + rename-at: func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; + symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>; + unlink-file-at: func(path: string) -> result<_, error-code>; + is-same-object: func(other: borrow) -> bool; + metadata-hash: func() -> result; + metadata-hash-at: func(path-flags: path-flags, path: string) -> result; + } + + resource directory-entry-stream { + read-directory-entry: func() -> result, error-code>; + } + + filesystem-error-code: func(err: borrow) -> option; +} + +interface preopens { + use types.{descriptor}; + + get-directories: func() -> list>; +} + diff --git a/wit-aggregator/deps/wasi-http-0.2.0/package.wit b/wit-aggregator/deps/wasi-http-0.2.0/package.wit new file mode 100644 index 00000000..11f7ff44 --- /dev/null +++ b/wit-aggregator/deps/wasi-http-0.2.0/package.wit @@ -0,0 +1,571 @@ +package wasi:http@0.2.0; + +/// This interface defines all of the types and methods for implementing +/// HTTP Requests and Responses, both incoming and outgoing, as well as +/// their headers, trailers, and bodies. +interface types { + use wasi:clocks/monotonic-clock@0.2.0.{duration}; + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + use wasi:io/error@0.2.0.{error as io-error}; + use wasi:io/poll@0.2.0.{pollable}; + + /// This type corresponds to HTTP standard Methods. + variant method { + get, + head, + post, + put, + delete, + connect, + options, + trace, + patch, + other(string), + } + + /// This type corresponds to HTTP standard Related Schemes. + variant scheme { + HTTP, + HTTPS, + other(string), + } + + /// Defines the case payload type for `DNS-error` above: + record DNS-error-payload { + rcode: option, + info-code: option, + } + + /// Defines the case payload type for `TLS-alert-received` above: + record TLS-alert-received-payload { + alert-id: option, + alert-message: option, + } + + /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: + record field-size-payload { + field-name: option, + field-size: option, + } + + /// These cases are inspired by the IANA HTTP Proxy Error Types: + /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types + variant error-code { + DNS-timeout, + DNS-error(DNS-error-payload), + destination-not-found, + destination-unavailable, + destination-IP-prohibited, + destination-IP-unroutable, + connection-refused, + connection-terminated, + connection-timeout, + connection-read-timeout, + connection-write-timeout, + connection-limit-reached, + TLS-protocol-error, + TLS-certificate-error, + TLS-alert-received(TLS-alert-received-payload), + HTTP-request-denied, + HTTP-request-length-required, + HTTP-request-body-size(option), + HTTP-request-method-invalid, + HTTP-request-URI-invalid, + HTTP-request-URI-too-long, + HTTP-request-header-section-size(option), + HTTP-request-header-size(option), + HTTP-request-trailer-section-size(option), + HTTP-request-trailer-size(field-size-payload), + HTTP-response-incomplete, + HTTP-response-header-section-size(option), + HTTP-response-header-size(field-size-payload), + HTTP-response-body-size(option), + HTTP-response-trailer-section-size(option), + HTTP-response-trailer-size(field-size-payload), + HTTP-response-transfer-coding(option), + HTTP-response-content-coding(option), + HTTP-response-timeout, + HTTP-upgrade-failed, + HTTP-protocol-error, + loop-detected, + configuration-error, + /// This is a catch-all error for anything that doesn't fit cleanly into a + /// more specific case. It also includes an optional string for an + /// unstructured description of the error. Users should not depend on the + /// string for diagnosing errors, as it's not required to be consistent + /// between implementations. + internal-error(option), + } + + /// This type enumerates the different kinds of errors that may occur when + /// setting or appending to a `fields` resource. + variant header-error { + /// This error indicates that a `field-key` or `field-value` was + /// syntactically invalid when used with an operation that sets headers in a + /// `fields`. + invalid-syntax, + /// This error indicates that a forbidden `field-key` was used when trying + /// to set a header in a `fields`. + forbidden, + /// This error indicates that the operation on the `fields` was not + /// permitted because the fields are immutable. + immutable, + } + + /// Field keys are always strings. + type field-key = string; + + /// Field values should always be ASCII strings. However, in + /// reality, HTTP implementations often have to interpret malformed values, + /// so they are provided as a list of bytes. + type field-value = list; + + /// This following block defines the `fields` resource which corresponds to + /// HTTP standard Fields. Fields are a common representation used for both + /// Headers and Trailers. + /// + /// A `fields` may be mutable or immutable. A `fields` created using the + /// constructor, `from-list`, or `clone` will be mutable, but a `fields` + /// resource given by other means (including, but not limited to, + /// `incoming-request.headers`, `outgoing-request.headers`) might be be + /// immutable. In an immutable fields, the `set`, `append`, and `delete` + /// operations will fail with `header-error.immutable`. + resource fields { + /// Construct an empty HTTP Fields. + /// + /// The resulting `fields` is mutable. + constructor(); + /// Construct an HTTP Fields. + /// + /// The resulting `fields` is mutable. + /// + /// The list represents each key-value pair in the Fields. Keys + /// which have multiple values are represented by multiple entries in this + /// list with the same key. + /// + /// The tuple is a pair of the field key, represented as a string, and + /// Value, represented as a list of bytes. In a valid Fields, all keys + /// and values are valid UTF-8 strings. However, values are not always + /// well-formed, so they are represented as a raw list of bytes. + /// + /// An error result will be returned if any header or value was + /// syntactically invalid, or if a header was forbidden. + from-list: static func(entries: list>) -> result; + /// Get all of the values corresponding to a key. If the key is not present + /// in this `fields`, an empty list is returned. However, if the key is + /// present but empty, this is represented by a list with one or more + /// empty field-values present. + get: func(name: field-key) -> list; + /// Returns `true` when the key is present in this `fields`. If the key is + /// syntactically invalid, `false` is returned. + has: func(name: field-key) -> bool; + /// Set all of the values for a key. Clears any existing values for that + /// key, if they have been set. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + set: func(name: field-key, value: list) -> result<_, header-error>; + /// Delete all values for a key. Does nothing if no values for the key + /// exist. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + delete: func(name: field-key) -> result<_, header-error>; + /// Append a value for a key. Does not change or delete any existing + /// values for that key. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + append: func(name: field-key, value: field-value) -> result<_, header-error>; + /// Retrieve the full set of keys and values in the Fields. Like the + /// constructor, the list represents each key-value pair. + /// + /// The outer list represents each key-value pair in the Fields. Keys + /// which have multiple values are represented by multiple entries in this + /// list with the same key. + entries: func() -> list>; + /// Make a deep copy of the Fields. Equivelant in behavior to calling the + /// `fields` constructor on the return value of `entries`. The resulting + /// `fields` is mutable. + clone: func() -> fields; + } + + /// Headers is an alias for Fields. + type headers = fields; + + /// Trailers is an alias for Fields. + type trailers = fields; + + /// Represents an incoming HTTP Request. + resource incoming-request { + /// Returns the method of the incoming request. + method: func() -> method; + /// Returns the path with query parameters from the request, as a string. + path-with-query: func() -> option; + /// Returns the protocol scheme from the request. + scheme: func() -> option; + /// Returns the authority from the request, if it was present. + authority: func() -> option; + /// Get the `headers` associated with the request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// The `headers` returned are a child resource: it must be dropped before + /// the parent `incoming-request` is dropped. Dropping this + /// `incoming-request` before all children are dropped will trap. + headers: func() -> headers; + /// Gives the `incoming-body` associated with this request. Will only + /// return success at most once, and subsequent calls will return error. + consume: func() -> result; + } + + /// Represents an outgoing HTTP Request. + resource outgoing-request { + /// Construct a new `outgoing-request` with a default `method` of `GET`, and + /// `none` values for `path-with-query`, `scheme`, and `authority`. + /// + /// * `headers` is the HTTP Headers for the Request. + /// + /// It is possible to construct, or manipulate with the accessor functions + /// below, an `outgoing-request` with an invalid combination of `scheme` + /// and `authority`, or `headers` which are not permitted to be sent. + /// It is the obligation of the `outgoing-handler.handle` implementation + /// to reject invalid constructions of `outgoing-request`. + constructor(headers: headers); + /// Returns the resource corresponding to the outgoing Body for this + /// Request. + /// + /// Returns success on the first call: the `outgoing-body` resource for + /// this `outgoing-request` can be retrieved at most once. Subsequent + /// calls will return error. + body: func() -> result; + /// Get the Method for the Request. + method: func() -> method; + /// Set the Method for the Request. Fails if the string present in a + /// `method.other` argument is not a syntactically valid method. + set-method: func(method: method) -> result; + /// Get the combination of the HTTP Path and Query for the Request. + /// When `none`, this represents an empty Path and empty Query. + path-with-query: func() -> option; + /// Set the combination of the HTTP Path and Query for the Request. + /// When `none`, this represents an empty Path and empty Query. Fails is the + /// string given is not a syntactically valid path and query uri component. + set-path-with-query: func(path-with-query: option) -> result; + /// Get the HTTP Related Scheme for the Request. When `none`, the + /// implementation may choose an appropriate default scheme. + scheme: func() -> option; + /// Set the HTTP Related Scheme for the Request. When `none`, the + /// implementation may choose an appropriate default scheme. Fails if the + /// string given is not a syntactically valid uri scheme. + set-scheme: func(scheme: option) -> result; + /// Get the HTTP Authority for the Request. A value of `none` may be used + /// with Related Schemes which do not require an Authority. The HTTP and + /// HTTPS schemes always require an authority. + authority: func() -> option; + /// Set the HTTP Authority for the Request. A value of `none` may be used + /// with Related Schemes which do not require an Authority. The HTTP and + /// HTTPS schemes always require an authority. Fails if the string given is + /// not a syntactically valid uri authority. + set-authority: func(authority: option) -> result; + /// Get the headers associated with the Request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `outgoing-request` is dropped, or its ownership is transfered to + /// another component by e.g. `outgoing-handler.handle`. + headers: func() -> headers; + } + + /// Parameters for making an HTTP Request. Each of these parameters is + /// currently an optional timeout applicable to the transport layer of the + /// HTTP protocol. + /// + /// These timeouts are separate from any the user may use to bound a + /// blocking call to `wasi:io/poll.poll`. + resource request-options { + /// Construct a default `request-options` value. + constructor(); + /// The timeout for the initial connect to the HTTP Server. + connect-timeout: func() -> option; + /// Set the timeout for the initial connect to the HTTP Server. An error + /// return value indicates that this timeout is not supported. + set-connect-timeout: func(duration: option) -> result; + /// The timeout for receiving the first byte of the Response body. + first-byte-timeout: func() -> option; + /// Set the timeout for receiving the first byte of the Response body. An + /// error return value indicates that this timeout is not supported. + set-first-byte-timeout: func(duration: option) -> result; + /// The timeout for receiving subsequent chunks of bytes in the Response + /// body stream. + between-bytes-timeout: func() -> option; + /// Set the timeout for receiving subsequent chunks of bytes in the Response + /// body stream. An error return value indicates that this timeout is not + /// supported. + set-between-bytes-timeout: func(duration: option) -> result; + } + + /// Represents the ability to send an HTTP Response. + /// + /// This resource is used by the `wasi:http/incoming-handler` interface to + /// allow a Response to be sent corresponding to the Request provided as the + /// other argument to `incoming-handler.handle`. + resource response-outparam { + /// Set the value of the `response-outparam` to either send a response, + /// or indicate an error. + /// + /// This method consumes the `response-outparam` to ensure that it is + /// called at most once. If it is never called, the implementation + /// will respond with an error. + /// + /// The user may provide an `error` to `response` to allow the + /// implementation determine how to respond with an HTTP error response. + set: static func(param: response-outparam, response: result); + } + + /// This type corresponds to the HTTP standard Status Code. + type status-code = u16; + + /// Represents an incoming HTTP Response. + resource incoming-response { + /// Returns the status code from the incoming response. + status: func() -> status-code; + /// Returns the headers from the incoming response. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `incoming-response` is dropped. + headers: func() -> headers; + /// Returns the incoming body. May be called at most once. Returns error + /// if called additional times. + consume: func() -> result; + } + + /// Represents an incoming HTTP Request or Response's Body. + /// + /// A body has both its contents - a stream of bytes - and a (possibly + /// empty) set of trailers, indicating that the full contents of the + /// body have been received. This resource represents the contents as + /// an `input-stream` and the delivery of trailers as a `future-trailers`, + /// and ensures that the user of this interface may only be consuming either + /// the body contents or waiting on trailers at any given time. + resource incoming-body { + /// Returns the contents of the body, as a stream of bytes. + /// + /// Returns success on first call: the stream representing the contents + /// can be retrieved at most once. Subsequent calls will return error. + /// + /// The returned `input-stream` resource is a child: it must be dropped + /// before the parent `incoming-body` is dropped, or consumed by + /// `incoming-body.finish`. + /// + /// This invariant ensures that the implementation can determine whether + /// the user is consuming the contents of the body, waiting on the + /// `future-trailers` to be ready, or neither. This allows for network + /// backpressure is to be applied when the user is consuming the body, + /// and for that backpressure to not inhibit delivery of the trailers if + /// the user does not read the entire body. + %stream: func() -> result; + /// Takes ownership of `incoming-body`, and returns a `future-trailers`. + /// This function will trap if the `input-stream` child is still alive. + finish: static func(this: incoming-body) -> future-trailers; + } + + /// Represents a future which may eventaully return trailers, or an error. + /// + /// In the case that the incoming HTTP Request or Response did not have any + /// trailers, this future will resolve to the empty set of trailers once the + /// complete Request or Response body has been received. + resource future-trailers { + /// Returns a pollable which becomes ready when either the trailers have + /// been received, or an error has occured. When this pollable is ready, + /// the `get` method will return `some`. + subscribe: func() -> pollable; + /// Returns the contents of the trailers, or an error which occured, + /// once the future is ready. + /// + /// The outer `option` represents future readiness. Users can wait on this + /// `option` to become `some` using the `subscribe` method. + /// + /// The outer `result` is used to retrieve the trailers or error at most + /// once. It will be success on the first call in which the outer option + /// is `some`, and error on subsequent calls. + /// + /// The inner `result` represents that either the HTTP Request or Response + /// body, as well as any trailers, were received successfully, or that an + /// error occured receiving them. The optional `trailers` indicates whether + /// or not trailers were present in the body. + /// + /// When some `trailers` are returned by this method, the `trailers` + /// resource is immutable, and a child. Use of the `set`, `append`, or + /// `delete` methods will return an error, and the resource must be + /// dropped before the parent `future-trailers` is dropped. + get: func() -> option, error-code>>>; + } + + /// Represents an outgoing HTTP Response. + resource outgoing-response { + /// Construct an `outgoing-response`, with a default `status-code` of `200`. + /// If a different `status-code` is needed, it must be set via the + /// `set-status-code` method. + /// + /// * `headers` is the HTTP Headers for the Response. + constructor(headers: headers); + /// Get the HTTP Status Code for the Response. + status-code: func() -> status-code; + /// Set the HTTP Status Code for the Response. Fails if the status-code + /// given is not a valid http status code. + set-status-code: func(status-code: status-code) -> result; + /// Get the headers associated with the Request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `outgoing-request` is dropped, or its ownership is transfered to + /// another component by e.g. `outgoing-handler.handle`. + headers: func() -> headers; + /// Returns the resource corresponding to the outgoing Body for this Response. + /// + /// Returns success on the first call: the `outgoing-body` resource for + /// this `outgoing-response` can be retrieved at most once. Subsequent + /// calls will return error. + body: func() -> result; + } + + /// Represents an outgoing HTTP Request or Response's Body. + /// + /// A body has both its contents - a stream of bytes - and a (possibly + /// empty) set of trailers, inducating the full contents of the body + /// have been sent. This resource represents the contents as an + /// `output-stream` child resource, and the completion of the body (with + /// optional trailers) with a static function that consumes the + /// `outgoing-body` resource, and ensures that the user of this interface + /// may not write to the body contents after the body has been finished. + /// + /// If the user code drops this resource, as opposed to calling the static + /// method `finish`, the implementation should treat the body as incomplete, + /// and that an error has occured. The implementation should propogate this + /// error to the HTTP protocol by whatever means it has available, + /// including: corrupting the body on the wire, aborting the associated + /// Request, or sending a late status code for the Response. + resource outgoing-body { + /// Returns a stream for writing the body contents. + /// + /// The returned `output-stream` is a child resource: it must be dropped + /// before the parent `outgoing-body` resource is dropped (or finished), + /// otherwise the `outgoing-body` drop or `finish` will trap. + /// + /// Returns success on the first call: the `output-stream` resource for + /// this `outgoing-body` may be retrieved at most once. Subsequent calls + /// will return error. + write: func() -> result; + /// Finalize an outgoing body, optionally providing trailers. This must be + /// called to signal that the response is complete. If the `outgoing-body` + /// is dropped without calling `outgoing-body.finalize`, the implementation + /// should treat the body as corrupted. + /// + /// Fails if the body's `outgoing-request` or `outgoing-response` was + /// constructed with a Content-Length header, and the contents written + /// to the body (via `write`) does not match the value given in the + /// Content-Length. + finish: static func(this: outgoing-body, trailers: option) -> result<_, error-code>; + } + + /// Represents a future which may eventaully return an incoming HTTP + /// Response, or an error. + /// + /// This resource is returned by the `wasi:http/outgoing-handler` interface to + /// provide the HTTP Response corresponding to the sent Request. + resource future-incoming-response { + /// Returns a pollable which becomes ready when either the Response has + /// been received, or an error has occured. When this pollable is ready, + /// the `get` method will return `some`. + subscribe: func() -> pollable; + /// Returns the incoming HTTP Response, or an error, once one is ready. + /// + /// The outer `option` represents future readiness. Users can wait on this + /// `option` to become `some` using the `subscribe` method. + /// + /// The outer `result` is used to retrieve the response or error at most + /// once. It will be success on the first call in which the outer option + /// is `some`, and error on subsequent calls. + /// + /// The inner `result` represents that either the incoming HTTP Response + /// status and headers have recieved successfully, or that an error + /// occured. Errors may also occur while consuming the response body, + /// but those will be reported by the `incoming-body` and its + /// `output-stream` child. + get: func() -> option>>; + } + + /// Attempts to extract a http-related `error` from the wasi:io `error` + /// provided. + /// + /// Stream operations which return + /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of + /// type `wasi:io/error/error` with more information about the operation + /// that failed. This payload can be passed through to this function to see + /// if there's http-related information about the error to return. + /// + /// Note that this function is fallible because not all io-errors are + /// http-related errors. + http-error-code: func(err: borrow) -> option; +} + +/// This interface defines a handler of incoming HTTP Requests. It should +/// be exported by components which can respond to HTTP Requests. +interface incoming-handler { + use types.{incoming-request, response-outparam}; + + /// This function is invoked with an incoming HTTP Request, and a resource + /// `response-outparam` which provides the capability to reply with an HTTP + /// Response. The response is sent by calling the `response-outparam.set` + /// method, which allows execution to continue after the response has been + /// sent. This enables both streaming to the response body, and performing other + /// work. + /// + /// The implementor of this function must write a response to the + /// `response-outparam` before returning, or else the caller will respond + /// with an error on its behalf. + handle: func(request: incoming-request, response-out: response-outparam); +} + +/// This interface defines a handler of outgoing HTTP Requests. It should be +/// imported by components which wish to make HTTP Requests. +interface outgoing-handler { + use types.{outgoing-request, request-options, future-incoming-response, error-code}; + + /// This function is invoked with an outgoing HTTP Request, and it returns + /// a resource `future-incoming-response` which represents an HTTP Response + /// which may arrive in the future. + /// + /// The `options` argument accepts optional parameters for the HTTP + /// protocol's transport layer. + /// + /// This function may return an error if the `outgoing-request` is invalid + /// or not allowed to be made. Otherwise, protocol errors are reported + /// through the `future-incoming-response`. + handle: func(request: outgoing-request, options: option) -> result; +} + +/// The `wasi:http/proxy` world captures a widely-implementable intersection of +/// hosts that includes HTTP forward and reverse proxies. Components targeting +/// this world may concurrently stream in and out any number of incoming and +/// outgoing HTTP requests. +world proxy { + import wasi:random/random@0.2.0; + import wasi:io/error@0.2.0; + import wasi:io/poll@0.2.0; + import wasi:io/streams@0.2.0; + import wasi:cli/stdout@0.2.0; + import wasi:cli/stderr@0.2.0; + import wasi:cli/stdin@0.2.0; + import wasi:clocks/monotonic-clock@0.2.0; + import types; + import outgoing-handler; + import wasi:clocks/wall-clock@0.2.0; + + export incoming-handler; +} diff --git a/wit-aggregator/deps/wasi-io-0.2.0/package.wit b/wit-aggregator/deps/wasi-io-0.2.0/package.wit new file mode 100644 index 00000000..192e1cd5 --- /dev/null +++ b/wit-aggregator/deps/wasi-io-0.2.0/package.wit @@ -0,0 +1,292 @@ +package wasi:io@0.2.0; + +interface error { + /// A resource which represents some error information. + /// + /// The only method provided by this resource is `to-debug-string`, + /// which provides some human-readable information about the error. + /// + /// In the `wasi:io` package, this resource is returned through the + /// `wasi:io/streams/stream-error` type. + /// + /// To provide more specific error information, other interfaces may + /// provide functions to further "downcast" this error into more specific + /// error information. For example, `error`s returned in streams derived + /// from filesystem types to be described using the filesystem's own + /// error-code type, using the function + /// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter + /// `borrow` and returns + /// `option`. + /// + /// The set of functions which can "downcast" an `error` into a more + /// concrete type is open. + resource error { + /// Returns a string that is suitable to assist humans in debugging + /// this error. + /// + /// WARNING: The returned string should not be consumed mechanically! + /// It may change across platforms, hosts, or other implementation + /// details. Parsing this string is a major platform-compatibility + /// hazard. + to-debug-string: func() -> string; + } +} + +/// A poll API intended to let users wait for I/O events on multiple handles +/// at once. +interface poll { + /// `pollable` represents a single I/O event which may be ready, or not. + resource pollable { + /// Return the readiness of a pollable. This function never blocks. + /// + /// Returns `true` when the pollable is ready, and `false` otherwise. + ready: func() -> bool; + /// `block` returns immediately if the pollable is ready, and otherwise + /// blocks until ready. + /// + /// This function is equivalent to calling `poll.poll` on a list + /// containing only this pollable. + block: func(); + } + + /// Poll for completion on a set of pollables. + /// + /// This function takes a list of pollables, which identify I/O sources of + /// interest, and waits until one or more of the events is ready for I/O. + /// + /// The result `list` contains one or more indices of handles in the + /// argument list that is ready for I/O. + /// + /// If the list contains more elements than can be indexed with a `u32` + /// value, this function traps. + /// + /// A timeout can be implemented by adding a pollable from the + /// wasi-clocks API to the list. + /// + /// This function does not return a `result`; polling in itself does not + /// do any I/O so it doesn't fail. If any of the I/O sources identified by + /// the pollables has an error, it is indicated by marking the source as + /// being reaedy for I/O. + poll: func(in: list>) -> list; +} + +/// WASI I/O is an I/O abstraction API which is currently focused on providing +/// stream types. +/// +/// In the future, the component model is expected to add built-in stream types; +/// when it does, they are expected to subsume this API. +interface streams { + use error.{error}; + use poll.{pollable}; + + /// An error for input-stream and output-stream operations. + variant stream-error { + /// The last operation (a write or flush) failed before completion. + /// + /// More information is available in the `error` payload. + last-operation-failed(error), + /// The stream is closed: no more input will be accepted by the + /// stream. A closed output-stream will return this error on all + /// future operations. + closed, + } + + /// An input bytestream. + /// + /// `input-stream`s are *non-blocking* to the extent practical on underlying + /// platforms. I/O operations always return promptly; if fewer bytes are + /// promptly available than requested, they return the number of bytes promptly + /// available, which could even be zero. To wait for data to be available, + /// use the `subscribe` function to obtain a `pollable` which can be polled + /// for using `wasi:io/poll`. + resource input-stream { + /// Perform a non-blocking read from the stream. + /// + /// When the source of a `read` is binary data, the bytes from the source + /// are returned verbatim. When the source of a `read` is known to the + /// implementation to be text, bytes containing the UTF-8 encoding of the + /// text are returned. + /// + /// This function returns a list of bytes containing the read data, + /// when successful. The returned list will contain up to `len` bytes; + /// it may return fewer than requested, but not more. The list is + /// empty when no bytes are available for reading at this time. The + /// pollable given by `subscribe` will be ready when more bytes are + /// available. + /// + /// This function fails with a `stream-error` when the operation + /// encounters an error, giving `last-operation-failed`, or when the + /// stream is closed, giving `closed`. + /// + /// When the caller gives a `len` of 0, it represents a request to + /// read 0 bytes. If the stream is still open, this call should + /// succeed and return an empty list, or otherwise fail with `closed`. + /// + /// The `len` parameter is a `u64`, which could represent a list of u8 which + /// is not possible to allocate in wasm32, or not desirable to allocate as + /// as a return value by the callee. The callee may return a list of bytes + /// less than `len` in size while more bytes are available for reading. + read: func(len: u64) -> result, stream-error>; + /// Read bytes from a stream, after blocking until at least one byte can + /// be read. Except for blocking, behavior is identical to `read`. + blocking-read: func(len: u64) -> result, stream-error>; + /// Skip bytes from a stream. Returns number of bytes skipped. + /// + /// Behaves identical to `read`, except instead of returning a list + /// of bytes, returns the number of bytes consumed from the stream. + skip: func(len: u64) -> result; + /// Skip bytes from a stream, after blocking until at least one byte + /// can be skipped. Except for blocking behavior, identical to `skip`. + blocking-skip: func(len: u64) -> result; + /// Create a `pollable` which will resolve once either the specified stream + /// has bytes available to read or the other end of the stream has been + /// closed. + /// The created `pollable` is a child resource of the `input-stream`. + /// Implementations may trap if the `input-stream` is dropped before + /// all derived `pollable`s created with this function are dropped. + subscribe: func() -> pollable; + } + + /// An output bytestream. + /// + /// `output-stream`s are *non-blocking* to the extent practical on + /// underlying platforms. Except where specified otherwise, I/O operations also + /// always return promptly, after the number of bytes that can be written + /// promptly, which could even be zero. To wait for the stream to be ready to + /// accept data, the `subscribe` function to obtain a `pollable` which can be + /// polled for using `wasi:io/poll`. + resource output-stream { + /// Check readiness for writing. This function never blocks. + /// + /// Returns the number of bytes permitted for the next call to `write`, + /// or an error. Calling `write` with more bytes than this function has + /// permitted will trap. + /// + /// When this function returns 0 bytes, the `subscribe` pollable will + /// become ready when this function will report at least 1 byte, or an + /// error. + check-write: func() -> result; + /// Perform a write. This function never blocks. + /// + /// When the destination of a `write` is binary data, the bytes from + /// `contents` are written verbatim. When the destination of a `write` is + /// known to the implementation to be text, the bytes of `contents` are + /// transcoded from UTF-8 into the encoding of the destination and then + /// written. + /// + /// Precondition: check-write gave permit of Ok(n) and contents has a + /// length of less than or equal to n. Otherwise, this function will trap. + /// + /// returns Err(closed) without writing if the stream has closed since + /// the last call to check-write provided a permit. + write: func(contents: list) -> result<_, stream-error>; + /// Perform a write of up to 4096 bytes, and then flush the stream. Block + /// until all of these operations are complete, or an error occurs. + /// + /// This is a convenience wrapper around the use of `check-write`, + /// `subscribe`, `write`, and `flush`, and is implemented with the + /// following pseudo-code: + /// + /// ```text + /// let pollable = this.subscribe(); + /// while !contents.is_empty() { + /// // Wait for the stream to become writable + /// pollable.block(); + /// let Ok(n) = this.check-write(); // eliding error handling + /// let len = min(n, contents.len()); + /// let (chunk, rest) = contents.split_at(len); + /// this.write(chunk ); // eliding error handling + /// contents = rest; + /// } + /// this.flush(); + /// // Wait for completion of `flush` + /// pollable.block(); + /// // Check for any errors that arose during `flush` + /// let _ = this.check-write(); // eliding error handling + /// ``` + blocking-write-and-flush: func(contents: list) -> result<_, stream-error>; + /// Request to flush buffered output. This function never blocks. + /// + /// This tells the output-stream that the caller intends any buffered + /// output to be flushed. the output which is expected to be flushed + /// is all that has been passed to `write` prior to this call. + /// + /// Upon calling this function, the `output-stream` will not accept any + /// writes (`check-write` will return `ok(0)`) until the flush has + /// completed. The `subscribe` pollable will become ready when the + /// flush has completed and the stream can accept more writes. + flush: func() -> result<_, stream-error>; + /// Request to flush buffered output, and block until flush completes + /// and stream is ready for writing again. + blocking-flush: func() -> result<_, stream-error>; + /// Create a `pollable` which will resolve once the output-stream + /// is ready for more writing, or an error has occured. When this + /// pollable is ready, `check-write` will return `ok(n)` with n>0, or an + /// error. + /// + /// If the stream is closed, this pollable is always ready immediately. + /// + /// The created `pollable` is a child resource of the `output-stream`. + /// Implementations may trap if the `output-stream` is dropped before + /// all derived `pollable`s created with this function are dropped. + subscribe: func() -> pollable; + /// Write zeroes to a stream. + /// + /// This should be used precisely like `write` with the exact same + /// preconditions (must use check-write first), but instead of + /// passing a list of bytes, you simply pass the number of zero-bytes + /// that should be written. + write-zeroes: func(len: u64) -> result<_, stream-error>; + /// Perform a write of up to 4096 zeroes, and then flush the stream. + /// Block until all of these operations are complete, or an error + /// occurs. + /// + /// This is a convenience wrapper around the use of `check-write`, + /// `subscribe`, `write-zeroes`, and `flush`, and is implemented with + /// the following pseudo-code: + /// + /// ```text + /// let pollable = this.subscribe(); + /// while num_zeroes != 0 { + /// // Wait for the stream to become writable + /// pollable.block(); + /// let Ok(n) = this.check-write(); // eliding error handling + /// let len = min(n, num_zeroes); + /// this.write-zeroes(len); // eliding error handling + /// num_zeroes -= len; + /// } + /// this.flush(); + /// // Wait for completion of `flush` + /// pollable.block(); + /// // Check for any errors that arose during `flush` + /// let _ = this.check-write(); // eliding error handling + /// ``` + blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>; + /// Read from one stream and write to another. + /// + /// The behavior of splice is equivelant to: + /// 1. calling `check-write` on the `output-stream` + /// 2. calling `read` on the `input-stream` with the smaller of the + /// `check-write` permitted length and the `len` provided to `splice` + /// 3. calling `write` on the `output-stream` with that read data. + /// + /// Any error reported by the call to `check-write`, `read`, or + /// `write` ends the splice and reports that error. + /// + /// This function returns the number of bytes transferred; it may be less + /// than `len`. + splice: func(src: borrow, len: u64) -> result; + /// Read from one stream and write to another, with blocking. + /// + /// This is similar to `splice`, except that it blocks until the + /// `output-stream` is ready for writing, and the `input-stream` + /// is ready for reading, before performing the `splice`. + blocking-splice: func(src: borrow, len: u64) -> result; + } +} + +world imports { + import error; + import poll; + import streams; +} diff --git a/wit-aggregator/deps/wasi-keyvalue-0.2.0-draft2/package.wit b/wit-aggregator/deps/wasi-keyvalue-0.2.0-draft2/package.wit new file mode 100644 index 00000000..bd613ff4 --- /dev/null +++ b/wit-aggregator/deps/wasi-keyvalue-0.2.0-draft2/package.wit @@ -0,0 +1,264 @@ +package wasi:keyvalue@0.2.0-draft2; + +/// A keyvalue interface that provides eventually consistent key-value operations. +/// +/// Each of these operations acts on a single key-value pair. +/// +/// The value in the key-value pair is defined as a `u8` byte array and the intention is that it is +/// the common denominator for all data types defined by different key-value stores to handle data, +/// ensuring compatibility between different key-value stores. Note: the clients will be expecting +/// serialization/deserialization overhead to be handled by the key-value store. The value could be +/// a serialized object from JSON, HTML or vendor-specific data types like AWS S3 objects. +/// +/// Data consistency in a key value store refers to the guarantee that once a write operation +/// completes, all subsequent read operations will return the value that was written. +/// +/// Any implementation of this interface must have enough consistency to guarantee "reading your +/// writes." In particular, this means that the client should never get a value that is older than +/// the one it wrote, but it MAY get a newer value if one was written around the same time. These +/// guarantees only apply to the same client (which will likely be provided by the host or an +/// external capability of some kind). In this context a "client" is referring to the caller or +/// guest that is consuming this interface. Once a write request is committed by a specific client, +/// all subsequent read requests by the same client will reflect that write or any subsequent +/// writes. Another client running in a different context may or may not immediately see the result +/// due to the replication lag. As an example of all of this, if a value at a given key is A, and +/// the client writes B, then immediately reads, it should get B. If something else writes C in +/// quick succession, then the client may get C. However, a client running in a separate context may +/// still see A or B +interface store { + /// The set of errors which may be raised by functions in this package + variant error { + /// The host does not recognize the store identifier requested. + no-such-store, + /// The requesting component does not have access to the specified store + /// (which may or may not exist). + access-denied, + /// Some implementation-specific error has occurred (e.g. I/O) + other(string), + } + + /// A response to a `list-keys` operation. + record key-response { + /// The list of keys returned by the query. + keys: list, + /// The continuation token to use to fetch the next page of keys. If this is `null`, then + /// there are no more keys to fetch. + cursor: option, + } + + /// A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the + /// bucket, and the bucket itself acts as a collection of all these entries. + /// + /// It is worth noting that the exact terminology for bucket in key-value stores can very + /// depending on the specific implementation. For example: + /// + /// 1. Amazon DynamoDB calls a collection of key-value pairs a table + /// 2. Redis has hashes, sets, and sorted sets as different types of collections + /// 3. Cassandra calls a collection of key-value pairs a column family + /// 4. MongoDB calls a collection of key-value pairs a collection + /// 5. Riak calls a collection of key-value pairs a bucket + /// 6. Memcached calls a collection of key-value pairs a slab + /// 7. Azure Cosmos DB calls a collection of key-value pairs a container + /// + /// In this interface, we use the term `bucket` to refer to a collection of key-value pairs + resource bucket { + /// Get the value associated with the specified `key` + /// + /// The value is returned as an option. If the key-value pair exists in the + /// store, it returns `Ok(value)`. If the key does not exist in the + /// store, it returns `Ok(none)`. + /// + /// If any other error occurs, it returns an `Err(error)`. + get: func(key: string) -> result>, error>; + /// Set the value associated with the key in the store. If the key already + /// exists in the store, it overwrites the value. + /// + /// If the key does not exist in the store, it creates a new key-value pair. + /// + /// If any other error occurs, it returns an `Err(error)`. + set: func(key: string, value: list) -> result<_, error>; + /// Delete the key-value pair associated with the key in the store. + /// + /// If the key does not exist in the store, it does nothing. + /// + /// If any other error occurs, it returns an `Err(error)`. + delete: func(key: string) -> result<_, error>; + /// Check if the key exists in the store. + /// + /// If the key exists in the store, it returns `Ok(true)`. If the key does + /// not exist in the store, it returns `Ok(false)`. + /// + /// If any other error occurs, it returns an `Err(error)`. + exists: func(key: string) -> result; + /// Get all the keys in the store with an optional cursor (for use in pagination). It + /// returns a list of keys. Please note that for most KeyValue implementations, this is a + /// can be a very expensive operation and so it should be used judiciously. Implementations + /// can return any number of keys in a single response, but they should never attempt to + /// send more data than is reasonable (i.e. on a small edge device, this may only be a few + /// KB, while on a large machine this could be several MB). Any response should also return + /// a cursor that can be used to fetch the next page of keys. See the `key-response` record + /// for more information. + /// + /// Note that the keys are not guaranteed to be returned in any particular order. + /// + /// If the store is empty, it returns an empty list. + /// + /// MAY show an out-of-date list of keys if there are concurrent writes to the store. + /// + /// If any error occurs, it returns an `Err(error)`. + list-keys: func(cursor: option) -> result; + } + + /// Get the bucket with the specified identifier. + /// + /// `identifier` must refer to a bucket provided by the host. + /// + /// `error::no-such-store` will be raised if the `identifier` is not recognized. + open: func(identifier: string) -> result; +} + +/// A keyvalue interface that provides atomic operations. +/// +/// Atomic operations are single, indivisible operations. When a fault causes an atomic operation to +/// fail, it will appear to the invoker of the atomic operation that the action either completed +/// successfully or did nothing at all. +/// +/// Please note that this interface is bare functions that take a reference to a bucket. This is to +/// get around the current lack of a way to "extend" a resource with additional methods inside of +/// wit. Future version of the interface will instead extend these methods on the base `bucket` +/// resource. +interface atomics { + use store.{bucket, error}; + + /// A handle to a CAS (compare-and-swap) operation. + resource cas { + /// Construct a new CAS operation. Implementors can map the underlying functionality + /// (transactions, versions, etc) as desired. + new: static func(bucket: borrow, key: string) -> result; + /// Get the current value of the key (if it exists). This allows for avoiding reads if all + /// that is needed to ensure the atomicity of the operation + current: func() -> result>, error>; + } + + /// The error returned by a CAS operation + variant cas-error { + /// A store error occurred when performing the operation + store-error(error), + /// The CAS operation failed because the value was too old. This returns a new CAS handle + /// for easy retries. Implementors MUST return a CAS handle that has been updated to the + /// latest version or transaction. + cas-failed(cas), + } + + /// Atomically increment the value associated with the key in the store by the given delta. It + /// returns the new value. + /// + /// If the key does not exist in the store, it creates a new key-value pair with the value set + /// to the given delta. + /// + /// If any other error occurs, it returns an `Err(error)`. + increment: func(bucket: borrow, key: string, delta: s64) -> result; + + /// Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if + /// the CAS operation failed. + swap: func(cas: cas, value: list) -> result<_, cas-error>; +} + +/// A keyvalue interface that provides batch operations. +/// +/// A batch operation is an operation that operates on multiple keys at once. +/// +/// Batch operations are useful for reducing network round-trip time. For example, if you want to +/// get the values associated with 100 keys, you can either do 100 get operations or you can do 1 +/// batch get operation. The batch operation is faster because it only needs to make 1 network call +/// instead of 100. +/// +/// A batch operation does not guarantee atomicity, meaning that if the batch operation fails, some +/// of the keys may have been modified and some may not. +/// +/// This interface does has the same consistency guarantees as the `store` interface, meaning that +/// you should be able to "read your writes." +/// +/// Please note that this interface is bare functions that take a reference to a bucket. This is to +/// get around the current lack of a way to "extend" a resource with additional methods inside of +/// wit. Future version of the interface will instead extend these methods on the base `bucket` +/// resource. +interface batch { + use store.{bucket, error}; + + /// Get the key-value pairs associated with the keys in the store. It returns a list of + /// key-value pairs. + /// + /// If any of the keys do not exist in the store, it returns a `none` value for that pair in the + /// list. + /// + /// MAY show an out-of-date value if there are concurrent writes to the store. + /// + /// If any other error occurs, it returns an `Err(error)`. + get-many: func(bucket: borrow, keys: list) -> result>>>, error>; + + /// Set the values associated with the keys in the store. If the key already exists in the + /// store, it overwrites the value. + /// + /// Note that the key-value pairs are not guaranteed to be set in the order they are provided. + /// + /// If any of the keys do not exist in the store, it creates a new key-value pair. + /// + /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not + /// rollback the key-value pairs that were already set. Thus, this batch operation does not + /// guarantee atomicity, implying that some key-value pairs could be set while others might + /// fail. + /// + /// Other concurrent operations may also be able to see the partial results. + set-many: func(bucket: borrow, key-values: list>>) -> result<_, error>; + + /// Delete the key-value pairs associated with the keys in the store. + /// + /// Note that the key-value pairs are not guaranteed to be deleted in the order they are + /// provided. + /// + /// If any of the keys do not exist in the store, it skips the key. + /// + /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not + /// rollback the key-value pairs that were already deleted. Thus, this batch operation does not + /// guarantee atomicity, implying that some key-value pairs could be deleted while others might + /// fail. + /// + /// Other concurrent operations may also be able to see the partial results. + delete-many: func(bucket: borrow, keys: list) -> result<_, error>; +} + +/// A keyvalue interface that provides watch operations. +/// +/// This interface is used to provide event-driven mechanisms to handle +/// keyvalue changes. +interface watcher { + use store.{bucket}; + + /// Handle the `set` event for the given bucket and key. It includes a reference to the `bucket` + /// that can be used to interact with the store. + on-set: func(bucket: bucket, key: string, value: list); + + /// Handle the `delete` event for the given bucket and key. It includes a reference to the + /// `bucket` that can be used to interact with the store. + on-delete: func(bucket: bucket, key: string); +} + +/// The `wasi:keyvalue/imports` world provides common APIs for interacting with key-value stores. +/// Components targeting this world will be able to do: +/// +/// 1. CRUD (create, read, update, delete) operations on key-value stores. +/// 2. Atomic `increment` and CAS (compare-and-swap) operations. +/// 3. Batch operations that can reduce the number of round trips to the network. +world imports { + import store; + import atomics; + import batch; +} +world watch-service { + import store; + import atomics; + import batch; + + export watcher; +} diff --git a/wit-aggregator/deps/wasi-random-0.2.0/package.wit b/wit-aggregator/deps/wasi-random-0.2.0/package.wit new file mode 100644 index 00000000..58c179e1 --- /dev/null +++ b/wit-aggregator/deps/wasi-random-0.2.0/package.wit @@ -0,0 +1,18 @@ +package wasi:random@0.2.0; + +interface random { + get-random-bytes: func(len: u64) -> list; + + get-random-u64: func() -> u64; +} + +interface insecure { + get-insecure-random-bytes: func(len: u64) -> list; + + get-insecure-random-u64: func() -> u64; +} + +interface insecure-seed { + insecure-seed: func() -> tuple; +} + diff --git a/wit-aggregator/deps/wasi-sockets-0.2.0/package.wit b/wit-aggregator/deps/wasi-sockets-0.2.0/package.wit new file mode 100644 index 00000000..d464864c --- /dev/null +++ b/wit-aggregator/deps/wasi-sockets-0.2.0/package.wit @@ -0,0 +1,833 @@ +package wasi:sockets@0.2.0; + +interface network { + /// An opaque resource that represents access to (a subset of) the network. + /// This enables context-based security for networking. + /// There is no need for this to map 1:1 to a physical network interface. + resource network; + + /// Error codes. + /// + /// In theory, every API can return any error code. + /// In practice, API's typically only return the errors documented per API + /// combined with a couple of errors that are always possible: + /// - `unknown` + /// - `access-denied` + /// - `not-supported` + /// - `out-of-memory` + /// - `concurrency-conflict` + /// + /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. + enum error-code { + /// Unknown error + unknown, + /// Access denied. + /// + /// POSIX equivalent: EACCES, EPERM + access-denied, + /// The operation is not supported. + /// + /// POSIX equivalent: EOPNOTSUPP + not-supported, + /// One of the arguments is invalid. + /// + /// POSIX equivalent: EINVAL + invalid-argument, + /// Not enough memory to complete the operation. + /// + /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY + out-of-memory, + /// The operation timed out before it could finish completely. + timeout, + /// This operation is incompatible with another asynchronous operation that is already in progress. + /// + /// POSIX equivalent: EALREADY + concurrency-conflict, + /// Trying to finish an asynchronous operation that: + /// - has not been started yet, or: + /// - was already finished by a previous `finish-*` call. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. + not-in-progress, + /// The operation has been aborted because it could not be completed immediately. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. + would-block, + /// The operation is not valid in the socket's current state. + invalid-state, + /// A new socket resource could not be created because of a system limit. + new-socket-limit, + /// A bind operation failed because the provided address is not an address that the `network` can bind to. + address-not-bindable, + /// A bind operation failed because the provided address is already in use or because there are no ephemeral ports available. + address-in-use, + /// The remote address is not reachable + remote-unreachable, + /// The TCP connection was forcefully rejected + connection-refused, + /// The TCP connection was reset. + connection-reset, + /// A TCP connection was aborted. + connection-aborted, + /// The size of a datagram sent to a UDP socket exceeded the maximum + /// supported size. + datagram-too-large, + /// Name does not exist or has no suitable associated IP addresses. + name-unresolvable, + /// A temporary failure in name resolution occurred. + temporary-resolver-failure, + /// A permanent failure in name resolution occurred. + permanent-resolver-failure, + } + + enum ip-address-family { + /// Similar to `AF_INET` in POSIX. + ipv4, + /// Similar to `AF_INET6` in POSIX. + ipv6, + } + + type ipv4-address = tuple; + + type ipv6-address = tuple; + + variant ip-address { + ipv4(ipv4-address), + ipv6(ipv6-address), + } + + record ipv4-socket-address { + /// sin_port + port: u16, + /// sin_addr + address: ipv4-address, + } + + record ipv6-socket-address { + /// sin6_port + port: u16, + /// sin6_flowinfo + flow-info: u32, + /// sin6_addr + address: ipv6-address, + /// sin6_scope_id + scope-id: u32, + } + + variant ip-socket-address { + ipv4(ipv4-socket-address), + ipv6(ipv6-socket-address), + } +} + +/// This interface provides a value-export of the default network handle.. +interface instance-network { + use network.{network}; + + /// Get a handle to the default network. + instance-network: func() -> network; +} + +interface ip-name-lookup { + use wasi:io/poll@0.2.0.{pollable}; + use network.{network, error-code, ip-address}; + + resource resolve-address-stream { + /// Returns the next address from the resolver. + /// + /// This function should be called multiple times. On each call, it will + /// return the next address in connection order preference. If all + /// addresses have been exhausted, this function returns `none`. + /// + /// This function never returns IPv4-mapped IPv6 addresses. + /// + /// # Typical errors + /// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY) + /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) + /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) + /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) + resolve-next-address: func() -> result, error-code>; + /// Create a `pollable` which will resolve once the stream is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } + + /// Resolve an internet host name to a list of IP addresses. + /// + /// Unicode domain names are automatically converted to ASCII using IDNA encoding. + /// If the input is an IP address string, the address is parsed and returned + /// as-is without making any external requests. + /// + /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. + /// + /// This function never blocks. It either immediately fails or immediately + /// returns successfully with a `resolve-address-stream` that can be used + /// to (asynchronously) fetch the results. + /// + /// # Typical errors + /// - `invalid-argument`: `name` is a syntactically invalid domain name or IP address. + /// + /// # References: + /// - + /// - + /// - + /// - + resolve-addresses: func(network: borrow, name: string) -> result; +} + +interface tcp { + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + use wasi:io/poll@0.2.0.{pollable}; + use wasi:clocks/monotonic-clock@0.2.0.{duration}; + use network.{network, error-code, ip-socket-address, ip-address-family}; + + enum shutdown-type { + /// Similar to `SHUT_RD` in POSIX. + receive, + /// Similar to `SHUT_WR` in POSIX. + send, + /// Similar to `SHUT_RDWR` in POSIX. + both, + } + + /// A TCP socket resource. + /// + /// The socket can be in one of the following states: + /// - `unbound` + /// - `bind-in-progress` + /// - `bound` (See note below) + /// - `listen-in-progress` + /// - `listening` + /// - `connect-in-progress` + /// - `connected` + /// - `closed` + /// See + /// for a more information. + /// + /// Note: Except where explicitly mentioned, whenever this documentation uses + /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. + /// (i.e. `bound`, `listen-in-progress`, `listening`, `connect-in-progress` or `connected`) + /// + /// In addition to the general error codes documented on the + /// `network::error-code` type, TCP socket methods may always return + /// `error(invalid-state)` when in the `closed` state. + resource tcp-socket { + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the TCP/UDP port is zero, the socket will be bound to a random free port. + /// + /// Bind can be attempted multiple times on the same socket, even with + /// different arguments on each iteration. But never concurrently and + /// only as long as the previous bind failed. Once a bind succeeds, the + /// binding can't be changed anymore. + /// + /// # Typical errors + /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) + /// - `invalid-argument`: `local-address` is not a unicast address. (EINVAL) + /// - `invalid-argument`: `local-address` is an IPv4-mapped IPv6 address. (EINVAL) + /// - `invalid-state`: The socket is already bound. (EINVAL) + /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT + /// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR + /// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior + /// and SO_REUSEADDR performs something different entirely. + /// + /// Unlike in POSIX, in WASI the bind operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `bind` as part of either `start-bind` or `finish-bind`. + /// + /// # References + /// - + /// - + /// - + /// - + start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; + finish-bind: func() -> result<_, error-code>; + /// Connect to a remote endpoint. + /// + /// On success: + /// - the socket is transitioned into the `connection` state. + /// - a pair of streams is returned that can be used to read & write to the connection + /// + /// After a failed connection attempt, the socket will be in the `closed` + /// state and the only valid action left is to `drop` the socket. A single + /// socket can not be used to connect more than once. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS) + /// - `invalid-argument`: `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows) + /// - `invalid-argument`: The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`. + /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN) + /// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) + /// - `timeout`: Connection timed out. (ETIMEDOUT) + /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) + /// - `connection-reset`: The connection was reset. (ECONNRESET) + /// - `connection-aborted`: The connection was aborted. (ECONNABORTED) + /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `not-in-progress`: A connect operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// The POSIX equivalent of `start-connect` is the regular `connect` syscall. + /// Because all WASI sockets are non-blocking this is expected to return + /// EINPROGRESS, which should be translated to `ok()` in WASI. + /// + /// The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT` + /// with a timeout of 0 on the socket descriptor. Followed by a check for + /// the `SO_ERROR` socket option, in case the poll signaled readiness. + /// + /// # References + /// - + /// - + /// - + /// - + start-connect: func(network: borrow, remote-address: ip-socket-address) -> result<_, error-code>; + finish-connect: func() -> result, error-code>; + /// Start listening for new connections. + /// + /// Transitions the socket into the `listening` state. + /// + /// Unlike POSIX, the socket must already be explicitly bound. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. (EDESTADDRREQ) + /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) + /// - `invalid-state`: The socket is already in the `listening` state. + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) + /// - `not-in-progress`: A listen operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// Unlike in POSIX, in WASI the listen operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `listen` as part of either `start-listen` or `finish-listen`. + /// + /// # References + /// - + /// - + /// - + /// - + start-listen: func() -> result<_, error-code>; + finish-listen: func() -> result<_, error-code>; + /// Accept a new client socket. + /// + /// The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket: + /// - `address-family` + /// - `keep-alive-enabled` + /// - `keep-alive-idle-time` + /// - `keep-alive-interval` + /// - `keep-alive-count` + /// - `hop-limit` + /// - `receive-buffer-size` + /// - `send-buffer-size` + /// + /// On success, this function returns the newly accepted client socket along with + /// a pair of streams that can be used to read & write to the connection. + /// + /// # Typical errors + /// - `invalid-state`: Socket is not in the `listening` state. (EINVAL) + /// - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) + /// - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + accept: func() -> result, error-code>; + /// Get the bound local address. + /// + /// POSIX mentions: + /// > If the socket has not been bound to a local name, the value + /// > stored in the object pointed to by `address` is unspecified. + /// + /// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - + local-address: func() -> result; + /// Get the remote address. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + remote-address: func() -> result; + /// Whether the socket is in the `listening` state. + /// + /// Equivalent to the SO_ACCEPTCONN socket option. + is-listening: func() -> bool; + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. + address-family: func() -> ip-address-family; + /// Hints the desired listen queue size. Implementations are free to ignore this. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// + /// # Typical errors + /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. + /// - `invalid-argument`: (set) The provided value was 0. + /// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state. + set-listen-backlog-size: func(value: u64) -> result<_, error-code>; + /// Enables or disables keepalive. + /// + /// The keepalive behavior can be adjusted using: + /// - `keep-alive-idle-time` + /// - `keep-alive-interval` + /// - `keep-alive-count` + /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. + /// + /// Equivalent to the SO_KEEPALIVE socket option. + keep-alive-enabled: func() -> result; + set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; + /// Amount of time the connection has to be idle before TCP starts sending keepalive packets. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + keep-alive-idle-time: func() -> result; + set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; + /// The time between keepalive packets. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPINTVL socket option. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + keep-alive-interval: func() -> result; + set-keep-alive-interval: func(value: duration) -> result<_, error-code>; + /// The maximum amount of keepalive packets TCP should send before aborting the connection. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPCNT socket option. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + keep-alive-count: func() -> result; + set-keep-alive-count: func(value: u32) -> result<_, error-code>; + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + hop-limit: func() -> result; + set-hop-limit: func(value: u8) -> result<_, error-code>; + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + receive-buffer-size: func() -> result; + set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + send-buffer-size: func() -> result; + set-send-buffer-size: func(value: u64) -> result<_, error-code>; + /// Create a `pollable` which can be used to poll for, or block on, + /// completion of any of the asynchronous operations of this socket. + /// + /// When `finish-bind`, `finish-listen`, `finish-connect` or `accept` + /// return `error(would-block)`, this pollable can be used to wait for + /// their success or failure, after which the method can be retried. + /// + /// The pollable is not limited to the async operation that happens to be + /// in progress at the time of calling `subscribe` (if any). Theoretically, + /// `subscribe` only has to be called once per socket and can then be + /// (re)used for the remainder of the socket's lifetime. + /// + /// See + /// for a more information. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + /// Initiate a graceful shutdown. + /// + /// - `receive`: The socket is not expecting to receive any data from + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. + /// - `send`: The socket has no more data to send to the peer. The `output-stream` + /// associated with this socket will be closed and a FIN packet will be sent. + /// - `both`: Same effect as `receive` & `send` combined. + /// + /// This function is idempotent. Shutting a down a direction more than once + /// has no effect and returns `ok`. + /// + /// The shutdown function does not close (drop) the socket. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>; + } +} + +interface tcp-create-socket { + use network.{network, error-code, ip-address-family}; + use tcp.{tcp-socket}; + + /// Create a new TCP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. + /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect` + /// is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + create-tcp-socket: func(address-family: ip-address-family) -> result; +} + +interface udp { + use wasi:io/poll@0.2.0.{pollable}; + use network.{network, error-code, ip-socket-address, ip-address-family}; + + /// A received datagram. + record incoming-datagram { + /// The payload. + /// + /// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes. + data: list, + /// The source address. + /// + /// This field is guaranteed to match the remote address the stream was initialized with, if any. + /// + /// Equivalent to the `src_addr` out parameter of `recvfrom`. + remote-address: ip-socket-address, + } + + /// A datagram to be sent out. + record outgoing-datagram { + /// The payload. + data: list, + /// The destination address. + /// + /// The requirements on this field depend on how the stream was initialized: + /// - with a remote address: this field must be None or match the stream's remote address exactly. + /// - without a remote address: this field is required. + /// + /// If this value is None, the send operation is equivalent to `send` in POSIX. Otherwise it is equivalent to `sendto`. + remote-address: option, + } + + /// A UDP socket handle. + resource udp-socket { + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the port is zero, the socket will be bound to a random free port. + /// + /// # Typical errors + /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) + /// - `invalid-state`: The socket is already bound. (EINVAL) + /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// Unlike in POSIX, in WASI the bind operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `bind` as part of either `start-bind` or `finish-bind`. + /// + /// # References + /// - + /// - + /// - + /// - + start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; + finish-bind: func() -> result<_, error-code>; + /// Set up inbound & outbound communication channels, optionally to a specific peer. + /// + /// This function only changes the local socket configuration and does not generate any network traffic. + /// On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well, + /// based on the best network path to `remote-address`. + /// + /// When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer: + /// - `send` can only be used to send to this destination. + /// - `receive` will only return datagrams sent from the provided `remote-address`. + /// + /// This method may be called multiple times on the same socket to change its association, but + /// only the most recently returned pair of streams will be operational. Implementations may trap if + /// the streams returned by a previous invocation haven't been dropped yet before calling `stream` again. + /// + /// The POSIX equivalent in pseudo-code is: + /// ```text + /// if (was previously connected) { + /// connect(s, AF_UNSPEC) + /// } + /// if (remote_address is Some) { + /// connect(s, remote_address) + /// } + /// ``` + /// + /// Unlike in POSIX, the socket must already be explicitly bound. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-state`: The socket is not bound. + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// + /// # References + /// - + /// - + /// - + /// - + %stream: func(remote-address: option) -> result, error-code>; + /// Get the current bound address. + /// + /// POSIX mentions: + /// > If the socket has not been bound to a local name, the value + /// > stored in the object pointed to by `address` is unspecified. + /// + /// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - + local-address: func() -> result; + /// Get the address the socket is currently streaming to. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + remote-address: func() -> result; + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. + address-family: func() -> ip-address-family; + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + unicast-hop-limit: func() -> result; + set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + receive-buffer-size: func() -> result; + set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + send-buffer-size: func() -> result; + set-send-buffer-size: func(value: u64) -> result<_, error-code>; + /// Create a `pollable` which will resolve once the socket is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } + + resource incoming-datagram-stream { + /// Receive messages on the socket. + /// + /// This function attempts to receive up to `max-results` datagrams on the socket without blocking. + /// The returned list may contain fewer elements than requested, but never more. + /// + /// This function returns successfully with an empty list when either: + /// - `max-results` is 0, or: + /// - `max-results` is greater than 0, but no results are immediately available. + /// This function never returns `error(would-block)`. + /// + /// # Typical errors + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + /// - + receive: func(max-results: u64) -> result, error-code>; + /// Create a `pollable` which will resolve once the stream is ready to receive again. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } + + resource outgoing-datagram-stream { + /// Check readiness for sending. This function never blocks. + /// + /// Returns the number of datagrams permitted for the next call to `send`, + /// or an error. Calling `send` with more datagrams than this function has + /// permitted will trap. + /// + /// When this function returns ok(0), the `subscribe` pollable will + /// become ready when this function will report at least ok(1), or an + /// error. + /// + /// Never returns `would-block`. + check-send: func() -> result; + /// Send messages on the socket. + /// + /// This function attempts to send all provided `datagrams` on the socket without blocking and + /// returns how many messages were actually sent (or queued for sending). This function never + /// returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned. + /// + /// This function semantically behaves the same as iterating the `datagrams` list and sequentially + /// sending each individual datagram until either the end of the list has been reached or the first error occurred. + /// If at least one datagram has been sent successfully, this function never returns an error. + /// + /// If the input list is empty, the function returns `ok(0)`. + /// + /// Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if + /// either `check-send` was not called or `datagrams` contains more items than `check-send` permitted. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN) + /// - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + /// - + send: func(datagrams: list) -> result; + /// Create a `pollable` which will resolve once the stream is ready to send again. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } +} + +interface udp-create-socket { + use network.{network, error-code, ip-address-family}; + use udp.{udp-socket}; + + /// Create a new UDP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. + /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called, + /// the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References: + /// - + /// - + /// - + /// - + create-udp-socket: func(address-family: ip-address-family) -> result; +} + +world imports { + import network; + import instance-network; + import wasi:io/poll@0.2.0; + import udp; + import udp-create-socket; + import wasi:io/error@0.2.0; + import wasi:io/streams@0.2.0; + import wasi:clocks/monotonic-clock@0.2.0; + import tcp; + import tcp-create-socket; + import ip-name-lookup; +} diff --git a/wit-aggregator/deps/wasi-tls-0.2.0-draft/package.wit b/wit-aggregator/deps/wasi-tls-0.2.0-draft/package.wit new file mode 100644 index 00000000..b83efe83 --- /dev/null +++ b/wit-aggregator/deps/wasi-tls-0.2.0-draft/package.wit @@ -0,0 +1,45 @@ +package wasi:tls@0.2.0-draft; + +@unstable(feature = tls) +interface types { + @unstable(feature = tls) + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + @unstable(feature = tls) + use wasi:io/poll@0.2.0.{pollable}; + @unstable(feature = tls) + use wasi:io/error@0.2.0.{error as io-error}; + + @unstable(feature = tls) + resource client-handshake { + @unstable(feature = tls) + constructor(server-name: string, input: input-stream, output: output-stream); + @unstable(feature = tls) + finish: static func(this: client-handshake) -> future-client-streams; + } + + @unstable(feature = tls) + resource client-connection { + @unstable(feature = tls) + close-output: func(); + } + + @unstable(feature = tls) + resource future-client-streams { + @unstable(feature = tls) + subscribe: func() -> pollable; + @unstable(feature = tls) + get: func() -> option, io-error>>>; + } +} + +@unstable(feature = tls) +world imports { + @unstable(feature = tls) + import wasi:io/error@0.2.0; + @unstable(feature = tls) + import wasi:io/poll@0.2.0; + @unstable(feature = tls) + import wasi:io/streams@0.2.0; + @unstable(feature = tls) + import types; +} diff --git a/wit-aggregator/deps/wavs-operator-2.7.0/operator.wit b/wit-aggregator/deps/wavs-operator-2.7.0/operator.wit new file mode 100644 index 00000000..b2a46b98 --- /dev/null +++ b/wit-aggregator/deps/wavs-operator-2.7.0/operator.wit @@ -0,0 +1,87 @@ +package wavs:operator@2.7.0; + +use wavs:types/core@2.7.0 as core-types; +use wavs:types/service@2.7.0 as service-types; +use wavs:types/chain@2.7.0 as chain-types; +use wavs:types/events@2.7.0 as event-types; + +interface input { + use service-types.{service-id, workflow-id, trigger}; + use event-types.{trigger-data}; + + record trigger-action { + config: trigger-config, + data: trigger-data + } + + record trigger-config { + service-id: service-id, + workflow-id: workflow-id, + trigger: trigger + } +} + +interface output { + use event-types.{event-id}; + + record wasm-response { + // arbitrary payload returned from the component + // and passed on to be signed by the operators + payload: list, + // currently unused + ordering: option, + // if not supplied, this will be `trigger-data` + // if supplied, make sure this is unique for every response! + // for example, using a "message id" from a third-party service + // also, it MUST be supplied if multiple responses are returned + event-id-salt: option> + } +} + +world wavs-world { + // include needed for golang support + include wasi:cli/imports@0.2.0; + + // wasi:http 0.2.6 uses the `imports` style, but for now import each interface separately + import wasi:http/types@0.2.0; + import wasi:http/outgoing-handler@0.2.0; + + // for key-value store support + include wasi:keyvalue/imports@0.2.0-draft2; + + // for raw socket support + include wasi:sockets/imports@0.2.0; + + // for tls support + include wasi:tls/imports@0.2.0-draft; + + import host: interface { + use chain-types.{evm-chain-config, cosmos-chain-config}; + use service-types.{service-and-workflow-id, workflow-and-workflow-id}; + use core-types.{log-level}; + use event-types.{event-id}; + + get-evm-chain-config: func(chain-key: string) -> option; + get-cosmos-chain-config: func(chain-key: string) -> option; + + config-var: func(key: string) -> option; + + log: func(level: log-level, message: string); + + // gets the service and workflow id that called this component + get-service: func() -> service-and-workflow-id; + + // convenience function to get the workflow without having to walk service.workflows + get-workflow: func() -> workflow-and-workflow-id; + + // convenience function to get what the event id will be + // typically only used for debugging or testing purposes + get-event-id: func(salt: option>) -> event-id; + } + + use input.{trigger-action}; + use output.{wasm-response}; + + // if returning multiple responses, they must all have an event-id-salt + export run: func(trigger-action: trigger-action) -> result, string>; +} diff --git a/wit-aggregator/deps/wavs-types-2.7.0/chain.wit b/wit-aggregator/deps/wavs-types-2.7.0/chain.wit new file mode 100644 index 00000000..de082754 --- /dev/null +++ b/wit-aggregator/deps/wavs-types-2.7.0/chain.wit @@ -0,0 +1,63 @@ +interface chain { + // A string mostly following the caip-2 format of namespace:reference, e.g. "eip155:1" for Ethereum mainnet or "cosmos:cosmoshub-4" for Cosmos Hub + // however, we allow up to 32 characters for the "namespace" part, and we call the "reference" part "chain-id" to confirm with popular usage + type chain-key = string; + type evm-tx-hash = list; // 32 bytes, a keccak hash of an RLP encoded signed transaction + type cosmos-tx-hash = string; + + variant any-tx-hash { + evm(evm-tx-hash), + cosmos(cosmos-tx-hash), + } + + record cosmos-address { + bech32-addr: string, + // prefix is the first part of the bech32 address + prefix-len: u32 + } + + record cosmos-event { + ty: string, + attributes: list>, + } + + record cosmos-chain-config { + chain-id: string, + rpc-endpoint: option, + grpc-endpoint: option, + grpc-web-endpoint: option, + gas-price: f32, + gas-denom: string, + bech32-prefix: string, + } + + record evm-address { + raw-bytes: list + } + + // The overall idea is to map alloy_rpc_types_eth::Log + record evm-event-log { + // These two fields are essentially alloy_primitives::Log + address: evm-address, + data: evm-event-log-data, + tx-hash: evm-tx-hash, + block-number: u64, + log-index: u64, + block-hash: list, // 256 bytes + block-timestamp: option, + tx-index: u64 + } + + record evm-event-log-data { + // the raw log topics that can be decoded into an event + topics: list>, + // the raw log data that can be decoded into an event + data: list, + } + + record evm-chain-config { + chain-id: string, + ws-endpoints: list, + http-endpoint: option, + } +} diff --git a/wit-aggregator/deps/wavs-types-2.7.0/core.wit b/wit-aggregator/deps/wavs-types-2.7.0/core.wit new file mode 100644 index 00000000..49d419d3 --- /dev/null +++ b/wit-aggregator/deps/wavs-types-2.7.0/core.wit @@ -0,0 +1,27 @@ +interface core { + type digest = string; + + record timestamp { + nanos: u64 + } + + record duration { + secs: u64 + } + /// 128-bit unsigned integer represented as two 64-bit values. + /// + /// The tuple is stored in little-endian order: + /// - First element (index 0): Lower 64 bits (bits 0-63) + /// - Second element (index 1): Upper 64 bits (bits 64-127) + record u128 { + value: tuple, + } + + variant log-level { + error, + warn, + info, + debug, + trace + } +} diff --git a/wit-aggregator/deps/wavs-types-2.7.0/events.wit b/wit-aggregator/deps/wavs-types-2.7.0/events.wit new file mode 100644 index 00000000..38f8f694 --- /dev/null +++ b/wit-aggregator/deps/wavs-types-2.7.0/events.wit @@ -0,0 +1,57 @@ +interface events { + use chain.{chain-key, evm-address, evm-event-log, cosmos-address, cosmos-event}; + use core.{timestamp}; + type event-id = list; // 20-byte unique hash + + + variant trigger-data { + evm-contract-event(trigger-data-evm-contract-event), + cosmos-contract-event(trigger-data-cosmos-contract-event), + block-interval(trigger-data-block-interval), + cron(trigger-data-cron), + atproto-event(trigger-data-atproto-event), + hypercore-append(trigger-data-hypercore-append), + raw(list) + } + + record trigger-data-evm-contract-event { + chain: chain-key, + log: evm-event-log, + } + + record trigger-data-cosmos-contract-event { + contract-address: cosmos-address, + chain: chain-key, + event: cosmos-event, + event-index: u64, + block-height: u64 + } + + record trigger-data-block-interval { + chain: chain-key, + block-height: u64 + } + + record trigger-data-cron { + trigger-time: timestamp + } + + record trigger-data-atproto-event { + sequence: s64, + timestamp: s64, + repo: string, + collection: string, + rkey: string, + action: string, + cid: option, + record-data: option, + rev: option, + op-index: option + } + + record trigger-data-hypercore-append { + feed-key: string, + index: u64, + data: list + } +} diff --git a/wit-aggregator/deps/wavs-types-2.7.0/lib.wit b/wit-aggregator/deps/wavs-types-2.7.0/lib.wit new file mode 100644 index 00000000..12c03432 --- /dev/null +++ b/wit-aggregator/deps/wavs-types-2.7.0/lib.wit @@ -0,0 +1 @@ +package wavs:types@2.7.0; diff --git a/wit-aggregator/deps/wavs-types-2.7.0/service.wit b/wit-aggregator/deps/wavs-types-2.7.0/service.wit new file mode 100644 index 00000000..45df3170 --- /dev/null +++ b/wit-aggregator/deps/wavs-types-2.7.0/service.wit @@ -0,0 +1,171 @@ +interface service { + // Basic types + type service-id = string; + type workflow-id = string; + type package-ref = string; + type semver-version = string; + + use core.{digest, timestamp}; + use chain.{chain-key, evm-address, cosmos-address}; + + // Service types + record service { + name: string, + workflows: list>, + status: service-status, + manager: service-manager, + } + + variant service-status { + active, + paused, + } + + variant service-manager { + evm(evm-manager), + cosmos(cosmos-manager), + } + + record evm-manager { + chain: chain-key, + address: evm-address, + } + + record cosmos-manager { + chain: chain-key, + address: cosmos-address, + } + + + // Workflow types + record workflow { + trigger: trigger, + component: component, + submit: submit, + } + + // Component types + record component { + source: component-source, + permissions: permissions, + fuel-limit: option, + time-limit-seconds: option, + config: list>, + env-keys: list, + } + + variant component-source { + download(component-source-download), + registry(registry), + digest(digest), + } + + record component-source-download { + uri: string, + digest: digest, + } + + record registry { + digest: digest, + domain: option, + version: option, + pkg: package-ref, + } + + // Permissions types + record permissions { + allowed-http-hosts: allowed-host-permission, + file-system: bool, + raw-sockets: bool, + dns-resolution: bool + } + + variant allowed-host-permission { + all, + only(list), + none, + } + + // Trigger types + variant trigger { + evm-contract-event(trigger-evm-contract-event), + cosmos-contract-event(trigger-cosmos-contract-event), + block-interval(trigger-block-interval), + cron(trigger-cron), + atproto-event(trigger-atproto-event), + hypercore-append(trigger-hypercore-append), + manual + } + + record trigger-evm-contract-event { + address: evm-address, + chain: chain-key, + event-hash: list + } + + record trigger-cosmos-contract-event { + address: cosmos-address, + chain: chain-key, + event-type: string + } + + record trigger-block-interval { + chain: chain-key, + n-blocks: u32, + start-block: option, + end-block: option + } + + record trigger-cron { + schedule: string, + start-time: option, + end-time: option + } + + record trigger-atproto-event { + collection: string, + repo-did: option, + action: option + } + + record trigger-hypercore-append { + feed-key: string + } + + + // Submit types + variant submit { + none, + aggregator(aggregator-submit), + } + + record aggregator-submit { + component: component, + signature-kind: signature-kind + } + + record signature-kind { + algorithm: signature-algorithm, + prefix: option, + } + + variant signature-algorithm { + secp256k1, + // Future: Bls12381, Ed25519, Secp256r1, etc. + } + + variant signature-prefix { + eip191 + } + + // Aggregator types + record service-and-workflow-id { + service: service, + workflow-id: workflow-id + } + + record workflow-and-workflow-id { + workflow: workflow, + workflow-id: workflow-id + } +} diff --git a/wit/deps/wasi-cli-0.2.0/package.wit b/wit/deps/wasi-cli-0.2.0/package.wit new file mode 100644 index 00000000..0a2737b7 --- /dev/null +++ b/wit/deps/wasi-cli-0.2.0/package.wit @@ -0,0 +1,159 @@ +package wasi:cli@0.2.0; + +interface environment { + /// Get the POSIX-style environment variables. + /// + /// Each environment variable is provided as a pair of string variable names + /// and string value. + /// + /// Morally, these are a value import, but until value imports are available + /// in the component model, this import function should return the same + /// values each time it is called. + get-environment: func() -> list>; + + /// Get the POSIX-style arguments to the program. + get-arguments: func() -> list; + + /// Return a path that programs should use as their initial current working + /// directory, interpreting `.` as shorthand for this. + initial-cwd: func() -> option; +} + +interface exit { + /// Exit the current instance and any linked instances. + exit: func(status: result); +} + +interface run { + /// Run the program. + run: func() -> result; +} + +interface stdin { + use wasi:io/streams@0.2.0.{input-stream}; + + get-stdin: func() -> input-stream; +} + +interface stdout { + use wasi:io/streams@0.2.0.{output-stream}; + + get-stdout: func() -> output-stream; +} + +interface stderr { + use wasi:io/streams@0.2.0.{output-stream}; + + get-stderr: func() -> output-stream; +} + +/// Terminal input. +/// +/// In the future, this may include functions for disabling echoing, +/// disabling input buffering so that keyboard events are sent through +/// immediately, querying supported features, and so on. +interface terminal-input { + /// The input side of a terminal. + resource terminal-input; +} + +/// Terminal output. +/// +/// In the future, this may include functions for querying the terminal +/// size, being notified of terminal size changes, querying supported +/// features, and so on. +interface terminal-output { + /// The output side of a terminal. + resource terminal-output; +} + +/// An interface providing an optional `terminal-input` for stdin as a +/// link-time authority. +interface terminal-stdin { + use terminal-input.{terminal-input}; + + /// If stdin is connected to a terminal, return a `terminal-input` handle + /// allowing further interaction with it. + get-terminal-stdin: func() -> option; +} + +/// An interface providing an optional `terminal-output` for stdout as a +/// link-time authority. +interface terminal-stdout { + use terminal-output.{terminal-output}; + + /// If stdout is connected to a terminal, return a `terminal-output` handle + /// allowing further interaction with it. + get-terminal-stdout: func() -> option; +} + +/// An interface providing an optional `terminal-output` for stderr as a +/// link-time authority. +interface terminal-stderr { + use terminal-output.{terminal-output}; + + /// If stderr is connected to a terminal, return a `terminal-output` handle + /// allowing further interaction with it. + get-terminal-stderr: func() -> option; +} + +world imports { + import environment; + import exit; + import wasi:io/error@0.2.0; + import wasi:io/poll@0.2.0; + import wasi:io/streams@0.2.0; + import stdin; + import stdout; + import stderr; + import terminal-input; + import terminal-output; + import terminal-stdin; + import terminal-stdout; + import terminal-stderr; + import wasi:clocks/monotonic-clock@0.2.0; + import wasi:clocks/wall-clock@0.2.0; + import wasi:filesystem/types@0.2.0; + import wasi:filesystem/preopens@0.2.0; + import wasi:sockets/network@0.2.0; + import wasi:sockets/instance-network@0.2.0; + import wasi:sockets/udp@0.2.0; + import wasi:sockets/udp-create-socket@0.2.0; + import wasi:sockets/tcp@0.2.0; + import wasi:sockets/tcp-create-socket@0.2.0; + import wasi:sockets/ip-name-lookup@0.2.0; + import wasi:random/random@0.2.0; + import wasi:random/insecure@0.2.0; + import wasi:random/insecure-seed@0.2.0; +} +world command { + import environment; + import exit; + import wasi:io/error@0.2.0; + import wasi:io/poll@0.2.0; + import wasi:io/streams@0.2.0; + import stdin; + import stdout; + import stderr; + import terminal-input; + import terminal-output; + import terminal-stdin; + import terminal-stdout; + import terminal-stderr; + import wasi:clocks/monotonic-clock@0.2.0; + import wasi:clocks/wall-clock@0.2.0; + import wasi:filesystem/types@0.2.0; + import wasi:filesystem/preopens@0.2.0; + import wasi:sockets/network@0.2.0; + import wasi:sockets/instance-network@0.2.0; + import wasi:sockets/udp@0.2.0; + import wasi:sockets/udp-create-socket@0.2.0; + import wasi:sockets/tcp@0.2.0; + import wasi:sockets/tcp-create-socket@0.2.0; + import wasi:sockets/ip-name-lookup@0.2.0; + import wasi:random/random@0.2.0; + import wasi:random/insecure@0.2.0; + import wasi:random/insecure-seed@0.2.0; + + export run; +} diff --git a/wit/deps/wasi-clocks-0.2.0/package.wit b/wit/deps/wasi-clocks-0.2.0/package.wit new file mode 100644 index 00000000..9e0ba3dc --- /dev/null +++ b/wit/deps/wasi-clocks-0.2.0/package.wit @@ -0,0 +1,29 @@ +package wasi:clocks@0.2.0; + +interface monotonic-clock { + use wasi:io/poll@0.2.0.{pollable}; + + type instant = u64; + + type duration = u64; + + now: func() -> instant; + + resolution: func() -> duration; + + subscribe-instant: func(when: instant) -> pollable; + + subscribe-duration: func(when: duration) -> pollable; +} + +interface wall-clock { + record datetime { + seconds: u64, + nanoseconds: u32, + } + + now: func() -> datetime; + + resolution: func() -> datetime; +} + diff --git a/wit/deps/wasi-filesystem-0.2.0/package.wit b/wit/deps/wasi-filesystem-0.2.0/package.wit new file mode 100644 index 00000000..cb6a2beb --- /dev/null +++ b/wit/deps/wasi-filesystem-0.2.0/package.wit @@ -0,0 +1,158 @@ +package wasi:filesystem@0.2.0; + +interface types { + use wasi:io/streams@0.2.0.{input-stream, output-stream, error}; + use wasi:clocks/wall-clock@0.2.0.{datetime}; + + type filesize = u64; + + enum descriptor-type { + unknown, + block-device, + character-device, + directory, + fifo, + symbolic-link, + regular-file, + socket, + } + + flags descriptor-flags { + read, + write, + file-integrity-sync, + data-integrity-sync, + requested-write-sync, + mutate-directory, + } + + flags path-flags { + symlink-follow, + } + + flags open-flags { + create, + directory, + exclusive, + truncate, + } + + type link-count = u64; + + record descriptor-stat { + %type: descriptor-type, + link-count: link-count, + size: filesize, + data-access-timestamp: option, + data-modification-timestamp: option, + status-change-timestamp: option, + } + + variant new-timestamp { + no-change, + now, + timestamp(datetime), + } + + record directory-entry { + %type: descriptor-type, + name: string, + } + + enum error-code { + access, + would-block, + already, + bad-descriptor, + busy, + deadlock, + quota, + exist, + file-too-large, + illegal-byte-sequence, + in-progress, + interrupted, + invalid, + io, + is-directory, + loop, + too-many-links, + message-size, + name-too-long, + no-device, + no-entry, + no-lock, + insufficient-memory, + insufficient-space, + not-directory, + not-empty, + not-recoverable, + unsupported, + no-tty, + no-such-device, + overflow, + not-permitted, + pipe, + read-only, + invalid-seek, + text-file-busy, + cross-device, + } + + enum advice { + normal, + sequential, + random, + will-need, + dont-need, + no-reuse, + } + + record metadata-hash-value { + lower: u64, + upper: u64, + } + + resource descriptor { + read-via-stream: func(offset: filesize) -> result; + write-via-stream: func(offset: filesize) -> result; + append-via-stream: func() -> result; + advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>; + sync-data: func() -> result<_, error-code>; + get-flags: func() -> result; + get-type: func() -> result; + set-size: func(size: filesize) -> result<_, error-code>; + set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; + read: func(length: filesize, offset: filesize) -> result, bool>, error-code>; + write: func(buffer: list, offset: filesize) -> result; + read-directory: func() -> result; + sync: func() -> result<_, error-code>; + create-directory-at: func(path: string) -> result<_, error-code>; + stat: func() -> result; + stat-at: func(path-flags: path-flags, path: string) -> result; + set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp: new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>; + link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; + open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result; + readlink-at: func(path: string) -> result; + remove-directory-at: func(path: string) -> result<_, error-code>; + rename-at: func(old-path: string, new-descriptor: borrow, new-path: string) -> result<_, error-code>; + symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>; + unlink-file-at: func(path: string) -> result<_, error-code>; + is-same-object: func(other: borrow) -> bool; + metadata-hash: func() -> result; + metadata-hash-at: func(path-flags: path-flags, path: string) -> result; + } + + resource directory-entry-stream { + read-directory-entry: func() -> result, error-code>; + } + + filesystem-error-code: func(err: borrow) -> option; +} + +interface preopens { + use types.{descriptor}; + + get-directories: func() -> list>; +} + diff --git a/wit/deps/wasi-http-0.2.0/package.wit b/wit/deps/wasi-http-0.2.0/package.wit new file mode 100644 index 00000000..11f7ff44 --- /dev/null +++ b/wit/deps/wasi-http-0.2.0/package.wit @@ -0,0 +1,571 @@ +package wasi:http@0.2.0; + +/// This interface defines all of the types and methods for implementing +/// HTTP Requests and Responses, both incoming and outgoing, as well as +/// their headers, trailers, and bodies. +interface types { + use wasi:clocks/monotonic-clock@0.2.0.{duration}; + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + use wasi:io/error@0.2.0.{error as io-error}; + use wasi:io/poll@0.2.0.{pollable}; + + /// This type corresponds to HTTP standard Methods. + variant method { + get, + head, + post, + put, + delete, + connect, + options, + trace, + patch, + other(string), + } + + /// This type corresponds to HTTP standard Related Schemes. + variant scheme { + HTTP, + HTTPS, + other(string), + } + + /// Defines the case payload type for `DNS-error` above: + record DNS-error-payload { + rcode: option, + info-code: option, + } + + /// Defines the case payload type for `TLS-alert-received` above: + record TLS-alert-received-payload { + alert-id: option, + alert-message: option, + } + + /// Defines the case payload type for `HTTP-response-{header,trailer}-size` above: + record field-size-payload { + field-name: option, + field-size: option, + } + + /// These cases are inspired by the IANA HTTP Proxy Error Types: + /// https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types + variant error-code { + DNS-timeout, + DNS-error(DNS-error-payload), + destination-not-found, + destination-unavailable, + destination-IP-prohibited, + destination-IP-unroutable, + connection-refused, + connection-terminated, + connection-timeout, + connection-read-timeout, + connection-write-timeout, + connection-limit-reached, + TLS-protocol-error, + TLS-certificate-error, + TLS-alert-received(TLS-alert-received-payload), + HTTP-request-denied, + HTTP-request-length-required, + HTTP-request-body-size(option), + HTTP-request-method-invalid, + HTTP-request-URI-invalid, + HTTP-request-URI-too-long, + HTTP-request-header-section-size(option), + HTTP-request-header-size(option), + HTTP-request-trailer-section-size(option), + HTTP-request-trailer-size(field-size-payload), + HTTP-response-incomplete, + HTTP-response-header-section-size(option), + HTTP-response-header-size(field-size-payload), + HTTP-response-body-size(option), + HTTP-response-trailer-section-size(option), + HTTP-response-trailer-size(field-size-payload), + HTTP-response-transfer-coding(option), + HTTP-response-content-coding(option), + HTTP-response-timeout, + HTTP-upgrade-failed, + HTTP-protocol-error, + loop-detected, + configuration-error, + /// This is a catch-all error for anything that doesn't fit cleanly into a + /// more specific case. It also includes an optional string for an + /// unstructured description of the error. Users should not depend on the + /// string for diagnosing errors, as it's not required to be consistent + /// between implementations. + internal-error(option), + } + + /// This type enumerates the different kinds of errors that may occur when + /// setting or appending to a `fields` resource. + variant header-error { + /// This error indicates that a `field-key` or `field-value` was + /// syntactically invalid when used with an operation that sets headers in a + /// `fields`. + invalid-syntax, + /// This error indicates that a forbidden `field-key` was used when trying + /// to set a header in a `fields`. + forbidden, + /// This error indicates that the operation on the `fields` was not + /// permitted because the fields are immutable. + immutable, + } + + /// Field keys are always strings. + type field-key = string; + + /// Field values should always be ASCII strings. However, in + /// reality, HTTP implementations often have to interpret malformed values, + /// so they are provided as a list of bytes. + type field-value = list; + + /// This following block defines the `fields` resource which corresponds to + /// HTTP standard Fields. Fields are a common representation used for both + /// Headers and Trailers. + /// + /// A `fields` may be mutable or immutable. A `fields` created using the + /// constructor, `from-list`, or `clone` will be mutable, but a `fields` + /// resource given by other means (including, but not limited to, + /// `incoming-request.headers`, `outgoing-request.headers`) might be be + /// immutable. In an immutable fields, the `set`, `append`, and `delete` + /// operations will fail with `header-error.immutable`. + resource fields { + /// Construct an empty HTTP Fields. + /// + /// The resulting `fields` is mutable. + constructor(); + /// Construct an HTTP Fields. + /// + /// The resulting `fields` is mutable. + /// + /// The list represents each key-value pair in the Fields. Keys + /// which have multiple values are represented by multiple entries in this + /// list with the same key. + /// + /// The tuple is a pair of the field key, represented as a string, and + /// Value, represented as a list of bytes. In a valid Fields, all keys + /// and values are valid UTF-8 strings. However, values are not always + /// well-formed, so they are represented as a raw list of bytes. + /// + /// An error result will be returned if any header or value was + /// syntactically invalid, or if a header was forbidden. + from-list: static func(entries: list>) -> result; + /// Get all of the values corresponding to a key. If the key is not present + /// in this `fields`, an empty list is returned. However, if the key is + /// present but empty, this is represented by a list with one or more + /// empty field-values present. + get: func(name: field-key) -> list; + /// Returns `true` when the key is present in this `fields`. If the key is + /// syntactically invalid, `false` is returned. + has: func(name: field-key) -> bool; + /// Set all of the values for a key. Clears any existing values for that + /// key, if they have been set. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + set: func(name: field-key, value: list) -> result<_, header-error>; + /// Delete all values for a key. Does nothing if no values for the key + /// exist. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + delete: func(name: field-key) -> result<_, header-error>; + /// Append a value for a key. Does not change or delete any existing + /// values for that key. + /// + /// Fails with `header-error.immutable` if the `fields` are immutable. + append: func(name: field-key, value: field-value) -> result<_, header-error>; + /// Retrieve the full set of keys and values in the Fields. Like the + /// constructor, the list represents each key-value pair. + /// + /// The outer list represents each key-value pair in the Fields. Keys + /// which have multiple values are represented by multiple entries in this + /// list with the same key. + entries: func() -> list>; + /// Make a deep copy of the Fields. Equivelant in behavior to calling the + /// `fields` constructor on the return value of `entries`. The resulting + /// `fields` is mutable. + clone: func() -> fields; + } + + /// Headers is an alias for Fields. + type headers = fields; + + /// Trailers is an alias for Fields. + type trailers = fields; + + /// Represents an incoming HTTP Request. + resource incoming-request { + /// Returns the method of the incoming request. + method: func() -> method; + /// Returns the path with query parameters from the request, as a string. + path-with-query: func() -> option; + /// Returns the protocol scheme from the request. + scheme: func() -> option; + /// Returns the authority from the request, if it was present. + authority: func() -> option; + /// Get the `headers` associated with the request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// The `headers` returned are a child resource: it must be dropped before + /// the parent `incoming-request` is dropped. Dropping this + /// `incoming-request` before all children are dropped will trap. + headers: func() -> headers; + /// Gives the `incoming-body` associated with this request. Will only + /// return success at most once, and subsequent calls will return error. + consume: func() -> result; + } + + /// Represents an outgoing HTTP Request. + resource outgoing-request { + /// Construct a new `outgoing-request` with a default `method` of `GET`, and + /// `none` values for `path-with-query`, `scheme`, and `authority`. + /// + /// * `headers` is the HTTP Headers for the Request. + /// + /// It is possible to construct, or manipulate with the accessor functions + /// below, an `outgoing-request` with an invalid combination of `scheme` + /// and `authority`, or `headers` which are not permitted to be sent. + /// It is the obligation of the `outgoing-handler.handle` implementation + /// to reject invalid constructions of `outgoing-request`. + constructor(headers: headers); + /// Returns the resource corresponding to the outgoing Body for this + /// Request. + /// + /// Returns success on the first call: the `outgoing-body` resource for + /// this `outgoing-request` can be retrieved at most once. Subsequent + /// calls will return error. + body: func() -> result; + /// Get the Method for the Request. + method: func() -> method; + /// Set the Method for the Request. Fails if the string present in a + /// `method.other` argument is not a syntactically valid method. + set-method: func(method: method) -> result; + /// Get the combination of the HTTP Path and Query for the Request. + /// When `none`, this represents an empty Path and empty Query. + path-with-query: func() -> option; + /// Set the combination of the HTTP Path and Query for the Request. + /// When `none`, this represents an empty Path and empty Query. Fails is the + /// string given is not a syntactically valid path and query uri component. + set-path-with-query: func(path-with-query: option) -> result; + /// Get the HTTP Related Scheme for the Request. When `none`, the + /// implementation may choose an appropriate default scheme. + scheme: func() -> option; + /// Set the HTTP Related Scheme for the Request. When `none`, the + /// implementation may choose an appropriate default scheme. Fails if the + /// string given is not a syntactically valid uri scheme. + set-scheme: func(scheme: option) -> result; + /// Get the HTTP Authority for the Request. A value of `none` may be used + /// with Related Schemes which do not require an Authority. The HTTP and + /// HTTPS schemes always require an authority. + authority: func() -> option; + /// Set the HTTP Authority for the Request. A value of `none` may be used + /// with Related Schemes which do not require an Authority. The HTTP and + /// HTTPS schemes always require an authority. Fails if the string given is + /// not a syntactically valid uri authority. + set-authority: func(authority: option) -> result; + /// Get the headers associated with the Request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `outgoing-request` is dropped, or its ownership is transfered to + /// another component by e.g. `outgoing-handler.handle`. + headers: func() -> headers; + } + + /// Parameters for making an HTTP Request. Each of these parameters is + /// currently an optional timeout applicable to the transport layer of the + /// HTTP protocol. + /// + /// These timeouts are separate from any the user may use to bound a + /// blocking call to `wasi:io/poll.poll`. + resource request-options { + /// Construct a default `request-options` value. + constructor(); + /// The timeout for the initial connect to the HTTP Server. + connect-timeout: func() -> option; + /// Set the timeout for the initial connect to the HTTP Server. An error + /// return value indicates that this timeout is not supported. + set-connect-timeout: func(duration: option) -> result; + /// The timeout for receiving the first byte of the Response body. + first-byte-timeout: func() -> option; + /// Set the timeout for receiving the first byte of the Response body. An + /// error return value indicates that this timeout is not supported. + set-first-byte-timeout: func(duration: option) -> result; + /// The timeout for receiving subsequent chunks of bytes in the Response + /// body stream. + between-bytes-timeout: func() -> option; + /// Set the timeout for receiving subsequent chunks of bytes in the Response + /// body stream. An error return value indicates that this timeout is not + /// supported. + set-between-bytes-timeout: func(duration: option) -> result; + } + + /// Represents the ability to send an HTTP Response. + /// + /// This resource is used by the `wasi:http/incoming-handler` interface to + /// allow a Response to be sent corresponding to the Request provided as the + /// other argument to `incoming-handler.handle`. + resource response-outparam { + /// Set the value of the `response-outparam` to either send a response, + /// or indicate an error. + /// + /// This method consumes the `response-outparam` to ensure that it is + /// called at most once. If it is never called, the implementation + /// will respond with an error. + /// + /// The user may provide an `error` to `response` to allow the + /// implementation determine how to respond with an HTTP error response. + set: static func(param: response-outparam, response: result); + } + + /// This type corresponds to the HTTP standard Status Code. + type status-code = u16; + + /// Represents an incoming HTTP Response. + resource incoming-response { + /// Returns the status code from the incoming response. + status: func() -> status-code; + /// Returns the headers from the incoming response. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `incoming-response` is dropped. + headers: func() -> headers; + /// Returns the incoming body. May be called at most once. Returns error + /// if called additional times. + consume: func() -> result; + } + + /// Represents an incoming HTTP Request or Response's Body. + /// + /// A body has both its contents - a stream of bytes - and a (possibly + /// empty) set of trailers, indicating that the full contents of the + /// body have been received. This resource represents the contents as + /// an `input-stream` and the delivery of trailers as a `future-trailers`, + /// and ensures that the user of this interface may only be consuming either + /// the body contents or waiting on trailers at any given time. + resource incoming-body { + /// Returns the contents of the body, as a stream of bytes. + /// + /// Returns success on first call: the stream representing the contents + /// can be retrieved at most once. Subsequent calls will return error. + /// + /// The returned `input-stream` resource is a child: it must be dropped + /// before the parent `incoming-body` is dropped, or consumed by + /// `incoming-body.finish`. + /// + /// This invariant ensures that the implementation can determine whether + /// the user is consuming the contents of the body, waiting on the + /// `future-trailers` to be ready, or neither. This allows for network + /// backpressure is to be applied when the user is consuming the body, + /// and for that backpressure to not inhibit delivery of the trailers if + /// the user does not read the entire body. + %stream: func() -> result; + /// Takes ownership of `incoming-body`, and returns a `future-trailers`. + /// This function will trap if the `input-stream` child is still alive. + finish: static func(this: incoming-body) -> future-trailers; + } + + /// Represents a future which may eventaully return trailers, or an error. + /// + /// In the case that the incoming HTTP Request or Response did not have any + /// trailers, this future will resolve to the empty set of trailers once the + /// complete Request or Response body has been received. + resource future-trailers { + /// Returns a pollable which becomes ready when either the trailers have + /// been received, or an error has occured. When this pollable is ready, + /// the `get` method will return `some`. + subscribe: func() -> pollable; + /// Returns the contents of the trailers, or an error which occured, + /// once the future is ready. + /// + /// The outer `option` represents future readiness. Users can wait on this + /// `option` to become `some` using the `subscribe` method. + /// + /// The outer `result` is used to retrieve the trailers or error at most + /// once. It will be success on the first call in which the outer option + /// is `some`, and error on subsequent calls. + /// + /// The inner `result` represents that either the HTTP Request or Response + /// body, as well as any trailers, were received successfully, or that an + /// error occured receiving them. The optional `trailers` indicates whether + /// or not trailers were present in the body. + /// + /// When some `trailers` are returned by this method, the `trailers` + /// resource is immutable, and a child. Use of the `set`, `append`, or + /// `delete` methods will return an error, and the resource must be + /// dropped before the parent `future-trailers` is dropped. + get: func() -> option, error-code>>>; + } + + /// Represents an outgoing HTTP Response. + resource outgoing-response { + /// Construct an `outgoing-response`, with a default `status-code` of `200`. + /// If a different `status-code` is needed, it must be set via the + /// `set-status-code` method. + /// + /// * `headers` is the HTTP Headers for the Response. + constructor(headers: headers); + /// Get the HTTP Status Code for the Response. + status-code: func() -> status-code; + /// Set the HTTP Status Code for the Response. Fails if the status-code + /// given is not a valid http status code. + set-status-code: func(status-code: status-code) -> result; + /// Get the headers associated with the Request. + /// + /// The returned `headers` resource is immutable: `set`, `append`, and + /// `delete` operations will fail with `header-error.immutable`. + /// + /// This headers resource is a child: it must be dropped before the parent + /// `outgoing-request` is dropped, or its ownership is transfered to + /// another component by e.g. `outgoing-handler.handle`. + headers: func() -> headers; + /// Returns the resource corresponding to the outgoing Body for this Response. + /// + /// Returns success on the first call: the `outgoing-body` resource for + /// this `outgoing-response` can be retrieved at most once. Subsequent + /// calls will return error. + body: func() -> result; + } + + /// Represents an outgoing HTTP Request or Response's Body. + /// + /// A body has both its contents - a stream of bytes - and a (possibly + /// empty) set of trailers, inducating the full contents of the body + /// have been sent. This resource represents the contents as an + /// `output-stream` child resource, and the completion of the body (with + /// optional trailers) with a static function that consumes the + /// `outgoing-body` resource, and ensures that the user of this interface + /// may not write to the body contents after the body has been finished. + /// + /// If the user code drops this resource, as opposed to calling the static + /// method `finish`, the implementation should treat the body as incomplete, + /// and that an error has occured. The implementation should propogate this + /// error to the HTTP protocol by whatever means it has available, + /// including: corrupting the body on the wire, aborting the associated + /// Request, or sending a late status code for the Response. + resource outgoing-body { + /// Returns a stream for writing the body contents. + /// + /// The returned `output-stream` is a child resource: it must be dropped + /// before the parent `outgoing-body` resource is dropped (or finished), + /// otherwise the `outgoing-body` drop or `finish` will trap. + /// + /// Returns success on the first call: the `output-stream` resource for + /// this `outgoing-body` may be retrieved at most once. Subsequent calls + /// will return error. + write: func() -> result; + /// Finalize an outgoing body, optionally providing trailers. This must be + /// called to signal that the response is complete. If the `outgoing-body` + /// is dropped without calling `outgoing-body.finalize`, the implementation + /// should treat the body as corrupted. + /// + /// Fails if the body's `outgoing-request` or `outgoing-response` was + /// constructed with a Content-Length header, and the contents written + /// to the body (via `write`) does not match the value given in the + /// Content-Length. + finish: static func(this: outgoing-body, trailers: option) -> result<_, error-code>; + } + + /// Represents a future which may eventaully return an incoming HTTP + /// Response, or an error. + /// + /// This resource is returned by the `wasi:http/outgoing-handler` interface to + /// provide the HTTP Response corresponding to the sent Request. + resource future-incoming-response { + /// Returns a pollable which becomes ready when either the Response has + /// been received, or an error has occured. When this pollable is ready, + /// the `get` method will return `some`. + subscribe: func() -> pollable; + /// Returns the incoming HTTP Response, or an error, once one is ready. + /// + /// The outer `option` represents future readiness. Users can wait on this + /// `option` to become `some` using the `subscribe` method. + /// + /// The outer `result` is used to retrieve the response or error at most + /// once. It will be success on the first call in which the outer option + /// is `some`, and error on subsequent calls. + /// + /// The inner `result` represents that either the incoming HTTP Response + /// status and headers have recieved successfully, or that an error + /// occured. Errors may also occur while consuming the response body, + /// but those will be reported by the `incoming-body` and its + /// `output-stream` child. + get: func() -> option>>; + } + + /// Attempts to extract a http-related `error` from the wasi:io `error` + /// provided. + /// + /// Stream operations which return + /// `wasi:io/stream/stream-error::last-operation-failed` have a payload of + /// type `wasi:io/error/error` with more information about the operation + /// that failed. This payload can be passed through to this function to see + /// if there's http-related information about the error to return. + /// + /// Note that this function is fallible because not all io-errors are + /// http-related errors. + http-error-code: func(err: borrow) -> option; +} + +/// This interface defines a handler of incoming HTTP Requests. It should +/// be exported by components which can respond to HTTP Requests. +interface incoming-handler { + use types.{incoming-request, response-outparam}; + + /// This function is invoked with an incoming HTTP Request, and a resource + /// `response-outparam` which provides the capability to reply with an HTTP + /// Response. The response is sent by calling the `response-outparam.set` + /// method, which allows execution to continue after the response has been + /// sent. This enables both streaming to the response body, and performing other + /// work. + /// + /// The implementor of this function must write a response to the + /// `response-outparam` before returning, or else the caller will respond + /// with an error on its behalf. + handle: func(request: incoming-request, response-out: response-outparam); +} + +/// This interface defines a handler of outgoing HTTP Requests. It should be +/// imported by components which wish to make HTTP Requests. +interface outgoing-handler { + use types.{outgoing-request, request-options, future-incoming-response, error-code}; + + /// This function is invoked with an outgoing HTTP Request, and it returns + /// a resource `future-incoming-response` which represents an HTTP Response + /// which may arrive in the future. + /// + /// The `options` argument accepts optional parameters for the HTTP + /// protocol's transport layer. + /// + /// This function may return an error if the `outgoing-request` is invalid + /// or not allowed to be made. Otherwise, protocol errors are reported + /// through the `future-incoming-response`. + handle: func(request: outgoing-request, options: option) -> result; +} + +/// The `wasi:http/proxy` world captures a widely-implementable intersection of +/// hosts that includes HTTP forward and reverse proxies. Components targeting +/// this world may concurrently stream in and out any number of incoming and +/// outgoing HTTP requests. +world proxy { + import wasi:random/random@0.2.0; + import wasi:io/error@0.2.0; + import wasi:io/poll@0.2.0; + import wasi:io/streams@0.2.0; + import wasi:cli/stdout@0.2.0; + import wasi:cli/stderr@0.2.0; + import wasi:cli/stdin@0.2.0; + import wasi:clocks/monotonic-clock@0.2.0; + import types; + import outgoing-handler; + import wasi:clocks/wall-clock@0.2.0; + + export incoming-handler; +} diff --git a/wit/deps/wasi-io-0.2.0/package.wit b/wit/deps/wasi-io-0.2.0/package.wit new file mode 100644 index 00000000..192e1cd5 --- /dev/null +++ b/wit/deps/wasi-io-0.2.0/package.wit @@ -0,0 +1,292 @@ +package wasi:io@0.2.0; + +interface error { + /// A resource which represents some error information. + /// + /// The only method provided by this resource is `to-debug-string`, + /// which provides some human-readable information about the error. + /// + /// In the `wasi:io` package, this resource is returned through the + /// `wasi:io/streams/stream-error` type. + /// + /// To provide more specific error information, other interfaces may + /// provide functions to further "downcast" this error into more specific + /// error information. For example, `error`s returned in streams derived + /// from filesystem types to be described using the filesystem's own + /// error-code type, using the function + /// `wasi:filesystem/types/filesystem-error-code`, which takes a parameter + /// `borrow` and returns + /// `option`. + /// + /// The set of functions which can "downcast" an `error` into a more + /// concrete type is open. + resource error { + /// Returns a string that is suitable to assist humans in debugging + /// this error. + /// + /// WARNING: The returned string should not be consumed mechanically! + /// It may change across platforms, hosts, or other implementation + /// details. Parsing this string is a major platform-compatibility + /// hazard. + to-debug-string: func() -> string; + } +} + +/// A poll API intended to let users wait for I/O events on multiple handles +/// at once. +interface poll { + /// `pollable` represents a single I/O event which may be ready, or not. + resource pollable { + /// Return the readiness of a pollable. This function never blocks. + /// + /// Returns `true` when the pollable is ready, and `false` otherwise. + ready: func() -> bool; + /// `block` returns immediately if the pollable is ready, and otherwise + /// blocks until ready. + /// + /// This function is equivalent to calling `poll.poll` on a list + /// containing only this pollable. + block: func(); + } + + /// Poll for completion on a set of pollables. + /// + /// This function takes a list of pollables, which identify I/O sources of + /// interest, and waits until one or more of the events is ready for I/O. + /// + /// The result `list` contains one or more indices of handles in the + /// argument list that is ready for I/O. + /// + /// If the list contains more elements than can be indexed with a `u32` + /// value, this function traps. + /// + /// A timeout can be implemented by adding a pollable from the + /// wasi-clocks API to the list. + /// + /// This function does not return a `result`; polling in itself does not + /// do any I/O so it doesn't fail. If any of the I/O sources identified by + /// the pollables has an error, it is indicated by marking the source as + /// being reaedy for I/O. + poll: func(in: list>) -> list; +} + +/// WASI I/O is an I/O abstraction API which is currently focused on providing +/// stream types. +/// +/// In the future, the component model is expected to add built-in stream types; +/// when it does, they are expected to subsume this API. +interface streams { + use error.{error}; + use poll.{pollable}; + + /// An error for input-stream and output-stream operations. + variant stream-error { + /// The last operation (a write or flush) failed before completion. + /// + /// More information is available in the `error` payload. + last-operation-failed(error), + /// The stream is closed: no more input will be accepted by the + /// stream. A closed output-stream will return this error on all + /// future operations. + closed, + } + + /// An input bytestream. + /// + /// `input-stream`s are *non-blocking* to the extent practical on underlying + /// platforms. I/O operations always return promptly; if fewer bytes are + /// promptly available than requested, they return the number of bytes promptly + /// available, which could even be zero. To wait for data to be available, + /// use the `subscribe` function to obtain a `pollable` which can be polled + /// for using `wasi:io/poll`. + resource input-stream { + /// Perform a non-blocking read from the stream. + /// + /// When the source of a `read` is binary data, the bytes from the source + /// are returned verbatim. When the source of a `read` is known to the + /// implementation to be text, bytes containing the UTF-8 encoding of the + /// text are returned. + /// + /// This function returns a list of bytes containing the read data, + /// when successful. The returned list will contain up to `len` bytes; + /// it may return fewer than requested, but not more. The list is + /// empty when no bytes are available for reading at this time. The + /// pollable given by `subscribe` will be ready when more bytes are + /// available. + /// + /// This function fails with a `stream-error` when the operation + /// encounters an error, giving `last-operation-failed`, or when the + /// stream is closed, giving `closed`. + /// + /// When the caller gives a `len` of 0, it represents a request to + /// read 0 bytes. If the stream is still open, this call should + /// succeed and return an empty list, or otherwise fail with `closed`. + /// + /// The `len` parameter is a `u64`, which could represent a list of u8 which + /// is not possible to allocate in wasm32, or not desirable to allocate as + /// as a return value by the callee. The callee may return a list of bytes + /// less than `len` in size while more bytes are available for reading. + read: func(len: u64) -> result, stream-error>; + /// Read bytes from a stream, after blocking until at least one byte can + /// be read. Except for blocking, behavior is identical to `read`. + blocking-read: func(len: u64) -> result, stream-error>; + /// Skip bytes from a stream. Returns number of bytes skipped. + /// + /// Behaves identical to `read`, except instead of returning a list + /// of bytes, returns the number of bytes consumed from the stream. + skip: func(len: u64) -> result; + /// Skip bytes from a stream, after blocking until at least one byte + /// can be skipped. Except for blocking behavior, identical to `skip`. + blocking-skip: func(len: u64) -> result; + /// Create a `pollable` which will resolve once either the specified stream + /// has bytes available to read or the other end of the stream has been + /// closed. + /// The created `pollable` is a child resource of the `input-stream`. + /// Implementations may trap if the `input-stream` is dropped before + /// all derived `pollable`s created with this function are dropped. + subscribe: func() -> pollable; + } + + /// An output bytestream. + /// + /// `output-stream`s are *non-blocking* to the extent practical on + /// underlying platforms. Except where specified otherwise, I/O operations also + /// always return promptly, after the number of bytes that can be written + /// promptly, which could even be zero. To wait for the stream to be ready to + /// accept data, the `subscribe` function to obtain a `pollable` which can be + /// polled for using `wasi:io/poll`. + resource output-stream { + /// Check readiness for writing. This function never blocks. + /// + /// Returns the number of bytes permitted for the next call to `write`, + /// or an error. Calling `write` with more bytes than this function has + /// permitted will trap. + /// + /// When this function returns 0 bytes, the `subscribe` pollable will + /// become ready when this function will report at least 1 byte, or an + /// error. + check-write: func() -> result; + /// Perform a write. This function never blocks. + /// + /// When the destination of a `write` is binary data, the bytes from + /// `contents` are written verbatim. When the destination of a `write` is + /// known to the implementation to be text, the bytes of `contents` are + /// transcoded from UTF-8 into the encoding of the destination and then + /// written. + /// + /// Precondition: check-write gave permit of Ok(n) and contents has a + /// length of less than or equal to n. Otherwise, this function will trap. + /// + /// returns Err(closed) without writing if the stream has closed since + /// the last call to check-write provided a permit. + write: func(contents: list) -> result<_, stream-error>; + /// Perform a write of up to 4096 bytes, and then flush the stream. Block + /// until all of these operations are complete, or an error occurs. + /// + /// This is a convenience wrapper around the use of `check-write`, + /// `subscribe`, `write`, and `flush`, and is implemented with the + /// following pseudo-code: + /// + /// ```text + /// let pollable = this.subscribe(); + /// while !contents.is_empty() { + /// // Wait for the stream to become writable + /// pollable.block(); + /// let Ok(n) = this.check-write(); // eliding error handling + /// let len = min(n, contents.len()); + /// let (chunk, rest) = contents.split_at(len); + /// this.write(chunk ); // eliding error handling + /// contents = rest; + /// } + /// this.flush(); + /// // Wait for completion of `flush` + /// pollable.block(); + /// // Check for any errors that arose during `flush` + /// let _ = this.check-write(); // eliding error handling + /// ``` + blocking-write-and-flush: func(contents: list) -> result<_, stream-error>; + /// Request to flush buffered output. This function never blocks. + /// + /// This tells the output-stream that the caller intends any buffered + /// output to be flushed. the output which is expected to be flushed + /// is all that has been passed to `write` prior to this call. + /// + /// Upon calling this function, the `output-stream` will not accept any + /// writes (`check-write` will return `ok(0)`) until the flush has + /// completed. The `subscribe` pollable will become ready when the + /// flush has completed and the stream can accept more writes. + flush: func() -> result<_, stream-error>; + /// Request to flush buffered output, and block until flush completes + /// and stream is ready for writing again. + blocking-flush: func() -> result<_, stream-error>; + /// Create a `pollable` which will resolve once the output-stream + /// is ready for more writing, or an error has occured. When this + /// pollable is ready, `check-write` will return `ok(n)` with n>0, or an + /// error. + /// + /// If the stream is closed, this pollable is always ready immediately. + /// + /// The created `pollable` is a child resource of the `output-stream`. + /// Implementations may trap if the `output-stream` is dropped before + /// all derived `pollable`s created with this function are dropped. + subscribe: func() -> pollable; + /// Write zeroes to a stream. + /// + /// This should be used precisely like `write` with the exact same + /// preconditions (must use check-write first), but instead of + /// passing a list of bytes, you simply pass the number of zero-bytes + /// that should be written. + write-zeroes: func(len: u64) -> result<_, stream-error>; + /// Perform a write of up to 4096 zeroes, and then flush the stream. + /// Block until all of these operations are complete, or an error + /// occurs. + /// + /// This is a convenience wrapper around the use of `check-write`, + /// `subscribe`, `write-zeroes`, and `flush`, and is implemented with + /// the following pseudo-code: + /// + /// ```text + /// let pollable = this.subscribe(); + /// while num_zeroes != 0 { + /// // Wait for the stream to become writable + /// pollable.block(); + /// let Ok(n) = this.check-write(); // eliding error handling + /// let len = min(n, num_zeroes); + /// this.write-zeroes(len); // eliding error handling + /// num_zeroes -= len; + /// } + /// this.flush(); + /// // Wait for completion of `flush` + /// pollable.block(); + /// // Check for any errors that arose during `flush` + /// let _ = this.check-write(); // eliding error handling + /// ``` + blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>; + /// Read from one stream and write to another. + /// + /// The behavior of splice is equivelant to: + /// 1. calling `check-write` on the `output-stream` + /// 2. calling `read` on the `input-stream` with the smaller of the + /// `check-write` permitted length and the `len` provided to `splice` + /// 3. calling `write` on the `output-stream` with that read data. + /// + /// Any error reported by the call to `check-write`, `read`, or + /// `write` ends the splice and reports that error. + /// + /// This function returns the number of bytes transferred; it may be less + /// than `len`. + splice: func(src: borrow, len: u64) -> result; + /// Read from one stream and write to another, with blocking. + /// + /// This is similar to `splice`, except that it blocks until the + /// `output-stream` is ready for writing, and the `input-stream` + /// is ready for reading, before performing the `splice`. + blocking-splice: func(src: borrow, len: u64) -> result; + } +} + +world imports { + import error; + import poll; + import streams; +} diff --git a/wit/deps/wasi-keyvalue-0.2.0-draft2/package.wit b/wit/deps/wasi-keyvalue-0.2.0-draft2/package.wit new file mode 100644 index 00000000..bd613ff4 --- /dev/null +++ b/wit/deps/wasi-keyvalue-0.2.0-draft2/package.wit @@ -0,0 +1,264 @@ +package wasi:keyvalue@0.2.0-draft2; + +/// A keyvalue interface that provides eventually consistent key-value operations. +/// +/// Each of these operations acts on a single key-value pair. +/// +/// The value in the key-value pair is defined as a `u8` byte array and the intention is that it is +/// the common denominator for all data types defined by different key-value stores to handle data, +/// ensuring compatibility between different key-value stores. Note: the clients will be expecting +/// serialization/deserialization overhead to be handled by the key-value store. The value could be +/// a serialized object from JSON, HTML or vendor-specific data types like AWS S3 objects. +/// +/// Data consistency in a key value store refers to the guarantee that once a write operation +/// completes, all subsequent read operations will return the value that was written. +/// +/// Any implementation of this interface must have enough consistency to guarantee "reading your +/// writes." In particular, this means that the client should never get a value that is older than +/// the one it wrote, but it MAY get a newer value if one was written around the same time. These +/// guarantees only apply to the same client (which will likely be provided by the host or an +/// external capability of some kind). In this context a "client" is referring to the caller or +/// guest that is consuming this interface. Once a write request is committed by a specific client, +/// all subsequent read requests by the same client will reflect that write or any subsequent +/// writes. Another client running in a different context may or may not immediately see the result +/// due to the replication lag. As an example of all of this, if a value at a given key is A, and +/// the client writes B, then immediately reads, it should get B. If something else writes C in +/// quick succession, then the client may get C. However, a client running in a separate context may +/// still see A or B +interface store { + /// The set of errors which may be raised by functions in this package + variant error { + /// The host does not recognize the store identifier requested. + no-such-store, + /// The requesting component does not have access to the specified store + /// (which may or may not exist). + access-denied, + /// Some implementation-specific error has occurred (e.g. I/O) + other(string), + } + + /// A response to a `list-keys` operation. + record key-response { + /// The list of keys returned by the query. + keys: list, + /// The continuation token to use to fetch the next page of keys. If this is `null`, then + /// there are no more keys to fetch. + cursor: option, + } + + /// A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the + /// bucket, and the bucket itself acts as a collection of all these entries. + /// + /// It is worth noting that the exact terminology for bucket in key-value stores can very + /// depending on the specific implementation. For example: + /// + /// 1. Amazon DynamoDB calls a collection of key-value pairs a table + /// 2. Redis has hashes, sets, and sorted sets as different types of collections + /// 3. Cassandra calls a collection of key-value pairs a column family + /// 4. MongoDB calls a collection of key-value pairs a collection + /// 5. Riak calls a collection of key-value pairs a bucket + /// 6. Memcached calls a collection of key-value pairs a slab + /// 7. Azure Cosmos DB calls a collection of key-value pairs a container + /// + /// In this interface, we use the term `bucket` to refer to a collection of key-value pairs + resource bucket { + /// Get the value associated with the specified `key` + /// + /// The value is returned as an option. If the key-value pair exists in the + /// store, it returns `Ok(value)`. If the key does not exist in the + /// store, it returns `Ok(none)`. + /// + /// If any other error occurs, it returns an `Err(error)`. + get: func(key: string) -> result>, error>; + /// Set the value associated with the key in the store. If the key already + /// exists in the store, it overwrites the value. + /// + /// If the key does not exist in the store, it creates a new key-value pair. + /// + /// If any other error occurs, it returns an `Err(error)`. + set: func(key: string, value: list) -> result<_, error>; + /// Delete the key-value pair associated with the key in the store. + /// + /// If the key does not exist in the store, it does nothing. + /// + /// If any other error occurs, it returns an `Err(error)`. + delete: func(key: string) -> result<_, error>; + /// Check if the key exists in the store. + /// + /// If the key exists in the store, it returns `Ok(true)`. If the key does + /// not exist in the store, it returns `Ok(false)`. + /// + /// If any other error occurs, it returns an `Err(error)`. + exists: func(key: string) -> result; + /// Get all the keys in the store with an optional cursor (for use in pagination). It + /// returns a list of keys. Please note that for most KeyValue implementations, this is a + /// can be a very expensive operation and so it should be used judiciously. Implementations + /// can return any number of keys in a single response, but they should never attempt to + /// send more data than is reasonable (i.e. on a small edge device, this may only be a few + /// KB, while on a large machine this could be several MB). Any response should also return + /// a cursor that can be used to fetch the next page of keys. See the `key-response` record + /// for more information. + /// + /// Note that the keys are not guaranteed to be returned in any particular order. + /// + /// If the store is empty, it returns an empty list. + /// + /// MAY show an out-of-date list of keys if there are concurrent writes to the store. + /// + /// If any error occurs, it returns an `Err(error)`. + list-keys: func(cursor: option) -> result; + } + + /// Get the bucket with the specified identifier. + /// + /// `identifier` must refer to a bucket provided by the host. + /// + /// `error::no-such-store` will be raised if the `identifier` is not recognized. + open: func(identifier: string) -> result; +} + +/// A keyvalue interface that provides atomic operations. +/// +/// Atomic operations are single, indivisible operations. When a fault causes an atomic operation to +/// fail, it will appear to the invoker of the atomic operation that the action either completed +/// successfully or did nothing at all. +/// +/// Please note that this interface is bare functions that take a reference to a bucket. This is to +/// get around the current lack of a way to "extend" a resource with additional methods inside of +/// wit. Future version of the interface will instead extend these methods on the base `bucket` +/// resource. +interface atomics { + use store.{bucket, error}; + + /// A handle to a CAS (compare-and-swap) operation. + resource cas { + /// Construct a new CAS operation. Implementors can map the underlying functionality + /// (transactions, versions, etc) as desired. + new: static func(bucket: borrow, key: string) -> result; + /// Get the current value of the key (if it exists). This allows for avoiding reads if all + /// that is needed to ensure the atomicity of the operation + current: func() -> result>, error>; + } + + /// The error returned by a CAS operation + variant cas-error { + /// A store error occurred when performing the operation + store-error(error), + /// The CAS operation failed because the value was too old. This returns a new CAS handle + /// for easy retries. Implementors MUST return a CAS handle that has been updated to the + /// latest version or transaction. + cas-failed(cas), + } + + /// Atomically increment the value associated with the key in the store by the given delta. It + /// returns the new value. + /// + /// If the key does not exist in the store, it creates a new key-value pair with the value set + /// to the given delta. + /// + /// If any other error occurs, it returns an `Err(error)`. + increment: func(bucket: borrow, key: string, delta: s64) -> result; + + /// Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if + /// the CAS operation failed. + swap: func(cas: cas, value: list) -> result<_, cas-error>; +} + +/// A keyvalue interface that provides batch operations. +/// +/// A batch operation is an operation that operates on multiple keys at once. +/// +/// Batch operations are useful for reducing network round-trip time. For example, if you want to +/// get the values associated with 100 keys, you can either do 100 get operations or you can do 1 +/// batch get operation. The batch operation is faster because it only needs to make 1 network call +/// instead of 100. +/// +/// A batch operation does not guarantee atomicity, meaning that if the batch operation fails, some +/// of the keys may have been modified and some may not. +/// +/// This interface does has the same consistency guarantees as the `store` interface, meaning that +/// you should be able to "read your writes." +/// +/// Please note that this interface is bare functions that take a reference to a bucket. This is to +/// get around the current lack of a way to "extend" a resource with additional methods inside of +/// wit. Future version of the interface will instead extend these methods on the base `bucket` +/// resource. +interface batch { + use store.{bucket, error}; + + /// Get the key-value pairs associated with the keys in the store. It returns a list of + /// key-value pairs. + /// + /// If any of the keys do not exist in the store, it returns a `none` value for that pair in the + /// list. + /// + /// MAY show an out-of-date value if there are concurrent writes to the store. + /// + /// If any other error occurs, it returns an `Err(error)`. + get-many: func(bucket: borrow, keys: list) -> result>>>, error>; + + /// Set the values associated with the keys in the store. If the key already exists in the + /// store, it overwrites the value. + /// + /// Note that the key-value pairs are not guaranteed to be set in the order they are provided. + /// + /// If any of the keys do not exist in the store, it creates a new key-value pair. + /// + /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not + /// rollback the key-value pairs that were already set. Thus, this batch operation does not + /// guarantee atomicity, implying that some key-value pairs could be set while others might + /// fail. + /// + /// Other concurrent operations may also be able to see the partial results. + set-many: func(bucket: borrow, key-values: list>>) -> result<_, error>; + + /// Delete the key-value pairs associated with the keys in the store. + /// + /// Note that the key-value pairs are not guaranteed to be deleted in the order they are + /// provided. + /// + /// If any of the keys do not exist in the store, it skips the key. + /// + /// If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not + /// rollback the key-value pairs that were already deleted. Thus, this batch operation does not + /// guarantee atomicity, implying that some key-value pairs could be deleted while others might + /// fail. + /// + /// Other concurrent operations may also be able to see the partial results. + delete-many: func(bucket: borrow, keys: list) -> result<_, error>; +} + +/// A keyvalue interface that provides watch operations. +/// +/// This interface is used to provide event-driven mechanisms to handle +/// keyvalue changes. +interface watcher { + use store.{bucket}; + + /// Handle the `set` event for the given bucket and key. It includes a reference to the `bucket` + /// that can be used to interact with the store. + on-set: func(bucket: bucket, key: string, value: list); + + /// Handle the `delete` event for the given bucket and key. It includes a reference to the + /// `bucket` that can be used to interact with the store. + on-delete: func(bucket: bucket, key: string); +} + +/// The `wasi:keyvalue/imports` world provides common APIs for interacting with key-value stores. +/// Components targeting this world will be able to do: +/// +/// 1. CRUD (create, read, update, delete) operations on key-value stores. +/// 2. Atomic `increment` and CAS (compare-and-swap) operations. +/// 3. Batch operations that can reduce the number of round trips to the network. +world imports { + import store; + import atomics; + import batch; +} +world watch-service { + import store; + import atomics; + import batch; + + export watcher; +} diff --git a/wit/deps/wasi-random-0.2.0/package.wit b/wit/deps/wasi-random-0.2.0/package.wit new file mode 100644 index 00000000..58c179e1 --- /dev/null +++ b/wit/deps/wasi-random-0.2.0/package.wit @@ -0,0 +1,18 @@ +package wasi:random@0.2.0; + +interface random { + get-random-bytes: func(len: u64) -> list; + + get-random-u64: func() -> u64; +} + +interface insecure { + get-insecure-random-bytes: func(len: u64) -> list; + + get-insecure-random-u64: func() -> u64; +} + +interface insecure-seed { + insecure-seed: func() -> tuple; +} + diff --git a/wit/deps/wasi-sockets-0.2.0/package.wit b/wit/deps/wasi-sockets-0.2.0/package.wit new file mode 100644 index 00000000..d464864c --- /dev/null +++ b/wit/deps/wasi-sockets-0.2.0/package.wit @@ -0,0 +1,833 @@ +package wasi:sockets@0.2.0; + +interface network { + /// An opaque resource that represents access to (a subset of) the network. + /// This enables context-based security for networking. + /// There is no need for this to map 1:1 to a physical network interface. + resource network; + + /// Error codes. + /// + /// In theory, every API can return any error code. + /// In practice, API's typically only return the errors documented per API + /// combined with a couple of errors that are always possible: + /// - `unknown` + /// - `access-denied` + /// - `not-supported` + /// - `out-of-memory` + /// - `concurrency-conflict` + /// + /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. + enum error-code { + /// Unknown error + unknown, + /// Access denied. + /// + /// POSIX equivalent: EACCES, EPERM + access-denied, + /// The operation is not supported. + /// + /// POSIX equivalent: EOPNOTSUPP + not-supported, + /// One of the arguments is invalid. + /// + /// POSIX equivalent: EINVAL + invalid-argument, + /// Not enough memory to complete the operation. + /// + /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY + out-of-memory, + /// The operation timed out before it could finish completely. + timeout, + /// This operation is incompatible with another asynchronous operation that is already in progress. + /// + /// POSIX equivalent: EALREADY + concurrency-conflict, + /// Trying to finish an asynchronous operation that: + /// - has not been started yet, or: + /// - was already finished by a previous `finish-*` call. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. + not-in-progress, + /// The operation has been aborted because it could not be completed immediately. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. + would-block, + /// The operation is not valid in the socket's current state. + invalid-state, + /// A new socket resource could not be created because of a system limit. + new-socket-limit, + /// A bind operation failed because the provided address is not an address that the `network` can bind to. + address-not-bindable, + /// A bind operation failed because the provided address is already in use or because there are no ephemeral ports available. + address-in-use, + /// The remote address is not reachable + remote-unreachable, + /// The TCP connection was forcefully rejected + connection-refused, + /// The TCP connection was reset. + connection-reset, + /// A TCP connection was aborted. + connection-aborted, + /// The size of a datagram sent to a UDP socket exceeded the maximum + /// supported size. + datagram-too-large, + /// Name does not exist or has no suitable associated IP addresses. + name-unresolvable, + /// A temporary failure in name resolution occurred. + temporary-resolver-failure, + /// A permanent failure in name resolution occurred. + permanent-resolver-failure, + } + + enum ip-address-family { + /// Similar to `AF_INET` in POSIX. + ipv4, + /// Similar to `AF_INET6` in POSIX. + ipv6, + } + + type ipv4-address = tuple; + + type ipv6-address = tuple; + + variant ip-address { + ipv4(ipv4-address), + ipv6(ipv6-address), + } + + record ipv4-socket-address { + /// sin_port + port: u16, + /// sin_addr + address: ipv4-address, + } + + record ipv6-socket-address { + /// sin6_port + port: u16, + /// sin6_flowinfo + flow-info: u32, + /// sin6_addr + address: ipv6-address, + /// sin6_scope_id + scope-id: u32, + } + + variant ip-socket-address { + ipv4(ipv4-socket-address), + ipv6(ipv6-socket-address), + } +} + +/// This interface provides a value-export of the default network handle.. +interface instance-network { + use network.{network}; + + /// Get a handle to the default network. + instance-network: func() -> network; +} + +interface ip-name-lookup { + use wasi:io/poll@0.2.0.{pollable}; + use network.{network, error-code, ip-address}; + + resource resolve-address-stream { + /// Returns the next address from the resolver. + /// + /// This function should be called multiple times. On each call, it will + /// return the next address in connection order preference. If all + /// addresses have been exhausted, this function returns `none`. + /// + /// This function never returns IPv4-mapped IPv6 addresses. + /// + /// # Typical errors + /// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY) + /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) + /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) + /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) + resolve-next-address: func() -> result, error-code>; + /// Create a `pollable` which will resolve once the stream is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } + + /// Resolve an internet host name to a list of IP addresses. + /// + /// Unicode domain names are automatically converted to ASCII using IDNA encoding. + /// If the input is an IP address string, the address is parsed and returned + /// as-is without making any external requests. + /// + /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. + /// + /// This function never blocks. It either immediately fails or immediately + /// returns successfully with a `resolve-address-stream` that can be used + /// to (asynchronously) fetch the results. + /// + /// # Typical errors + /// - `invalid-argument`: `name` is a syntactically invalid domain name or IP address. + /// + /// # References: + /// - + /// - + /// - + /// - + resolve-addresses: func(network: borrow, name: string) -> result; +} + +interface tcp { + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + use wasi:io/poll@0.2.0.{pollable}; + use wasi:clocks/monotonic-clock@0.2.0.{duration}; + use network.{network, error-code, ip-socket-address, ip-address-family}; + + enum shutdown-type { + /// Similar to `SHUT_RD` in POSIX. + receive, + /// Similar to `SHUT_WR` in POSIX. + send, + /// Similar to `SHUT_RDWR` in POSIX. + both, + } + + /// A TCP socket resource. + /// + /// The socket can be in one of the following states: + /// - `unbound` + /// - `bind-in-progress` + /// - `bound` (See note below) + /// - `listen-in-progress` + /// - `listening` + /// - `connect-in-progress` + /// - `connected` + /// - `closed` + /// See + /// for a more information. + /// + /// Note: Except where explicitly mentioned, whenever this documentation uses + /// the term "bound" without backticks it actually means: in the `bound` state *or higher*. + /// (i.e. `bound`, `listen-in-progress`, `listening`, `connect-in-progress` or `connected`) + /// + /// In addition to the general error codes documented on the + /// `network::error-code` type, TCP socket methods may always return + /// `error(invalid-state)` when in the `closed` state. + resource tcp-socket { + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the TCP/UDP port is zero, the socket will be bound to a random free port. + /// + /// Bind can be attempted multiple times on the same socket, even with + /// different arguments on each iteration. But never concurrently and + /// only as long as the previous bind failed. Once a bind succeeds, the + /// binding can't be changed anymore. + /// + /// # Typical errors + /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) + /// - `invalid-argument`: `local-address` is not a unicast address. (EINVAL) + /// - `invalid-argument`: `local-address` is an IPv4-mapped IPv6 address. (EINVAL) + /// - `invalid-state`: The socket is already bound. (EINVAL) + /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// When binding to a non-zero port, this bind operation shouldn't be affected by the TIME_WAIT + /// state of a recently closed socket on the same local address. In practice this means that the SO_REUSEADDR + /// socket option should be set implicitly on all platforms, except on Windows where this is the default behavior + /// and SO_REUSEADDR performs something different entirely. + /// + /// Unlike in POSIX, in WASI the bind operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `bind` as part of either `start-bind` or `finish-bind`. + /// + /// # References + /// - + /// - + /// - + /// - + start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; + finish-bind: func() -> result<_, error-code>; + /// Connect to a remote endpoint. + /// + /// On success: + /// - the socket is transitioned into the `connection` state. + /// - a pair of streams is returned that can be used to read & write to the connection + /// + /// After a failed connection attempt, the socket will be in the `closed` + /// state and the only valid action left is to `drop` the socket. A single + /// socket can not be used to connect more than once. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: `remote-address` is not a unicast address. (EINVAL, ENETUNREACH on Linux, EAFNOSUPPORT on MacOS) + /// - `invalid-argument`: `remote-address` is an IPv4-mapped IPv6 address. (EINVAL, EADDRNOTAVAIL on Illumos) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows) + /// - `invalid-argument`: The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`. + /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN) + /// - `invalid-state`: The socket is already in the `listening` state. (EOPNOTSUPP, EINVAL on Windows) + /// - `timeout`: Connection timed out. (ETIMEDOUT) + /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) + /// - `connection-reset`: The connection was reset. (ECONNRESET) + /// - `connection-aborted`: The connection was aborted. (ECONNABORTED) + /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `not-in-progress`: A connect operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// The POSIX equivalent of `start-connect` is the regular `connect` syscall. + /// Because all WASI sockets are non-blocking this is expected to return + /// EINPROGRESS, which should be translated to `ok()` in WASI. + /// + /// The POSIX equivalent of `finish-connect` is a `poll` for event `POLLOUT` + /// with a timeout of 0 on the socket descriptor. Followed by a check for + /// the `SO_ERROR` socket option, in case the poll signaled readiness. + /// + /// # References + /// - + /// - + /// - + /// - + start-connect: func(network: borrow, remote-address: ip-socket-address) -> result<_, error-code>; + finish-connect: func() -> result, error-code>; + /// Start listening for new connections. + /// + /// Transitions the socket into the `listening` state. + /// + /// Unlike POSIX, the socket must already be explicitly bound. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. (EDESTADDRREQ) + /// - `invalid-state`: The socket is already in the `connected` state. (EISCONN, EINVAL on BSD) + /// - `invalid-state`: The socket is already in the `listening` state. + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) + /// - `not-in-progress`: A listen operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// Unlike in POSIX, in WASI the listen operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `listen` as part of either `start-listen` or `finish-listen`. + /// + /// # References + /// - + /// - + /// - + /// - + start-listen: func() -> result<_, error-code>; + finish-listen: func() -> result<_, error-code>; + /// Accept a new client socket. + /// + /// The returned socket is bound and in the `connected` state. The following properties are inherited from the listener socket: + /// - `address-family` + /// - `keep-alive-enabled` + /// - `keep-alive-idle-time` + /// - `keep-alive-interval` + /// - `keep-alive-count` + /// - `hop-limit` + /// - `receive-buffer-size` + /// - `send-buffer-size` + /// + /// On success, this function returns the newly accepted client socket along with + /// a pair of streams that can be used to read & write to the connection. + /// + /// # Typical errors + /// - `invalid-state`: Socket is not in the `listening` state. (EINVAL) + /// - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) + /// - `connection-aborted`: An incoming connection was pending, but was terminated by the client before this listener could accept it. (ECONNABORTED) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + accept: func() -> result, error-code>; + /// Get the bound local address. + /// + /// POSIX mentions: + /// > If the socket has not been bound to a local name, the value + /// > stored in the object pointed to by `address` is unspecified. + /// + /// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - + local-address: func() -> result; + /// Get the remote address. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not connected to a remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + remote-address: func() -> result; + /// Whether the socket is in the `listening` state. + /// + /// Equivalent to the SO_ACCEPTCONN socket option. + is-listening: func() -> bool; + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. + address-family: func() -> ip-address-family; + /// Hints the desired listen queue size. Implementations are free to ignore this. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// + /// # Typical errors + /// - `not-supported`: (set) The platform does not support changing the backlog size after the initial listen. + /// - `invalid-argument`: (set) The provided value was 0. + /// - `invalid-state`: (set) The socket is in the `connect-in-progress` or `connected` state. + set-listen-backlog-size: func(value: u64) -> result<_, error-code>; + /// Enables or disables keepalive. + /// + /// The keepalive behavior can be adjusted using: + /// - `keep-alive-idle-time` + /// - `keep-alive-interval` + /// - `keep-alive-count` + /// These properties can be configured while `keep-alive-enabled` is false, but only come into effect when `keep-alive-enabled` is true. + /// + /// Equivalent to the SO_KEEPALIVE socket option. + keep-alive-enabled: func() -> result; + set-keep-alive-enabled: func(value: bool) -> result<_, error-code>; + /// Amount of time the connection has to be idle before TCP starts sending keepalive packets. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPIDLE socket option. (TCP_KEEPALIVE on MacOS) + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + keep-alive-idle-time: func() -> result; + set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>; + /// The time between keepalive packets. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPINTVL socket option. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + keep-alive-interval: func() -> result; + set-keep-alive-interval: func(value: duration) -> result<_, error-code>; + /// The maximum amount of keepalive packets TCP should send before aborting the connection. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the TCP_KEEPCNT socket option. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + keep-alive-count: func() -> result; + set-keep-alive-count: func(value: u32) -> result<_, error-code>; + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + hop-limit: func() -> result; + set-hop-limit: func(value: u8) -> result<_, error-code>; + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + receive-buffer-size: func() -> result; + set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + send-buffer-size: func() -> result; + set-send-buffer-size: func(value: u64) -> result<_, error-code>; + /// Create a `pollable` which can be used to poll for, or block on, + /// completion of any of the asynchronous operations of this socket. + /// + /// When `finish-bind`, `finish-listen`, `finish-connect` or `accept` + /// return `error(would-block)`, this pollable can be used to wait for + /// their success or failure, after which the method can be retried. + /// + /// The pollable is not limited to the async operation that happens to be + /// in progress at the time of calling `subscribe` (if any). Theoretically, + /// `subscribe` only has to be called once per socket and can then be + /// (re)used for the remainder of the socket's lifetime. + /// + /// See + /// for a more information. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + /// Initiate a graceful shutdown. + /// + /// - `receive`: The socket is not expecting to receive any data from + /// the peer. The `input-stream` associated with this socket will be + /// closed. Any data still in the receive queue at time of calling + /// this method will be discarded. + /// - `send`: The socket has no more data to send to the peer. The `output-stream` + /// associated with this socket will be closed and a FIN packet will be sent. + /// - `both`: Same effect as `receive` & `send` combined. + /// + /// This function is idempotent. Shutting a down a direction more than once + /// has no effect and returns `ok`. + /// + /// The shutdown function does not close (drop) the socket. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not in the `connected` state. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>; + } +} + +interface tcp-create-socket { + use network.{network, error-code, ip-address-family}; + use tcp.{tcp-socket}; + + /// Create a new TCP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. + /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect` + /// is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + create-tcp-socket: func(address-family: ip-address-family) -> result; +} + +interface udp { + use wasi:io/poll@0.2.0.{pollable}; + use network.{network, error-code, ip-socket-address, ip-address-family}; + + /// A received datagram. + record incoming-datagram { + /// The payload. + /// + /// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes. + data: list, + /// The source address. + /// + /// This field is guaranteed to match the remote address the stream was initialized with, if any. + /// + /// Equivalent to the `src_addr` out parameter of `recvfrom`. + remote-address: ip-socket-address, + } + + /// A datagram to be sent out. + record outgoing-datagram { + /// The payload. + data: list, + /// The destination address. + /// + /// The requirements on this field depend on how the stream was initialized: + /// - with a remote address: this field must be None or match the stream's remote address exactly. + /// - without a remote address: this field is required. + /// + /// If this value is None, the send operation is equivalent to `send` in POSIX. Otherwise it is equivalent to `sendto`. + remote-address: option, + } + + /// A UDP socket handle. + resource udp-socket { + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the port is zero, the socket will be bound to a random free port. + /// + /// # Typical errors + /// - `invalid-argument`: The `local-address` has the wrong address family. (EAFNOSUPPORT, EFAULT on Windows) + /// - `invalid-state`: The socket is already bound. (EINVAL) + /// - `address-in-use`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # Implementors note + /// Unlike in POSIX, in WASI the bind operation is async. This enables + /// interactive WASI hosts to inject permission prompts. Runtimes that + /// don't want to make use of this ability can simply call the native + /// `bind` as part of either `start-bind` or `finish-bind`. + /// + /// # References + /// - + /// - + /// - + /// - + start-bind: func(network: borrow, local-address: ip-socket-address) -> result<_, error-code>; + finish-bind: func() -> result<_, error-code>; + /// Set up inbound & outbound communication channels, optionally to a specific peer. + /// + /// This function only changes the local socket configuration and does not generate any network traffic. + /// On success, the `remote-address` of the socket is updated. The `local-address` may be updated as well, + /// based on the best network path to `remote-address`. + /// + /// When a `remote-address` is provided, the returned streams are limited to communicating with that specific peer: + /// - `send` can only be used to send to this destination. + /// - `receive` will only return datagrams sent from the provided `remote-address`. + /// + /// This method may be called multiple times on the same socket to change its association, but + /// only the most recently returned pair of streams will be operational. Implementations may trap if + /// the streams returned by a previous invocation haven't been dropped yet before calling `stream` again. + /// + /// The POSIX equivalent in pseudo-code is: + /// ```text + /// if (was previously connected) { + /// connect(s, AF_UNSPEC) + /// } + /// if (remote_address is Some) { + /// connect(s, remote_address) + /// } + /// ``` + /// + /// Unlike in POSIX, the socket must already be explicitly bound. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-state`: The socket is not bound. + /// - `address-in-use`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// + /// # References + /// - + /// - + /// - + /// - + %stream: func(remote-address: option) -> result, error-code>; + /// Get the current bound address. + /// + /// POSIX mentions: + /// > If the socket has not been bound to a local name, the value + /// > stored in the object pointed to by `address` is unspecified. + /// + /// WASI is stricter and requires `local-address` to return `invalid-state` when the socket hasn't been bound yet. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - + local-address: func() -> result; + /// Get the address the socket is currently streaming to. + /// + /// # Typical errors + /// - `invalid-state`: The socket is not streaming to a specific remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + remote-address: func() -> result; + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. + address-family: func() -> ip-address-family; + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The TTL value must be 1 or higher. + unicast-hop-limit: func() -> result; + set-unicast-hop-limit: func(value: u8) -> result<_, error-code>; + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// If the provided value is 0, an `invalid-argument` error is returned. + /// Any other value will never cause an error, but it might be silently clamped and/or rounded. + /// I.e. after setting a value, reading the same setting back may return a different value. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `invalid-argument`: (set) The provided value was 0. + receive-buffer-size: func() -> result; + set-receive-buffer-size: func(value: u64) -> result<_, error-code>; + send-buffer-size: func() -> result; + set-send-buffer-size: func(value: u64) -> result<_, error-code>; + /// Create a `pollable` which will resolve once the socket is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } + + resource incoming-datagram-stream { + /// Receive messages on the socket. + /// + /// This function attempts to receive up to `max-results` datagrams on the socket without blocking. + /// The returned list may contain fewer elements than requested, but never more. + /// + /// This function returns successfully with an empty list when either: + /// - `max-results` is 0, or: + /// - `max-results` is greater than 0, but no results are immediately available. + /// This function never returns `error(would-block)`. + /// + /// # Typical errors + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + /// - + receive: func(max-results: u64) -> result, error-code>; + /// Create a `pollable` which will resolve once the stream is ready to receive again. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } + + resource outgoing-datagram-stream { + /// Check readiness for sending. This function never blocks. + /// + /// Returns the number of datagrams permitted for the next call to `send`, + /// or an error. Calling `send` with more datagrams than this function has + /// permitted will trap. + /// + /// When this function returns ok(0), the `subscribe` pollable will + /// become ready when this function will report at least ok(1), or an + /// error. + /// + /// Never returns `would-block`. + check-send: func() -> result; + /// Send messages on the socket. + /// + /// This function attempts to send all provided `datagrams` on the socket without blocking and + /// returns how many messages were actually sent (or queued for sending). This function never + /// returns `error(would-block)`. If none of the datagrams were able to be sent, `ok(0)` is returned. + /// + /// This function semantically behaves the same as iterating the `datagrams` list and sequentially + /// sending each individual datagram until either the end of the list has been reached or the first error occurred. + /// If at least one datagram has been sent successfully, this function never returns an error. + /// + /// If the input list is empty, the function returns `ok(0)`. + /// + /// Each call to `send` must be permitted by a preceding `check-send`. Implementations must trap if + /// either `check-send` was not called or `datagrams` contains more items than `check-send` permitted. + /// + /// # Typical errors + /// - `invalid-argument`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-argument`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-argument`: The socket is in "connected" mode and `remote-address` is `some` value that does not match the address passed to `stream`. (EISCONN) + /// - `invalid-argument`: The socket is not "connected" and no value for `remote-address` was provided. (EDESTADDRREQ) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN, ENONET) + /// - `connection-refused`: The connection was refused. (ECONNREFUSED) + /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + /// - + send: func(datagrams: list) -> result; + /// Create a `pollable` which will resolve once the stream is ready to send again. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func() -> pollable; + } +} + +interface udp-create-socket { + use network.{network, error-code, ip-address-family}; + use udp.{udp-socket}; + + /// Create a new UDP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. + /// On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called, + /// the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References: + /// - + /// - + /// - + /// - + create-udp-socket: func(address-family: ip-address-family) -> result; +} + +world imports { + import network; + import instance-network; + import wasi:io/poll@0.2.0; + import udp; + import udp-create-socket; + import wasi:io/error@0.2.0; + import wasi:io/streams@0.2.0; + import wasi:clocks/monotonic-clock@0.2.0; + import tcp; + import tcp-create-socket; + import ip-name-lookup; +} diff --git a/wit/deps/wasi-tls-0.2.0-draft/package.wit b/wit/deps/wasi-tls-0.2.0-draft/package.wit new file mode 100644 index 00000000..b83efe83 --- /dev/null +++ b/wit/deps/wasi-tls-0.2.0-draft/package.wit @@ -0,0 +1,45 @@ +package wasi:tls@0.2.0-draft; + +@unstable(feature = tls) +interface types { + @unstable(feature = tls) + use wasi:io/streams@0.2.0.{input-stream, output-stream}; + @unstable(feature = tls) + use wasi:io/poll@0.2.0.{pollable}; + @unstable(feature = tls) + use wasi:io/error@0.2.0.{error as io-error}; + + @unstable(feature = tls) + resource client-handshake { + @unstable(feature = tls) + constructor(server-name: string, input: input-stream, output: output-stream); + @unstable(feature = tls) + finish: static func(this: client-handshake) -> future-client-streams; + } + + @unstable(feature = tls) + resource client-connection { + @unstable(feature = tls) + close-output: func(); + } + + @unstable(feature = tls) + resource future-client-streams { + @unstable(feature = tls) + subscribe: func() -> pollable; + @unstable(feature = tls) + get: func() -> option, io-error>>>; + } +} + +@unstable(feature = tls) +world imports { + @unstable(feature = tls) + import wasi:io/error@0.2.0; + @unstable(feature = tls) + import wasi:io/poll@0.2.0; + @unstable(feature = tls) + import wasi:io/streams@0.2.0; + @unstable(feature = tls) + import types; +} diff --git a/wit/deps/wavs-types-2.7.0/chain.wit b/wit/deps/wavs-types-2.7.0/chain.wit new file mode 100644 index 00000000..de082754 --- /dev/null +++ b/wit/deps/wavs-types-2.7.0/chain.wit @@ -0,0 +1,63 @@ +interface chain { + // A string mostly following the caip-2 format of namespace:reference, e.g. "eip155:1" for Ethereum mainnet or "cosmos:cosmoshub-4" for Cosmos Hub + // however, we allow up to 32 characters for the "namespace" part, and we call the "reference" part "chain-id" to confirm with popular usage + type chain-key = string; + type evm-tx-hash = list; // 32 bytes, a keccak hash of an RLP encoded signed transaction + type cosmos-tx-hash = string; + + variant any-tx-hash { + evm(evm-tx-hash), + cosmos(cosmos-tx-hash), + } + + record cosmos-address { + bech32-addr: string, + // prefix is the first part of the bech32 address + prefix-len: u32 + } + + record cosmos-event { + ty: string, + attributes: list>, + } + + record cosmos-chain-config { + chain-id: string, + rpc-endpoint: option, + grpc-endpoint: option, + grpc-web-endpoint: option, + gas-price: f32, + gas-denom: string, + bech32-prefix: string, + } + + record evm-address { + raw-bytes: list + } + + // The overall idea is to map alloy_rpc_types_eth::Log + record evm-event-log { + // These two fields are essentially alloy_primitives::Log + address: evm-address, + data: evm-event-log-data, + tx-hash: evm-tx-hash, + block-number: u64, + log-index: u64, + block-hash: list, // 256 bytes + block-timestamp: option, + tx-index: u64 + } + + record evm-event-log-data { + // the raw log topics that can be decoded into an event + topics: list>, + // the raw log data that can be decoded into an event + data: list, + } + + record evm-chain-config { + chain-id: string, + ws-endpoints: list, + http-endpoint: option, + } +} diff --git a/wit/deps/wavs-types-2.7.0/core.wit b/wit/deps/wavs-types-2.7.0/core.wit new file mode 100644 index 00000000..49d419d3 --- /dev/null +++ b/wit/deps/wavs-types-2.7.0/core.wit @@ -0,0 +1,27 @@ +interface core { + type digest = string; + + record timestamp { + nanos: u64 + } + + record duration { + secs: u64 + } + /// 128-bit unsigned integer represented as two 64-bit values. + /// + /// The tuple is stored in little-endian order: + /// - First element (index 0): Lower 64 bits (bits 0-63) + /// - Second element (index 1): Upper 64 bits (bits 64-127) + record u128 { + value: tuple, + } + + variant log-level { + error, + warn, + info, + debug, + trace + } +} diff --git a/wit/deps/wavs-types-2.7.0/events.wit b/wit/deps/wavs-types-2.7.0/events.wit new file mode 100644 index 00000000..38f8f694 --- /dev/null +++ b/wit/deps/wavs-types-2.7.0/events.wit @@ -0,0 +1,57 @@ +interface events { + use chain.{chain-key, evm-address, evm-event-log, cosmos-address, cosmos-event}; + use core.{timestamp}; + type event-id = list; // 20-byte unique hash + + + variant trigger-data { + evm-contract-event(trigger-data-evm-contract-event), + cosmos-contract-event(trigger-data-cosmos-contract-event), + block-interval(trigger-data-block-interval), + cron(trigger-data-cron), + atproto-event(trigger-data-atproto-event), + hypercore-append(trigger-data-hypercore-append), + raw(list) + } + + record trigger-data-evm-contract-event { + chain: chain-key, + log: evm-event-log, + } + + record trigger-data-cosmos-contract-event { + contract-address: cosmos-address, + chain: chain-key, + event: cosmos-event, + event-index: u64, + block-height: u64 + } + + record trigger-data-block-interval { + chain: chain-key, + block-height: u64 + } + + record trigger-data-cron { + trigger-time: timestamp + } + + record trigger-data-atproto-event { + sequence: s64, + timestamp: s64, + repo: string, + collection: string, + rkey: string, + action: string, + cid: option, + record-data: option, + rev: option, + op-index: option + } + + record trigger-data-hypercore-append { + feed-key: string, + index: u64, + data: list + } +} diff --git a/wit/deps/wavs-types-2.7.0/lib.wit b/wit/deps/wavs-types-2.7.0/lib.wit new file mode 100644 index 00000000..12c03432 --- /dev/null +++ b/wit/deps/wavs-types-2.7.0/lib.wit @@ -0,0 +1 @@ +package wavs:types@2.7.0; diff --git a/wit/deps/wavs-types-2.7.0/service.wit b/wit/deps/wavs-types-2.7.0/service.wit new file mode 100644 index 00000000..45df3170 --- /dev/null +++ b/wit/deps/wavs-types-2.7.0/service.wit @@ -0,0 +1,171 @@ +interface service { + // Basic types + type service-id = string; + type workflow-id = string; + type package-ref = string; + type semver-version = string; + + use core.{digest, timestamp}; + use chain.{chain-key, evm-address, cosmos-address}; + + // Service types + record service { + name: string, + workflows: list>, + status: service-status, + manager: service-manager, + } + + variant service-status { + active, + paused, + } + + variant service-manager { + evm(evm-manager), + cosmos(cosmos-manager), + } + + record evm-manager { + chain: chain-key, + address: evm-address, + } + + record cosmos-manager { + chain: chain-key, + address: cosmos-address, + } + + + // Workflow types + record workflow { + trigger: trigger, + component: component, + submit: submit, + } + + // Component types + record component { + source: component-source, + permissions: permissions, + fuel-limit: option, + time-limit-seconds: option, + config: list>, + env-keys: list, + } + + variant component-source { + download(component-source-download), + registry(registry), + digest(digest), + } + + record component-source-download { + uri: string, + digest: digest, + } + + record registry { + digest: digest, + domain: option, + version: option, + pkg: package-ref, + } + + // Permissions types + record permissions { + allowed-http-hosts: allowed-host-permission, + file-system: bool, + raw-sockets: bool, + dns-resolution: bool + } + + variant allowed-host-permission { + all, + only(list), + none, + } + + // Trigger types + variant trigger { + evm-contract-event(trigger-evm-contract-event), + cosmos-contract-event(trigger-cosmos-contract-event), + block-interval(trigger-block-interval), + cron(trigger-cron), + atproto-event(trigger-atproto-event), + hypercore-append(trigger-hypercore-append), + manual + } + + record trigger-evm-contract-event { + address: evm-address, + chain: chain-key, + event-hash: list + } + + record trigger-cosmos-contract-event { + address: cosmos-address, + chain: chain-key, + event-type: string + } + + record trigger-block-interval { + chain: chain-key, + n-blocks: u32, + start-block: option, + end-block: option + } + + record trigger-cron { + schedule: string, + start-time: option, + end-time: option + } + + record trigger-atproto-event { + collection: string, + repo-did: option, + action: option + } + + record trigger-hypercore-append { + feed-key: string + } + + + // Submit types + variant submit { + none, + aggregator(aggregator-submit), + } + + record aggregator-submit { + component: component, + signature-kind: signature-kind + } + + record signature-kind { + algorithm: signature-algorithm, + prefix: option, + } + + variant signature-algorithm { + secp256k1, + // Future: Bls12381, Ed25519, Secp256r1, etc. + } + + variant signature-prefix { + eip191 + } + + // Aggregator types + record service-and-workflow-id { + service: service, + workflow-id: workflow-id + } + + record workflow-and-workflow-id { + workflow: workflow, + workflow-id: workflow-id + } +} diff --git a/wit/operator.wit b/wit/operator.wit new file mode 100644 index 00000000..b2a46b98 --- /dev/null +++ b/wit/operator.wit @@ -0,0 +1,87 @@ +package wavs:operator@2.7.0; + +use wavs:types/core@2.7.0 as core-types; +use wavs:types/service@2.7.0 as service-types; +use wavs:types/chain@2.7.0 as chain-types; +use wavs:types/events@2.7.0 as event-types; + +interface input { + use service-types.{service-id, workflow-id, trigger}; + use event-types.{trigger-data}; + + record trigger-action { + config: trigger-config, + data: trigger-data + } + + record trigger-config { + service-id: service-id, + workflow-id: workflow-id, + trigger: trigger + } +} + +interface output { + use event-types.{event-id}; + + record wasm-response { + // arbitrary payload returned from the component + // and passed on to be signed by the operators + payload: list, + // currently unused + ordering: option, + // if not supplied, this will be `trigger-data` + // if supplied, make sure this is unique for every response! + // for example, using a "message id" from a third-party service + // also, it MUST be supplied if multiple responses are returned + event-id-salt: option> + } +} + +world wavs-world { + // include needed for golang support + include wasi:cli/imports@0.2.0; + + // wasi:http 0.2.6 uses the `imports` style, but for now import each interface separately + import wasi:http/types@0.2.0; + import wasi:http/outgoing-handler@0.2.0; + + // for key-value store support + include wasi:keyvalue/imports@0.2.0-draft2; + + // for raw socket support + include wasi:sockets/imports@0.2.0; + + // for tls support + include wasi:tls/imports@0.2.0-draft; + + import host: interface { + use chain-types.{evm-chain-config, cosmos-chain-config}; + use service-types.{service-and-workflow-id, workflow-and-workflow-id}; + use core-types.{log-level}; + use event-types.{event-id}; + + get-evm-chain-config: func(chain-key: string) -> option; + get-cosmos-chain-config: func(chain-key: string) -> option; + + config-var: func(key: string) -> option; + + log: func(level: log-level, message: string); + + // gets the service and workflow id that called this component + get-service: func() -> service-and-workflow-id; + + // convenience function to get the workflow without having to walk service.workflows + get-workflow: func() -> workflow-and-workflow-id; + + // convenience function to get what the event id will be + // typically only used for debugging or testing purposes + get-event-id: func(salt: option>) -> event-id; + } + + use input.{trigger-action}; + use output.{wasm-response}; + + // if returning multiple responses, they must all have an event-id-salt + export run: func(trigger-action: trigger-action) -> result, string>; +} diff --git a/wkg.toml b/wkg.toml new file mode 100644 index 00000000..3bf8307d --- /dev/null +++ b/wkg.toml @@ -0,0 +1,3 @@ +[overrides] +"wavs:operator" = { path = "./wit" } +"wavs:aggregator" = { path = "./wit-aggregator" }