From 7a707bd7773c3152a6f58b5ffed53abcf66f4e58 Mon Sep 17 00:00:00 2001 From: Afsal Thaj Date: Sun, 29 Mar 2026 13:04:35 +1100 Subject: [PATCH] remove all golem dependencies --- Cargo.lock | 4097 ++--------------- Cargo.toml | 15 - rib-core/Cargo.toml | 20 +- rib-core/build.rs | 52 - .../proto/golem/rib/compiler_output.proto | 15 - rib-core/proto/golem/rib/expr.proto | 410 -- rib-core/proto/golem/rib/function_name.proto | 72 - rib-core/proto/golem/rib/instance_type.proto | 96 - rib-core/proto/golem/rib/ir.proto | 223 - rib-core/proto/golem/rib/rib_byte_code.proto | 9 - rib-core/proto/golem/rib/rib_input.proto | 9 - rib-core/proto/golem/rib/rib_output.proto | 9 - rib-core/proto/golem/rib/type_name.proto | 79 - .../golem/rib/worker_functions_in_rib.proto | 16 - rib-core/regression_tests/lib.rs | 28 +- rib-core/src/analysis/mod.rs | 2 + rib-core/src/analysis/model.rs | 571 +++ rib-core/src/call_type.rs | 219 +- rib-core/src/compiler/byte_code.rs | 62 +- rib-core/src/compiler/compiler_output.rs | 57 - rib-core/src/compiler/desugar.rs | 6 +- rib-core/src/compiler/ir.rs | 539 +-- rib-core/src/compiler/mod.rs | 8 +- rib-core/src/compiler/type_with_unit.rs | 10 +- .../src/compiler/worker_functions_in_rib.rs | 99 +- rib-core/src/expr.rs | 1063 +---- rib-core/src/function_name.rs | 369 +- rib-core/src/generic_type_parameter.rs | 4 +- rib-core/src/inferred_type/mod.rs | 16 +- rib-core/src/inferred_type/type_internal.rs | 4 +- rib-core/src/inferred_type/type_origin.rs | 7 +- rib-core/src/instance_type.rs | 156 +- rib-core/src/interpreter/env.rs | 6 +- rib-core/src/interpreter/interpreter_input.rs | 2 +- .../src/interpreter/interpreter_result.rs | 6 +- .../interpreter/interpreter_stack_value.rs | 8 +- rib-core/src/interpreter/literal.rs | 6 +- .../src/interpreter/rib_function_invoke.rs | 4 +- rib-core/src/interpreter/rib_interpreter.rs | 45 +- rib-core/src/interpreter/rib_runtime_error.rs | 2 +- rib-core/src/interpreter/stack.rs | 10 +- rib-core/src/lib.rs | 35 +- rib-core/src/parser/literal.rs | 9 +- rib-core/src/parser/type_name.rs | 169 +- .../src/registry/component_dependencies.rs | 8 +- .../src/registry/component_dependency_key.rs | 4 +- rib-core/src/registry/function_dictionary.rs | 82 +- rib-core/src/registry/raw_type_registry.rs | 4 +- rib-core/src/rib_source_span.rs | 7 +- .../type_checker/exhaustive_pattern_match.rs | 2 +- .../src/type_checker/invalid_function_args.rs | 2 +- rib-core/src/type_checker/missing_fields.rs | 2 +- .../call_arguments_inference.rs | 8 +- .../type_inference/custom_instance_spec.rs | 2 +- rib-core/src/type_inference/enum_inference.rs | 2 +- rib-core/src/type_inference/errors.rs | 2 +- .../identify_instance_creation.rs | 2 +- rib-core/src/type_inference/mod.rs | 20 +- rib-core/src/type_inference/rib_input_type.rs | 35 +- .../src/type_inference/rib_output_type.rs | 31 +- rib-core/src/type_inference/type_hint.rs | 2 +- rib-core/src/type_inference/type_push_down.rs | 2 +- rib-core/src/type_parameter.rs | 13 +- rib-core/src/value.rs | 113 + rib-core/src/value_and_type.rs | 205 + rib-core/src/variable_id.rs | 118 +- rib-core/src/wasm_wave_text.rs | 441 ++ rib-core/src/wave.rs | 181 + rib-repl/Cargo.toml | 1 - rib-repl/src/command/builtin.rs | 2 +- rib-repl/src/compiler.rs | 2 +- rib-repl/src/invoke.rs | 4 +- rib-repl/src/repl_printer.rs | 6 +- rib-repl/src/repl_state.rs | 2 +- rib-repl/src/rib_edit.rs | 4 +- rib-repl/src/value_generator.rs | 4 +- 76 files changed, 2116 insertions(+), 7841 deletions(-) delete mode 100644 rib-core/build.rs delete mode 100644 rib-core/proto/golem/rib/compiler_output.proto delete mode 100644 rib-core/proto/golem/rib/expr.proto delete mode 100644 rib-core/proto/golem/rib/function_name.proto delete mode 100644 rib-core/proto/golem/rib/instance_type.proto delete mode 100644 rib-core/proto/golem/rib/ir.proto delete mode 100644 rib-core/proto/golem/rib/rib_byte_code.proto delete mode 100644 rib-core/proto/golem/rib/rib_input.proto delete mode 100644 rib-core/proto/golem/rib/rib_output.proto delete mode 100644 rib-core/proto/golem/rib/type_name.proto delete mode 100644 rib-core/proto/golem/rib/worker_functions_in_rib.proto create mode 100644 rib-core/src/analysis/mod.rs create mode 100644 rib-core/src/analysis/model.rs create mode 100644 rib-core/src/value.rs create mode 100644 rib-core/src/value_and_type.rs create mode 100644 rib-core/src/wasm_wave_text.rs create mode 100644 rib-core/src/wave.rs diff --git a/Cargo.lock b/Cargo.lock index c8c8aa5..0ec5c3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,86 +2,18 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" -dependencies = [ - "gimli 0.32.3", -] - -[[package]] -name = "addr2line" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9698bf0769c641b18618039fe2ebd41eb3541f98433000f64e663fab7cea2c87" -dependencies = [ - "gimli 0.33.0", -] - [[package]] name = "adler2" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures 0.2.17", -] - -[[package]] -name = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "aho-corasick" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" -dependencies = [ - "memchr", -] - [[package]] name = "allocator-api2" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" -[[package]] -name = "ambient-authority" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9d4ee0d472d1cd2e28c97dfa124b3d8d992e10eb0a035f33f5d12e3a177ba3b" - [[package]] name = "android_system_properties" version = "0.1.5" @@ -146,26 +78,6 @@ version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" -[[package]] -name = "arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" -dependencies = [ - "derive_arbitrary", -] - -[[package]] -name = "async-recursion" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "async-trait" version = "0.1.89" @@ -177,103 +89,12 @@ dependencies = [ "syn", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "auditable-serde" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" -dependencies = [ - "semver", - "serde", - "serde_json", - "topological-sort", -] - [[package]] name = "autocfg" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "axum" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b52af3cb4058c895d37317bb27508dccc8e5f2d39454016b297bf4a400597b8" -dependencies = [ - "axum-core", - "bytes", - "futures-util", - "http", - "http-body", - "http-body-util", - "itoa", - "matchit", - "memchr", - "mime", - "percent-encoding", - "pin-project-lite", - "serde_core", - "sync_wrapper", - "tower", - "tower-layer", - "tower-service", -] - -[[package]] -name = "axum-core" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "http-body-util", - "mime", - "pin-project-lite", - "sync_wrapper", - "tower-layer", - "tower-service", -] - -[[package]] -name = "backtrace" -version = "0.3.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" -dependencies = [ - "addr2line 0.25.1", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-link", -] - -[[package]] -name = "backtrace-ext" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" -dependencies = [ - "backtrace", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - [[package]] name = "beef" version = "0.5.2" @@ -294,47 +115,17 @@ dependencies = [ "serde", ] -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -dependencies = [ - "serde", -] - [[package]] name = "bitflags" version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" -[[package]] -name = "bitmaps" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" -dependencies = [ - "typenum", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - [[package]] name = "bumpalo" version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" -dependencies = [ - "allocator-api2", -] [[package]] name = "bytes" @@ -342,133 +133,6 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" -[[package]] -name = "camino" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" -dependencies = [ - "serde_core", -] - -[[package]] -name = "cap-fs-ext" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5528f85b1e134ae811704e41ef80930f56e795923f866813255bc342cc20654" -dependencies = [ - "cap-primitives", - "cap-std", - "io-lifetimes", - "windows-sys 0.59.0", -] - -[[package]] -name = "cap-net-ext" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20a158160765c6a7d0d8c072a53d772e4cb243f38b04bfcf6b4939cfbe7482e7" -dependencies = [ - "cap-primitives", - "cap-std", - "rustix 1.1.4", - "smallvec", -] - -[[package]] -name = "cap-primitives" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6cf3aea8a5081171859ef57bc1606b1df6999df4f1110f8eef68b30098d1d3a" -dependencies = [ - "ambient-authority", - "fs-set-times", - "io-extras", - "io-lifetimes", - "ipnet", - "maybe-owned", - "rustix 1.1.4", - "rustix-linux-procfs", - "windows-sys 0.59.0", - "winx", -] - -[[package]] -name = "cap-rand" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8144c22e24bbcf26ade86cb6501a0916c46b7e4787abdb0045a467eb1645a1d" -dependencies = [ - "ambient-authority", - "rand 0.8.5", -] - -[[package]] -name = "cap-std" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6dc3090992a735d23219de5c204927163d922f42f575a0189b005c62d37549a" -dependencies = [ - "cap-primitives", - "io-extras", - "io-lifetimes", - "rustix 1.1.4", -] - -[[package]] -name = "cap-time-ext" -version = "3.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def102506ce40c11710a9b16e614af0cde8e76ae51b1f48c04b8d79f4b671a80" -dependencies = [ - "ambient-authority", - "cap-primitives", - "iana-time-zone", - "once_cell", - "rustix 1.1.4", - "winx", -] - -[[package]] -name = "cargo-platform" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84982c6c0ae343635a3a4ee6dedef965513735c8b183caa7289fa6e27399ebd4" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-util-schemas" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc1a6f7b5651af85774ae5a34b4e8be397d9cf4bc063b7e6dbd99a841837830" -dependencies = [ - "semver", - "serde", - "serde-untagged", - "serde-value", - "thiserror 2.0.18", - "toml 0.8.23", - "unicode-xid", - "url", -] - -[[package]] -name = "cargo_metadata" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cfca2aaa699835ba88faf58a06342a314a950d2b9686165e038286c30316868" -dependencies = [ - "camino", - "cargo-platform", - "cargo-util-schemas", - "semver", - "serde", - "serde_json", - "thiserror 2.0.18", -] - [[package]] name = "castaway" version = "0.2.4" @@ -485,8 +149,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1e928d4b69e3077709075a938a05ffbedfa53a84c8f766efbf8220bb1ff60e1" dependencies = [ "find-msvc-tools", - "jobserver", - "libc", "shlex", ] @@ -509,8 +171,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" dependencies = [ "cfg-if", - "cpufeatures 0.3.0", - "rand_core 0.10.0", + "cpufeatures", + "rand_core", ] [[package]] @@ -522,7 +184,6 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-link", ] @@ -537,16 +198,6 @@ dependencies = [ "phf", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - [[package]] name = "clap" version = "4.5.60" @@ -596,15 +247,6 @@ dependencies = [ "error-code", ] -[[package]] -name = "cobs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" -dependencies = [ - "thiserror 2.0.18", -] - [[package]] name = "colorchoice" version = "1.0.5" @@ -640,271 +282,62 @@ dependencies = [ ] [[package]] -name = "convert_case" -version = "0.10.0" +name = "core-foundation-sys" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" -dependencies = [ - "unicode-segmentation", -] +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] -name = "cookie" -version = "0.18.1" +name = "cpufeatures" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" dependencies = [ - "aes-gcm", - "base64", - "hkdf", - "hmac", - "percent-encoding", - "rand 0.8.5", - "sha2", - "subtle", - "time", - "version_check", + "libc", ] [[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cpp_demangle" -version = "0.4.5" +name = "crc32fast" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] [[package]] -name = "cpufeatures" -version = "0.2.17" +name = "crossterm" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" dependencies = [ - "libc", + "bitflags", + "crossterm_winapi", + "mio", + "parking_lot", + "rustix 0.38.44", + "signal-hook", + "signal-hook-mio", + "winapi", ] [[package]] -name = "cpufeatures" -version = "0.3.0" +name = "crossterm_winapi" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ - "libc", + "winapi", ] [[package]] -name = "cranelift-assembler-x64" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "ctor" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec09e802f5081de6157da9a75701d6c713d8dc3ba52571fd4bd25f412644e8a6" dependencies = [ - "cranelift-assembler-x64-meta", -] - -[[package]] -name = "cranelift-assembler-x64-meta" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-srcgen", -] - -[[package]] -name = "cranelift-bforest" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-entity", -] - -[[package]] -name = "cranelift-bitset" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "serde", - "serde_derive", - "wasmtime-internal-core", -] - -[[package]] -name = "cranelift-codegen" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "bumpalo", - "cranelift-assembler-x64", - "cranelift-bforest", - "cranelift-bitset", - "cranelift-codegen-meta", - "cranelift-codegen-shared", - "cranelift-control", - "cranelift-entity", - "cranelift-isle", - "gimli 0.33.0", - "hashbrown 0.15.5", - "libm", - "log", - "pulley-interpreter", - "regalloc2", - "rustc-hash", - "serde", - "smallvec", - "target-lexicon", - "wasmtime-internal-core", -] - -[[package]] -name = "cranelift-codegen-meta" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-assembler-x64-meta", - "cranelift-codegen-shared", - "cranelift-srcgen", - "heck", - "pulley-interpreter", -] - -[[package]] -name = "cranelift-codegen-shared" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" - -[[package]] -name = "cranelift-control" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "arbitrary", -] - -[[package]] -name = "cranelift-entity" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-bitset", - "serde", - "serde_derive", - "wasmtime-internal-core", -] - -[[package]] -name = "cranelift-frontend" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-codegen", - "log", - "smallvec", - "target-lexicon", -] - -[[package]] -name = "cranelift-isle" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" - -[[package]] -name = "cranelift-native" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-codegen", - "libc", - "target-lexicon", -] - -[[package]] -name = "cranelift-srcgen" -version = "0.129.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" - -[[package]] -name = "crc32fast" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - -[[package]] -name = "crossterm" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d955a0bb380ef178a640b91779e3987da38c9aea133b20614cfed8cdea9c6" -dependencies = [ - "bitflags", - "crossterm_winapi", - "mio", - "parking_lot", - "rustix 0.38.44", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - -[[package]] -name = "crypto-common" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "typenum", -] - -[[package]] -name = "ctor" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec09e802f5081de6157da9a75701d6c713d8dc3ba52571fd4bd25f412644e8a6" -dependencies = [ - "ctor-proc-macro", - "dtor", + "ctor-proc-macro", + "dtor", ] [[package]] @@ -913,15 +346,6 @@ version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2931af7e13dc045d8e9d26afccc6fa115d64e115c9c84b1166288b46f6782c2" -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - [[package]] name = "ctrf-rs" version = "0.1.0" @@ -934,38 +358,14 @@ dependencies = [ "uuid", ] -[[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", + "darling_core", + "darling_macro", ] [[package]] @@ -982,84 +382,15 @@ dependencies = [ "syn", ] -[[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", -] - [[package]] name = "darling_macro" version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "darling_core 0.21.3", - "quote", - "syn", -] - -[[package]] -name = "data-encoding" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" - -[[package]] -name = "debugid" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "uuid", -] - -[[package]] -name = "deranged" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derive_arbitrary" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_more" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" -dependencies = [ - "convert_case 0.10.0", - "proc-macro2", + "darling_core", "quote", - "rustc_version", "syn", - "unicode-xid", ] [[package]] @@ -1069,7 +400,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47c629b264e47dba69c637cfd85b36c0fe75d4cbabbef46e71a21d644153b1f6" dependencies = [ "bigdecimal", - "bit-vec", "bytes", "castaway", "chrono", @@ -1077,11 +407,9 @@ dependencies = [ "flate2", "hashbrown 0.16.1", "lazy_static", - "mac_address", "nonempty-collections", "once_cell", "serde_json", - "url", "uuid", ] @@ -1109,27 +437,6 @@ dependencies = [ "desert_macro", ] -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "directories-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - [[package]] name = "dirs" version = "4.0.0" @@ -1150,28 +457,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "doctest-file" version = "1.1.1" @@ -1193,33 +478,6 @@ version = "0.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7454e41ff9012c00d53cf7f475c5e3afa3b91b7c90568495495e8d9bf47a1055" -[[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - [[package]] name = "endian-type" version = "0.1.2" @@ -1232,17 +490,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" -[[package]] -name = "erased-serde" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" -dependencies = [ - "serde", - "serde_core", - "typeid", -] - [[package]] name = "errno" version = "0.3.14" @@ -1265,12 +512,6 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5692dd7b5a1978a5aeb0ce83b7655c58ca8efdcb79d21036ea249da95afec2c6" -[[package]] -name = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - [[package]] name = "fd-lock" version = "4.0.4" @@ -1288,18 +529,6 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "fixedbitset" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" - [[package]] name = "flate2" version = "1.1.9" @@ -1329,30 +558,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] -name = "form_urlencoded" -version = "1.2.2" +name = "futures" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fs-set-times" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e7099f6313ecacbe1256e8ff9d617b75d1bcb16a6fddef94866d225a01a14a" -dependencies = [ - "io-lifetimes", - "rustix 1.1.4", - "windows-sys 0.59.0", -] - -[[package]] -name = "futures" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -1436,30 +645,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxprof-processed-profile" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25234f20a3ec0a962a61770cfe39ecf03cb529a6e474ad8cff025ed497eda557" -dependencies = [ - "bitflags", - "debugid", - "rustc-hash", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - [[package]] name = "getrandom" version = "0.2.17" @@ -1471,18 +656,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - [[package]] name = "getrandom" version = "0.4.2" @@ -1491,102 +664,12 @@ checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" dependencies = [ "cfg-if", "libc", - "r-efi 6.0.0", - "rand_core 0.10.0", + "r-efi", + "rand_core", "wasip2", "wasip3", ] -[[package]] -name = "ghash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "gimli" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" - -[[package]] -name = "gimli" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" -dependencies = [ - "fnv", - "hashbrown 0.16.1", - "indexmap", - "stable_deref_trait", -] - -[[package]] -name = "golem-wasm" -version = "0.0.0" -dependencies = [ - "arbitrary", - "async-recursion", - "async-trait", - "bigdecimal", - "bit-vec", - "chrono", - "desert_rust", - "golem-wasm-derive", - "itertools", - "lazy_static", - "miette", - "poem-openapi", - "prost", - "prost-build", - "protox", - "semver", - "serde", - "serde_json", - "url", - "uuid", - "wasm-metadata", - "wasm-wave", - "wasmparser 0.244.0", - "wasmtime", - "wasmtime-wasi", - "wit-component", - "wit-parser", -] - -[[package]] -name = "golem-wasm-derive" -version = "0.0.0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "h2" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.15.5" @@ -1594,7 +677,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "foldhash 0.1.5", - "serde", ] [[package]] @@ -1608,54 +690,12 @@ dependencies = [ "foldhash 0.2.0", ] -[[package]] -name = "headers" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3314d5adb5d94bcdf56771f2e50dbbc80bb4bdf88967526706205ac9eff24eb" -dependencies = [ - "base64", - "bytes", - "headers-core", - "http", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" -dependencies = [ - "http", -] - [[package]] name = "heck" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - [[package]] name = "home" version = "0.5.12" @@ -1665,113 +705,12 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "http" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" -dependencies = [ - "bytes", - "itoa", -] - -[[package]] -name = "http-body" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "http-body-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" -dependencies = [ - "bytes", - "futures-core", - "http", - "http-body", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "humantime" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" -[[package]] -name = "hyper" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "pin-utils", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-timeout" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" -dependencies = [ - "hyper", - "hyper-util", - "pin-project-lite", - "tokio", - "tower-service", -] - -[[package]] -name = "hyper-util" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "http", - "http-body", - "hyper", - "libc", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", -] - [[package]] name = "iana-time-zone" version = "0.1.65" @@ -1796,87 +735,6 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" - -[[package]] -name = "icu_properties" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - [[package]] name = "id-arena" version = "2.3.0" @@ -1889,41 +747,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "im-rc" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" -dependencies = [ - "bitmaps", - "rand_core 0.6.4", - "rand_xoshiro", - "sized-chunks", - "typenum", - "version_check", -] - [[package]] name = "indexmap" version = "2.13.0" @@ -1936,15 +759,6 @@ dependencies = [ "serde_core", ] -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array", -] - [[package]] name = "interprocess" version = "2.4.0" @@ -1960,49 +774,12 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "io-extras" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2285ddfe3054097ef4b2fe909ef8c3bcd1ea52a8f0d274416caebeef39f04a65" -dependencies = [ - "io-lifetimes", - "windows-sys 0.59.0", -] - -[[package]] -name = "io-lifetimes" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06432fb54d3be7964ecd3649233cddf80db2832f47fec34c01f65b3d9d774983" - -[[package]] -name = "ipnet" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" - -[[package]] -name = "is_ci" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" - [[package]] name = "is_terminal_polyfill" version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" -[[package]] -name = "itertools" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.18" @@ -2010,40 +787,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] -name = "ittapi" -version = "0.4.0" +name = "js-sys" +version = "0.3.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b996fe614c41395cdaedf3cf408a9534851090959d90d54a535f675550b64b1" -dependencies = [ - "anyhow", - "ittapi-sys", - "log", -] - -[[package]] -name = "ittapi-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f5385394064fa2c886205dba02598013ce83d3e92d33dbdc0c52fe0e7bf4fc" -dependencies = [ - "cc", -] - -[[package]] -name = "jobserver" -version = "0.1.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" -dependencies = [ - "getrandom 0.3.4", - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.92" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4c90f45aa2e6eacbe8645f77fdea542ac97a494bcd117a67df9ff4d611f995" +checksum = "cc4c90f45aa2e6eacbe8645f77fdea542ac97a494bcd117a67df9ff4d611f995" dependencies = [ "once_cell", "wasm-bindgen", @@ -2055,12 +802,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - [[package]] name = "leb128fmt" version = "0.1.0" @@ -2100,12 +841,6 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" -[[package]] -name = "litemap" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - [[package]] name = "lock_api" version = "0.4.14" @@ -2127,16 +862,7 @@ version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7251356ef8cb7aec833ddf598c6cb24d17b689d20b993f9d11a3d764e34e6458" dependencies = [ - "logos-derive 0.14.4", -] - -[[package]] -name = "logos" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff472f899b4ec2d99161c51f60ff7075eeb3097069a36050d8037a6325eb8154" -dependencies = [ - "logos-derive 0.15.1", + "logos-derive", ] [[package]] @@ -2154,131 +880,21 @@ dependencies = [ "syn", ] -[[package]] -name = "logos-codegen" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "192a3a2b90b0c05b27a0b2c43eecdb7c415e29243acc3f89cc8247a5b693045c" -dependencies = [ - "beef", - "fnv", - "lazy_static", - "proc-macro2", - "quote", - "regex-syntax", - "rustc_version", - "syn", -] - [[package]] name = "logos-derive" version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24fb722b06a9dc12adb0963ed585f19fc61dc5413e6a9be9422ef92c091e731d" dependencies = [ - "logos-codegen 0.14.4", -] - -[[package]] -name = "logos-derive" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "605d9697bcd5ef3a42d38efc51541aa3d6a4a25f7ab6d1ed0da5ac632a26b470" -dependencies = [ - "logos-codegen 0.15.1", -] - -[[package]] -name = "mac_address" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0aeb26bf5e836cc1c341c8106051b573f1766dfa05aa87f0b98be5e51b02303" -dependencies = [ - "nix 0.29.0", - "winapi", -] - -[[package]] -name = "mach2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" -dependencies = [ - "libc", + "logos-codegen", ] -[[package]] -name = "matchit" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" - -[[package]] -name = "maybe-owned" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" - [[package]] name = "memchr" version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" -[[package]] -name = "memfd" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad38eb12aea514a0466ea40a80fd8cc83637065948eb4a426e4aa46261175227" -dependencies = [ - "rustix 1.1.4", -] - -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - -[[package]] -name = "miette" -version = "7.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" -dependencies = [ - "backtrace", - "backtrace-ext", - "cfg-if", - "miette-derive", - "owo-colors", - "supports-color", - "supports-hyperlinks", - "supports-unicode", - "terminal_size", - "textwrap", - "unicode-width 0.1.14", -] - -[[package]] -name = "miette-derive" -version = "7.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[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.9" @@ -2301,30 +917,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http", - "httparse", - "memchr", - "mime", - "spin", - "tokio", - "version_check", -] - -[[package]] -name = "multimap" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" - [[package]] name = "nibble_vec" version = "0.1.0" @@ -2339,19 +931,6 @@ name = "nix" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags", - "cfg-if", - "cfg_aliases", - "libc", - "memoffset", -] - -[[package]] -name = "nix" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" dependencies = [ "bitflags", "cfg-if", @@ -2375,12 +954,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-conv" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" - [[package]] name = "num-integer" version = "0.1.46" @@ -2399,45 +972,12 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.37.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" -dependencies = [ - "crc32fast", - "hashbrown 0.15.5", - "indexmap", - "memchr", -] - [[package]] name = "once_cell" version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "ordered-float" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" -dependencies = [ - "num-traits", -] - -[[package]] -name = "owo-colors" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d211803b9b6b570f68772237e415a029d5a50c65d382910b879fb19d3271f94d" - [[package]] name = "parking_lot" version = "0.12.5" @@ -2461,33 +1001,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "percent-encoding" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" - -[[package]] -name = "petgraph" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" -dependencies = [ - "fixedbitset 0.4.2", - "indexmap", -] - -[[package]] -name = "petgraph" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455" -dependencies = [ - "fixedbitset 0.5.7", - "hashbrown 0.15.5", - "indexmap", -] - [[package]] name = "phf" version = "0.12.1" @@ -2506,26 +1019,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project" -version = "1.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" version = "0.2.17" @@ -2533,324 +1026,235 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "poem" -version = "3.1.12" +name = "prettyplease" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f977080932c87287147dca052951c3e2696f8759863f6b4e4c0c9ffe7a4cc8b" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ - "base64", - "bytes", - "chrono", - "cookie", - "futures-util", - "headers", - "http", - "http-body-util", - "hyper", - "hyper-util", - "mime", - "multer", - "nix 0.30.1", - "parking_lot", - "percent-encoding", - "pin-project-lite", - "poem-derive", - "quick-xml 0.36.2", - "regex", - "rfc7239", - "serde", - "serde_json", - "serde_urlencoded", - "serde_yaml", - "smallvec", - "sync_wrapper", - "tempfile", - "thiserror 2.0.18", - "time", - "tokio", - "tokio-stream", - "tokio-tungstenite", - "tokio-util", - "tracing", - "wildmatch", + "proc-macro2", + "syn", ] [[package]] -name = "poem-derive" -version = "3.1.12" +name = "proc-macro2" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "056e2fea6de1cb240ffe23cfc4fc370b629f8be83b5f27e16b7acd5231a72de4" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", + "unicode-ident", ] [[package]] -name = "poem-openapi" -version = "5.1.16" +name = "quick-xml" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ccbcc395bf4dd03df1da32da351b6b6732e4074ce27ddec315650e52a2be44c" +checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" dependencies = [ - "base64", - "bytes", - "chrono", - "derive_more", - "futures-util", - "humantime", - "indexmap", - "itertools", - "mime", - "num-traits", - "poem", - "poem-openapi-derive", - "quick-xml 0.36.2", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "serde_yaml", - "thiserror 2.0.18", - "time", - "tokio", - "url", - "uuid", + "memchr", ] [[package]] -name = "poem-openapi-derive" -version = "5.1.16" +name = "quote" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41273b691a3d467a8c44d05506afba9f7b6bd56c9cdf80123de13fe52d7ec587" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ - "darling 0.20.11", - "http", - "indexmap", - "mime", - "proc-macro-crate", "proc-macro2", - "quote", - "regex", - "syn", - "thiserror 2.0.18", ] [[package]] -name = "polyval" -version = "0.6.2" +name = "r-efi" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "opaque-debug", - "universal-hash", -] +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] -name = "postcard" -version = "1.1.3" +name = "radix_trie" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", + "endian-type", + "nibble_vec", ] [[package]] -name = "potential_utf" -version = "0.1.4" +name = "rand" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" dependencies = [ - "zerovec", + "chacha20", + "getrandom 0.4.2", + "rand_core", ] [[package]] -name = "powerfmt" -version = "0.2.0" +name = "rand_core" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" [[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] -name = "prettyplease" -version = "0.2.37" +name = "redox_syscall" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "proc-macro2", - "syn", + "bitflags", ] [[package]] -name = "proc-macro-crate" -version = "3.5.0" +name = "redox_users" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "toml_edit 0.25.8+spec-1.1.0", + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", ] [[package]] -name = "proc-macro2" -version = "1.0.106" +name = "regex-syntax" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" -dependencies = [ - "unicode-ident", -] +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] -name = "prost" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ea70524a2f82d518bce41317d0fae74151505651af45faf1ffbd6fd33f0568" +name = "rib-core" +version = "0.0.0" dependencies = [ - "bytes", - "prost-derive", + "async-trait", + "bigdecimal", + "combine", + "lazy_static", + "semver", + "serde", + "serde_json", + "test-r", + "uuid", + "wasm-wave", ] [[package]] -name = "prost-build" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7" +name = "rib-repl" +version = "0.0.0" dependencies = [ - "heck", - "itertools", - "log", - "multimap", - "petgraph 0.8.3", - "prettyplease", - "prost", - "prost-types", - "pulldown-cmark", - "pulldown-cmark-to-cmark", - "regex", - "syn", - "tempfile", + "anyhow", + "async-trait", + "clap", + "colored", + "convert_case", + "crossterm", + "dirs", + "rib-core", + "rustyline", + "test-r", + "uuid", + "wasm-wave", ] [[package]] -name = "prost-derive" -version = "0.14.3" +name = "rustix" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c6023962132f4b30eb4c172c91ce92d933da334c59c23cddee82358ddafb0b" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn", + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", ] [[package]] -name = "prost-reflect" -version = "0.16.3" +name = "rustix" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b89455ef41ed200cafc47c76c552ee7792370ac420497e551f16123a9135f76e" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "logos 0.15.1", - "miette", - "prost", - "prost-types", + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.12.1", + "windows-sys 0.61.2", ] [[package]] -name = "prost-types" -version = "0.14.3" +name = "rustversion" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8991c4cbdb8bc5b11f0b074ffe286c30e523de90fee5ba8132f1399f23cb3dd7" -dependencies = [ - "prost", -] +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] -name = "protox" -version = "0.9.1" +name = "rustyline" +version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f25a07a73c6717f0b9bbbd685918f5df9815f7efba450b83d9c9dea41f0e3a1" +checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" dependencies = [ - "bytes", - "miette", - "prost", - "prost-reflect", - "prost-types", - "protox-parse", - "thiserror 2.0.18", + "bitflags", + "cfg-if", + "clipboard-win", + "fd-lock", + "home", + "libc", + "log", + "memchr", + "nix", + "radix_trie", + "unicode-segmentation", + "unicode-width", + "utf8parse", + "windows-sys 0.59.0", ] [[package]] -name = "protox-parse" -version = "0.9.0" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "072eee358134396a4643dff81cfff1c255c9fbd3fb296be14bdb6a26f9156366" -dependencies = [ - "logos 0.15.1", - "miette", - "prost-types", - "thiserror 2.0.18", -] +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "pulldown-cmark" -version = "0.13.3" +name = "semver" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a14896dfa883796f1cb410461aef38810ea05f2b2c33c5aded3649095fdad" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" dependencies = [ - "bitflags", - "memchr", - "unicase", + "serde", + "serde_core", ] [[package]] -name = "pulldown-cmark-to-cmark" -version = "22.0.0" +name = "serde" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50793def1b900256624a709439404384204a5dc3a6ec580281bfaac35e882e90" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ - "pulldown-cmark", + "serde_core", + "serde_derive", ] [[package]] -name = "pulley-interpreter" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ - "cranelift-bitset", - "log", - "pulley-macros", - "wasmtime-internal-core", + "serde_derive", ] [[package]] -name = "pulley-macros" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -2858,436 +1262,226 @@ dependencies = [ ] [[package]] -name = "quick-xml" -version = "0.36.2" +name = "serde_json" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ + "itoa", "memchr", "serde", + "serde_core", + "zmij", ] [[package]] -name = "quick-xml" -version = "0.38.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66c2058c55a409d601666cffe35f04333cf1013010882cec174a7467cd4e21c" -dependencies = [ - "memchr", -] - -[[package]] -name = "quote" -version = "1.0.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r-efi" -version = "5.3.0" +name = "sha1_smol" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" [[package]] -name = "r-efi" -version = "6.0.0" +name = "shlex" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "radix_trie" -version = "0.2.1" +name = "signal-hook" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" dependencies = [ - "endian-type", - "nibble_vec", + "libc", + "signal-hook-registry", ] [[package]] -name = "rand" -version = "0.8.5" +name = "signal-hook-mio" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" dependencies = [ "libc", - "rand_chacha 0.3.1", - "rand_core 0.6.4", + "mio", + "signal-hook", ] [[package]] -name = "rand" -version = "0.9.2" +name = "signal-hook-registry" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ - "rand_chacha 0.9.0", - "rand_core 0.9.5", + "errno", + "libc", ] [[package]] -name = "rand" -version = "0.10.0" +name = "simd-adler32" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc266eb313df6c5c09c1c7b1fbe2510961e5bcd3add930c1e31f7ed9da0feff8" -dependencies = [ - "chacha20", - "getrandom 0.4.2", - "rand_core 0.10.0", -] +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" [[package]] -name = "rand_chacha" -version = "0.3.1" +name = "siphasher" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] -name = "rand_chacha" -version = "0.9.0" +name = "slab" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core 0.9.5", -] +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] -name = "rand_core" -version = "0.6.4" +name = "smallvec" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom 0.2.17", -] +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] -name = "rand_core" -version = "0.9.5" +name = "socket2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ - "getrandom 0.3.4", + "libc", + "windows-sys 0.61.2", ] [[package]] -name = "rand_core" -version = "0.10.0" +name = "strsim" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c8d0fd677905edcbeedbf2edb6494d676f0e98d54d5cf9bda0b061cb8fb8aba" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] -name = "rand_xoshiro" -version = "0.6.0" +name = "syn" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ - "rand_core 0.6.4", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "rayon" -version = "1.11.0" +name = "test-r" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +checksum = "29af3b851f27a4f4223b7638cfc197601e04f86cd0057e9dc8b3760771b653e9" dependencies = [ - "either", - "rayon-core", + "ctor", + "test-r-core", + "test-r-macro", + "tokio", ] [[package]] -name = "rayon-core" -version = "1.13.0" +name = "test-r-core" +version = "6.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "recvmsg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" - -[[package]] -name = "redox_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom 0.2.17", - "libredox", - "thiserror 1.0.69", -] - -[[package]] -name = "regalloc2" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08effbc1fa53aaebff69521a5c05640523fab037b34a4a2c109506bc938246fa" -dependencies = [ - "allocator-api2", - "bumpalo", - "hashbrown 0.15.5", - "log", - "rustc-hash", - "smallvec", -] - -[[package]] -name = "regex" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" - -[[package]] -name = "rfc7239" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a82f1d1e38e9a85bb58ffcfadf22ed6f2c94e8cd8581ec2b0f80a2a6858350f" -dependencies = [ - "uncased", -] - -[[package]] -name = "rib-core" -version = "0.0.0" -dependencies = [ - "async-trait", - "bigdecimal", - "cargo_metadata", - "combine", - "desert_rust", - "golem-wasm", - "lazy_static", - "miette", - "poem-openapi", - "prost", - "prost-types", - "protox", - "semver", - "serde", - "serde_json", - "test-r", - "tonic", - "tonic-prost", - "tonic-prost-build", - "uuid", -] - -[[package]] -name = "rib-repl" -version = "0.0.0" +checksum = "e0f22fa86d211b7b94c5f6f2472d44fd953d381ad4e93a46e806833d48a28fef" dependencies = [ + "anstream", + "anstyle", + "anstyle-query", + "anstyle-wincon", "anyhow", - "async-trait", "clap", - "colored", - "convert_case 0.8.0", - "crossterm", - "dirs", - "golem-wasm", - "rib-core", - "rustyline", - "test-r", + "ctrf-rs", + "desert_rust", + "escape8259", + "futures", + "interprocess", + "parking_lot", + "quick-xml", + "rand", + "serde_json", + "tokio", + "topological-sort", "uuid", - "wasm-wave", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" - -[[package]] -name = "rustc-hash" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" - -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.38.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", - "windows-sys 0.59.0", -] - -[[package]] -name = "rustix" -version = "1.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustix-linux-procfs" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc84bf7e9aa16c4f2c758f27412dc9841341e16aa682d9c7ac308fe3ee12056" -dependencies = [ - "once_cell", - "rustix 1.1.4", ] [[package]] -name = "rustversion" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" - -[[package]] -name = "rustyline" -version = "15.0.0" +name = "test-r-macro" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee1e066dc922e513bda599c6ccb5f3bb2b0ea5870a579448f2622993f0a9a2f" +checksum = "f96550a7e63f9cdc5ced794757e31f43e6a2d5402192edcadaeb578bc58ba0c9" dependencies = [ - "bitflags", - "cfg-if", - "clipboard-win", - "fd-lock", - "home", - "libc", - "log", - "memchr", - "nix 0.29.0", - "radix_trie", - "unicode-segmentation", - "unicode-width 0.2.2", - "utf8parse", - "windows-sys 0.59.0", + "darling", + "humantime", + "proc-macro2", + "quote", + "rand", + "syn", + "test-r-core", ] [[package]] -name = "ryu" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "semver" -version = "1.0.27" +name = "thiserror" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "serde", - "serde_core", + "thiserror-impl 1.0.69", ] [[package]] -name = "serde" -version = "1.0.228" +name = "thiserror" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "serde_core", - "serde_derive", + "thiserror-impl 2.0.18", ] [[package]] -name = "serde-untagged" -version = "0.1.9" +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "erased-serde", - "serde", - "serde_core", - "typeid", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "serde-value" -version = "0.7.0" +name = "thiserror-impl" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ - "ordered-float", - "serde", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "serde_core" -version = "1.0.228" +name = "tokio" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" dependencies = [ - "serde_derive", + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", ] [[package]] -name = "serde_derive" -version = "1.0.228" +name = "tokio-macros" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" dependencies = [ "proc-macro2", "quote", @@ -3295,1452 +1489,173 @@ dependencies = [ ] [[package]] -name = "serde_json" -version = "1.0.149" +name = "topological-sort" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] +checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" [[package]] -name = "serde_spanned" -version = "0.6.9" +name = "unicode-ident" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] -name = "serde_spanned" -version = "1.1.0" +name = "unicode-segmentation" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876ac351060d4f882bb1032b6369eb0aef79ad9df1ea8bc404874d8cc3d0cd98" -dependencies = [ - "serde_core", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest", -] - -[[package]] -name = "sha1_smol" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures 0.2.17", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[package]] -name = "simd-adler32" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" - -[[package]] -name = "siphasher" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" - -[[package]] -name = "sized-chunks" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] - -[[package]] -name = "slab" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" - -[[package]] -name = "smallvec" -version = "1.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" -dependencies = [ - "libc", - "windows-sys 0.61.2", -] - -[[package]] -name = "spdx" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e17e880bafaeb362a7b751ec46bdc5b61445a188f80e0606e68167cd540fa3" -dependencies = [ - "smallvec", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "supports-color" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fc7232dd8d2e4ac5ce4ef302b1d81e0b80d055b9d77c7c4f51f6aa4c867d6" -dependencies = [ - "is_ci", -] - -[[package]] -name = "supports-hyperlinks" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e396b6523b11ccb83120b115a0b7366de372751aa6edf19844dfb13a6af97e91" - -[[package]] -name = "supports-unicode" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" - -[[package]] -name = "syn" -version = "2.0.117" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sync_wrapper" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" -dependencies = [ - "futures-core", -] - -[[package]] -name = "synstructure" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "system-interface" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4592f674ce18521c2a81483873a49596655b179f71c5e05d10c1fe66c78745" -dependencies = [ - "bitflags", - "cap-fs-ext", - "cap-std", - "fd-lock", - "io-lifetimes", - "rustix 0.38.44", - "windows-sys 0.59.0", - "winx", -] - -[[package]] -name = "target-lexicon" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.2", - "once_cell", - "rustix 1.1.4", - "windows-sys 0.61.2", -] - -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "terminal_size" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230a1b821ccbd75b185820a1f1ff7b14d21da1e442e22c0863ea5f08771a8874" -dependencies = [ - "rustix 1.1.4", - "windows-sys 0.61.2", -] - -[[package]] -name = "test-r" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29af3b851f27a4f4223b7638cfc197601e04f86cd0057e9dc8b3760771b653e9" -dependencies = [ - "ctor", - "test-r-core", - "test-r-macro", - "tokio", -] - -[[package]] -name = "test-r-core" -version = "6.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f22fa86d211b7b94c5f6f2472d44fd953d381ad4e93a46e806833d48a28fef" -dependencies = [ - "anstream", - "anstyle", - "anstyle-query", - "anstyle-wincon", - "anyhow", - "clap", - "ctrf-rs", - "desert_rust", - "escape8259", - "futures", - "interprocess", - "parking_lot", - "quick-xml 0.38.4", - "rand 0.10.0", - "serde_json", - "tokio", - "topological-sort", - "uuid", -] - -[[package]] -name = "test-r-macro" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f96550a7e63f9cdc5ced794757e31f43e6a2d5402192edcadaeb578bc58ba0c9" -dependencies = [ - "darling 0.21.3", - "humantime", - "proc-macro2", - "quote", - "rand 0.10.0", - "syn", - "test-r-core", -] - -[[package]] -name = "textwrap" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13547615a44dc9c452a8a534638acdf07120d4b6847c8178705da06306a3057" -dependencies = [ - "unicode-linebreak", - "unicode-width 0.2.2", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl 1.0.69", -] - -[[package]] -name = "thiserror" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" -dependencies = [ - "thiserror-impl 2.0.18", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror-impl" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.3.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde_core", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" - -[[package]] -name = "time-macros" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tokio" -version = "1.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" -dependencies = [ - "bytes", - "libc", - "mio", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-stream" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489a59b6730eda1b0171fcfda8b121f4bee2b35cba8645ca35c5f7ba3eb736c1" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - -[[package]] -name = "tokio-util" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_edit 0.22.27", -] - -[[package]] -name = "toml" -version = "0.9.12+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned 1.1.0", - "toml_datetime 0.7.5+spec-1.1.0", - "toml_parser", - "toml_writer", - "winnow 0.7.15", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_datetime" -version = "1.1.0+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97251a7c317e03ad83774a8752a7e81fb6067740609f75ea2b585b569a59198f" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap", - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_write", - "winnow 0.7.15", -] - -[[package]] -name = "toml_edit" -version = "0.25.8+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16bff38f1d86c47f9ff0647e6838d7bb362522bdf44006c7068c2b1e606f1f3c" -dependencies = [ - "indexmap", - "toml_datetime 1.1.0+spec-1.1.0", - "toml_parser", - "winnow 1.0.0", -] - -[[package]] -name = "toml_parser" -version = "1.1.0+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2334f11ee363607eb04df9b8fc8a13ca1715a72ba8662a26ac285c98aabb4011" -dependencies = [ - "winnow 1.0.0", -] - -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - -[[package]] -name = "toml_writer" -version = "1.1.0+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d282ade6016312faf3e41e57ebbba0c073e4056dab1232ab1cb624199648f8ed" - -[[package]] -name = "tonic" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec7c61a0695dc1887c1b53952990f3ad2e3a31453e1f49f10e75424943a93ec" -dependencies = [ - "async-trait", - "axum", - "base64", - "bytes", - "flate2", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-timeout", - "hyper-util", - "percent-encoding", - "pin-project", - "socket2", - "sync_wrapper", - "tokio", - "tokio-stream", - "tower", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tonic-build" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1882ac3bf5ef12877d7ed57aad87e75154c11931c2ba7e6cde5e22d63522c734" -dependencies = [ - "prettyplease", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tonic-prost" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55376a0bbaa4975a3f10d009ad763d8f4108f067c7c2e74f3001fb49778d309" -dependencies = [ - "bytes", - "prost", - "tonic", -] - -[[package]] -name = "tonic-prost-build" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3144df636917574672e93d0f56d7edec49f90305749c668df5101751bb8f95a" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "prost-types", - "quote", - "syn", - "tempfile", - "tonic-build", -] - -[[package]] -name = "topological-sort" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" - -[[package]] -name = "tower" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" -dependencies = [ - "futures-core", - "futures-util", - "indexmap", - "pin-project-lite", - "slab", - "sync_wrapper", - "tokio", - "tokio-util", - "tower-layer", - "tower-service", - "tracing", -] - -[[package]] -name = "tower-layer" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tracing-core" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "tungstenite" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadc29d668c91fcc564941132e17b28a7ceb2f3ebf0b9dae3e03fd7a6748eb0d" -dependencies = [ - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand 0.9.2", - "sha1", - "thiserror 2.0.18", - "utf-8", -] - -[[package]] -name = "typeid" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" - -[[package]] -name = "typenum" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" - -[[package]] -name = "uncased" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicase" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" - -[[package]] -name = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - -[[package]] -name = "unicode-segmentation" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" - -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - -[[package]] -name = "url" -version = "2.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", - "serde_derive", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] -name = "uuid" -version = "1.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9" -dependencies = [ - "getrandom 0.4.2", - "js-sys", - "serde_core", - "sha1_smol", - "wasm-bindgen", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - -[[package]] -name = "wasip2" -version = "1.0.2+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -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 = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.115" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6523d69017b7633e396a89c5efab138161ed5aafcbc8d3e5c5a42ae38f50495a" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.115" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3a6c758eb2f701ed3d052ff5737f5bfe6614326ea7f3bbac7156192dc32e67" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.115" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921de2737904886b52bcbb237301552d05969a6f9c40d261eb0533c8b055fedf" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.115" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a93e946af942b58934c604527337bad9ae33ba1d5c6900bbb41c2c07c2364a93" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-compose" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92cda9c76ca8dcac01a8b497860c2cb15cd6f216dc07060517df5abbe82512ac" -dependencies = [ - "anyhow", - "heck", - "im-rc", - "indexmap", - "log", - "petgraph 0.6.5", - "serde", - "serde_derive", - "serde_yaml", - "smallvec", - "wasm-encoder 0.244.0", - "wasmparser 0.244.0", - "wat", -] - -[[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-encoder" -version = "0.245.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9dca005e69bf015e45577e415b9af8c67e8ee3c0e38b5b0add5aa92581ed5c" -dependencies = [ - "leb128fmt", - "wasmparser 0.245.1", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "auditable-serde", - "flate2", - "indexmap", - "serde", - "serde_derive", - "serde_json", - "spdx", - "url", - "wasm-encoder 0.244.0", - "wasmparser 0.244.0", -] - -[[package]] -name = "wasm-wave" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c34a4c10a1b9260f8131929d680e36edf00836bb8e76524d3004522bd6f287" -dependencies = [ - "logos 0.14.4", - "thiserror 2.0.18", - "wit-parser", -] - -[[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", - "semver", - "serde", -] - -[[package]] -name = "wasmparser" -version = "0.245.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f08c9adee0428b7bddf3890fc27e015ac4b761cc608c822667102b8bfd6995e" -dependencies = [ - "bitflags", - "indexmap", - "semver", -] - -[[package]] -name = "wasmprinter" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09390d7b2bd7b938e563e4bff10aa345ef2e27a3bc99135697514ef54495e68f" -dependencies = [ - "anyhow", - "termcolor", - "wasmparser 0.244.0", -] - -[[package]] -name = "wasmtime" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "addr2line 0.26.0", - "async-trait", - "bitflags", - "bumpalo", - "cc", - "cfg-if", - "encoding_rs", - "futures", - "fxprof-processed-profile", - "gimli 0.33.0", - "ittapi", - "libc", - "log", - "mach2", - "memfd", - "object", - "once_cell", - "postcard", - "pulley-interpreter", - "rayon", - "rustix 1.1.4", - "semver", - "serde", - "serde_derive", - "serde_json", - "smallvec", - "target-lexicon", - "tempfile", - "wasm-compose", - "wasm-encoder 0.244.0", - "wasmparser 0.244.0", - "wasmtime-environ", - "wasmtime-internal-cache", - "wasmtime-internal-component-macro", - "wasmtime-internal-component-util", - "wasmtime-internal-core", - "wasmtime-internal-cranelift", - "wasmtime-internal-fiber", - "wasmtime-internal-jit-debug", - "wasmtime-internal-jit-icache-coherence", - "wasmtime-internal-unwinder", - "wasmtime-internal-versioned-export-macros", - "wasmtime-internal-winch", - "wat", - "windows-sys 0.61.2", -] - -[[package]] -name = "wasmtime-environ" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "anyhow", - "cpp_demangle", - "cranelift-bitset", - "cranelift-entity", - "gimli 0.33.0", - "hashbrown 0.15.5", - "indexmap", - "log", - "object", - "postcard", - "rustc-demangle", - "semver", - "serde", - "serde_derive", - "smallvec", - "target-lexicon", - "wasm-encoder 0.244.0", - "wasmparser 0.244.0", - "wasmprinter", - "wasmtime-internal-component-util", - "wasmtime-internal-core", -] - -[[package]] -name = "wasmtime-internal-cache" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "base64", - "directories-next", - "log", - "postcard", - "rustix 1.1.4", - "serde", - "serde_derive", - "sha2", - "toml 0.9.12+spec-1.1.0", - "wasmtime-environ", - "windows-sys 0.61.2", - "zstd", -] - -[[package]] -name = "wasmtime-internal-component-macro" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "anyhow", - "proc-macro2", - "quote", - "syn", - "wasmtime-internal-component-util", - "wasmtime-internal-wit-bindgen", - "wit-parser", -] - -[[package]] -name = "wasmtime-internal-component-util" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" - -[[package]] -name = "wasmtime-internal-core" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "anyhow", - "libm", -] - -[[package]] -name = "wasmtime-internal-cranelift" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cfg-if", - "cranelift-codegen", - "cranelift-control", - "cranelift-entity", - "cranelift-frontend", - "cranelift-native", - "gimli 0.33.0", - "itertools", - "log", - "object", - "pulley-interpreter", - "smallvec", - "target-lexicon", - "thiserror 2.0.18", - "wasmparser 0.244.0", - "wasmtime-environ", - "wasmtime-internal-core", - "wasmtime-internal-unwinder", - "wasmtime-internal-versioned-export-macros", -] - -[[package]] -name = "wasmtime-internal-fiber" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cc", - "cfg-if", - "libc", - "rustix 1.1.4", - "wasmtime-environ", - "wasmtime-internal-versioned-export-macros", - "windows-sys 0.61.2", -] +checksum = "9629274872b2bfaf8d66f5f15725007f635594914870f65218920345aa11aa8c" [[package]] -name = "wasmtime-internal-jit-debug" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cc", - "object", - "rustix 1.1.4", - "wasmtime-internal-versioned-export-macros", -] +name = "unicode-width" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" [[package]] -name = "wasmtime-internal-jit-icache-coherence" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cfg-if", - "libc", - "wasmtime-internal-core", - "windows-sys 0.61.2", -] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] -name = "wasmtime-internal-unwinder" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cfg-if", - "cranelift-codegen", - "log", - "object", - "wasmtime-environ", -] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "wasmtime-internal-versioned-export-macros" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "uuid" +version = "1.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ac8b6f42ead25368cf5b098aeb3dc8a1a2c05a3eee8a9a1a68c640edbfc79d9" dependencies = [ - "proc-macro2", - "quote", - "syn", + "getrandom 0.4.2", + "js-sys", + "serde_core", + "sha1_smol", + "wasm-bindgen", ] [[package]] -name = "wasmtime-internal-winch" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-codegen", - "gimli 0.33.0", - "log", - "object", - "target-lexicon", - "wasmparser 0.244.0", - "wasmtime-environ", - "wasmtime-internal-cranelift", - "winch-codegen", -] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasmtime-internal-wit-bindgen" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "anyhow", - "bitflags", - "heck", - "indexmap", - "wit-parser", + "wit-bindgen", ] [[package]] -name = "wasmtime-wasi" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +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 = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ - "async-trait", - "bitflags", - "bytes", - "cap-fs-ext", - "cap-net-ext", - "cap-rand", - "cap-std", - "cap-time-ext", - "fs-set-times", - "futures", - "io-extras", - "io-lifetimes", - "rustix 1.1.4", - "system-interface", - "thiserror 2.0.18", - "tokio", - "tracing", - "url", - "wasmtime", - "wasmtime-wasi-io", - "wiggle", - "windows-sys 0.61.2", + "wit-bindgen", ] [[package]] -name = "wasmtime-wasi-io" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "wasm-bindgen" +version = "0.2.115" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6523d69017b7633e396a89c5efab138161ed5aafcbc8d3e5c5a42ae38f50495a" dependencies = [ - "async-trait", - "bytes", - "futures", - "tracing", - "wasmtime", + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", ] [[package]] -name = "wast" -version = "35.0.2" +name = "wasm-bindgen-macro" +version = "0.2.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68" +checksum = "4e3a6c758eb2f701ed3d052ff5737f5bfe6614326ea7f3bbac7156192dc32e67" dependencies = [ - "leb128", + "quote", + "wasm-bindgen-macro-support", ] [[package]] -name = "wast" -version = "245.0.1" +name = "wasm-bindgen-macro-support" +version = "0.2.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cf1149285569120b8ce39db8b465e8a2b55c34cbb586bd977e43e2bc7300bf" +checksum = "921de2737904886b52bcbb237301552d05969a6f9c40d261eb0533c8b055fedf" dependencies = [ "bumpalo", - "leb128fmt", - "memchr", - "unicode-width 0.2.2", - "wasm-encoder 0.245.1", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", ] [[package]] -name = "wat" -version = "1.245.1" +name = "wasm-bindgen-shared" +version = "0.2.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd48d1679b6858988cb96b154dda0ec5bbb09275b71db46057be37332d5477be" +checksum = "a93e946af942b58934c604527337bad9ae33ba1d5c6900bbb41c2c07c2364a93" dependencies = [ - "wast 245.0.1", + "unicode-ident", ] [[package]] -name = "widestring" -version = "1.2.1" +name = "wasm-encoder" +version = "0.244.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] [[package]] -name = "wiggle" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" dependencies = [ - "bitflags", - "thiserror 2.0.18", - "tracing", - "wasmtime", - "wasmtime-environ", - "wiggle-macro", + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", ] [[package]] -name = "wiggle-generate" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "wasm-wave" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1c34a4c10a1b9260f8131929d680e36edf00836bb8e76524d3004522bd6f287" dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", - "wasmtime-environ", - "witx", + "logos", + "thiserror 2.0.18", + "wit-parser", ] [[package]] -name = "wiggle-macro" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" dependencies = [ - "proc-macro2", - "quote", - "syn", - "wiggle-generate", + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", ] [[package]] -name = "wildmatch" -version = "2.6.1" +name = "widestring" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29333c3ea1ba8b17211763463ff24ee84e41c78224c16b001cd907e663a38c68" +checksum = "72069c3113ab32ab29e5584db3c6ec55d416895e60715417b5b883a357c3e471" [[package]] name = "winapi" @@ -4758,39 +1673,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "winch-codegen" -version = "42.0.1" -source = "git+https://github.com/golemcloud/wasmtime.git?branch=golem-wasmtime-v42.0.1#9fc55305c583e4d98edecfdab59dab5e5c3f6e1c" -dependencies = [ - "cranelift-assembler-x64", - "cranelift-codegen", - "gimli 0.33.0", - "regalloc2", - "smallvec", - "target-lexicon", - "thiserror 2.0.18", - "wasmparser 0.244.0", - "wasmtime-environ", - "wasmtime-internal-core", - "wasmtime-internal-cranelift", -] - [[package]] name = "windows-core" version = "0.62.2" @@ -4941,34 +1829,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8" -dependencies = [ - "memchr", -] - -[[package]] -name = "winx" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3fd376f71958b862e7afb20cfe5a22830e1963462f3a17f49d82a6c1d1f42d" -dependencies = [ - "bitflags", - "windows-sys 0.59.0", -] - [[package]] name = "wit-bindgen" version = "0.51.0" @@ -5033,9 +1893,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.244.0", + "wasm-encoder", "wasm-metadata", - "wasmparser 0.244.0", + "wasmparser", "wit-parser", ] @@ -5054,122 +1914,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.244.0", -] - -[[package]] -name = "witx" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" -dependencies = [ - "anyhow", - "log", - "thiserror 1.0.69", - "wast 35.0.2", -] - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "wasmparser", ] [[package]] @@ -5177,31 +1922,3 @@ name = "zmij" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" - -[[package]] -name = "zstd" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.16+zstd.1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/Cargo.toml b/Cargo.toml index 70e8625..95750a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,29 +7,21 @@ members = [ ] [workspace.dependencies] -golem-wasm = { version = "=0.0.0", path = "../golem/golem-wasm", default-features = false } rib-core = { version = "=0.0.0", path = "rib-core" } rib-repl = { version = "=0.0.0", path = "rib-repl" } anyhow = "1.0.97" async-trait = "0.1.87" bigdecimal = { version = "0.4.7", features = ["serde", "string-only"] } -cargo_metadata = "0.21.0" clap = { version = "4.5.32", features = ["derive", "suggestions", "color", "help", "env"] } colored = "3.0.0" combine = "4.6.7" convert_case = "0.8.0" crossterm = "0.28.1" -desert_rust = { version = "0.1.6", features = ["bigdecimal", "uuid", "chrono", "nonempty-collections", "serde-json", "bit-vec", "url", "mac_address"] } dirs = "4.0.0" lazy_static = "1.5.0" miette = { version = "7.6.0", features = ["fancy"] } -poem-openapi = { version = "=5.1.16", features = ["chrono", "cookie", "humantime", "swagger-ui", "time", "url", "uuid", "websocket"] } -prometheus = { version = "0.14.0", features = ["process"] } reqwest = { version = "0.12.13", features = ["json"] } -prost = "0.14.1" -prost-types = "0.14.1" -protox = "0.9.0" rustyline = "15.0.0" semver = "1.0.26" serde = { version = "1.0", features = ["derive"] } @@ -37,13 +29,6 @@ serde_json = { version = "1.0", features = ["raw_value"] } shell-words = "1.1.0" test-r = { version = "3.0.3", default-features = true } tokio = { version = "1.44", features = ["macros", "rt-multi-thread", "sync", "io-std", "net", "tracing", "process"] } -tonic = { version = "0.14.2", features = ["gzip"] } -tonic-prost = "0.14.2" -tonic-prost-build = "0.14.2" tracing = { version = "0.1.41", features = ["log"] } uuid = { version = "1.15.1", features = ["serde", "v4", "v5", "v7"] } wasm-wave = "0.244" - -[patch.crates-io] -wasmtime = { git = "https://github.com/golemcloud/wasmtime.git", branch = "golem-wasmtime-v42.0.1" } -wasmtime-wasi = { git = "https://github.com/golemcloud/wasmtime.git", branch = "golem-wasmtime-v42.0.1" } diff --git a/rib-core/Cargo.toml b/rib-core/Cargo.toml index 69a6d18..041d25e 100644 --- a/rib-core/Cargo.toml +++ b/rib-core/Cargo.toml @@ -8,35 +8,19 @@ description = "Parser for Golem's Rib language" license-file = "../LICENSE" [features] -default = ["json_in_errors", "poem"] +default = ["json_in_errors"] json_in_errors = [] -poem = [ - "dep:poem-openapi", -] [dependencies] -golem-wasm = { workspace = true } - async-trait = { workspace = true } bigdecimal = { workspace = true } combine = { workspace = true } -desert_rust = { workspace = true } lazy_static = { workspace = true } -poem-openapi = { workspace = true, optional = true } -prost = { workspace = true } -prost-types = { workspace = true } semver = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } -tonic = { workspace = true } -tonic-prost = { workspace = true } uuid = { workspace = true } - -[build-dependencies] -cargo_metadata = { workspace = true } -miette = { workspace = true } -protox = { workspace = true } -tonic-prost-build = { workspace = true } +wasm-wave = { workspace = true } [dev-dependencies] test-r = { workspace = true } diff --git a/rib-core/build.rs b/rib-core/build.rs deleted file mode 100644 index 0b7dcc9..0000000 --- a/rib-core/build.rs +++ /dev/null @@ -1,52 +0,0 @@ -use cargo_metadata::MetadataCommand; -use miette::miette; -use protox::prost::Message; -use std::env; -use std::path::PathBuf; - -fn main() -> Result<(), Box> { - let golem_wasm_root = find_package_root("golem-wasm"); - - let file_descriptors = protox::compile( - [ - "proto/golem/rib/compiler_output.proto", - "proto/golem/rib/expr.proto", - "proto/golem/rib/function_name.proto", - "proto/golem/rib/instance_type.proto", - "proto/golem/rib/ir.proto", - "proto/golem/rib/rib_byte_code.proto", - "proto/golem/rib/rib_input.proto", - "proto/golem/rib/rib_output.proto", - "proto/golem/rib/type_name.proto", - "proto/golem/rib/worker_functions_in_rib.proto", - ], - [&format!("{golem_wasm_root}/proto"), &"proto".to_string()], - )?; - - let out_dir = PathBuf::from(env::var("OUT_DIR")?); - let fd_path = out_dir.join("services.bin"); - - std::fs::write(fd_path, file_descriptors.encode_to_vec())?; - - tonic_prost_build::configure() - .build_server(true) - .extern_path(".wasm.rpc", "::golem_wasm::protobuf") - .include_file("mod.rs") - .compile_fds(file_descriptors) - .map_err(|e| miette!(e))?; - - Ok(()) -} - -fn find_package_root(name: &str) -> String { - let metadata = MetadataCommand::new() - .manifest_path("./Cargo.toml") - .exec() - .unwrap(); - let package = metadata - .packages - .iter() - .find(|p| p.name.as_str() == name) - .unwrap(); - package.manifest_path.parent().unwrap().to_string() -} diff --git a/rib-core/proto/golem/rib/compiler_output.proto b/rib-core/proto/golem/rib/compiler_output.proto deleted file mode 100644 index d6aa387..0000000 --- a/rib-core/proto/golem/rib/compiler_output.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "golem/rib/rib_input.proto"; -import "golem/rib/rib_byte_code.proto"; -import "golem/rib/worker_functions_in_rib.proto"; -import "golem/rib/rib_output.proto"; - -message CompilerOutput { - RibByteCode byte_code = 1; - RibInputType rib_input = 2; - optional WorkerFunctionsInRib worker_invoke_calls = 3; - optional RibOutputType rib_output = 4; -} \ No newline at end of file diff --git a/rib-core/proto/golem/rib/expr.proto b/rib-core/proto/golem/rib/expr.proto deleted file mode 100644 index 34dc897..0000000 --- a/rib-core/proto/golem/rib/expr.proto +++ /dev/null @@ -1,410 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "golem/rib/function_name.proto"; -import "golem/rib/type_name.proto"; - -message Expr { - oneof expr { - LetExpr let = 1; - SelectFieldExpr select_field = 2; - SelectIndexExpr select_index = 3; - SequenceExpr sequence = 4; - RecordExpr record = 5; - TupleExpr tuple = 6; - LiteralExpr literal = 7; - NumberExpr number = 8; - FlagsExpr flags = 9; - IdentifierExpr identifier = 10; - BooleanExpr boolean = 11; - ConcatExpr concat = 12; - MultipleExpr multiple = 13; - NotExpr not = 14; - GreaterThanExpr greater_than = 15; - GreaterThanOrEqualToExpr greater_than_or_equal = 16; - LessThanOrEqualToExpr less_than_or_equal = 17; - EqualToExpr equal_to = 18; - LessThanExpr less_than = 19; - CondExpr cond = 20; - PatternMatchExpr pattern_match = 21; - OptionExpr option = 22; - ResultExpr result = 23; - CallExpr call = 24; - AndExpr and = 25; - GetTagExpr tag = 26; - UnwrapExpr unwrap = 27; - ThrowExpr throw = 28; - OrExpr or = 29; - ListComprehensionExpr list_comprehension = 30; - ListReduceExpr list_reduce = 31; - AddExpr add = 32; - SubtractExpr subtract = 33; - MultiplyExpr multiply = 34; - DivideExpr divide = 35; - LazyInvokeMethodExpr lazy_invoke_method = 36; - RangeExpr range = 37; - SelectIndexExprV1 select_index_v1 = 38; - LengthExpr length = 39; - GenerateWorkerNameExpr generate_worker_name = 40; - } -} - -message RangeExpr { - oneof range_expr { - RangeFrom range_from = 2; - Range range = 5; - RangeInclusive range_inclusive = 6; - } -} - -message LengthExpr { - Expr expr = 1; -} - -message Range { - Expr from = 1; - Expr to = 2; -} - -message RangeFrom { - Expr from = 1; -} - -message RangeInclusive { - Expr from = 1; - Expr to = 2; -} - -message LetExpr { - string name = 1; - Expr expr = 2; - optional TypeName type_name = 3; -} - -message SelectFieldExpr { - string field = 1; - Expr expr = 2; - optional TypeName type_name = 3; -} - -message SelectIndexExpr { - uint64 index = 1; - Expr expr = 2; - optional TypeName type_name = 3; -} - -message SelectIndexExprV1 { - Expr index = 1; - Expr expr = 2; - optional TypeName type_name = 3; -} - -message SequenceExpr { - repeated Expr exprs = 1; - optional TypeName type_name = 2; -} - -message RecordExpr { - repeated RecordFieldExpr fields = 1; -} - -message RecordFieldExpr { - string name = 1; - Expr expr = 2; -} - -message ThrowExpr { - string message = 1; -} - -message GenerateWorkerNameExpr{} - -message TupleExpr { - repeated Expr exprs = 1; -} - -message LiteralExpr { - string value = 1; -} - -message NumberExpr { - optional double float = 1; - optional TypeName type_name = 2; - optional string number = 3; -} - -message FlagsExpr { - repeated string values = 1; -} - -message IdentifierExpr { - string name = 1; - optional TypeName type_name = 2; -} - -message BooleanExpr { - bool value = 1; -} - -message ConcatExpr { - repeated Expr exprs = 1; -} - -message MultipleExpr { - repeated Expr exprs = 1; -} - -message NotExpr { - Expr expr = 1; -} - -message GetTagExpr { - Expr expr = 1; -} - -message UnwrapExpr { - Expr expr = 1; -} - -message GreaterThanExpr { - Expr left = 1; - Expr right = 2; -} - -message AndExpr { - Expr left = 1; - Expr right = 2; -} - -message OrExpr { - Expr left = 1; - Expr right = 2; -} - -message GreaterThanOrEqualToExpr { - Expr left = 1; - Expr right = 2; -} - -message LessThanOrEqualToExpr { - Expr left = 1; - Expr right = 2; -} - -message EqualToExpr { - Expr left = 1; - Expr right = 2; -} - -message LessThanExpr { - Expr left = 1; - Expr right = 2; -} - -message AddExpr { - Expr left = 1; - Expr right = 2; -} - -message MultiplyExpr { - Expr left = 1; - Expr right = 2; -} - -message SubtractExpr { - Expr left = 1; - Expr right = 2; -} - -message DivideExpr { - Expr left = 1; - Expr right = 2; -} - -message CondExpr { - Expr left = 1; - Expr cond = 2; - Expr right = 3; -} - -message PatternMatchExpr { - Expr expr = 1; - repeated MatchArm patterns = 2; -} - -message OptionExpr { - optional Expr expr = 1; - optional TypeName type_name = 2; -} - -message ResultExpr { - oneof result { - Expr ok = 1; - Expr err = 2; - } - optional TypeName type_name = 3; -} - -message CallExpr { - optional InvocationName name = 1; - repeated Expr params = 2; - optional CallType call_type = 3; - optional string generic_type_parameter = 4; -} - -message LazyInvokeMethodExpr { - golem.rib.Expr lhs = 1; - string method = 2; - optional string generic_type_parameter = 3; - repeated golem.rib.Expr args = 4; -} - -message CallType { - oneof name { - golem.rib.DynamicParsedFunctionName parsed = 1; - string variant_constructor = 2; - string enum_constructor = 3; - golem.rib.InstanceCreationType instance_creation = 4; - } -} - -message ComponentDependencyKey { - string component_name = 1; - UUID value = 2; - optional string root_package_name = 3; - optional string root_package_version = 4; - uint64 component_revision = 5; -} - -message InstanceCreationType { - oneof kind { - WorkerInstance worker = 1; - ResourceInstanceWithWorkerName resource = 2; - } -} - -message WorkerInstance { - optional golem.rib.Expr worker_name = 1; - optional ComponentDependencyKey component = 2; -} - -message ResourceInstanceWithWorkerName { - optional golem.rib.Expr worker_name = 1; - golem.rib.FullyQualifiedResourceConstructor resource_name = 2; - optional ComponentDependencyKey component = 3; - -} - -message FullyQualifiedResourceConstructor { - optional PackageName package_name = 1; - optional InterfaceName interface_name = 2; - string resource_name = 3; -} - -message PackageName { - string namespace = 1; - string package_name = 2; - optional string version = 3; -} - -message InterfaceName { - string name = 1; - optional string version = 2; -} - -/** Legacy call-type that holds fully formed function names and not dynamic functions. This is kept for backward compatibility */ -message InvocationName { - oneof name { - golem.rib.ParsedFunctionName parsed = 1; - string variant_constructor = 2; - string enum_constructor = 3; - } -} - -message MatchArm { - ArmPattern pattern = 1; - Expr expr = 2; -} - -message ArmPattern { - oneof pattern { - WildCardArmPattern wild_card = 1; - AsArmPattern as = 2; - ConstructorArmPattern constructor = 3; - LiteralArmPattern literal = 4; - TupleConstructorArmPattern tuple_constructor = 5; - ListConstructorArmPattern list_constructor = 6; - RecordConstructorArmPattern record_constructor = 7; - } -} - -message WildCardArmPattern { - -} - -message AsArmPattern { - string name = 1; - ArmPattern pattern = 2; -} - -message ConstructorArmPattern { - string name = 1; - repeated ArmPattern patterns = 2; -} - -message TupleConstructorArmPattern { - repeated ArmPattern patterns = 1; -} - -message ListConstructorArmPattern { - repeated ArmPattern patterns = 1; -} - -message RecordConstructorArmPattern { - repeated RecordFieldArmPattern fields = 1; -} - -message RecordFieldArmPattern { - string name = 1; - ArmPattern pattern = 2; -} - - -message LiteralArmPattern { - Expr expr = 1; -} - -message DynamicParsedFunctionName { - golem.rib.ParsedFunctionSite site = 1; - DynamicParsedFunctionReference function = 2; -} - -message DynamicParsedFunctionReference { - oneof function_reference { - golem.rib.FunctionFunctionReference function = 1; - golem.rib.RawResourceConstructorFunctionReference raw_resource_constructor = 2; - golem.rib.RawResourceDropFunctionReference raw_resource_drop = 3; - golem.rib.RawResourceMethodFunctionReference raw_resource_method = 4; - golem.rib.RawResourceStaticMethodFunctionReference raw_resource_static_method = 5; - } -} - -message ListComprehensionExpr { - string iterated_variable = 1; - Expr iterable_expr = 2; - Expr yield_expr = 3; -} - -message ListReduceExpr { - string reduce_variable = 1; - string iterated_variable = 2; - Expr iterable_expr = 3; - Expr init_value_expr = 4; - Expr yield_expr = 5; -} - -message UUID { - uint64 high_bits = 1; - uint64 low_bits = 2; -} diff --git a/rib-core/proto/golem/rib/function_name.proto b/rib-core/proto/golem/rib/function_name.proto deleted file mode 100644 index 9c63be7..0000000 --- a/rib-core/proto/golem/rib/function_name.proto +++ /dev/null @@ -1,72 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -message ParsedFunctionName { - ParsedFunctionSite site = 1; - ParsedFunctionReference function = 2; -} - -message ParsedFunctionSite { - oneof site { - GlobalFunctionSite global = 1; - InterfaceFunctionSite interface = 2; - PackageInterfaceFunctionSite package_interface = 3; - } -} - -message GlobalFunctionSite { - -} - -message InterfaceFunctionSite { - string name = 1; -} - -message PackageInterfaceFunctionSite { - string namespace = 1; - string package = 2; - string interface = 3; - SemVersion version = 4; -} - -message SemVersion { - uint64 major = 1; - uint64 minor = 2; - uint64 patch = 3; - string pre = 4; - string build = 5; -} - -message ParsedFunctionReference { - oneof function_reference { - FunctionFunctionReference function = 1; - RawResourceConstructorFunctionReference raw_resource_constructor = 2; - RawResourceDropFunctionReference raw_resource_drop = 3; - RawResourceMethodFunctionReference raw_resource_method = 4; - RawResourceStaticMethodFunctionReference raw_resource_static_method = 5; - } -} - -message FunctionFunctionReference { - string function = 1; -} - -message RawResourceConstructorFunctionReference { - string resource = 1; -} - -message RawResourceDropFunctionReference { - string resource = 1; -} - -message RawResourceMethodFunctionReference { - string resource = 1; - string method = 2; -} - -message RawResourceStaticMethodFunctionReference { - string resource = 1; - string method = 2; -} - diff --git a/rib-core/proto/golem/rib/instance_type.proto b/rib-core/proto/golem/rib/instance_type.proto deleted file mode 100644 index b0646f1..0000000 --- a/rib-core/proto/golem/rib/instance_type.proto +++ /dev/null @@ -1,96 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "golem/rib/expr.proto"; -import "wasm/rpc/type.proto"; - -message FunctionDictionary { - repeated FunctionEntry map = 1; -} - -message FunctionEntry { - FunctionNameType key = 1; - FunctionType value = 2; -} - -message ResourceMethodDictionary { - repeated ResourceMethodEntry map = 1; -} - -message ResourceMethodEntry { - FullyQualifiedResourceMethod key = 1; - FunctionType value = 2; -} - -message InstanceType { - oneof instance { - GlobalInstance global = 1; - PackageInstance package = 2; - InterfaceInstance interface = 3; - PackageInterfaceInstance package_interface = 4; - ResourceInstance resource = 5; - } -} - -message GlobalInstance { - golem.rib.Expr worker_name = 1; - FunctionDictionary functions_global = 2; -} - -message PackageInstance { - golem.rib.Expr worker_name = 1; - golem.rib.PackageName package_name = 2; - FunctionDictionary functions_in_package = 3; -} - -message InterfaceInstance { - golem.rib.Expr worker_name = 1; - golem.rib.InterfaceName interface_name = 2; - FunctionDictionary functions_in_interface = 3; -} - -message PackageInterfaceInstance { - golem.rib.Expr worker_name = 1; - golem.rib.PackageName package_name = 2; - golem.rib.InterfaceName interface_name = 3; - FunctionDictionary functions_in_package_interface = 4; -} - -message ResourceInstance { - golem.rib.Expr worker_name = 1; - optional golem.rib.PackageName package_name = 2; - optional golem.rib.InterfaceName interface_name = 3; - string resource_constructor = 4; - repeated golem.rib.Expr resource_args = 5; - ResourceMethodDictionary resource_method_dict = 6; -} - -// Function-related messages -message FunctionNameType { - oneof function_name { - string variant_name = 1; - string enum_name = 2; - FullyQualifiedFunctionName function = 3; - FullyQualifiedResourceConstructor resource_constructor = 4; - FullyQualifiedResourceMethod resource_method = 5; - } -} - -message FullyQualifiedFunctionName { - optional golem.rib.PackageName package_name = 1; - optional golem.rib.InterfaceName interface_name = 2; - string function_name = 3; -} - -message FullyQualifiedResourceMethod { - optional golem.rib.PackageName package_name = 1; - optional golem.rib.InterfaceName interface_name = 2; - string resource_name = 3; - string method_name = 4; -} - -message FunctionType { - repeated wasm.rpc.Type parameter_types = 1; - optional wasm.rpc.Type return_type = 2; -} diff --git a/rib-core/proto/golem/rib/ir.proto b/rib-core/proto/golem/rib/ir.proto deleted file mode 100644 index 5cd0603..0000000 --- a/rib-core/proto/golem/rib/ir.proto +++ /dev/null @@ -1,223 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "wasm/rpc/type.proto"; -import "wasm/rpc/value_and_type.proto"; -import "golem/rib/function_name.proto"; -import "golem/rib/expr.proto"; - - -message RibIR { - oneof instruction { - wasm.rpc.ValueAndType push_lit = 1; - VariableId assign_var = 2; - VariableId load_var = 3; - wasm.rpc.Type create_and_push_record = 4; - string update_record = 5; - PushListInstruction push_list = 6; - wasm.rpc.Type create_some = 7; - PushNoneInstruction create_none = 8; - wasm.rpc.Type create_ok_result = 9; - wasm.rpc.Type create_err_result = 10; - string select_field = 11; - uint64 select_index = 12; - EqualTo equal_to = 13; - GreaterThan greater_than = 14; - LessThan less_than = 15; - GreaterThanOrEqualTo greater_than_or_equal_to = 16; - LessThanOrEqualTo less_than_or_equal_to = 17; - JumpInstruction jump_if_false = 18; - JumpInstruction jump = 19; - JumpInstruction label = 20; - wasm.rpc.Type deconstruct = 21; - InvokeFunctionInstruction invoke_function = 22; - string throw = 23; - wasm.rpc.ValueAndType push_flag = 24; - GetTag get_tag = 25; - VariantConstructionInstruction variant_construction = 26; - PushTupleInstruction push_tuple = 27; - Negate negate = 28; - ConcatInstruction concat = 29; - EnumConstructionInstruction enum_construction = 30; - And and = 31; - CreateFunctionNameInstruction create_function_name = 32; - Or or = 33; - ListToIterator list_to_iterator = 34; - CreateSink create_sink = 35; - AdvanceIterator advance_iterator = 36; - SinkToList sink_to_list = 37; - PushToSink push_to_sink = 38; - wasm.rpc.Type plus = 39; - wasm.rpc.Type minus = 40; - wasm.rpc.Type multiply = 41; - wasm.rpc.Type divide = 42; - IsEmpty is_empty = 43; - SelectIndexV1 select_index_v1 = 44; - Length length = 45; - GenerateWorkerName generate_worker_name = 46; - } -} - -message Length {} - -message GenerateWorkerName { - optional VariableId variable_id = 1; -} - -message SelectIndexV1{} - -message VariableId { - oneof variable_id { - Global global = 1; - Local local = 2; - MatchIdentifier match_identifier = 3; - ListComprehensionIdentifier list_comprehension_identifier = 4; - ListAggregationIdentifier list_aggregation_identifier = 5; - } -} - -message Global { - string name = 1; -} - -message ListComprehensionIdentifier { - string name = 1; -} - -message ListAggregationIdentifier { - string name = 1; -} - - -message MatchIdentifier { - string name = 1; - uint32 match_arm_index = 2; -} - -message Local { - string name = 1; - optional uint64 id = 2; -} - -message PushListInstruction { - wasm.rpc.Type list_type = 1; - uint64 list_size = 2; -} - -message ConcatInstruction { - uint64 arg_size = 1; -} - -message PushTupleInstruction { - wasm.rpc.Type tuple_type = 1; - uint64 tuple_size = 2; -} - -message PushNoneInstruction { - optional wasm.rpc.Type none_type = 1; -} - -message UpdateInstruction {} - -message JumpInstruction { - uint64 instruction_id = 1; -} - -message InvokeFunctionInstruction { - golem.rib.ComponentDependencyKey component = 1; - uint64 argument_count = 2; - wasm.rpc.Type return_type = 3; - InstanceVariable instance_variable = 4; - -} - -message InstanceVariable { - oneof kind { - WitWorker worker = 1; - WitResource resource = 2; - } -} - -message WitWorker { - golem.rib.VariableId variable_id = 1; -} - -message WitResource { - golem.rib.VariableId variable_id = 1; -} - -enum WorkerNamePresence { - PRESENT = 0; - ABSENT = 1; -} - -message VariantConstructionInstruction { - string variant_name = 1; - wasm.rpc.Type return_type = 3; -} - -message EnumConstructionInstruction { - string enum_name = 1; - wasm.rpc.Type return_type = 2; -} - -message CreateFunctionNameInstruction { - golem.rib.ParsedFunctionSite site = 1; - FunctionReferenceType function_reference_details = 2; -} - - -message EqualTo {} -message GreaterThan {} -message LessThan {} -message GreaterThanOrEqualTo {} -message LessThanOrEqualTo {} -message GetTag {} -message Negate {} -message And {} -message Or {} -message IsEmpty{} - -message FunctionReferenceType { - oneof type { - Function function = 1; - RawResourceConstructor raw_resource_constructor = 2; - RawResourceDrop raw_resource_drop = 3; - RawResourceMethod raw_resource_method = 4; - RawResourceStaticMethod raw_resource_static_method = 5; - } -} - -message Function { - string name = 1; -} - -message RawResourceConstructor { - string resource_name = 1; -} - -message RawResourceDrop { - string resource_name = 1; -} - -message RawResourceMethod { - string resource_name = 1; - string method_name = 2; -} - -message RawResourceStaticMethod { - string resource_name = 1; - string method_name = 2; -} - -message SinkToList {} - -message PushToSink {} - -message AdvanceIterator {} - -message CreateSink { - wasm.rpc.Type list_type = 1; -} -message ListToIterator {} diff --git a/rib-core/proto/golem/rib/rib_byte_code.proto b/rib-core/proto/golem/rib/rib_byte_code.proto deleted file mode 100644 index cb9c795..0000000 --- a/rib-core/proto/golem/rib/rib_byte_code.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "golem/rib/ir.proto"; - -message RibByteCode { - repeated RibIR instructions = 1; -} diff --git a/rib-core/proto/golem/rib/rib_input.proto b/rib-core/proto/golem/rib/rib_input.proto deleted file mode 100644 index 244e524..0000000 --- a/rib-core/proto/golem/rib/rib_input.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "wasm/rpc/type.proto"; - -message RibInputType { - map types = 1; -} \ No newline at end of file diff --git a/rib-core/proto/golem/rib/rib_output.proto b/rib-core/proto/golem/rib/rib_output.proto deleted file mode 100644 index 94233d8..0000000 --- a/rib-core/proto/golem/rib/rib_output.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "wasm/rpc/type.proto"; - -message RibOutputType { - wasm.rpc.Type type = 1; -} \ No newline at end of file diff --git a/rib-core/proto/golem/rib/type_name.proto b/rib-core/proto/golem/rib/type_name.proto deleted file mode 100644 index 182ffe7..0000000 --- a/rib-core/proto/golem/rib/type_name.proto +++ /dev/null @@ -1,79 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -// Define the TypeName enum to represent simple types. -enum BasicTypeName { - BOOL = 0; - S8 = 1; - U8 = 2; - S16 = 3; - U16 = 4; - S32 = 5; - U32 = 6; - S64 = 7; - U64 = 8; - F32 = 9; - F64 = 10; - CHR = 11; - STR = 12; -} - -message TypeName { - oneof kind { - BasicTypeName basic_type = 1; - ListType list_type = 2; - TupleType tuple_type = 3; - OptionType option_type = 4; - ResultType result_type = 5; - EnumType enum_type = 6; - FlagType flag_type = 7; - RecordType record_type = 8; - VariantType variant_type = 9; - - } -} - -message ListType { - TypeName inner_type = 1; -} - -message TupleType { - repeated TypeName types = 1; -} - -message OptionType { - TypeName inner_type = 1; -} - -message ResultType { - optional TypeName ok_type = 1; - optional TypeName err_type = 2; -} - -message EnumType { - repeated string cases = 1; -} - -message FlagType { - repeated string flags = 1; -} - -message RecordType { - repeated KeyValue fields = 1; -} - -message KeyValue { - string key = 1; - TypeName value = 2; -} - -message VariantType { - repeated VariantCase cases = 2; -} - -message VariantCase { - string case_name = 1; - optional TypeName variant_arg = 2; -} - diff --git a/rib-core/proto/golem/rib/worker_functions_in_rib.proto b/rib-core/proto/golem/rib/worker_functions_in_rib.proto deleted file mode 100644 index d03667e..0000000 --- a/rib-core/proto/golem/rib/worker_functions_in_rib.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -package golem.rib; - -import "wasm/rpc/type.proto"; -import "golem/rib/instance_type.proto"; - -message WorkerFunctionsInRib { - repeated WorkerFunctionType function_calls = 1; -} - -message WorkerFunctionType { - golem.rib.FunctionNameType function_name = 1; - repeated wasm.rpc.Type parameter_types = 2; - optional wasm.rpc.Type return_type = 3; -} diff --git a/rib-core/regression_tests/lib.rs b/rib-core/regression_tests/lib.rs index 10e0634..7a0edf7 100644 --- a/rib-core/regression_tests/lib.rs +++ b/rib-core/regression_tests/lib.rs @@ -2,9 +2,9 @@ test_r::enable!(); use test_r::test; -use golem_wasm::analysis::analysed_type::{bool, f32, f64, field, record, s16, s32, str, u64, u8}; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::ValueAndType; +use rib::analysis::analysed_type::{bool, f32, f64, field, record, s16, s32, str, u64, u8}; +use rib::analysis::AnalysedType; +use rib::ValueAndType; use rib::{ EvaluatedFnArgs, EvaluatedFqFn, EvaluatedWorkerName, Expr, Interpreter, RibCompiler, RibCompilerConfig, RibComponentFunctionInvoke, RibFunctionInvokeResult, RibInput, @@ -699,7 +699,7 @@ mod component_metadata { mod function_metadata { use crate::{data_types, test_utils}; - use golem_wasm::analysis::AnalysedExport; + use rib::analysis::AnalysedExport; pub(crate) fn function_unit_response() -> Vec { test_utils::get_function_component_metadata( @@ -1156,11 +1156,11 @@ mod function_metadata { } mod data_types { - use golem_wasm::analysis::analysed_type::{ + use rib::analysis::analysed_type::{ bool, case, chr, f32, f64, field, flags, list, option, r#enum, record, result, s16, s32, s64, s8, str, tuple, u16, u32, u64, u8, unit_case, variant, }; - use golem_wasm::analysis::*; + use rib::analysis::*; // Result pub(crate) fn result_of_str_type() -> AnalysedType { @@ -1416,7 +1416,7 @@ mod data_types { mod mock_data { use crate::{data_types, test_utils}; - use golem_wasm::ValueAndType; + use rib::ValueAndType; pub(crate) fn ok_of_str() -> ValueAndType { test_utils::get_value_and_type(&data_types::result_of_str_type(), "ok(\"foo\")") @@ -1716,9 +1716,9 @@ mod mock_interpreter { }; use async_trait::async_trait; - use golem_wasm::analysis::analysed_type::{field, record, str}; - use golem_wasm::analysis::AnalysedType; - use golem_wasm::ValueAndType; + use rib::analysis::analysed_type::{field, record, str}; + use rib::analysis::AnalysedType; + use rib::ValueAndType; use rib::{ComponentDependencyKey, DefaultWorkerNameGenerator, InstructionId}; use std::collections::HashMap; use std::sync::Arc; @@ -1940,14 +1940,14 @@ mod mock_interpreter { } mod test_utils { - use golem_wasm::analysis::*; - use golem_wasm::ValueAndType; + use rib::analysis::*; + use rib::ValueAndType; pub(crate) fn get_value_and_type( analysed_type: &AnalysedType, wasm_wave_str: &str, ) -> ValueAndType { - let result = golem_wasm::parse_value_and_type(analysed_type, wasm_wave_str); + let result = rib::parse_value_and_type(analysed_type, wasm_wave_str); match result { Ok(value) => value, @@ -1956,7 +1956,7 @@ mod test_utils { } pub(crate) fn convert_value_and_type_to_str(value: &ValueAndType) -> String { - golem_wasm::print_value_and_type(value).unwrap() + rib::print_value_and_type(value).unwrap() } pub(crate) fn get_function_component_metadata( diff --git a/rib-core/src/analysis/mod.rs b/rib-core/src/analysis/mod.rs new file mode 100644 index 0000000..8177ff8 --- /dev/null +++ b/rib-core/src/analysis/mod.rs @@ -0,0 +1,2 @@ +mod model; +pub use model::*; diff --git a/rib-core/src/analysis/model.rs b/rib-core/src/analysis/model.rs new file mode 100644 index 0000000..d0e43ff --- /dev/null +++ b/rib-core/src/analysis/model.rs @@ -0,0 +1,571 @@ +use std::fmt::{Display, Formatter}; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "type")] +pub enum AnalysedExport { + Function(AnalysedFunction), + Instance(AnalysedInstance), +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct AnalysedFunction { + pub name: String, + pub parameters: Vec, + pub result: Option, +} + +impl AnalysedFunction { + pub fn is_constructor(&self) -> bool { + self.name.starts_with("[constructor]") + && self.result.is_some() + && matches!( + &self.result.as_ref().unwrap().typ, + AnalysedType::Handle(TypeHandle { + mode: AnalysedResourceMode::Owned, + .. + }) + ) + } + + pub fn is_method(&self) -> bool { + self.name.starts_with("[method]") + && !self.parameters.is_empty() + && matches!( + &self.parameters[0].typ, + AnalysedType::Handle(TypeHandle { + mode: AnalysedResourceMode::Borrowed, + .. + }) + ) + } + + pub fn is_static_method(&self) -> bool { + self.name.starts_with("[static]") + } +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct AnalysedInstance { + pub name: String, + pub functions: Vec, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeResult { + pub name: Option, + pub owner: Option, + pub ok: Option>, + pub err: Option>, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct NameTypePair { + pub name: String, + pub typ: AnalysedType, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct NameOptionTypePair { + pub name: String, + pub typ: Option, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeVariant { + pub name: Option, + pub owner: Option, + pub cases: Vec, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeOption { + pub name: Option, + pub owner: Option, + pub inner: Box, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeEnum { + pub name: Option, + pub owner: Option, + pub cases: Vec, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeFlags { + pub name: Option, + pub owner: Option, + pub names: Vec, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeRecord { + pub name: Option, + pub owner: Option, + pub fields: Vec, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeTuple { + pub name: Option, + pub owner: Option, + pub items: Vec, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeList { + pub name: Option, + pub owner: Option, + pub inner: Box, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeStr; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeChr; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeF64; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeF32; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeU64; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeS64; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeU32; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeS32; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeU16; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeS16; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeU8; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeS8; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeBool; + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct TypeHandle { + pub name: Option, + pub owner: Option, + pub resource_id: AnalysedResourceId, + pub mode: AnalysedResourceMode, +} + +#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[serde(tag = "type")] +pub enum AnalysedType { + Variant(TypeVariant), + Result(TypeResult), + Option(TypeOption), + Enum(TypeEnum), + Flags(TypeFlags), + Record(TypeRecord), + Tuple(TypeTuple), + List(TypeList), + Str(TypeStr), + Chr(TypeChr), + F64(TypeF64), + F32(TypeF32), + U64(TypeU64), + S64(TypeS64), + U32(TypeU32), + S32(TypeS32), + U16(TypeU16), + S16(TypeS16), + U8(TypeU8), + S8(TypeS8), + Bool(TypeBool), + Handle(TypeHandle), +} + +impl AnalysedType { + pub fn name(&self) -> Option<&str> { + match self { + AnalysedType::Variant(typ) => typ.name.as_deref(), + AnalysedType::Result(typ) => typ.name.as_deref(), + AnalysedType::Option(typ) => typ.name.as_deref(), + AnalysedType::Enum(typ) => typ.name.as_deref(), + AnalysedType::Flags(typ) => typ.name.as_deref(), + AnalysedType::Record(typ) => typ.name.as_deref(), + AnalysedType::Tuple(typ) => typ.name.as_deref(), + AnalysedType::List(typ) => typ.name.as_deref(), + AnalysedType::Handle(typ) => typ.name.as_deref(), + _ => None, + } + } + + pub fn with_optional_name(self, name: Option) -> Self { + match self { + AnalysedType::Variant(mut typ) => { + typ.name = name; + AnalysedType::Variant(typ) + } + AnalysedType::Result(mut typ) => { + typ.name = name; + AnalysedType::Result(typ) + } + AnalysedType::Option(mut typ) => { + typ.name = name; + AnalysedType::Option(typ) + } + AnalysedType::Enum(mut typ) => { + typ.name = name; + AnalysedType::Enum(typ) + } + AnalysedType::Flags(mut typ) => { + typ.name = name; + AnalysedType::Flags(typ) + } + AnalysedType::Record(mut typ) => { + typ.name = name; + AnalysedType::Record(typ) + } + AnalysedType::Tuple(mut typ) => { + typ.name = name; + AnalysedType::Tuple(typ) + } + AnalysedType::List(mut typ) => { + typ.name = name; + AnalysedType::List(typ) + } + AnalysedType::Handle(mut typ) => { + typ.name = name; + AnalysedType::Handle(typ) + } + _ => self, + } + } + + pub fn named(self, name: impl AsRef) -> Self { + self.with_optional_name(Some(name.as_ref().to_string())) + } + + pub fn owner(&self) -> Option<&str> { + match self { + AnalysedType::Variant(typ) => typ.owner.as_deref(), + AnalysedType::Result(typ) => typ.owner.as_deref(), + AnalysedType::Option(typ) => typ.owner.as_deref(), + AnalysedType::Enum(typ) => typ.owner.as_deref(), + AnalysedType::Flags(typ) => typ.owner.as_deref(), + AnalysedType::Record(typ) => typ.owner.as_deref(), + AnalysedType::Tuple(typ) => typ.owner.as_deref(), + AnalysedType::List(typ) => typ.owner.as_deref(), + AnalysedType::Handle(typ) => typ.owner.as_deref(), + _ => None, + } + } + + pub fn with_optional_owner(self, owner: Option) -> Self { + match self { + AnalysedType::Variant(mut typ) => { + typ.owner = owner; + AnalysedType::Variant(typ) + } + AnalysedType::Result(mut typ) => { + typ.owner = owner; + AnalysedType::Result(typ) + } + AnalysedType::Option(mut typ) => { + typ.owner = owner; + AnalysedType::Option(typ) + } + AnalysedType::Enum(mut typ) => { + typ.owner = owner; + AnalysedType::Enum(typ) + } + AnalysedType::Flags(mut typ) => { + typ.owner = owner; + AnalysedType::Flags(typ) + } + AnalysedType::Record(mut typ) => { + typ.owner = owner; + AnalysedType::Record(typ) + } + AnalysedType::Tuple(mut typ) => { + typ.owner = owner; + AnalysedType::Tuple(typ) + } + AnalysedType::List(mut typ) => { + typ.owner = owner; + AnalysedType::List(typ) + } + AnalysedType::Handle(mut typ) => { + typ.owner = owner; + AnalysedType::Handle(typ) + } + _ => self, + } + } + + pub fn owned(self, owner: impl AsRef) -> Self { + self.with_optional_owner(Some(owner.as_ref().to_string())) + } + + pub fn contains_handle(&self) -> bool { + match self { + AnalysedType::Handle(_) => true, + AnalysedType::Variant(typ) => typ + .cases + .iter() + .any(|case| case.typ.as_ref().is_some_and(|t| t.contains_handle())), + AnalysedType::Result(typ) => { + typ.ok.as_ref().is_some_and(|t| t.contains_handle()) + || typ.err.as_ref().is_some_and(|t| t.contains_handle()) + } + AnalysedType::Option(typ) => typ.inner.contains_handle(), + AnalysedType::Record(typ) => typ.fields.iter().any(|f| f.typ.contains_handle()), + AnalysedType::Tuple(typ) => typ.items.iter().any(|t| t.contains_handle()), + AnalysedType::List(typ) => typ.inner.contains_handle(), + _ => false, + } + } +} + +impl Display for AnalysedType { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + AnalysedType::Variant(_) => write!(f, "Variant"), + AnalysedType::Result(_) => write!(f, "Result"), + AnalysedType::Option(_) => write!(f, "Option"), + AnalysedType::Enum(_) => write!(f, "Enum"), + AnalysedType::Flags(_) => write!(f, "Flags"), + AnalysedType::Record(_) => write!(f, "Record"), + AnalysedType::Tuple(_) => write!(f, "Tuple"), + AnalysedType::List(_) => write!(f, "List"), + AnalysedType::Str(_) => write!(f, "Str"), + AnalysedType::Chr(_) => write!(f, "Chr"), + AnalysedType::F64(_) => write!(f, "F64"), + AnalysedType::F32(_) => write!(f, "F32"), + AnalysedType::U64(_) => write!(f, "U64"), + AnalysedType::S64(_) => write!(f, "S64"), + AnalysedType::U32(_) => write!(f, "U32"), + AnalysedType::S32(_) => write!(f, "S32"), + AnalysedType::U16(_) => write!(f, "U16"), + AnalysedType::S16(_) => write!(f, "S16"), + AnalysedType::U8(_) => write!(f, "U8"), + AnalysedType::S8(_) => write!(f, "S8"), + AnalysedType::Bool(_) => write!(f, "Bool"), + AnalysedType::Handle(_) => write!(f, "Handle"), + } + } +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub enum AnalysedResourceMode { + Owned, + Borrowed, +} + +#[derive(Debug, Copy, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct AnalysedResourceId(pub u64); + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct AnalysedFunctionParameter { + pub name: String, + pub typ: AnalysedType, +} + +#[derive(Debug, Clone, PartialEq, Hash, Eq, serde::Serialize, serde::Deserialize)] +pub struct AnalysedFunctionResult { + pub typ: AnalysedType, +} + +pub mod analysed_type { + use super::*; + + pub fn field(name: &str, typ: AnalysedType) -> NameTypePair { + NameTypePair { + name: name.to_string(), + typ, + } + } + + pub fn case(name: &str, typ: AnalysedType) -> NameOptionTypePair { + NameOptionTypePair { + name: name.to_string(), + typ: Some(typ), + } + } + + pub fn opt_case(name: &str, typ: Option) -> NameOptionTypePair { + NameOptionTypePair { + name: name.to_string(), + typ, + } + } + + pub fn unit_case(name: &str) -> NameOptionTypePair { + NameOptionTypePair { + name: name.to_string(), + typ: None, + } + } + + pub fn bool() -> AnalysedType { + AnalysedType::Bool(TypeBool) + } + + pub fn s8() -> AnalysedType { + AnalysedType::S8(TypeS8) + } + + pub fn s16() -> AnalysedType { + AnalysedType::S16(TypeS16) + } + + pub fn s32() -> AnalysedType { + AnalysedType::S32(TypeS32) + } + + pub fn s64() -> AnalysedType { + AnalysedType::S64(TypeS64) + } + + pub fn u8() -> AnalysedType { + AnalysedType::U8(TypeU8) + } + + pub fn u16() -> AnalysedType { + AnalysedType::U16(TypeU16) + } + + pub fn u32() -> AnalysedType { + AnalysedType::U32(TypeU32) + } + + pub fn u64() -> AnalysedType { + AnalysedType::U64(TypeU64) + } + + pub fn f32() -> AnalysedType { + AnalysedType::F32(TypeF32) + } + + pub fn f64() -> AnalysedType { + AnalysedType::F64(TypeF64) + } + + pub fn chr() -> AnalysedType { + AnalysedType::Chr(TypeChr) + } + + pub fn str() -> AnalysedType { + AnalysedType::Str(TypeStr) + } + + pub fn list(inner: AnalysedType) -> AnalysedType { + AnalysedType::List(TypeList { + name: None, + owner: None, + inner: Box::new(inner), + }) + } + + pub fn option(inner: AnalysedType) -> AnalysedType { + AnalysedType::Option(TypeOption { + name: None, + owner: None, + inner: Box::new(inner), + }) + } + + pub fn flags(names: &[&str]) -> AnalysedType { + AnalysedType::Flags(TypeFlags { + name: None, + owner: None, + names: names.iter().map(|n| n.to_string()).collect(), + }) + } + + pub fn r#enum(cases: &[&str]) -> AnalysedType { + AnalysedType::Enum(TypeEnum { + name: None, + owner: None, + cases: cases.iter().map(|n| n.to_string()).collect(), + }) + } + + pub fn tuple(items: Vec) -> AnalysedType { + AnalysedType::Tuple(TypeTuple { + name: None, + owner: None, + items, + }) + } + + pub fn result(ok: AnalysedType, err: AnalysedType) -> AnalysedType { + AnalysedType::Result(TypeResult { + name: None, + owner: None, + ok: Some(Box::new(ok)), + err: Some(Box::new(err)), + }) + } + + pub fn result_ok(ok: AnalysedType) -> AnalysedType { + AnalysedType::Result(TypeResult { + name: None, + owner: None, + ok: Some(Box::new(ok)), + err: None, + }) + } + + pub fn result_err(err: AnalysedType) -> AnalysedType { + AnalysedType::Result(TypeResult { + name: None, + owner: None, + ok: None, + err: Some(Box::new(err)), + }) + } + + pub fn unit_result() -> AnalysedType { + AnalysedType::Result(TypeResult { + name: None, + owner: None, + ok: None, + err: None, + }) + } + + pub fn record(fields: Vec) -> AnalysedType { + AnalysedType::Record(TypeRecord { + name: None, + owner: None, + fields, + }) + } + + pub fn variant(cases: Vec) -> AnalysedType { + AnalysedType::Variant(TypeVariant { + name: None, + owner: None, + cases, + }) + } + + pub fn handle(resource_id: AnalysedResourceId, mode: AnalysedResourceMode) -> AnalysedType { + AnalysedType::Handle(TypeHandle { + name: None, + owner: None, + resource_id, + mode, + }) + } +} diff --git a/rib-core/src/call_type.rs b/rib-core/src/call_type.rs index db88a20..82c8e17 100644 --- a/rib-core/src/call_type.rs +++ b/rib-core/src/call_type.rs @@ -14,11 +14,9 @@ use crate::{ComponentDependencyKey, DynamicParsedFunctionName, Expr}; use crate::{FullyQualifiedResourceConstructor, VariableId}; -use desert_rust::BinaryCodec; use std::fmt::Display; -#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub enum CallType { Function { component_info: Option, @@ -36,8 +34,7 @@ pub enum CallType { // InstanceIdentifier holds the variables that are used to identify a worker or resource instance. // Unlike InstanceCreationType, this type can be formed only after the instance is inferred -#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub enum InstanceIdentifier { WitWorker { variable_id: Option, @@ -66,7 +63,7 @@ impl InstanceIdentifier { } } -#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, BinaryCodec)] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub enum InstanceCreationType { // A wit worker instance can be created without another module WitWorker { @@ -170,213 +167,3 @@ impl Display for CallType { } } } - -mod protobuf { - use crate::call_type::{CallType, InstanceCreationType}; - use crate::proto::golem::rib::WorkerInstance; - use crate::FullyQualifiedResourceConstructor; - use crate::{ComponentDependencyKey, DynamicParsedFunctionName, Expr, ParsedFunctionName}; - - impl TryFrom for ComponentDependencyKey { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::ComponentDependencyKey, - ) -> Result { - Ok(ComponentDependencyKey { - component_name: value.component_name, - component_id: value.value.ok_or("Missing component id")?.into(), - component_revision: value.component_revision, - root_package_name: value.root_package_name, - root_package_version: value.root_package_version, - }) - } - } - - impl From for crate::proto::golem::rib::ComponentDependencyKey { - fn from(value: ComponentDependencyKey) -> Self { - crate::proto::golem::rib::ComponentDependencyKey { - component_name: value.component_name, - component_revision: value.component_revision, - value: Some(value.component_id.into()), - root_package_name: value.root_package_name, - root_package_version: value.root_package_version, - } - } - } - - impl TryFrom for InstanceCreationType { - type Error = String; - fn try_from( - value: crate::proto::golem::rib::InstanceCreationType, - ) -> Result { - match value.kind.ok_or("Missing instance creation kind")? { - crate::proto::golem::rib::instance_creation_type::Kind::Worker(worker_instance) => { - let worker_name = worker_instance - .worker_name - .map(|w| Expr::try_from(*w)) - .transpose()? - .map(Box::new); - - Ok(InstanceCreationType::WitWorker { - component_info: None, - worker_name, - }) - } - crate::proto::golem::rib::instance_creation_type::Kind::Resource( - resource_instance, - ) => { - let resource_constructor_proto = resource_instance - .resource_name - .ok_or("Missing resource name")?; - let resource_name = - FullyQualifiedResourceConstructor::try_from(resource_constructor_proto)?; - - let component_info = resource_instance - .component - .map(ComponentDependencyKey::try_from) - .transpose()?; - - Ok(InstanceCreationType::WitResource { - component_info, - module: None, - resource_name, - }) - } - } - } - } - - impl From for crate::proto::golem::rib::InstanceCreationType { - fn from(value: InstanceCreationType) -> Self { - match value { - InstanceCreationType::WitWorker { component_info, .. } => { - crate::proto::golem::rib::InstanceCreationType { - kind: Some(crate::proto::golem::rib::instance_creation_type::Kind::Worker(Box::new(WorkerInstance { - component: component_info.map(crate::proto::golem::rib::ComponentDependencyKey::from), - worker_name: None - }))), - } - } - InstanceCreationType::WitResource { component_info, resource_name, .. } => { - crate::proto::golem::rib::InstanceCreationType { - kind: Some(crate::proto::golem::rib::instance_creation_type::Kind::Resource(Box::new(crate::proto::golem::rib::ResourceInstanceWithWorkerName { - component: component_info.map(crate::proto::golem::rib::ComponentDependencyKey::from), - worker_name: None, - resource_name: Some(crate::proto::golem::rib::FullyQualifiedResourceConstructor::from(resource_name)), - }))), - } - } - } - } - } - - impl TryFrom for CallType { - type Error = String; - fn try_from(value: crate::proto::golem::rib::CallType) -> Result { - let invocation = value.name.ok_or("Missing name of invocation")?; - match invocation { - crate::proto::golem::rib::call_type::Name::Parsed(name) => Ok(CallType::Function { - component_info: None, - function_name: DynamicParsedFunctionName::try_from(name)?, - instance_identifier: None, - }), - crate::proto::golem::rib::call_type::Name::VariantConstructor(name) => { - Ok(CallType::VariantConstructor(name)) - } - crate::proto::golem::rib::call_type::Name::EnumConstructor(name) => { - Ok(CallType::EnumConstructor(name)) - } - - crate::proto::golem::rib::call_type::Name::InstanceCreation(instance_creation) => { - let instance_creation = InstanceCreationType::try_from(*instance_creation)?; - Ok(CallType::InstanceCreation(instance_creation)) - } - } - } - } - - impl From for crate::proto::golem::rib::CallType { - fn from(value: CallType) -> Self { - match value { - CallType::Function { - function_name, - .. - } => crate::proto::golem::rib::CallType { - name: Some(crate::proto::golem::rib::call_type::Name::Parsed( - function_name.into(), - )), - }, - CallType::VariantConstructor(name) => crate::proto::golem::rib::CallType { - name: Some( - crate::proto::golem::rib::call_type::Name::VariantConstructor( - name, - ), - ), - }, - CallType::EnumConstructor(name) => crate::proto::golem::rib::CallType { - name: Some( - crate::proto::golem::rib::call_type::Name::EnumConstructor(name), - ), - }, - CallType::InstanceCreation(instance_creation) => { - match instance_creation { - InstanceCreationType::WitWorker { worker_name , component_info} => { - crate::proto::golem::rib::CallType { - name: Some(crate::proto::golem::rib::call_type::Name::InstanceCreation( - Box::new(crate::proto::golem::rib::InstanceCreationType { - kind: Some(crate::proto::golem::rib::instance_creation_type::Kind::Worker(Box::new(WorkerInstance { - component: component_info.map(crate::proto::golem::rib::ComponentDependencyKey::from), - worker_name: worker_name.map(|w| Box::new(crate::proto::golem::rib::Expr::from(*w))), - }))), - }) - )), - } - } - InstanceCreationType::WitResource { resource_name, component_info, .. } => { - crate::proto::golem::rib::CallType { - name: Some(crate::proto::golem::rib::call_type::Name::InstanceCreation( - Box::new(crate::proto::golem::rib::InstanceCreationType { - kind: Some(crate::proto::golem::rib::instance_creation_type::Kind::Resource(Box::new(crate::proto::golem::rib::ResourceInstanceWithWorkerName { - component: component_info.map(crate::proto::golem::rib::ComponentDependencyKey::from), - worker_name: None, - resource_name: Some(crate::proto::golem::rib::FullyQualifiedResourceConstructor::from(resource_name)), - }))), - }) - )), - } - } - } - } - } - } - } - - // InvocationName is a legacy structure to keep the backward compatibility. - // InvocationName is corresponding to the new CallType and the difference here is, - // InvocationName::Function will always hold a static function name and not a dynamic one - // with Expr representing resource construction parameters - impl TryFrom for CallType { - type Error = String; - fn try_from(value: crate::proto::golem::rib::InvocationName) -> Result { - let invocation = value.name.ok_or("Missing name of invocation")?; - match invocation { - crate::proto::golem::rib::invocation_name::Name::Parsed(name) => { - Ok(CallType::Function { - component_info: None, - instance_identifier: None, - function_name: DynamicParsedFunctionName::parse( - ParsedFunctionName::try_from(name)?.to_string(), - )?, - }) - } - crate::proto::golem::rib::invocation_name::Name::VariantConstructor(name) => { - Ok(CallType::VariantConstructor(name)) - } - crate::proto::golem::rib::invocation_name::Name::EnumConstructor(name) => { - Ok(CallType::EnumConstructor(name)) - } - } - } - } -} diff --git a/rib-core/src/compiler/byte_code.rs b/rib-core/src/compiler/byte_code.rs index 6ca3e30..c2f651f 100644 --- a/rib-core/src/compiler/byte_code.rs +++ b/rib-core/src/compiler/byte_code.rs @@ -16,11 +16,9 @@ use crate::compiler::byte_code::internal::ExprState; use crate::compiler::ir::RibIR; use crate::type_inference::TypeHint; use crate::{Expr, InferredExpr, InstructionId}; -use desert_rust::BinaryCodec; use std::fmt::{Display, Formatter}; -#[derive(Debug, Clone, Default, PartialEq, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, Default, PartialEq)] pub struct RibByteCode { pub instructions: Vec, } @@ -120,54 +118,20 @@ impl RibByteCode { }) } } - -mod protobuf { - use crate::proto::golem::rib::RibByteCode as ProtoRibByteCode; - use crate::RibByteCode; - - impl TryFrom for RibByteCode { - type Error = String; - - fn try_from(value: ProtoRibByteCode) -> Result { - let proto_instructions = value.instructions; - let mut instructions = Vec::new(); - - for proto_instruction in proto_instructions { - instructions.push(proto_instruction.try_into()?); - } - - Ok(RibByteCode { instructions }) - } - } - - impl TryFrom for ProtoRibByteCode { - type Error = String; - - fn try_from(value: RibByteCode) -> Result { - let mut instructions = Vec::new(); - for instruction in value.instructions { - instructions.push(instruction.try_into()?); - } - - Ok(ProtoRibByteCode { instructions }) - } - } -} - mod internal { + use crate::analysis::{AnalysedType, TypeFlags}; use crate::compiler::desugar::{desugar_pattern_match, desugar_range_selection}; use crate::{ AnalysedTypeWithUnit, DynamicParsedFunctionReference, Expr, FunctionReferenceType, InferredType, InstanceIdentifier, InstanceVariable, InstructionId, Range, RibByteCodeGenerationError, RibIR, TypeInternal, VariableId, }; - use golem_wasm::analysis::{AnalysedType, TypeFlags}; use std::collections::HashSet; + use crate::analysis::analysed_type::bool; use crate::call_type::{CallType, InstanceCreationType}; use crate::type_inference::{GetTypeHint, TypeHint}; - use golem_wasm::analysis::analysed_type::bool; - use golem_wasm::{IntoValueAndType, Value, ValueAndType}; + use crate::{IntoValueAndType, Value, ValueAndType}; use std::ops::Deref; pub(crate) fn process_expr( @@ -958,10 +922,10 @@ mod compiler_tests { use test_r::test; use super::*; + use crate::analysis::analysed_type; + use crate::analysis::analysed_type::{field, list, record, s32, str}; use crate::{ArmPattern, InferredType, MatchArm, RibCompiler, VariableId}; - use golem_wasm::analysis::analysed_type; - use golem_wasm::analysis::analysed_type::{field, list, record, s32, str}; - use golem_wasm::{IntoValueAndType, Value, ValueAndType}; + use crate::{IntoValueAndType, Value, ValueAndType}; #[test] fn test_instructions_for_literal() { @@ -1463,9 +1427,9 @@ mod compiler_tests { mod invalid_function_invoke_tests { use test_r::test; + use crate::analysis::analysed_type::str; use crate::compiler::byte_code::compiler_tests::internal; use crate::{Expr, RibCompiler, RibCompilerConfig}; - use golem_wasm::analysis::analysed_type::str; #[test] fn test_unknown_function() { @@ -1555,12 +1519,12 @@ mod compiler_tests { mod global_input_tests { use test_r::test; - use crate::compiler::byte_code::compiler_tests::internal; - use crate::{Expr, RibCompiler, RibCompilerConfig}; - use golem_wasm::analysis::analysed_type::{ + use crate::analysis::analysed_type::{ case, field, list, option, r#enum, record, result, str, tuple, u32, u64, unit_case, variant, }; + use crate::compiler::byte_code::compiler_tests::internal; + use crate::{Expr, RibCompiler, RibCompilerConfig}; #[test] async fn test_str_global_input() { @@ -1894,9 +1858,9 @@ mod compiler_tests { } mod internal { + use crate::analysis::analysed_type::{case, str, u64, unit_case, variant}; + use crate::analysis::*; use crate::{ComponentDependency, ComponentDependencyKey, RibInputTypeInfo}; - use golem_wasm::analysis::analysed_type::{case, str, u64, unit_case, variant}; - use golem_wasm::analysis::*; use std::collections::HashMap; use uuid::Uuid; diff --git a/rib-core/src/compiler/compiler_output.rs b/rib-core/src/compiler/compiler_output.rs index 8f7d31d..4816d9f 100644 --- a/rib-core/src/compiler/compiler_output.rs +++ b/rib-core/src/compiler/compiler_output.rs @@ -27,60 +27,3 @@ pub struct CompilerOutput { // we can compile the expression again and get the output type info pub rib_output_type_info: Option, } - -mod protobuf { - use crate::proto::golem::rib::CompilerOutput as ProtoCompilerOutput; - use crate::{ - CompilerOutput, RibByteCode, RibInputTypeInfo, RibOutputTypeInfo, WorkerFunctionsInRib, - }; - - impl TryFrom for CompilerOutput { - type Error = String; - - fn try_from(value: ProtoCompilerOutput) -> Result { - let proto_rib_input = value.rib_input.ok_or("Missing rib_input")?; - let proto_byte_code = value.byte_code.ok_or("Missing byte_code")?; - let rib_input = RibInputTypeInfo::try_from(proto_rib_input)?; - let byte_code = RibByteCode::try_from(proto_byte_code)?; - let worker_invoke_calls = if let Some(value) = value.worker_invoke_calls { - Some(WorkerFunctionsInRib::try_from(value)?) - } else { - None - }; - - let rib_output_type_info = value - .rib_output - .map(RibOutputTypeInfo::try_from) - .transpose()?; - - Ok(CompilerOutput { - worker_invoke_calls, - byte_code, - rib_input_type_info: rib_input, - rib_output_type_info, - }) - } - } - - impl TryFrom for ProtoCompilerOutput { - type Error = String; - - fn try_from(value: CompilerOutput) -> Result { - Ok(ProtoCompilerOutput { - byte_code: Some(crate::proto::golem::rib::RibByteCode::try_from( - value.byte_code, - )?), - rib_input: Some(crate::proto::golem::rib::RibInputType::from( - value.rib_input_type_info, - )), - worker_invoke_calls: value - .worker_invoke_calls - .map(crate::proto::golem::rib::WorkerFunctionsInRib::from), - - rib_output: value - .rib_output_type_info - .map(crate::proto::golem::rib::RibOutputType::from), - }) - } - } -} diff --git a/rib-core/src/compiler/desugar.rs b/rib-core/src/compiler/desugar.rs index 93d671a..5ef0207 100644 --- a/rib-core/src/compiler/desugar.rs +++ b/rib-core/src/compiler/desugar.rs @@ -632,13 +632,13 @@ mod desugar_tests { use test_r::test; use super::*; + use crate::analysis::{ + AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedType, TypeU32, TypeU64, + }; use crate::compiler::desugar::desugar_tests::expectations::expected_condition_with_identifiers; use crate::{ ComponentDependency, ComponentDependencyKey, Expr, RibCompiler, RibCompilerConfig, }; - use golem_wasm::analysis::{ - AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedType, TypeU32, TypeU64, - }; use std::ops::Deref; use uuid::Uuid; diff --git a/rib-core/src/compiler/ir.rs b/rib-core/src/compiler/ir.rs index d3803f6..040bc28 100644 --- a/rib-core/src/compiler/ir.rs +++ b/rib-core/src/compiler/ir.rs @@ -12,15 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; +use crate::ValueAndType; use crate::{AnalysedTypeWithUnit, ComponentDependencyKey, ParsedFunctionSite, VariableId}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::ValueAndType; use serde::{Deserialize, Serialize}; // To create any type, example, CreateOption, you have to feed a fully formed AnalysedType -#[derive(Debug, Clone, PartialEq, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq)] pub enum RibIR { PushLit(ValueAndType), AssignVar(VariableId), @@ -75,8 +73,7 @@ pub enum RibIR { GenerateWorkerName(Option), } -#[derive(Debug, Clone, PartialEq, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq)] pub enum InstanceVariable { WitResource(VariableId), WitWorker(VariableId), @@ -91,8 +88,7 @@ impl RibIR { } } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum FunctionReferenceType { Function { function: String }, RawResourceConstructor { resource: String }, @@ -106,8 +102,7 @@ pub enum FunctionReferenceType { // This is more efficient than assigning index to every instruction and incrementing it // as we care about it only if we need to jump through instructions. // Jumping to an ID is simply draining the stack until we find a Label instruction with the same ID. -#[derive(Debug, Clone, PartialEq, Hash, Eq, Serialize, Deserialize, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq, Hash, Eq, Serialize, Deserialize)] pub struct InstructionId { pub index: usize, } @@ -132,525 +127,3 @@ impl InstructionId { self.clone() } } - -mod protobuf { - use crate::proto::golem::rib::rib_ir::Instruction; - use crate::proto::golem::rib::{ - And, ConcatInstruction, CreateFunctionNameInstruction, EqualTo, GetTag, GreaterThan, - GreaterThanOrEqualTo, InvokeFunctionInstruction, IsEmpty, JumpInstruction, LessThan, - LessThanOrEqualTo, Negate, Or, PushListInstruction, PushNoneInstruction, - PushTupleInstruction, RibIr as ProtoRibIR, WitResource, - }; - use crate::{ - AnalysedTypeWithUnit, ComponentDependencyKey, FunctionReferenceType, InstanceVariable, - InstructionId, ParsedFunctionSite, RibIR, VariableId, - }; - use golem_wasm::analysis::{AnalysedType, TypeStr}; - - impl TryFrom for FunctionReferenceType { - type Error = String; - fn try_from( - value: crate::proto::golem::rib::FunctionReferenceType, - ) -> Result { - let value = value.r#type.ok_or("Missing type".to_string())?; - let function_reference_type = match value { - crate::proto::golem::rib::function_reference_type::Type::Function(name) => FunctionReferenceType::Function { - function: name.name - }, - crate::proto::golem::rib::function_reference_type::Type::RawResourceConstructor(name) => - FunctionReferenceType::RawResourceConstructor { - resource: name.resource_name - }, - crate::proto::golem::rib::function_reference_type::Type::RawResourceDrop(name) => FunctionReferenceType::RawResourceDrop { - resource: name.resource_name - }, - crate::proto::golem::rib::function_reference_type::Type::RawResourceMethod(raw_resource_method) => { - let resource = raw_resource_method.resource_name; - let method = raw_resource_method.method_name; - FunctionReferenceType::RawResourceMethod { resource, method } - } - crate::proto::golem::rib::function_reference_type::Type::RawResourceStaticMethod(raw_resource_static_method) => { - let resource = raw_resource_static_method.resource_name; - let method = raw_resource_static_method.method_name; - FunctionReferenceType::RawResourceStaticMethod { resource, method } - } - }; - Ok(function_reference_type) - } - } - - impl From for crate::proto::golem::rib::FunctionReferenceType { - fn from(value: FunctionReferenceType) -> Self { - match value { - FunctionReferenceType::Function { function } => crate::proto::golem::rib::FunctionReferenceType { - r#type: Some(crate::proto::golem::rib::function_reference_type::Type::Function(crate::proto::golem::rib::Function { - name: function - })) - }, - FunctionReferenceType::RawResourceConstructor { resource } => crate::proto::golem::rib::FunctionReferenceType { - r#type: Some(crate::proto::golem::rib::function_reference_type::Type::RawResourceConstructor(crate::proto::golem::rib::RawResourceConstructor { - resource_name: resource - })) - }, - FunctionReferenceType::RawResourceDrop { resource } => crate::proto::golem::rib::FunctionReferenceType { - r#type: Some(crate::proto::golem::rib::function_reference_type::Type::RawResourceDrop(crate::proto::golem::rib::RawResourceDrop { - resource_name: resource - })) - }, - FunctionReferenceType::RawResourceMethod { resource, method } => crate::proto::golem::rib::FunctionReferenceType { - r#type: Some(crate::proto::golem::rib::function_reference_type::Type::RawResourceMethod(crate::proto::golem::rib::RawResourceMethod { - resource_name: resource, - method_name: method, - })) - }, - FunctionReferenceType::RawResourceStaticMethod { resource, method } => crate::proto::golem::rib::FunctionReferenceType { - r#type: Some(crate::proto::golem::rib::function_reference_type::Type::RawResourceStaticMethod(crate::proto::golem::rib::RawResourceStaticMethod { - resource_name: resource, - method_name: method, - })) - }, - } - } - } - - impl TryFrom for RibIR { - type Error = String; - - fn try_from(value: ProtoRibIR) -> Result { - let instruction = value - .instruction - .ok_or_else(|| "Missing instruction".to_string())?; - - match instruction { - Instruction::GenerateWorkerName(generate_worker_name) => { - let variable_id = generate_worker_name - .variable_id - .map(VariableId::try_from) - .transpose()?; - - Ok(RibIR::GenerateWorkerName(variable_id)) - } - Instruction::PushLit(value) => Ok(RibIR::PushLit( - value - .try_into() - .map_err(|_| "Failed to convert PushLit".to_string())?, - )), - Instruction::AssignVar(value) => Ok(RibIR::AssignVar( - value - .try_into() - .map_err(|_| "Failed to convert AssignVar".to_string())?, - )), - Instruction::LoadVar(value) => Ok(RibIR::LoadVar( - value - .try_into() - .map_err(|_| "Failed to convert LoadVar".to_string())?, - )), - Instruction::CreateAndPushRecord(value) => { - Ok(RibIR::CreateAndPushRecord((&value).try_into().map_err( - |_| "Failed to convert CreateAndPushRecord".to_string(), - )?)) - } - Instruction::Plus(value) => { - Ok(RibIR::Plus((&value).try_into().map_err(|_| { - "Failed to convert CreateAndPushRecord".to_string() - })?)) - } - Instruction::Multiply(value) => { - Ok(RibIR::Multiply((&value).try_into().map_err(|_| { - "Failed to convert CreateAndPushRecord".to_string() - })?)) - } - Instruction::Minus(value) => { - Ok(RibIR::Minus((&value).try_into().map_err(|_| { - "Failed to convert CreateAndPushRecord".to_string() - })?)) - } - Instruction::Divide(value) => { - Ok(RibIR::Divide((&value).try_into().map_err(|_| { - "Failed to convert CreateAndPushRecord".to_string() - })?)) - } - - Instruction::UpdateRecord(value) => Ok(RibIR::UpdateRecord(value)), - Instruction::PushList(value) => Ok(RibIR::PushList( - value - .list_type - .ok_or("List type not present".to_string()) - .and_then(|t| { - (&t).try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string()) - })?, - value.list_size as usize, - )), - Instruction::CreateSome(value) => Ok(RibIR::PushSome( - (&value) - .try_into() - .map_err(|_| "Failed to convert CreateSome".to_string())?, - )), - Instruction::CreateNone(value) => match value.none_type { - Some(v) => { - let optional_type = (&v) - .try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string()); - Ok(RibIR::PushNone(Some(optional_type?))) - } - None => Ok(RibIR::PushNone(None)), - }, - Instruction::CreateOkResult(value) => { - Ok(RibIR::PushOkResult((&value).try_into().map_err(|_| { - "Failed to convert CreateOkResult".to_string() - })?)) - } - Instruction::CreateErrResult(value) => { - Ok(RibIR::PushErrResult((&value).try_into().map_err(|_| { - "Failed to convert CreateErrResult".to_string() - })?)) - } - Instruction::Length(_) => Ok(RibIR::Length), - Instruction::SelectField(value) => Ok(RibIR::SelectField(value)), - Instruction::SelectIndex(value) => Ok(RibIR::SelectIndex(value as usize)), - Instruction::SelectIndexV1(_) => Ok(RibIR::SelectIndexV1), - Instruction::EqualTo(_) => Ok(RibIR::EqualTo), - Instruction::GreaterThan(_) => Ok(RibIR::GreaterThan), - Instruction::LessThan(_) => Ok(RibIR::LessThan), - Instruction::GreaterThanOrEqualTo(_) => Ok(RibIR::GreaterThanOrEqualTo), - Instruction::LessThanOrEqualTo(_) => Ok(RibIR::LessThanOrEqualTo), - Instruction::And(_) => Ok(RibIR::And), - Instruction::IsEmpty(_) => Ok(RibIR::IsEmpty), - Instruction::Or(_) => Ok(RibIR::Or), - Instruction::JumpIfFalse(value) => Ok(RibIR::JumpIfFalse(InstructionId::new( - value.instruction_id as usize, - ))), - Instruction::Jump(value) => Ok(RibIR::Jump(InstructionId::new( - value.instruction_id as usize, - ))), - Instruction::Label(value) => Ok(RibIR::Label(InstructionId::new( - value.instruction_id as usize, - ))), - Instruction::Deconstruct(_) => Ok(RibIR::Deconstruct), - Instruction::InvokeFunction(invoke_function_instruction) => { - let return_type = match invoke_function_instruction.return_type { - Some(return_type) => { - let analysed_type = (&return_type) - .try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string())?; - - AnalysedTypeWithUnit::Type(analysed_type) - } - None => AnalysedTypeWithUnit::Unit, - }; - - let instance_variable: InstanceVariable = invoke_function_instruction - .instance_variable - .ok_or("Missing instance_variable".to_string()) - .and_then(|iv| { - match iv - .kind - .ok_or("Missing instance_variable kind".to_string())? - { - crate::proto::golem::rib::instance_variable::Kind::Resource( - wit_resource, - ) => { - let variable_id = wit_resource - .variable_id - .ok_or("Missing variable_id in WitResource".to_string())? - .try_into() - .map_err(|_| "Failed to convert VariableId".to_string())?; - Ok(InstanceVariable::WitResource(variable_id)) - } - crate::proto::golem::rib::instance_variable::Kind::Worker( - wit_worker, - ) => { - let variable_id = wit_worker - .variable_id - .ok_or("Missing variable_id in WitWorker".to_string())? - .try_into() - .map_err(|_| "Failed to convert VariableId".to_string())?; - - Ok(InstanceVariable::WitWorker(variable_id)) - } - } - })?; - - let component_dependency_key_proto = invoke_function_instruction - .component - .ok_or("Missing component_dependency_key".to_string())?; - - let component_dependency_key = - ComponentDependencyKey::try_from(component_dependency_key_proto) - .map_err(|_| "Failed to convert ComponentDependencyKey".to_string())?; - - Ok(RibIR::InvokeFunction( - component_dependency_key, - instance_variable, - invoke_function_instruction.argument_count as usize, - return_type, - )) - } - Instruction::VariantConstruction(variant_construction) => { - let variant_type = variant_construction - .return_type - .ok_or("Missing return_type for variant construction".to_string())?; - - let analysed_variant_type = (&variant_type) - .try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string())?; - - Ok(RibIR::PushVariant( - variant_construction.variant_name, - analysed_variant_type, - )) - } - Instruction::EnumConstruction(enum_construction) => { - let enum_type = enum_construction - .return_type - .ok_or("Missing return_type for enum construction".to_string())?; - - let analysed_enum_type = (&enum_type) - .try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string())?; - - Ok(RibIR::PushEnum( - enum_construction.enum_name, - analysed_enum_type, - )) - } - Instruction::Throw(value) => Ok(RibIR::Throw(value)), - Instruction::PushFlag(flag) => Ok(RibIR::PushFlag( - flag.try_into() - .map_err(|_| "Failed to convert PushFlag".to_string())?, - )), - Instruction::GetTag(_) => Ok(RibIR::GetTag), - Instruction::PushTuple(tuple_instruction) => { - let tuple_type = tuple_instruction - .tuple_type - .ok_or("Missing tuple_type".to_string()) - .and_then(|t| { - (&t).try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string()) - })?; - - Ok(RibIR::PushTuple( - tuple_type, - tuple_instruction.tuple_size as usize, - )) - } - Instruction::Negate(_) => Ok(RibIR::Negate), - Instruction::Concat(concat_instruction) => { - Ok(RibIR::Concat(concat_instruction.arg_size as usize)) - } - Instruction::CreateFunctionName(instruction) => { - let parsed_site = instruction.site.ok_or("Missing site".to_string())?; - let parsed_function_site = ParsedFunctionSite::try_from(parsed_site)?; - - let reference_type = instruction - .function_reference_details - .ok_or("Missing reference_type".to_string())?; - let function_reference_type = reference_type.try_into()?; - - Ok(RibIR::CreateFunctionName( - parsed_function_site, - function_reference_type, - )) - } - Instruction::ListToIterator(_) => Ok(RibIR::ToIterator), - Instruction::CreateSink(create_sink) => { - let result = create_sink - .list_type - .ok_or("Sink list type not present".to_string()) - .and_then(|t| { - (&t).try_into() - .map_err(|_| "Failed to convert AnalysedType".to_string()) - })?; - - Ok(RibIR::CreateSink(result)) - } - Instruction::AdvanceIterator(_) => Ok(RibIR::AdvanceIterator), - Instruction::SinkToList(_) => Ok(RibIR::SinkToList), - Instruction::PushToSink(_) => Ok(RibIR::PushToSink), - } - } - } - - impl TryFrom for ProtoRibIR { - type Error = String; - - fn try_from(value: RibIR) -> Result { - let instruction = match value { - RibIR::GenerateWorkerName(variable_id) => { - let variable_id_proto = variable_id.map(|v| v.into()); - - Instruction::GenerateWorkerName(crate::proto::golem::rib::GenerateWorkerName { - variable_id: variable_id_proto, - }) - } - RibIR::PushLit(value) => Instruction::PushLit(value.into()), - RibIR::And => Instruction::And(And {}), - RibIR::IsEmpty => Instruction::IsEmpty(IsEmpty {}), - RibIR::Or => Instruction::Or(Or {}), - RibIR::AssignVar(value) => Instruction::AssignVar(value.into()), - RibIR::LoadVar(value) => Instruction::LoadVar(value.into()), - RibIR::CreateAndPushRecord(value) => { - Instruction::CreateAndPushRecord((&value).into()) - } - RibIR::Plus(value) => Instruction::Plus((&value).into()), - RibIR::Minus(value) => Instruction::Minus((&value).into()), - RibIR::Multiply(value) => Instruction::Multiply((&value).into()), - RibIR::Divide(value) => Instruction::Divide((&value).into()), - RibIR::UpdateRecord(value) => Instruction::UpdateRecord(value), - RibIR::PushList(value, arg_size) => Instruction::PushList(PushListInstruction { - list_type: Some((&value).into()), - list_size: arg_size as u64, - }), - RibIR::PushSome(value) => Instruction::CreateSome((&value).into()), - RibIR::PushNone(value) => { - let push_none_instruction = PushNoneInstruction { - none_type: value.map(|t| (&t).into()), - }; - Instruction::CreateNone(push_none_instruction) - } - RibIR::PushOkResult(value) => Instruction::CreateOkResult((&value).into()), - RibIR::PushErrResult(value) => Instruction::CreateErrResult((&value).into()), - RibIR::SelectField(value) => Instruction::SelectField(value), - RibIR::SelectIndex(value) => Instruction::SelectIndex(value as u64), - RibIR::EqualTo => Instruction::EqualTo(EqualTo {}), - RibIR::GreaterThan => Instruction::GreaterThan(GreaterThan {}), - RibIR::LessThan => Instruction::LessThan(LessThan {}), - RibIR::Length => Instruction::Length(crate::proto::golem::rib::Length {}), - RibIR::SelectIndexV1 => { - Instruction::SelectIndexV1(crate::proto::golem::rib::SelectIndexV1 {}) - } - RibIR::GreaterThanOrEqualTo => { - Instruction::GreaterThanOrEqualTo(GreaterThanOrEqualTo {}) - } - RibIR::LessThanOrEqualTo => Instruction::LessThanOrEqualTo(LessThanOrEqualTo {}), - RibIR::JumpIfFalse(value) => Instruction::JumpIfFalse(JumpInstruction { - instruction_id: value.index as u64, - }), - RibIR::Jump(value) => Instruction::Jump(JumpInstruction { - instruction_id: value.index as u64, - }), - RibIR::Label(value) => Instruction::Label(JumpInstruction { - instruction_id: value.index as u64, - }), - RibIR::Deconstruct => { - Instruction::Deconstruct((&AnalysedType::Str(TypeStr)).into()) - } //TODO; remove type in deconstruct from protobuf - RibIR::InvokeFunction( - component_dependency_key, - worker_name_presence, - arg_count, - return_type, - ) => { - let typ = match return_type { - AnalysedTypeWithUnit::Unit => None, - AnalysedTypeWithUnit::Type(analysed_type) => { - let typ = golem_wasm::protobuf::Type::from(&analysed_type); - Some(typ) - } - }; - - let instance_variable = match worker_name_presence { - InstanceVariable::WitResource(variable_id) => { - crate::proto::golem::rib::InstanceVariable { - kind: Some( - crate::proto::golem::rib::instance_variable::Kind::Resource( - WitResource { - variable_id: Some(variable_id.into()), - }, - ), - ), - } - } - InstanceVariable::WitWorker(variable_id) => { - crate::proto::golem::rib::InstanceVariable { - kind: Some( - crate::proto::golem::rib::instance_variable::Kind::Worker( - crate::proto::golem::rib::WitWorker { - variable_id: Some(variable_id.into()), - }, - ), - ), - } - } - }; - - let component_dependency_key = - crate::proto::golem::rib::ComponentDependencyKey::from( - component_dependency_key, - ); - - Instruction::InvokeFunction(InvokeFunctionInstruction { - component: Some(component_dependency_key), - argument_count: arg_count as u64, - return_type: typ, - instance_variable: Some(instance_variable), - }) - } - RibIR::PushVariant(name, return_type) => { - let typ = golem_wasm::protobuf::Type::from(&return_type); - - Instruction::VariantConstruction( - crate::proto::golem::rib::VariantConstructionInstruction { - variant_name: name, - return_type: Some(typ), - }, - ) - } - RibIR::PushEnum(name, return_type) => { - let typ = golem_wasm::protobuf::Type::from(&return_type); - - Instruction::EnumConstruction( - crate::proto::golem::rib::EnumConstructionInstruction { - enum_name: name, - return_type: Some(typ), - }, - ) - } - RibIR::Throw(msg) => Instruction::Throw(msg), - RibIR::PushFlag(flag) => Instruction::PushFlag(flag.into()), - RibIR::GetTag => Instruction::GetTag(GetTag {}), - RibIR::PushTuple(analysed_type, size) => { - let typ = golem_wasm::protobuf::Type::from(&analysed_type); - - Instruction::PushTuple(PushTupleInstruction { - tuple_type: Some(typ), - tuple_size: size as u64, - }) - } - RibIR::Concat(concat) => Instruction::Concat(ConcatInstruction { - arg_size: concat as u64, - }), - RibIR::Negate => Instruction::Negate(Negate {}), - RibIR::CreateFunctionName(site, reference_type) => { - Instruction::CreateFunctionName(CreateFunctionNameInstruction { - site: Some(site.into()), - function_reference_details: Some(reference_type.into()), - }) - } - - RibIR::ToIterator => { - Instruction::ListToIterator(crate::proto::golem::rib::ListToIterator {}) - } - RibIR::CreateSink(analysed_type) => { - Instruction::CreateSink(crate::proto::golem::rib::CreateSink { - list_type: Some((&analysed_type).into()), - }) - } - RibIR::AdvanceIterator => { - Instruction::AdvanceIterator(crate::proto::golem::rib::AdvanceIterator {}) - } - RibIR::PushToSink => { - Instruction::PushToSink(crate::proto::golem::rib::PushToSink {}) - } - RibIR::SinkToList => { - Instruction::SinkToList(crate::proto::golem::rib::SinkToList {}) - } - }; - - Ok(ProtoRibIR { - instruction: Some(instruction), - }) - } - } -} diff --git a/rib-core/src/compiler/mod.rs b/rib-core/src/compiler/mod.rs index f5dbde2..3f81b5c 100644 --- a/rib-core/src/compiler/mod.rs +++ b/rib-core/src/compiler/mod.rs @@ -18,12 +18,12 @@ pub use ir::*; pub use type_with_unit::*; pub use worker_functions_in_rib::*; +use crate::analysis::{AnalysedExport, TypeEnum, TypeVariant}; use crate::rib_type_error::RibTypeError; use crate::{ ComponentDependencies, ComponentDependencyKey, CustomInstanceSpec, Expr, GlobalVariableTypeSpec, InferredExpr, RibInputTypeInfo, RibOutputTypeInfo, }; -use golem_wasm::analysis::{AnalysedExport, TypeEnum, TypeVariant}; use std::error::Error; use std::fmt::Display; @@ -912,14 +912,14 @@ mod compiler_error_tests { } mod test_utils { - use crate::{ComponentDependency, ComponentDependencyKey}; - use golem_wasm::analysis::analysed_type::{ + use crate::analysis::analysed_type::{ case, f32, field, handle, list, record, s32, str, tuple, u32, u64, variant, }; - use golem_wasm::analysis::{ + use crate::analysis::{ AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedFunctionResult, AnalysedInstance, AnalysedResourceId, AnalysedResourceMode, NameTypePair, }; + use crate::{ComponentDependency, ComponentDependencyKey}; use uuid::Uuid; pub(crate) fn strip_spaces(input: &str) -> String { diff --git a/rib-core/src/compiler/type_with_unit.rs b/rib-core/src/compiler/type_with_unit.rs index 13b3e4e..2c6b39a 100644 --- a/rib-core/src/compiler/type_with_unit.rs +++ b/rib-core/src/compiler/type_with_unit.rs @@ -12,22 +12,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{GetTypeHint, InferredType, InstanceType, TypeInternal}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::analysed_type::{bool, field, record, str, tuple}; -use golem_wasm::analysis::{ +use crate::analysis::analysed_type::{bool, field, record, str, tuple}; +use crate::analysis::{ AnalysedResourceId, AnalysedResourceMode, AnalysedType, NameOptionTypePair, NameTypePair, TypeBool, TypeChr, TypeEnum, TypeF32, TypeF64, TypeFlags, TypeHandle, TypeList, TypeOption, TypeRecord, TypeResult, TypeS16, TypeS32, TypeS64, TypeS8, TypeStr, TypeTuple, TypeU16, TypeU32, TypeU64, TypeU8, TypeVariant, }; +use crate::{GetTypeHint, InferredType, InstanceType, TypeInternal}; use serde::{Deserialize, Serialize}; // An absence of analysed type is really `Unit`, however, we avoid // Option in favor of `AnalysedTypeWithUnit` for clarity. // and conversions such as what to print if its `unit` becomes more precise -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub enum AnalysedTypeWithUnit { Unit, Type(AnalysedType), diff --git a/rib-core/src/compiler/worker_functions_in_rib.rs b/rib-core/src/compiler/worker_functions_in_rib.rs index ae2dabf..5047684 100644 --- a/rib-core/src/compiler/worker_functions_in_rib.rs +++ b/rib-core/src/compiler/worker_functions_in_rib.rs @@ -12,9 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::{ComponentDependencies, FunctionName, InferredExpr, RibCompilationError}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::AnalysedType; // An easier data type that focus just on the side effecting function calls in Rib script. // These will not include variant or enum calls, that were originally @@ -23,8 +22,7 @@ use golem_wasm::analysis::AnalysedType; // which has specific details, along with original type registry to construct this data. // These function calls are indeed worker invoke calls and nothing else. // If Rib has inbuilt function support, those will not be included here either. -#[derive(Debug, Clone, PartialEq, Eq, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct WorkerFunctionsInRib { pub function_calls: Vec, } @@ -68,100 +66,9 @@ impl WorkerFunctionsInRib { } // The type of a function call with worker (ephmeral or durable) in Rib script -#[derive(Debug, Clone, PartialEq, Eq, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct WorkerFunctionType { pub function_name: FunctionName, pub parameter_types: Vec, pub return_type: Option, } - -mod protobuf { - use crate::proto::golem::rib::WorkerFunctionType as WorkerFunctionTypeProto; - use crate::proto::golem::rib::WorkerFunctionsInRib as WorkerFunctionsInRibProto; - use crate::{FunctionName, WorkerFunctionType, WorkerFunctionsInRib}; - use golem_wasm::analysis::AnalysedType; - - impl TryFrom for WorkerFunctionsInRib { - type Error = String; - - fn try_from(value: WorkerFunctionsInRibProto) -> Result { - let function_calls_proto = value.function_calls; - let function_calls = function_calls_proto - .iter() - .map(|worker_function_type_proto| { - WorkerFunctionType::try_from(worker_function_type_proto.clone()) - }) - .collect::>()?; - Ok(Self { function_calls }) - } - } - - impl From for WorkerFunctionsInRibProto { - fn from(value: WorkerFunctionsInRib) -> Self { - WorkerFunctionsInRibProto { - function_calls: value - .function_calls - .iter() - .map(|x| WorkerFunctionTypeProto::from(x.clone())) - .collect(), - } - } - } - - impl TryFrom for WorkerFunctionType { - type Error = String; - - fn try_from(value: WorkerFunctionTypeProto) -> Result { - let return_type = value - .return_type - .as_ref() - .map(AnalysedType::try_from) - .transpose()?; - - let parameter_types = value - .parameter_types - .iter() - .map(AnalysedType::try_from) - .collect::>()?; - - let function_key_type = value.function_name.and_then(|x| x.function_name).ok_or( - "WorkerFunctionTypeProto function_key must have a function_name".to_string(), - )?; - - let function_name = FunctionName::try_from(function_key_type) - .map_err(|e| format!("Failed to convert function key: {e}"))?; - - Ok(Self { - function_name, - return_type, - parameter_types, - }) - } - } - - impl From for WorkerFunctionTypeProto { - fn from(value: WorkerFunctionType) -> Self { - let function_key = crate::proto::golem::rib::function_name_type::FunctionName::from( - value.function_name, - ); - - let function_name_type = crate::proto::golem::rib::FunctionNameType { - function_name: Some(function_key), - }; - - WorkerFunctionTypeProto { - function_name: Some(function_name_type), - parameter_types: value - .parameter_types - .iter() - .map(|analysed_type| analysed_type.into()) - .collect(), - return_type: value - .return_type - .as_ref() - .map(|analysed_type| analysed_type.into()), - } - } - } -} diff --git a/rib-core/src/expr.rs b/rib-core/src/expr.rs index a4b69cc..bb0c88b 100644 --- a/rib-core/src/expr.rs +++ b/rib-core/src/expr.rs @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::call_type::{CallType, InstanceCreationType}; use crate::generic_type_parameter::GenericTypeParameter; use crate::inferred_type::{DefaultType, TypeOrigin}; use crate::parser::block::block; use crate::parser::type_name::TypeName; -use crate::proto::golem::rib::range_expr::RangeExpr; use crate::rib_source_span::SourceSpan; use crate::rib_type_error::RibTypeErrorInternal; use crate::{ @@ -25,14 +25,12 @@ use crate::{ CustomInstanceSpec, DynamicParsedFunctionName, ExprVisitor, GlobalVariableTypeSpec, InferredType, InstanceIdentifier, ParsedFunctionName, VariableId, }; +use crate::{IntoValueAndType, ValueAndType}; use bigdecimal::{BigDecimal, FromPrimitive, ToPrimitive}; use combine::parser::char::spaces; use combine::stream::position; use combine::Parser; use combine::{eof, EasyParser}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::{IntoValueAndType, ValueAndType}; use serde::{Deserialize, Serialize, Serializer}; use serde_json::Value; use std::collections::VecDeque; @@ -40,8 +38,7 @@ use std::fmt::Display; use std::ops::Deref; use std::str::FromStr; -#[derive(Debug, Hash, Clone, PartialEq, Eq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum Expr { Let { variable_id: VariableId, @@ -1808,8 +1805,7 @@ impl Expr { } } -#[derive(Debug, Hash, Clone, PartialEq, Eq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum Range { Range { from: Box, to: Box }, RangeInclusive { from: Box, to: Box }, @@ -1854,8 +1850,7 @@ impl Range { } } -#[derive(Debug, Hash, Clone, PartialEq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, PartialEq, Ord, PartialOrd)] pub struct Number { pub value: BigDecimal, } @@ -1886,8 +1881,7 @@ impl Display for Number { } } -#[derive(Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd)] pub struct MatchArm { pub arm_pattern: ArmPattern, pub arm_resolution_expr: Box, @@ -1902,8 +1896,7 @@ impl MatchArm { } } -#[derive(Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd)] pub enum ArmPattern { WildCard, As(String, Box), @@ -2075,458 +2068,6 @@ impl ArmPattern { } } -impl TryFrom for Expr { - type Error = String; - - fn try_from(value: crate::proto::golem::rib::Expr) -> Result { - let expr = value.expr.ok_or("Missing expr")?; - - let expr = match expr { - crate::proto::golem::rib::expr::Expr::Let(expr) => { - let name = expr.name; - let type_annotation = expr.type_name.map(TypeName::try_from).transpose()?; - let expr_: crate::proto::golem::rib::Expr = *expr.expr.ok_or("Missing expr")?; - let expr: Expr = expr_.try_into()?; - Expr::let_binding(name, expr, type_annotation) - } - - crate::proto::golem::rib::expr::Expr::SelectIndexV1(expr) => { - let selection = *expr.expr.ok_or("Missing expr")?; - let field = *expr.index.ok_or("Missing index")?; - let type_annotation = expr.type_name.map(TypeName::try_from).transpose()?; - - Expr::select_index(selection.try_into()?, field.try_into()?) - .with_type_annotation_opt(type_annotation) - } - - crate::proto::golem::rib::expr::Expr::Length(expr) => { - let expr = expr.expr.ok_or("Missing expr")?; - Expr::Length { - expr: Box::new((*expr).try_into()?), - type_annotation: None, - inferred_type: InferredType::unknown(), - source_span: SourceSpan::default(), - } - } - - crate::proto::golem::rib::expr::Expr::Range(range) => { - let range_expr = range.range_expr.ok_or("Missing range expr")?; - - match range_expr { - RangeExpr::RangeFrom(range_from) => { - let from = range_from.from.ok_or("Missing from expr")?; - Expr::range_from((*from).try_into()?) - } - RangeExpr::Range(range) => { - let from = range.from.ok_or("Missing from expr")?; - let to = range.to.ok_or("Missing to expr")?; - Expr::range((*from).try_into()?, (*to).try_into()?) - } - RangeExpr::RangeInclusive(range_inclusive) => { - let from = range_inclusive.from.ok_or("Missing from expr")?; - let to = range_inclusive.to.ok_or("Missing to expr")?; - Expr::range_inclusive((*from).try_into()?, (*to).try_into()?) - } - } - } - - crate::proto::golem::rib::expr::Expr::Not(expr) => { - let expr = expr.expr.ok_or("Missing expr")?; - Expr::not((*expr).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::GreaterThan(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::greater_than((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::GreaterThanOrEqual(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::greater_than_or_equal_to((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::LessThan(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::less_than((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::LessThanOrEqual(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::less_than_or_equal_to((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::EqualTo(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::equal_to((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Add(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::plus((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Subtract(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::plus((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Divide(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::plus((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Multiply(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::plus((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Cond(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let cond = expr.cond.ok_or("Missing cond expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::cond( - (*left).try_into()?, - (*cond).try_into()?, - (*right).try_into()?, - ) - } - - crate::proto::golem::rib::expr::Expr::Concat( - crate::proto::golem::rib::ConcatExpr { exprs }, - ) => { - let exprs: Vec = exprs - .into_iter() - .map(|expr| expr.try_into()) - .collect::, _>>()?; - Expr::concat(exprs) - } - - crate::proto::golem::rib::expr::Expr::Multiple( - crate::proto::golem::rib::MultipleExpr { exprs }, - ) => { - let exprs: Vec = exprs - .into_iter() - .map(|expr| expr.try_into()) - .collect::, _>>()?; - Expr::expr_block(exprs) - } - - crate::proto::golem::rib::expr::Expr::Sequence( - crate::proto::golem::rib::SequenceExpr { exprs, type_name }, - ) => { - let type_annotation = type_name.map(TypeName::try_from).transpose()?; - - let exprs: Vec = exprs - .into_iter() - .map(|expr| expr.try_into()) - .collect::, _>>()?; - Expr::sequence(exprs, type_annotation) - } - - crate::proto::golem::rib::expr::Expr::Tuple(crate::proto::golem::rib::TupleExpr { - exprs, - }) => { - let exprs: Vec = exprs - .into_iter() - .map(|expr| expr.try_into()) - .collect::, _>>()?; - Expr::tuple(exprs) - } - - crate::proto::golem::rib::expr::Expr::Record( - crate::proto::golem::rib::RecordExpr { fields }, - ) => { - let mut values: Vec<(String, Expr)> = vec![]; - for record in fields.into_iter() { - let name = record.name; - let expr = record.expr.ok_or("Missing expr")?; - values.push((name, expr.try_into()?)); - } - Expr::record(values) - } - - crate::proto::golem::rib::expr::Expr::Flags(crate::proto::golem::rib::FlagsExpr { - values, - }) => Expr::flags(values), - - crate::proto::golem::rib::expr::Expr::Literal( - crate::proto::golem::rib::LiteralExpr { value }, - ) => Expr::literal(value), - - crate::proto::golem::rib::expr::Expr::Identifier( - crate::proto::golem::rib::IdentifierExpr { name, type_name }, - ) => { - let type_name = type_name.map(TypeName::try_from).transpose()?; - - Expr::identifier_global(name.as_str(), type_name) - } - - crate::proto::golem::rib::expr::Expr::Boolean( - crate::proto::golem::rib::BooleanExpr { value }, - ) => Expr::boolean(value), - - crate::proto::golem::rib::expr::Expr::Throw(crate::proto::golem::rib::ThrowExpr { - message, - }) => Expr::throw(message), - - crate::proto::golem::rib::expr::Expr::GenerateWorkerName( - crate::proto::golem::rib::GenerateWorkerNameExpr {}, - ) => Expr::generate_worker_name(None), - - crate::proto::golem::rib::expr::Expr::And(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::and((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Or(expr) => { - let left = expr.left.ok_or("Missing left expr")?; - let right = expr.right.ok_or("Missing right expr")?; - Expr::or((*left).try_into()?, (*right).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Tag(expr) => { - let expr = expr.expr.ok_or("Missing expr in tag")?; - Expr::get_tag((*expr).try_into()?) - } - - crate::proto::golem::rib::expr::Expr::Unwrap(expr) => { - let expr = expr.expr.ok_or("Missing expr")?; - let expr: Expr = (*expr).try_into()?; - expr.unwrap() - } - - crate::proto::golem::rib::expr::Expr::Number(number) => { - // Backward compatibility - let type_name = number.type_name.map(TypeName::try_from).transpose()?; - let big_decimal = if let Some(number) = number.number { - BigDecimal::from_str(&number).map_err(|e| e.to_string())? - } else if let Some(float) = number.float { - BigDecimal::from_f64(float).ok_or("Invalid float")? - } else { - return Err("Missing number".to_string()); - }; - - Expr::number(big_decimal).with_type_annotation_opt(type_name) - } - crate::proto::golem::rib::expr::Expr::SelectField(expr) => { - let expr = *expr; - let field = expr.field; - let type_name = expr.type_name.map(TypeName::try_from).transpose()?; - let expr = *expr.expr.ok_or( - "Mi\ - ssing expr", - )?; - - Expr::select_field(expr.try_into()?, field.as_str(), type_name) - } - crate::proto::golem::rib::expr::Expr::SelectIndex(expr) => { - let expr = *expr; - let type_name = expr.type_name.map(TypeName::try_from).transpose()?; - let index = expr.index as usize; - let expr = *expr.expr.ok_or("Missing expr")?; - - let index_expr = - Expr::number(BigDecimal::from_usize(index).ok_or("Invalid index")?); - - Expr::select_index(expr.try_into()?, index_expr).with_type_annotation_opt(type_name) - } - crate::proto::golem::rib::expr::Expr::Option(expr) => { - let type_name = expr.type_name; - let type_name = type_name.map(TypeName::try_from).transpose()?; - - match expr.expr { - Some(expr) => { - Expr::option(Some((*expr).try_into()?)).with_type_annotation_opt(type_name) - } - None => Expr::option(None).with_type_annotation_opt(type_name), - } - } - crate::proto::golem::rib::expr::Expr::Result(expr) => { - let type_name = expr.type_name; - let type_name = type_name.map(TypeName::try_from).transpose()?; - let result = expr.result.ok_or("Missing result")?; - match result { - crate::proto::golem::rib::result_expr::Result::Ok(expr) => { - Expr::ok((*expr).try_into()?, type_name) - } - crate::proto::golem::rib::result_expr::Result::Err(expr) => { - Expr::err((*expr).try_into()?, type_name) - } - } - } - crate::proto::golem::rib::expr::Expr::PatternMatch(expr) => { - let patterns: Vec = expr - .patterns - .into_iter() - .map(|expr| expr.try_into()) - .collect::, _>>()?; - let expr = expr.expr.ok_or("Missing expr")?; - Expr::pattern_match((*expr).try_into()?, patterns) - } - crate::proto::golem::rib::expr::Expr::ListComprehension(list_comprehension) => { - let iterable_expr = list_comprehension.iterable_expr.ok_or("Missing expr")?; - let iterable_expr = (*iterable_expr).try_into()?; - let yield_expr = list_comprehension.yield_expr.ok_or("Missing list")?; - let yield_expr = (*yield_expr).try_into()?; - let variable_id = - VariableId::list_comprehension_identifier(list_comprehension.iterated_variable); - Expr::list_comprehension(variable_id, iterable_expr, yield_expr) - } - crate::proto::golem::rib::expr::Expr::ListReduce(list_reduce) => { - let init_value_expr = list_reduce.init_value_expr.ok_or("Missing initial expr")?; - let init_value_expr = (*init_value_expr).try_into()?; - let iterable_expr = list_reduce.iterable_expr.ok_or("Missing expr")?; - let iterable_expr = (*iterable_expr).try_into()?; - let yield_expr = list_reduce.yield_expr.ok_or("Missing list")?; - let yield_expr = (*yield_expr).try_into()?; - let iterated_variable_id = - VariableId::list_comprehension_identifier(list_reduce.iterated_variable); - let reduce_variable_id = - VariableId::list_reduce_identifier(list_reduce.reduce_variable); - Expr::list_reduce( - reduce_variable_id, - iterated_variable_id, - iterable_expr, - init_value_expr, - yield_expr, - ) - } - crate::proto::golem::rib::expr::Expr::Call(expr) => { - let params: Vec = expr - .params - .into_iter() - .map(|expr| expr.try_into()) - .collect::, _>>()?; - // This is not required and kept for backward compatibility - let legacy_invocation_name = expr.name; - let call_type = expr.call_type; - let generic_type_parameter = expr - .generic_type_parameter - .map(|tp| GenericTypeParameter { value: tp }); - - match (legacy_invocation_name, call_type) { - (Some(legacy), None) => { - let name = legacy.name.ok_or("Missing function call name")?; - match name { - crate::proto::golem::rib::invocation_name::Name::Parsed(name) => { - // Reading the previous parsed-function-name in persistent store as a dynamic-parsed-function-name - Expr::call_worker_function( - DynamicParsedFunctionName::parse( - ParsedFunctionName::try_from(name)?.to_string(), - )?, - generic_type_parameter, - None, - params, - None, - ) - } - crate::proto::golem::rib::invocation_name::Name::VariantConstructor( - name, - ) => Expr::call_worker_function( - DynamicParsedFunctionName::parse(name)?, - generic_type_parameter, - None, - params, - None, - ), - crate::proto::golem::rib::invocation_name::Name::EnumConstructor( - name, - ) => Expr::call_worker_function( - DynamicParsedFunctionName::parse(name)?, - generic_type_parameter, - None, - params, - None, - ), - } - } - (_, Some(call_type)) => { - let name = call_type.name.ok_or("Missing function call name")?; - match name { - crate::proto::golem::rib::call_type::Name::Parsed(name) => { - Expr::call_worker_function( - name.try_into()?, - generic_type_parameter, - None, - params, - None, - ) - } - crate::proto::golem::rib::call_type::Name::VariantConstructor(name) => { - Expr::call_worker_function( - DynamicParsedFunctionName::parse(name)?, - generic_type_parameter, - None, - params, - None, - ) - } - crate::proto::golem::rib::call_type::Name::EnumConstructor(name) => { - Expr::call_worker_function( - DynamicParsedFunctionName::parse(name)?, - generic_type_parameter, - None, - params, - None, - ) - } - crate::proto::golem::rib::call_type::Name::InstanceCreation( - instance_creation, - ) => { - let instance_creation_type = - InstanceCreationType::try_from(*instance_creation)?; - let call_type = CallType::InstanceCreation(instance_creation_type); - Expr::Call { - call_type, - generic_type_parameter, - args: vec![], - inferred_type: InferredType::unknown(), - source_span: SourceSpan::default(), - type_annotation: None, // TODO - } - } - } - } - (_, _) => Err("Missing both call type (and legacy invocation type)")?, - } - } - crate::proto::golem::rib::expr::Expr::LazyInvokeMethod(lazy_invoke) => { - let lhs_proto = lazy_invoke.lhs.ok_or("Missing lhs")?; - let lhs = Box::new((*lhs_proto).try_into()?); - let method = lazy_invoke.method; - let generic_type_parameter = lazy_invoke.generic_type_parameter; - let args: Vec = lazy_invoke - .args - .into_iter() - .map(Expr::try_from) - .collect::, _>>()?; - - Expr::InvokeMethodLazy { - lhs, - method, - generic_type_parameter: generic_type_parameter - .map(|value| GenericTypeParameter { value }), - args, - inferred_type: InferredType::unknown(), - source_span: SourceSpan::default(), - type_annotation: None, //TODO - } - } - }; - Ok(expr) - } -} - impl Display for Expr { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", text::to_string(self).unwrap()) @@ -2570,596 +2111,6 @@ impl Serialize for Expr { } } -mod protobuf { - use crate::proto::golem::rib::range_expr::RangeExpr; - use crate::{ArmPattern, Expr, MatchArm, Range}; - - // It is to be noted that when we change `Expr` tree solely for the purpose of - // updating type inference, we don't need to change the proto version - // of Expr. A proto version of Expr changes only when Rib adds/updates the grammar itself. - // This makes it easy to keep backward compatibility at the persistence level - // (if persistence using grpc encode) - // - // Reason: A proto version of Expr doesn't take into the account the type inferred - // for each expr, or encode any behaviour that's the result of a type inference - // Example: in a type inference, a variable-id of expr which is tagged as `global` becomes - // `VariableId::Local(Identifier)` after a particular type inference phase, however, when encoding - // we don't need to consider this `Identifier` and is kept as global (i.e, the raw form) in Expr. - // This is because we never (want to) encode an Expr which is a result of `infer_types` function. - // - // Summary: We encode Expr only prior to compilation. After compilation, we encode only the RibByteCode. - // If we ever want to encode Expr after type-inference phase, it implies, we need to encode `InferredExpr` - // rather than `Expr` and this will ensure, users when retrieving back the `Expr` will never have - // noise regarding types and variable-ids, and will always stay one to one in round trip - impl From for crate::proto::golem::rib::Expr { - fn from(value: Expr) -> Self { - let expr = match value { - Expr::GenerateWorkerName { .. } => { - Some(crate::proto::golem::rib::expr::Expr::GenerateWorkerName( - crate::proto::golem::rib::GenerateWorkerNameExpr {}, - )) - } - Expr::Let { - variable_id, - type_annotation, - expr, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Let(Box::new( - crate::proto::golem::rib::LetExpr { - name: variable_id.name().to_string(), - expr: Some(Box::new((*expr).into())), - type_name: type_annotation.map(|t| t.into()), - }, - ))), - - Expr::Length { expr, .. } => Some(crate::proto::golem::rib::expr::Expr::Length( - Box::new(crate::proto::golem::rib::LengthExpr { - expr: Some(Box::new((*expr).into())), - }), - )), - - Expr::SelectField { - expr, - field, - type_annotation, - .. - } => Some(crate::proto::golem::rib::expr::Expr::SelectField(Box::new( - crate::proto::golem::rib::SelectFieldExpr { - expr: Some(Box::new((*expr).into())), - field, - type_name: type_annotation.map(|t| t.into()), - }, - ))), - - Expr::Range { range, .. } => match range { - Range::RangeFrom { from } => Some(crate::proto::golem::rib::expr::Expr::Range( - Box::new(crate::proto::golem::rib::RangeExpr { - range_expr: Some(RangeExpr::RangeFrom(Box::new( - crate::proto::golem::rib::RangeFrom { - from: Some(Box::new((*from).into())), - }, - ))), - }), - )), - Range::Range { from, to } => Some(crate::proto::golem::rib::expr::Expr::Range( - Box::new(crate::proto::golem::rib::RangeExpr { - range_expr: Some(RangeExpr::Range(Box::new( - crate::proto::golem::rib::Range { - from: Some(Box::new((*from).into())), - to: Some(Box::new((*to).into())), - }, - ))), - }), - )), - Range::RangeInclusive { from, to } => { - Some(crate::proto::golem::rib::expr::Expr::Range(Box::new( - crate::proto::golem::rib::RangeExpr { - range_expr: Some(RangeExpr::RangeInclusive(Box::new( - crate::proto::golem::rib::RangeInclusive { - from: Some(Box::new((*from).into())), - to: Some(Box::new((*to).into())), - }, - ))), - }, - ))) - } - }, - - Expr::SelectIndex { - expr, - index, - type_annotation, - .. - } => Some(crate::proto::golem::rib::expr::Expr::SelectIndexV1( - Box::new(crate::proto::golem::rib::SelectIndexExprV1 { - expr: Some(Box::new((*expr).into())), - index: Some(Box::new((*index).into())), - type_name: type_annotation.map(|t| t.into()), - }), - )), - - Expr::Sequence { - exprs: expressions, - type_annotation, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Sequence( - crate::proto::golem::rib::SequenceExpr { - exprs: expressions.into_iter().map(|expr| expr.into()).collect(), - type_name: type_annotation.map(|t| t.into()), - }, - )), - Expr::Record { exprs: fields, .. } => { - Some(crate::proto::golem::rib::expr::Expr::Record( - crate::proto::golem::rib::RecordExpr { - fields: fields - .into_iter() - .map(|(name, expr)| crate::proto::golem::rib::RecordFieldExpr { - name, - expr: Some((*expr).into()), - }) - .collect(), - }, - )) - } - Expr::Tuple { - exprs: expressions, .. - } => Some(crate::proto::golem::rib::expr::Expr::Tuple( - crate::proto::golem::rib::TupleExpr { - exprs: expressions.into_iter().map(|expr| expr.into()).collect(), - }, - )), - Expr::Literal { value, .. } => Some(crate::proto::golem::rib::expr::Expr::Literal( - crate::proto::golem::rib::LiteralExpr { value }, - )), - Expr::Number { - number, - type_annotation, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Number( - crate::proto::golem::rib::NumberExpr { - number: Some(number.value.to_string()), - float: None, - type_name: type_annotation.map(|t| t.into()), - }, - )), - Expr::Flags { flags, .. } => Some(crate::proto::golem::rib::expr::Expr::Flags( - crate::proto::golem::rib::FlagsExpr { values: flags }, - )), - Expr::Identifier { - variable_id, - type_annotation, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Identifier( - crate::proto::golem::rib::IdentifierExpr { - name: variable_id.name(), - type_name: type_annotation.map(|t| t.into()), - }, - )), - Expr::Boolean { value, .. } => Some(crate::proto::golem::rib::expr::Expr::Boolean( - crate::proto::golem::rib::BooleanExpr { value }, - )), - Expr::Concat { - exprs: expressions, .. - } => Some(crate::proto::golem::rib::expr::Expr::Concat( - crate::proto::golem::rib::ConcatExpr { - exprs: expressions.into_iter().map(|expr| expr.into()).collect(), - }, - )), - Expr::ExprBlock { - exprs: expressions, .. - } => Some(crate::proto::golem::rib::expr::Expr::Multiple( - crate::proto::golem::rib::MultipleExpr { - exprs: expressions.into_iter().map(|expr| expr.into()).collect(), - }, - )), - Expr::Not { expr, .. } => Some(crate::proto::golem::rib::expr::Expr::Not( - Box::new(crate::proto::golem::rib::NotExpr { - expr: Some(Box::new((*expr).into())), - }), - )), - Expr::GreaterThan { - lhs: left, - rhs: right, - .. - } => Some(crate::proto::golem::rib::expr::Expr::GreaterThan(Box::new( - crate::proto::golem::rib::GreaterThanExpr { - left: Some(Box::new((*left).into())), - right: Some(Box::new((*right).into())), - }, - ))), - Expr::GreaterThanOrEqualTo { lhs, rhs, .. } => { - Some(crate::proto::golem::rib::expr::Expr::GreaterThanOrEqual( - Box::new(crate::proto::golem::rib::GreaterThanOrEqualToExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }), - )) - } - Expr::LessThan { - lhs: left, - rhs: right, - .. - } => Some(crate::proto::golem::rib::expr::Expr::LessThan(Box::new( - crate::proto::golem::rib::LessThanExpr { - left: Some(Box::new((*left).into())), - right: Some(Box::new((*right).into())), - }, - ))), - Expr::Plus { - lhs: left, - rhs: right, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Add(Box::new( - crate::proto::golem::rib::AddExpr { - left: Some(Box::new((*left).into())), - right: Some(Box::new((*right).into())), - }, - ))), - Expr::Minus { - lhs: left, - rhs: right, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Subtract(Box::new( - crate::proto::golem::rib::SubtractExpr { - left: Some(Box::new((*left).into())), - right: Some(Box::new((*right).into())), - }, - ))), - Expr::Divide { lhs, rhs, .. } => { - Some(crate::proto::golem::rib::expr::Expr::Divide(Box::new( - crate::proto::golem::rib::DivideExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }, - ))) - } - Expr::Multiply { lhs, rhs, .. } => { - Some(crate::proto::golem::rib::expr::Expr::Multiply(Box::new( - crate::proto::golem::rib::MultiplyExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }, - ))) - } - Expr::LessThanOrEqualTo { lhs, rhs, .. } => { - Some(crate::proto::golem::rib::expr::Expr::LessThanOrEqual( - Box::new(crate::proto::golem::rib::LessThanOrEqualToExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }), - )) - } - Expr::EqualTo { lhs, rhs, .. } => { - Some(crate::proto::golem::rib::expr::Expr::EqualTo(Box::new( - crate::proto::golem::rib::EqualToExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }, - ))) - } - // Note: We were storing and retrieving (proto) condition expressions such that - // `cond` was written `lhs` and vice versa. - // This is probably difficult to fix to keep backward compatibility - // The issue is only with the protobuf types and the roundtrip tests were/are working since - // the read handles this (i.e, reading cond as lhs) - Expr::Cond { - cond: lhs, - lhs: cond, - rhs, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Cond(Box::new( - crate::proto::golem::rib::CondExpr { - left: Some(Box::new((*lhs).into())), - cond: Some(Box::new((*cond).into())), - right: Some(Box::new((*rhs).into())), - }, - ))), - Expr::PatternMatch { - predicate, - match_arms, - .. - } => Some(crate::proto::golem::rib::expr::Expr::PatternMatch( - Box::new(crate::proto::golem::rib::PatternMatchExpr { - expr: Some(Box::new((*predicate).into())), - patterns: match_arms.into_iter().map(|a| a.into()).collect(), - }), - )), - Expr::Option { - expr, - type_annotation, - .. - } => Some(crate::proto::golem::rib::expr::Expr::Option(Box::new( - crate::proto::golem::rib::OptionExpr { - expr: expr.map(|expr| Box::new((*expr).into())), - type_name: type_annotation.map(|t| t.into()), - }, - ))), - Expr::Result { - expr, - type_annotation, - .. - } => { - let type_name = type_annotation.map(|t| t.into()); - - let result = match expr { - Ok(expr) => crate::proto::golem::rib::result_expr::Result::Ok(Box::new( - (*expr).into(), - )), - Err(expr) => crate::proto::golem::rib::result_expr::Result::Err(Box::new( - (*expr).into(), - )), - }; - - Some(crate::proto::golem::rib::expr::Expr::Result(Box::new( - crate::proto::golem::rib::ResultExpr { - result: Some(result), - type_name, - }, - ))) - } - Expr::Call { - call_type, - generic_type_parameter, - args, - .. - } => { - Some(crate::proto::golem::rib::expr::Expr::Call(Box::new( - crate::proto::golem::rib::CallExpr { - name: None, // Kept for backward compatibility - params: args.into_iter().map(|expr| expr.into()).collect(), - generic_type_parameter: generic_type_parameter.map(|t| t.value), - call_type: Some(Box::new(crate::proto::golem::rib::CallType::from( - call_type, - ))), - }, - ))) - } - Expr::Unwrap { expr, .. } => Some(crate::proto::golem::rib::expr::Expr::Unwrap( - Box::new(crate::proto::golem::rib::UnwrapExpr { - expr: Some(Box::new((*expr).into())), - }), - )), - Expr::Throw { message, .. } => Some(crate::proto::golem::rib::expr::Expr::Throw( - crate::proto::golem::rib::ThrowExpr { message }, - )), - Expr::GetTag { expr, .. } => Some(crate::proto::golem::rib::expr::Expr::Tag( - Box::new(crate::proto::golem::rib::GetTagExpr { - expr: Some(Box::new((*expr).into())), - }), - )), - Expr::And { lhs, rhs, .. } => Some(crate::proto::golem::rib::expr::Expr::And( - Box::new(crate::proto::golem::rib::AndExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }), - )), - - Expr::Or { lhs, rhs, .. } => Some(crate::proto::golem::rib::expr::Expr::Or( - Box::new(crate::proto::golem::rib::OrExpr { - left: Some(Box::new((*lhs).into())), - right: Some(Box::new((*rhs).into())), - }), - )), - Expr::ListComprehension { - iterated_variable, - iterable_expr, - yield_expr, - .. - } => Some(crate::proto::golem::rib::expr::Expr::ListComprehension( - Box::new(crate::proto::golem::rib::ListComprehensionExpr { - iterated_variable: iterated_variable.name(), - iterable_expr: Some(Box::new((*iterable_expr).into())), - yield_expr: Some(Box::new((*yield_expr).into())), - }), - )), - - Expr::ListReduce { - reduce_variable, - iterated_variable, - iterable_expr, - yield_expr, - init_value_expr, - .. - } => Some(crate::proto::golem::rib::expr::Expr::ListReduce(Box::new( - crate::proto::golem::rib::ListReduceExpr { - reduce_variable: reduce_variable.name(), - iterated_variable: iterated_variable.name(), - iterable_expr: Some(Box::new((*iterable_expr).into())), - init_value_expr: Some(Box::new((*init_value_expr).into())), - yield_expr: Some(Box::new((*yield_expr).into())), - }, - ))), - Expr::InvokeMethodLazy { - lhs, - method, - generic_type_parameter, - args, - .. - } => Some(crate::proto::golem::rib::expr::Expr::LazyInvokeMethod( - Box::new(crate::proto::golem::rib::LazyInvokeMethodExpr { - lhs: Some(Box::new((*lhs).into())), - method, - generic_type_parameter: generic_type_parameter.map(|t| t.value), - args: args.into_iter().map(|expr| expr.into()).collect(), - }), - )), - }; - - crate::proto::golem::rib::Expr { expr } - } - } - - impl TryFrom for ArmPattern { - type Error = String; - - fn try_from(value: crate::proto::golem::rib::ArmPattern) -> Result { - let pattern = value.pattern.ok_or("Missing pattern")?; - match pattern { - crate::proto::golem::rib::arm_pattern::Pattern::WildCard(_) => { - Ok(ArmPattern::WildCard) - } - crate::proto::golem::rib::arm_pattern::Pattern::As(asp) => { - let name = asp.name; - let pattern = asp.pattern.ok_or("Missing pattern")?; - Ok(ArmPattern::As(name, Box::new((*pattern).try_into()?))) - } - crate::proto::golem::rib::arm_pattern::Pattern::Constructor( - crate::proto::golem::rib::ConstructorArmPattern { name, patterns }, - ) => { - let patterns = patterns - .into_iter() - .map(ArmPattern::try_from) - .collect::, _>>()?; - Ok(ArmPattern::Constructor(name, patterns)) - } - crate::proto::golem::rib::arm_pattern::Pattern::TupleConstructor( - crate::proto::golem::rib::TupleConstructorArmPattern { patterns }, - ) => { - let patterns = patterns - .into_iter() - .map(ArmPattern::try_from) - .collect::, _>>()?; - Ok(ArmPattern::TupleConstructor(patterns)) - } - crate::proto::golem::rib::arm_pattern::Pattern::Literal( - crate::proto::golem::rib::LiteralArmPattern { expr }, - ) => { - let inner = expr.ok_or("Missing expr")?; - Ok(ArmPattern::Literal(Box::new(inner.try_into()?))) - } - crate::proto::golem::rib::arm_pattern::Pattern::RecordConstructor( - crate::proto::golem::rib::RecordConstructorArmPattern { fields }, - ) => { - let fields = fields - .into_iter() - .map(|field| { - let name = field.name; - let proto_pattern = field.pattern.ok_or("Missing pattern")?; - let arm_pattern = ArmPattern::try_from(proto_pattern)?; - Ok((name, arm_pattern)) - }) - .collect::, String>>()?; - Ok(ArmPattern::RecordConstructor(fields)) - } - crate::proto::golem::rib::arm_pattern::Pattern::ListConstructor( - crate::proto::golem::rib::ListConstructorArmPattern { patterns }, - ) => { - let patterns = patterns - .into_iter() - .map(ArmPattern::try_from) - .collect::, _>>()?; - Ok(ArmPattern::ListConstructor(patterns)) - } - } - } - } - - impl From for crate::proto::golem::rib::ArmPattern { - fn from(value: ArmPattern) -> Self { - match value { - ArmPattern::WildCard => crate::proto::golem::rib::ArmPattern { - pattern: Some(crate::proto::golem::rib::arm_pattern::Pattern::WildCard( - crate::proto::golem::rib::WildCardArmPattern {}, - )), - }, - ArmPattern::As(name, pattern) => crate::proto::golem::rib::ArmPattern { - pattern: Some(crate::proto::golem::rib::arm_pattern::Pattern::As( - Box::new(crate::proto::golem::rib::AsArmPattern { - name, - pattern: Some(Box::new((*pattern).into())), - }), - )), - }, - ArmPattern::Constructor(name, patterns) => crate::proto::golem::rib::ArmPattern { - pattern: Some(crate::proto::golem::rib::arm_pattern::Pattern::Constructor( - crate::proto::golem::rib::ConstructorArmPattern { - name, - patterns: patterns - .into_iter() - .map(crate::proto::golem::rib::ArmPattern::from) - .collect(), - }, - )), - }, - ArmPattern::Literal(expr) => crate::proto::golem::rib::ArmPattern { - pattern: Some(crate::proto::golem::rib::arm_pattern::Pattern::Literal( - crate::proto::golem::rib::LiteralArmPattern { - expr: Some((*expr).into()), - }, - )), - }, - - ArmPattern::TupleConstructor(patterns) => crate::proto::golem::rib::ArmPattern { - pattern: Some( - crate::proto::golem::rib::arm_pattern::Pattern::TupleConstructor( - crate::proto::golem::rib::TupleConstructorArmPattern { - patterns: patterns - .into_iter() - .map(crate::proto::golem::rib::ArmPattern::from) - .collect(), - }, - ), - ), - }, - - ArmPattern::RecordConstructor(fields) => crate::proto::golem::rib::ArmPattern { - pattern: Some( - crate::proto::golem::rib::arm_pattern::Pattern::RecordConstructor( - crate::proto::golem::rib::RecordConstructorArmPattern { - fields: fields - .into_iter() - .map(|(name, pattern)| { - crate::proto::golem::rib::RecordFieldArmPattern { - name, - pattern: Some(pattern.into()), - } - }) - .collect(), - }, - ), - ), - }, - - ArmPattern::ListConstructor(patterns) => crate::proto::golem::rib::ArmPattern { - pattern: Some( - crate::proto::golem::rib::arm_pattern::Pattern::ListConstructor( - crate::proto::golem::rib::ListConstructorArmPattern { - patterns: patterns - .into_iter() - .map(crate::proto::golem::rib::ArmPattern::from) - .collect(), - }, - ), - ), - }, - } - } - } - - impl TryFrom for MatchArm { - type Error = String; - - fn try_from(value: crate::proto::golem::rib::MatchArm) -> Result { - let pattern = value.pattern.ok_or("Missing pattern")?; - let expr = value.expr.ok_or("Missing expr")?; - Ok(MatchArm::new(pattern.try_into()?, expr.try_into()?)) - } - } - - impl From for crate::proto::golem::rib::MatchArm { - fn from(value: MatchArm) -> Self { - let MatchArm { - arm_pattern, - arm_resolution_expr, - } = value; - crate::proto::golem::rib::MatchArm { - pattern: Some(arm_pattern.into()), - expr: Some((*arm_resolution_expr).into()), - } - } - } -} - fn find_expr(expr: &mut Expr, source_span: &SourceSpan) -> Option { let mut expr = expr.clone(); diff --git a/rib-core/src/function_name.rs b/rib-core/src/function_name.rs index 4da0c68..f558ad8 100644 --- a/rib-core/src/function_name.rs +++ b/rib-core/src/function_name.rs @@ -14,10 +14,6 @@ use combine::stream::position::Stream; use combine::{eof, EasyParser, Parser}; -use desert_rust::{ - BinaryCodec, BinaryDeserializer, BinaryOutput, BinarySerializer, DeserializationContext, - SerializationContext, -}; use semver::{BuildMetadata, Prerelease}; use serde::{Deserialize, Serialize}; use std::fmt::Display; @@ -39,45 +35,7 @@ impl std::fmt::Debug for SemVer { } } -impl BinarySerializer for SemVer { - fn serialize( - &self, - context: &mut SerializationContext, - ) -> desert_rust::Result<()> { - BinarySerializer::serialize(&self.0.major, context)?; - BinarySerializer::serialize(&self.0.minor, context)?; - BinarySerializer::serialize(&self.0.patch, context)?; - BinarySerializer::serialize(&self.0.pre.as_str(), context)?; - BinarySerializer::serialize(&self.0.build.as_str(), context)?; - Ok(()) - } -} - -impl BinaryDeserializer for SemVer { - fn deserialize(context: &mut DeserializationContext<'_>) -> desert_rust::Result { - let major = ::deserialize(context)?; - let minor = ::deserialize(context)?; - let patch = ::deserialize(context)?; - let pre_str = ::deserialize(context)?; - let build_str = ::deserialize(context)?; - let pre = Prerelease::new(&pre_str) - .map_err(|_| desert_rust::Error::DeserializationFailure("Invalid prerelease".into()))?; - let build = BuildMetadata::new(&build_str).map_err(|_| { - desert_rust::Error::DeserializationFailure("Invalid build metadata".into()) - })?; - - Ok(SemVer(semver::Version { - major, - minor, - patch, - pre, - build, - })) - } -} - -#[derive(Debug, Hash, PartialEq, Eq, Clone, BinaryCodec, Ord, PartialOrd)] -#[desert(evolution())] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub enum ParsedFunctionSite { Global, Interface { @@ -137,8 +95,7 @@ impl ParsedFunctionSite { } } -#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub enum DynamicParsedFunctionReference { Function { function: String }, RawResourceConstructor { resource: String }, @@ -191,8 +148,7 @@ impl DynamicParsedFunctionReference { } } -#[derive(Debug, PartialEq, Eq, Clone, Hash, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, PartialEq, Eq, Clone, Hash)] pub enum ParsedFunctionReference { Function { function: String }, RawResourceConstructor { resource: String }, @@ -270,8 +226,7 @@ impl ParsedFunctionReference { // `Examples`: // `DynamicParsedFunctionName` : ns:name/interface.{resource1(identifier1, { field-a: some(identifier2) }).new} // `ParsedFunctionName` : ns:name/interface.{resource1("foo", { field-a: some("bar") }).new} -#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub struct DynamicParsedFunctionName { pub site: ParsedFunctionSite, pub function: DynamicParsedFunctionReference, @@ -330,8 +285,7 @@ impl Display for DynamicParsedFunctionName { } } -#[derive(Debug, PartialEq, Eq, Clone, Hash, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, PartialEq, Eq, Clone, Hash)] pub struct ParsedFunctionName { pub site: ParsedFunctionSite, pub function: ParsedFunctionReference, @@ -446,319 +400,6 @@ impl ParsedFunctionName { } } -mod protobuf { - use crate::proto::golem::rib::dynamic_parsed_function_reference::FunctionReference as ProtoDynamicFunctionReference; - use crate::{ - DynamicParsedFunctionName, DynamicParsedFunctionReference, ParsedFunctionName, - ParsedFunctionReference, ParsedFunctionSite, SemVer, - }; - use semver::{BuildMetadata, Prerelease}; - - impl TryFrom for SemVer { - type Error = String; - - fn try_from(value: crate::proto::golem::rib::SemVersion) -> Result { - Ok(SemVer(semver::Version { - major: value.major, - minor: value.minor, - patch: value.patch, - pre: Prerelease::new(&value.pre).map_err(|_| "Invalid prerelease".to_string())?, - build: BuildMetadata::new(&value.build) - .map_err(|_| "Invalid build metadata".to_string())?, - })) - } - } - - impl From for crate::proto::golem::rib::SemVersion { - fn from(value: SemVer) -> Self { - crate::proto::golem::rib::SemVersion { - major: value.0.major, - minor: value.0.minor, - patch: value.0.patch, - pre: value.0.pre.to_string(), - build: value.0.build.to_string(), - } - } - } - - impl TryFrom for ParsedFunctionSite { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::ParsedFunctionSite, - ) -> Result { - let site = value.site.ok_or("Missing site".to_string())?; - match site { - crate::proto::golem::rib::parsed_function_site::Site::Global(_) => Ok(Self::Global), - crate::proto::golem::rib::parsed_function_site::Site::Interface( - crate::proto::golem::rib::InterfaceFunctionSite { name }, - ) => Ok(Self::Interface { name }), - crate::proto::golem::rib::parsed_function_site::Site::PackageInterface( - crate::proto::golem::rib::PackageInterfaceFunctionSite { - namespace, - package, - interface, - version, - }, - ) => { - let version = match version { - Some(version) => Some(version.try_into()?), - None => None, - }; - - Ok(Self::PackagedInterface { - namespace, - package, - interface, - version, - }) - } - } - } - } - - impl From for crate::proto::golem::rib::ParsedFunctionSite { - fn from(value: ParsedFunctionSite) -> Self { - let site = match value { - ParsedFunctionSite::Global => { - crate::proto::golem::rib::parsed_function_site::Site::Global( - crate::proto::golem::rib::GlobalFunctionSite {}, - ) - } - ParsedFunctionSite::Interface { name } => { - crate::proto::golem::rib::parsed_function_site::Site::Interface( - crate::proto::golem::rib::InterfaceFunctionSite { name }, - ) - } - ParsedFunctionSite::PackagedInterface { - namespace, - package, - interface, - version, - } => crate::proto::golem::rib::parsed_function_site::Site::PackageInterface( - crate::proto::golem::rib::PackageInterfaceFunctionSite { - namespace, - package, - interface, - version: version.map(|v| v.into()), - }, - ), - }; - crate::proto::golem::rib::ParsedFunctionSite { site: Some(site) } - } - } - - impl From - for crate::proto::golem::rib::DynamicParsedFunctionReference - { - fn from(value: DynamicParsedFunctionReference) -> Self { - let function = match value { - DynamicParsedFunctionReference::Function { function } => { - ProtoDynamicFunctionReference::Function( - crate::proto::golem::rib::FunctionFunctionReference { function }, - ) - } - DynamicParsedFunctionReference::RawResourceConstructor { resource } => { - ProtoDynamicFunctionReference::RawResourceConstructor( - crate::proto::golem::rib::RawResourceConstructorFunctionReference { - resource, - }, - ) - } - DynamicParsedFunctionReference::RawResourceMethod { resource, method } => { - ProtoDynamicFunctionReference::RawResourceMethod( - crate::proto::golem::rib::RawResourceMethodFunctionReference { - resource, - method, - }, - ) - } - DynamicParsedFunctionReference::RawResourceStaticMethod { resource, method } => { - ProtoDynamicFunctionReference::RawResourceStaticMethod( - crate::proto::golem::rib::RawResourceStaticMethodFunctionReference { - resource, - method, - }, - ) - } - DynamicParsedFunctionReference::RawResourceDrop { resource } => { - ProtoDynamicFunctionReference::RawResourceDrop( - crate::proto::golem::rib::RawResourceDropFunctionReference { resource }, - ) - } - }; - - crate::proto::golem::rib::DynamicParsedFunctionReference { - function_reference: Some(function), - } - } - } - - impl TryFrom - for DynamicParsedFunctionReference - { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::DynamicParsedFunctionReference, - ) -> Result { - let function = value - .function_reference - .ok_or("Missing function reference".to_string())?; - - match function { - ProtoDynamicFunctionReference::Function( - crate::proto::golem::rib::FunctionFunctionReference { function }, - ) => Ok(Self::Function { function }), - ProtoDynamicFunctionReference::RawResourceConstructor( - crate::proto::golem::rib::RawResourceConstructorFunctionReference { resource }, - ) => Ok(Self::RawResourceConstructor { resource }), - ProtoDynamicFunctionReference::RawResourceMethod( - crate::proto::golem::rib::RawResourceMethodFunctionReference { - resource, - method, - }, - ) => Ok(Self::RawResourceMethod { resource, method }), - ProtoDynamicFunctionReference::RawResourceStaticMethod( - crate::proto::golem::rib::RawResourceStaticMethodFunctionReference { - resource, - method, - }, - ) => Ok(Self::RawResourceStaticMethod { resource, method }), - ProtoDynamicFunctionReference::RawResourceDrop( - crate::proto::golem::rib::RawResourceDropFunctionReference { resource }, - ) => Ok(Self::RawResourceDrop { resource }), - } - } - } - - impl TryFrom for ParsedFunctionReference { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::ParsedFunctionReference, - ) -> Result { - let function = value - .function_reference - .ok_or("Missing function".to_string())?; - match function { - crate::proto::golem::rib::parsed_function_reference::FunctionReference::Function(crate::proto::golem::rib::FunctionFunctionReference { - function - }) => { - Ok(Self::Function { function }) - } - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceConstructor(crate::proto::golem::rib::RawResourceConstructorFunctionReference { - resource - }) => { - Ok(Self::RawResourceConstructor { resource }) - } - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceMethod(crate::proto::golem::rib::RawResourceMethodFunctionReference { - resource, - method - }) => { - Ok(Self::RawResourceMethod { resource, method }) - } - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceStaticMethod(crate::proto::golem::rib::RawResourceStaticMethodFunctionReference { - resource, - method - }) => { - Ok(Self::RawResourceStaticMethod { resource, method }) - } - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceDrop(crate::proto::golem::rib::RawResourceDropFunctionReference { - resource - }) => { - Ok(Self::RawResourceDrop { resource }) - } - } - } - } - - impl From for crate::proto::golem::rib::ParsedFunctionReference { - fn from(value: ParsedFunctionReference) -> Self { - let function = match value { - ParsedFunctionReference::Function { function } => crate::proto::golem::rib::parsed_function_reference::FunctionReference::Function( - crate::proto::golem::rib::FunctionFunctionReference { function }, - ), - ParsedFunctionReference::RawResourceConstructor { resource } => { - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceConstructor( - crate::proto::golem::rib::RawResourceConstructorFunctionReference { - resource, - }, - ) - } - ParsedFunctionReference::RawResourceMethod { resource, method } => { - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceMethod( - crate::proto::golem::rib::RawResourceMethodFunctionReference { - resource, - method, - }, - ) - } - ParsedFunctionReference::RawResourceStaticMethod { resource, method } => { - crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceStaticMethod( - crate::proto::golem::rib::RawResourceStaticMethodFunctionReference { - resource, - method, - }, - ) - } - ParsedFunctionReference::RawResourceDrop { resource } => crate::proto::golem::rib::parsed_function_reference::FunctionReference::RawResourceDrop( - crate::proto::golem::rib::RawResourceDropFunctionReference { resource }, - ), - }; - crate::proto::golem::rib::ParsedFunctionReference { - function_reference: Some(function), - } - } - } - - impl TryFrom for DynamicParsedFunctionName { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::DynamicParsedFunctionName, - ) -> Result { - let site = ParsedFunctionSite::try_from(value.site.ok_or("Missing site".to_string())?)?; - let function = DynamicParsedFunctionReference::try_from( - value.function.ok_or("Missing function".to_string())?, - )?; - Ok(Self { site, function }) - } - } - - impl TryFrom for ParsedFunctionName { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::ParsedFunctionName, - ) -> Result { - let site = ParsedFunctionSite::try_from(value.site.ok_or("Missing site".to_string())?)?; - let function = ParsedFunctionReference::try_from( - value.function.ok_or("Missing function".to_string())?, - )?; - Ok(Self { site, function }) - } - } - - impl From for crate::proto::golem::rib::ParsedFunctionName { - fn from(value: ParsedFunctionName) -> Self { - crate::proto::golem::rib::ParsedFunctionName { - site: Some(value.site.into()), - function: Some(value.function.into()), - } - } - } - - impl From for crate::proto::golem::rib::DynamicParsedFunctionName { - fn from(value: DynamicParsedFunctionName) -> Self { - crate::proto::golem::rib::DynamicParsedFunctionName { - site: Some(value.site.into()), - function: Some(value.function.into()), - } - } - } -} - #[cfg(test)] mod function_name_tests { use super::{ParsedFunctionName, ParsedFunctionReference, ParsedFunctionSite, SemVer}; diff --git a/rib-core/src/generic_type_parameter.rs b/rib-core/src/generic_type_parameter.rs index cecd3d0..653e0d6 100644 --- a/rib-core/src/generic_type_parameter.rs +++ b/rib-core/src/generic_type_parameter.rs @@ -12,11 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -use desert_rust::BinaryCodec; use std::fmt::Display; -#[derive(Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, PartialEq, Eq, Ord, PartialOrd)] pub struct GenericTypeParameter { pub value: String, } diff --git a/rib-core/src/inferred_type/mod.rs b/rib-core/src/inferred_type/mod.rs index 039bc38..5aa4d45 100644 --- a/rib-core/src/inferred_type/mod.rs +++ b/rib-core/src/inferred_type/mod.rs @@ -23,19 +23,17 @@ mod type_internal; mod type_origin; mod unification; +use crate::analysis::*; use crate::instance_type::InstanceType; use crate::rib_source_span::SourceSpan; use crate::type_inference::GetTypeHint; use crate::TypeName; use bigdecimal::BigDecimal; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::*; use std::fmt::{Display, Formatter}; use std::hash::{Hash, Hasher}; use std::ops::Deref; -#[derive(Debug, Clone, Eq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, Eq, PartialOrd, Ord)] pub struct InferredType { pub inner: Box, pub origin: TypeOrigin, @@ -692,12 +690,10 @@ impl From<&AnalysedType> for InferredType { AnalysedType::Flags(vs) => InferredType::flags(vs.names.clone()), AnalysedType::Enum(vs) => InferredType::from_enum_cases(vs), AnalysedType::Option(t) => InferredType::option(t.inner.as_ref().into()), - AnalysedType::Result(golem_wasm::analysis::TypeResult { ok, err, .. }) => { - InferredType::result( - ok.as_ref().map(|t| t.as_ref().into()), - err.as_ref().map(|t| t.as_ref().into()), - ) - } + AnalysedType::Result(TypeResult { ok, err, .. }) => InferredType::result( + ok.as_ref().map(|t| t.as_ref().into()), + err.as_ref().map(|t| t.as_ref().into()), + ), AnalysedType::Variant(vs) => InferredType::from_type_variant(vs), AnalysedType::Handle(TypeHandle { resource_id, diff --git a/rib-core/src/inferred_type/type_internal.rs b/rib-core/src/inferred_type/type_internal.rs index 3f79584..8264605 100644 --- a/rib-core/src/inferred_type/type_internal.rs +++ b/rib-core/src/inferred_type/type_internal.rs @@ -14,11 +14,9 @@ use crate::inferred_type::TypeOrigin; use crate::{ComponentDependencyKey, InferredType, InstanceType}; -use desert_rust::BinaryCodec; use std::hash::{Hash, Hasher}; -#[derive(Debug, Clone, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, Ord, PartialOrd)] pub enum TypeInternal { Bool, S8, diff --git a/rib-core/src/inferred_type/type_origin.rs b/rib-core/src/inferred_type/type_origin.rs index bd60236..7033d75 100644 --- a/rib-core/src/inferred_type/type_origin.rs +++ b/rib-core/src/inferred_type/type_origin.rs @@ -14,12 +14,10 @@ use crate::rib_source_span::SourceSpan; use bigdecimal::BigDecimal; -use desert_rust::BinaryCodec; use std::fmt::Debug; use std::hash::{Hash, Hasher}; -#[derive(Clone, Eq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Clone, Eq, PartialOrd, Ord)] pub enum TypeOrigin { OriginatedAt(SourceSpan), Default(DefaultType), @@ -34,8 +32,7 @@ impl Debug for TypeOrigin { } } -#[derive(Clone, Debug, Eq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Clone, Debug, Eq, PartialOrd, Ord)] pub enum DefaultType { String, F64, diff --git a/rib-core/src/instance_type.rs b/rib-core/src/instance_type.rs index 731aaa9..aadb8d0 100644 --- a/rib-core/src/instance_type.rs +++ b/rib-core/src/instance_type.rs @@ -12,20 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::parser::{PackageName, TypeParameter}; -use crate::proto::golem::rib::{ - FullyQualifiedResourceConstructor as ProtoFullyQualifiedResourceConstructor, - FunctionType as ProtoFunctionType, InterfaceName as ProtoInterfaceName, - PackageName as ProtoPackageName, -}; use crate::type_parameter::InterfaceName; use crate::FunctionName; use crate::{ ComponentDependencies, ComponentDependencyKey, Expr, FullyQualifiedResourceConstructor, FunctionDictionary, FunctionType, InferredType, ResourceMethodDictionary, }; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::AnalysedType; use std::collections::{BTreeMap, HashMap, HashSet}; use std::convert::TryFrom; use std::fmt::Debug; @@ -38,8 +32,7 @@ use std::ops::Deref; // // Please look at `InstanceCreationType` // for a tangible view on the fact that an instance can be either worker or a resource. -#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub enum InstanceType { // Holds functions across every package and interface in every component Global { @@ -699,148 +692,3 @@ fn search_function_in_multiple_packages( error_msg.push_str(&package_interface_list.join(", ")); Err(error_msg) } - -mod protobuf { - use crate::proto::golem::rib::FullyQualifiedFunctionName as ProtoFullyQualifiedFunctionName; - use crate::proto::golem::rib::FullyQualifiedResourceConstructor as ProtoFullyQualifiedResourceConstructor; - use crate::proto::golem::rib::FullyQualifiedResourceMethod as ProtoFullyQualifiedResourceMethod; - use crate::proto::golem::rib::InterfaceName as ProtoInterfaceName; - use crate::proto::golem::rib::PackageName as ProtoPackageName; - use crate::{ - FullyQualifiedFunctionName, FullyQualifiedResourceConstructor, - FullyQualifiedResourceMethod, InterfaceName, PackageName, - }; - - impl TryFrom for PackageName { - type Error = String; - - fn try_from(proto: ProtoPackageName) -> Result { - Ok(PackageName { - namespace: proto.namespace, - package_name: proto.package_name, - version: proto.version, - }) - } - } - - impl TryFrom for InterfaceName { - type Error = String; - - fn try_from(value: ProtoInterfaceName) -> Result { - Ok(InterfaceName { - name: value.name, - version: value.version, - }) - } - } - - impl TryFrom for FullyQualifiedFunctionName { - type Error = String; - - fn try_from(proto: ProtoFullyQualifiedFunctionName) -> Result { - Ok(FullyQualifiedFunctionName { - package_name: proto.package_name.map(TryFrom::try_from).transpose()?, - interface_name: proto.interface_name.map(TryFrom::try_from).transpose()?, - function_name: proto.function_name, - }) - } - } - - impl From for ProtoFullyQualifiedFunctionName { - fn from(value: FullyQualifiedFunctionName) -> Self { - ProtoFullyQualifiedFunctionName { - package_name: value.package_name.map(ProtoPackageName::from), - interface_name: value.interface_name.map(ProtoInterfaceName::from), - function_name: value.function_name, - } - } - } - - impl TryFrom for FullyQualifiedResourceMethod { - type Error = String; - - fn try_from(proto: ProtoFullyQualifiedResourceMethod) -> Result { - Ok(FullyQualifiedResourceMethod { - resource_name: proto.resource_name, - method_name: proto.method_name, - package_name: proto.package_name.map(TryFrom::try_from).transpose()?, - interface_name: proto.interface_name.map(TryFrom::try_from).transpose()?, - static_function: false, //FIXME - }) - } - } - - impl From for ProtoFullyQualifiedResourceMethod { - fn from(value: FullyQualifiedResourceMethod) -> Self { - ProtoFullyQualifiedResourceMethod { - resource_name: value.resource_name, - method_name: value.method_name, - package_name: value.package_name.map(ProtoPackageName::from), - interface_name: value.interface_name.map(ProtoInterfaceName::from), - } - } - } - - impl TryFrom for FullyQualifiedResourceConstructor { - type Error = String; - - fn try_from(proto: ProtoFullyQualifiedResourceConstructor) -> Result { - Ok(FullyQualifiedResourceConstructor { - package_name: proto.package_name.map(TryFrom::try_from).transpose()?, - interface_name: proto.interface_name.map(TryFrom::try_from).transpose()?, - resource_name: proto.resource_name, - }) - } - } -} - -impl TryFrom for FunctionType { - type Error = String; - - fn try_from(proto: ProtoFunctionType) -> Result { - let mut parameter_types = Vec::new(); - for param in proto.parameter_types { - parameter_types.push(InferredType::from(&AnalysedType::try_from(¶m)?)); - } - - let return_type = proto - .return_type - .as_ref() - .map(|ret| AnalysedType::try_from(ret).map(|ret| InferredType::from(&ret))) - .transpose()?; - - Ok(Self { - parameter_types, - return_type, - }) - } -} - -impl From for ProtoPackageName { - fn from(value: PackageName) -> Self { - ProtoPackageName { - namespace: value.namespace, - package_name: value.package_name, - version: value.version, - } - } -} - -impl From for ProtoInterfaceName { - fn from(value: InterfaceName) -> Self { - ProtoInterfaceName { - name: value.name, - version: value.version, - } - } -} - -impl From for ProtoFullyQualifiedResourceConstructor { - fn from(value: FullyQualifiedResourceConstructor) -> Self { - ProtoFullyQualifiedResourceConstructor { - package_name: value.package_name.map(ProtoPackageName::from), - interface_name: value.interface_name.map(ProtoInterfaceName::from), - resource_name: value.resource_name, - } - } -} diff --git a/rib-core/src/interpreter/env.rs b/rib-core/src/interpreter/env.rs index e2f3029..4d65610 100644 --- a/rib-core/src/interpreter/env.rs +++ b/rib-core/src/interpreter/env.rs @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::interpreter::interpreter_stack_value::RibInterpreterStackValue; +use crate::ValueAndType; use crate::{ ComponentDependencyKey, EvaluatedFnArgs, EvaluatedFqFn, EvaluatedWorkerName, InstructionId, RibComponentFunctionInvoke, RibInput, VariableId, }; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::ValueAndType; use std::collections::HashMap; use std::fmt::Debug; use std::sync::Arc; @@ -122,13 +122,13 @@ impl EnvironmentKey { } mod internal { + use crate::analysis::AnalysedType; use crate::interpreter::env::RibComponentFunctionInvoke; use crate::{ ComponentDependencyKey, EvaluatedFnArgs, EvaluatedFqFn, EvaluatedWorkerName, InstructionId, RibFunctionInvokeResult, }; use async_trait::async_trait; - use golem_wasm::analysis::AnalysedType; pub(crate) struct NoopRibFunctionInvoke; diff --git a/rib-core/src/interpreter/interpreter_input.rs b/rib-core/src/interpreter/interpreter_input.rs index 10d7025..6706379 100644 --- a/rib-core/src/interpreter/interpreter_input.rs +++ b/rib-core/src/interpreter/interpreter_input.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use golem_wasm::ValueAndType; +use crate::ValueAndType; use std::collections::HashMap; // Acts as the structure to hold the global input values to the Rib script diff --git a/rib-core/src/interpreter/interpreter_result.rs b/rib-core/src/interpreter/interpreter_result.rs index 3e4f4a6..f208543 100644 --- a/rib-core/src/interpreter/interpreter_result.rs +++ b/rib-core/src/interpreter/interpreter_result.rs @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::analysed_type::tuple; +use crate::analysis::AnalysedType; use crate::interpreter::interpreter_stack_value::RibInterpreterStackValue; use crate::{GetLiteralValue, LiteralValue}; -use golem_wasm::analysis::analysed_type::tuple; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::{Value, ValueAndType}; +use crate::{Value, ValueAndType}; use std::fmt::{Display, Formatter}; #[derive(Debug, Clone, PartialEq)] diff --git a/rib-core/src/interpreter/interpreter_stack_value.rs b/rib-core/src/interpreter/interpreter_stack_value.rs index 2e4fcde..b5ccdca 100644 --- a/rib-core/src/interpreter/interpreter_stack_value.rs +++ b/rib-core/src/interpreter/interpreter_stack_value.rs @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::interpreter::literal::{GetLiteralValue, LiteralValue}; use crate::interpreter::rib_runtime_error::{ arithmetic_error, invalid_comparison, RibRuntimeError, }; use crate::{internal_corrupted_state, CoercedNumericValue, RibInterpreterResult}; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::{IntoValueAndType, Value, ValueAndType}; +use crate::{IntoValueAndType, Value, ValueAndType}; use std::fmt; use std::fmt::{Display, Formatter}; use std::ops::Deref; @@ -240,11 +240,11 @@ impl fmt::Debug for RibInterpreterStackValue { } mod internal { + use crate::analysis::{AnalysedType, TypeVariant}; use crate::interpreter::literal::{GetLiteralValue, LiteralValue}; use crate::interpreter::rib_runtime_error::invalid_comparison; use crate::{internal_corrupted_state, RibInterpreterResult}; - use golem_wasm::analysis::{AnalysedType, TypeVariant}; - use golem_wasm::{IntoValueAndType, Value, ValueAndType}; + use crate::{IntoValueAndType, Value, ValueAndType}; pub(crate) fn compare_typed_value( left: &ValueAndType, diff --git a/rib-core/src/interpreter/literal.rs b/rib-core/src/interpreter/literal.rs index e91e7fd..103eb55 100644 --- a/rib-core/src/interpreter/literal.rs +++ b/rib-core/src/interpreter/literal.rs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use golem_wasm::analysis::AnalysedType; -use golem_wasm::{IntoValueAndType, Value, ValueAndType}; +use crate::analysis::AnalysedType; +use crate::{IntoValueAndType, Value, ValueAndType}; use std::cmp::Ordering; use std::fmt::Display; @@ -388,7 +388,7 @@ impl Display for LiteralValue { mod internal { use crate::interpreter::literal::CoercedNumericValue; - use golem_wasm::{Value, ValueAndType}; + use crate::{Value, ValueAndType}; pub(crate) fn get_numeric_value(value_and_type: &ValueAndType) -> Option { match &value_and_type.value { diff --git a/rib-core/src/interpreter/rib_function_invoke.rs b/rib-core/src/interpreter/rib_function_invoke.rs index 0f8ac70..bcb3d79 100644 --- a/rib-core/src/interpreter/rib_function_invoke.rs +++ b/rib-core/src/interpreter/rib_function_invoke.rs @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; +use crate::ValueAndType; use crate::{ComponentDependencyKey, InstructionId}; use async_trait::async_trait; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::ValueAndType; #[async_trait] pub trait RibComponentFunctionInvoke { diff --git a/rib-core/src/interpreter/rib_interpreter.rs b/rib-core/src/interpreter/rib_interpreter.rs index d65e099..ad09c57 100644 --- a/rib-core/src/interpreter/rib_interpreter.rs +++ b/rib-core/src/interpreter/rib_interpreter.rs @@ -346,6 +346,8 @@ impl Interpreter { } mod internal { + use crate::analysis::AnalysedType; + use crate::analysis::TypeResult; use crate::interpreter::env::{EnvironmentKey, InterpreterEnv}; use crate::interpreter::interpreter_stack_value::RibInterpreterStackValue; use crate::interpreter::literal::LiteralValue; @@ -358,10 +360,9 @@ mod internal { RibComponentFunctionInvoke, RibFunctionInvokeResult, RibInterpreterResult, TypeHint, VariableId, }; - use golem_wasm::analysis::AnalysedType; - use golem_wasm::analysis::TypeResult; - use golem_wasm::{IntoValueAndType, Value, ValueAndType}; + use crate::{IntoValueAndType, Value, ValueAndType}; + use crate::analysis::analysed_type::{s16, s32, s64, s8, str, u16, u32, u64, u8}; use crate::interpreter::instruction_cursor::RibByteCodeCursor; use crate::interpreter::rib_runtime_error::{ cast_error_custom, empty_stack, exhausted_iterator, field_not_found, function_invoke_fail, @@ -371,7 +372,6 @@ mod internal { }; use crate::type_inference::GetTypeHint; use async_trait::async_trait; - use golem_wasm::analysis::analysed_type::{s16, s32, s64, s8, str, u16, u32, u64, u8}; use std::ops::Deref; pub(crate) struct NoopRibFunctionInvoke; @@ -1525,6 +1525,11 @@ mod tests { use test_r::test; use super::*; + use crate::analysis::analysed_type::{ + bool, case, f32, field, list, option, r#enum, record, result, result_err, result_ok, s32, + str, tuple, u32, u64, u8, unit_case, variant, + }; + use crate::analysis::AnalysedType; use crate::interpreter::rib_interpreter::tests::test_utils::{ get_analysed_type_variant, get_value_and_type, strip_spaces, RibTestDeps, }; @@ -1532,12 +1537,7 @@ mod tests { CustomInstanceSpec, Expr, GlobalVariableTypeSpec, InferredType, InstructionId, InterfaceName, Path, RibCompiler, RibCompilerConfig, VariableId, }; - use golem_wasm::analysis::analysed_type::{ - bool, case, f32, field, list, option, r#enum, record, result, result_err, result_ok, s32, - str, tuple, u32, u64, u8, unit_case, variant, - }; - use golem_wasm::analysis::AnalysedType; - use golem_wasm::{IntoValue, IntoValueAndType, Value, ValueAndType}; + use crate::{IntoValue, IntoValueAndType, Value, ValueAndType}; #[test] async fn test_interpreter_for_literal() { @@ -2385,7 +2385,7 @@ mod tests { .unwrap(); let expected = r#"["foo", "bar"]"#; - let expected_value = golem_wasm::parse_value_and_type(&list(str()), expected).unwrap(); + let expected_value = crate::parse_value_and_type(&list(str()), expected).unwrap(); assert_eq!(result, expected_value); } @@ -2416,8 +2416,7 @@ mod tests { .unwrap(); let expected = r#"[]"#; - let expected_value_and_type = - golem_wasm::parse_value_and_type(&list(str()), expected).unwrap(); + let expected_value_and_type = crate::parse_value_and_type(&list(str()), expected).unwrap(); assert_eq!(result, expected_value_and_type); } @@ -4878,8 +4877,17 @@ mod tests { } mod test_utils { + use crate::analysis::analysed_type::{ + case, f32, field, handle, list, option, r#enum, record, result, s32, str, tuple, u32, + u64, unit_case, variant, + }; + use crate::analysis::{ + AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedFunctionResult, + AnalysedInstance, AnalysedResourceId, AnalysedResourceMode, AnalysedType, TypeHandle, + }; use crate::interpreter::rib_interpreter::internal::NoopRibFunctionInvoke; use crate::interpreter::rib_interpreter::Interpreter; + use crate::{print_value_and_type, IntoValueAndType, Value, ValueAndType}; use crate::{ ComponentDependency, ComponentDependencyKey, DefaultWorkerNameGenerator, EvaluatedFnArgs, EvaluatedFqFn, EvaluatedWorkerName, GenerateWorkerName, @@ -4887,15 +4895,6 @@ mod tests { RibInput, }; use async_trait::async_trait; - use golem_wasm::analysis::analysed_type::{ - case, f32, field, handle, list, option, r#enum, record, result, s32, str, tuple, u32, - u64, unit_case, variant, - }; - use golem_wasm::analysis::{ - AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedFunctionResult, - AnalysedInstance, AnalysedResourceId, AnalysedResourceMode, AnalysedType, TypeHandle, - }; - use golem_wasm::{print_value_and_type, IntoValueAndType, Value, ValueAndType}; use std::sync::Arc; use uuid::Uuid; @@ -5371,7 +5370,7 @@ mod tests { analysed_type: &AnalysedType, wasm_wave_str: &str, ) -> ValueAndType { - golem_wasm::parse_value_and_type(analysed_type, wasm_wave_str).unwrap() + crate::parse_value_and_type(analysed_type, wasm_wave_str).unwrap() } pub(crate) fn interpreter_with_noop_function_invoke( diff --git a/rib-core/src/interpreter/rib_runtime_error.rs b/rib-core/src/interpreter/rib_runtime_error.rs index bf9f014..9d28de7 100644 --- a/rib-core/src/interpreter/rib_runtime_error.rs +++ b/rib-core/src/interpreter/rib_runtime_error.rs @@ -14,7 +14,7 @@ use crate::interpreter::interpreter_stack_value::RibInterpreterStackValue; use crate::{InstructionId, TypeHint}; -use golem_wasm::{Value, ValueAndType}; +use crate::{Value, ValueAndType}; use std::fmt::{Display, Formatter}; #[derive(Debug)] diff --git a/rib-core/src/interpreter/stack.rs b/rib-core/src/interpreter/stack.rs index 4d5f61e..cd2d915 100644 --- a/rib-core/src/interpreter/stack.rs +++ b/rib-core/src/interpreter/stack.rs @@ -12,16 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::analysed_type::{list, option, record, str, tuple, variant}; +use crate::analysis::{ + AnalysedType, NameOptionTypePair, NameTypePair, TypeEnum, TypeRecord, TypeResult, +}; use crate::interpreter::interpreter_stack_value::RibInterpreterStackValue; use crate::interpreter::rib_runtime_error::{ empty_stack, insufficient_stack_items, type_mismatch_with_value, }; use crate::{internal_corrupted_state, GetLiteralValue, RibInterpreterResult, TypeHint}; -use golem_wasm::analysis::analysed_type::{list, option, record, str, tuple, variant}; -use golem_wasm::analysis::{ - AnalysedType, NameOptionTypePair, NameTypePair, TypeEnum, TypeRecord, TypeResult, -}; -use golem_wasm::{Value, ValueAndType}; +use crate::{Value, ValueAndType}; #[derive(Debug)] pub struct InterpreterStack { diff --git a/rib-core/src/lib.rs b/rib-core/src/lib.rs index b63a51c..412f53a 100644 --- a/rib-core/src/lib.rs +++ b/rib-core/src/lib.rs @@ -28,10 +28,14 @@ pub use text::*; pub use type_checker::*; pub use type_inference::*; pub use type_parameter::*; +pub use value::Value; +pub use value_and_type::{IntoValue, IntoValueAndType, ValueAndType}; pub use variable_id::*; +pub use wasm_wave_text::*; mod call_type; +pub mod analysis; mod compiler; mod expr; mod function_name; @@ -49,34 +53,11 @@ mod type_inference; mod type_parameter; mod type_parameter_parser; mod type_refinement; +pub mod value; +pub mod value_and_type; mod variable_id; - -#[allow(clippy::large_enum_variant)] -pub mod proto { - use uuid::Uuid; - - tonic::include_proto!("mod"); - - pub const FILE_DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("services"); - - impl From for golem::rib::Uuid { - fn from(value: Uuid) -> Self { - let (high_bits, low_bits) = value.as_u64_pair(); - golem::rib::Uuid { - high_bits, - low_bits, - } - } - } - - impl From for Uuid { - fn from(value: golem::rib::Uuid) -> Self { - let high_bits = value.high_bits; - let low_bits = value.low_bits; - Uuid::from_u64_pair(high_bits, low_bits) - } - } -} +mod wasm_wave_text; +mod wave; #[cfg(test)] test_r::enable!(); diff --git a/rib-core/src/parser/literal.rs b/rib-core/src/parser/literal.rs index 463f6d3..bc46c1a 100644 --- a/rib-core/src/parser/literal.rs +++ b/rib-core/src/parser/literal.rs @@ -106,12 +106,9 @@ mod internal { >, Input::Position: GetSourcePosition, { - many1(choice(( - escaped_char(), - none_of("\"\\${}".chars()), - ))) - .map(LiteralTerm::Static) - .message("Unable to parse static part of literal") + many1(choice((escaped_char(), none_of("\"\\${}".chars())))) + .map(LiteralTerm::Static) + .message("Unable to parse static part of literal") } fn dynamic_term() -> impl Parser diff --git a/rib-core/src/parser/type_name.rs b/rib-core/src/parser/type_name.rs index 0a04550..f36c098 100644 --- a/rib-core/src/parser/type_name.rs +++ b/rib-core/src/parser/type_name.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::{AnalysedType, TypeResult}; use crate::parser::errors::RibParseError; use crate::rib_source_span::GetSourcePosition; use crate::{InferredNumber, InferredType, TypeInternal}; @@ -19,8 +20,6 @@ use combine::parser::char; use combine::parser::char::{char, spaces, string}; use combine::{attempt, between, choice, optional, sep_by, Parser}; use combine::{parser, ParseError}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::{AnalysedType, TypeResult}; use std::fmt::Display; use std::ops::Deref; @@ -32,8 +31,7 @@ use std::ops::Deref; // Any compilation or interpreter error messages will also be using `TypeName` to show the type of the expression // for which we convert AnalysedType or InferredType back to TypeName. If `InferredType` cannot be converted to `TypeName`, we explain the error displaying // the original expression, and there is no point displaying `InferredType` to the user. -#[derive(Debug, Hash, Clone, Eq, PartialEq, BinaryCodec, Ord, PartialOrd)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd)] pub enum TypeName { Bool, S8, @@ -548,169 +546,6 @@ parser! { } } -mod protobuf { - use crate::proto::golem::rib::type_name::Kind as InnerTypeName; - use crate::proto::golem::rib::{ - BasicTypeName, EnumType, FlagType, KeyValue, ListType, OptionType, RecordType, ResultType, - TupleType, TypeName as ProtoTypeName, VariantCase, VariantType, - }; - use std::ops::Deref; - - use crate::TypeName; - - impl From for ProtoTypeName { - fn from(value: TypeName) -> Self { - let inner = match value { - TypeName::Bool => InnerTypeName::BasicType(BasicTypeName::Bool as i32), - TypeName::S8 => InnerTypeName::BasicType(BasicTypeName::S8 as i32), - TypeName::U8 => InnerTypeName::BasicType(BasicTypeName::U8 as i32), - TypeName::S16 => InnerTypeName::BasicType(BasicTypeName::S16 as i32), - TypeName::U16 => InnerTypeName::BasicType(BasicTypeName::U16 as i32), - TypeName::S32 => InnerTypeName::BasicType(BasicTypeName::S32 as i32), - TypeName::U32 => InnerTypeName::BasicType(BasicTypeName::U32 as i32), - TypeName::S64 => InnerTypeName::BasicType(BasicTypeName::S64 as i32), - TypeName::U64 => InnerTypeName::BasicType(BasicTypeName::U64 as i32), - TypeName::F32 => InnerTypeName::BasicType(BasicTypeName::F32 as i32), - TypeName::F64 => InnerTypeName::BasicType(BasicTypeName::F64 as i32), - TypeName::Chr => InnerTypeName::BasicType(BasicTypeName::Chr as i32), - TypeName::Str => InnerTypeName::BasicType(BasicTypeName::Str as i32), - TypeName::List(inner_type) => InnerTypeName::ListType(Box::new(ListType { - inner_type: Some(Box::new(inner_type.deref().clone().into())), - })), - TypeName::Tuple(inner_types) => InnerTypeName::TupleType(TupleType { - types: inner_types.into_iter().map(|t| t.into()).collect(), - }), - TypeName::Option(type_name) => InnerTypeName::OptionType(Box::new(OptionType { - inner_type: Some(Box::new(type_name.deref().clone().into())), - })), - TypeName::Result { ok, error } => InnerTypeName::ResultType(Box::new(ResultType { - ok_type: ok.map(|ok| Box::new(ok.deref().clone().into())), - err_type: error.map(|error| Box::new(error.deref().clone().into())), - })), - TypeName::Record(fields) => InnerTypeName::RecordType(RecordType { - fields: fields - .into_iter() - .map(|(field, typ)| KeyValue { - key: field, - value: Some(typ.deref().clone().into()), - }) - .collect(), - }), - TypeName::Flags(flags) => InnerTypeName::FlagType(FlagType { - flags: flags.into_iter().collect(), - }), - TypeName::Enum(cases) => InnerTypeName::EnumType(EnumType { - cases: cases.into_iter().collect(), - }), - TypeName::Variant { cases } => InnerTypeName::VariantType(VariantType { - cases: cases - .into_iter() - .map(|(case, typ)| VariantCase { - case_name: case, - variant_arg: typ.map(|x| x.deref().clone().into()), - }) - .collect(), - }), - }; - - ProtoTypeName { kind: Some(inner) } - } - } - - impl TryFrom for TypeName { - type Error = String; - - fn try_from(value: ProtoTypeName) -> Result { - match value.kind { - Some(inner) => match inner { - InnerTypeName::BasicType(value) => match BasicTypeName::try_from(value) { - Ok(BasicTypeName::Bool) => Ok(TypeName::Bool), - Ok(BasicTypeName::S8) => Ok(TypeName::S8), - Ok(BasicTypeName::U8) => Ok(TypeName::U8), - Ok(BasicTypeName::S16) => Ok(TypeName::S16), - Ok(BasicTypeName::U16) => Ok(TypeName::U16), - Ok(BasicTypeName::S32) => Ok(TypeName::S32), - Ok(BasicTypeName::U32) => Ok(TypeName::U32), - Ok(BasicTypeName::S64) => Ok(TypeName::S64), - Ok(BasicTypeName::U64) => Ok(TypeName::U64), - Ok(BasicTypeName::F32) => Ok(TypeName::F32), - Ok(BasicTypeName::F64) => Ok(TypeName::F64), - Ok(BasicTypeName::Chr) => Ok(TypeName::Chr), - Ok(BasicTypeName::Str) => Ok(TypeName::Str), - _ => Err(format!("Unknown basic type: {value:?}")), - }, - InnerTypeName::ListType(inner_type) => { - let proto_list_type = inner_type - .inner_type - .ok_or("No inner type for list provided")?; - let list_type = proto_list_type.deref().clone().try_into()?; - Ok(TypeName::List(Box::new(list_type))) - } - InnerTypeName::TupleType(inner_types) => { - let tuple_type = inner_types - .types - .into_iter() - .map(|t| t.try_into()) - .collect::, String>>()?; - Ok(TypeName::Tuple(tuple_type)) - } - InnerTypeName::OptionType(type_name) => { - let proto_option_type = type_name - .inner_type - .ok_or("No inner type for option provided")?; - let option_type = proto_option_type.deref().clone().try_into()?; - Ok(TypeName::Option(Box::new(option_type))) - } - InnerTypeName::ResultType(result_type) => { - let ok = result_type - .ok_type - .map(|ok| ok.deref().clone().try_into()) - .transpose()?; - let error = result_type - .err_type - .map(|error| error.deref().clone().try_into()) - .transpose()?; - Ok(TypeName::Result { - ok: ok.map(Box::new), - error: error.map(Box::new), - }) - } - InnerTypeName::RecordType(fields) => { - let record_type = fields - .fields - .into_iter() - .map(|key_value| { - key_value - .value - .ok_or("Field type missing")? - .try_into() - .map(|typ| (key_value.key, Box::new(typ))) - }) - .collect::)>, String>>()?; - Ok(TypeName::Record(record_type)) - } - InnerTypeName::FlagType(flag_type) => Ok(TypeName::Flags(flag_type.flags)), - InnerTypeName::EnumType(enum_type) => Ok(TypeName::Enum(enum_type.cases)), - InnerTypeName::VariantType(variant_type) => { - let mut cases = vec![]; - for variant_case in variant_type.cases { - let case = variant_case.case_name; - let typ = match variant_case.variant_arg { - Some(typ) => Some(Box::new(TypeName::try_from(typ)?)), - None => None, - }; - cases.push((case, typ)); - } - - Ok(TypeName::Variant { cases }) - } - }, - None => Err("No type kind provided".to_string()), - } - } - } -} - #[cfg(test)] mod type_name_tests { use combine::stream::position; diff --git a/rib-core/src/registry/component_dependencies.rs b/rib-core/src/registry/component_dependencies.rs index 982c0df..11614c5 100644 --- a/rib-core/src/registry/component_dependencies.rs +++ b/rib-core/src/registry/component_dependencies.rs @@ -12,18 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::TypeEnum; +use crate::analysis::{AnalysedExport, TypeVariant}; use crate::{ ComponentDependencyKey, Expr, FullyQualifiedInterfaceName, FunctionDictionary, FunctionName, FunctionType, FunctionTypeRegistry, InstanceCreationType, InterfaceName, PackageName, TypeParameter, }; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::TypeEnum; -use golem_wasm::analysis::{AnalysedExport, TypeVariant}; use std::collections::BTreeMap; -#[derive(Debug, Default, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Default, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct ComponentDependencies { pub dependencies: BTreeMap, } diff --git a/rib-core/src/registry/component_dependency_key.rs b/rib-core/src/registry/component_dependency_key.rs index 7d5ffb8..f43e169 100644 --- a/rib-core/src/registry/component_dependency_key.rs +++ b/rib-core/src/registry/component_dependency_key.rs @@ -12,12 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use desert_rust::BinaryCodec; use std::fmt::{Display, Formatter}; use uuid::Uuid; -#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, PartialEq, Eq, Clone, Ord, PartialOrd)] pub struct ComponentDependencyKey { pub component_name: String, pub component_id: Uuid, diff --git a/rib-core/src/registry/function_dictionary.rs b/rib-core/src/registry/function_dictionary.rs index c326c95..8df6c5e 100644 --- a/rib-core/src/registry/function_dictionary.rs +++ b/rib-core/src/registry/function_dictionary.rs @@ -12,14 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::{AnalysedExport, AnalysedType, TypeEnum, TypeVariant}; use crate::parser::{PackageName, TypeParameter}; use crate::type_parameter::InterfaceName; use crate::{ CallType, DynamicParsedFunctionName, DynamicParsedFunctionReference, FunctionTypeRegistry, InferredType, ParsedFunctionSite, RegistryKey, RegistryValue, SemVer, }; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::{AnalysedExport, AnalysedType, TypeEnum, TypeVariant}; use std::collections::BTreeMap; use std::convert::TryFrom; use std::fmt::{Debug, Display, Formatter}; @@ -29,8 +28,7 @@ use std::fmt::{Debug, Display, Formatter}; // Unlike FunctionTypeRegistry, the function names in `FunctionDictionary` is closer to Rib grammar // of invoking functions. Example: A RegistryKey of `[constructor]cart` in FunctionTypeRegistry becomes // FunctionName::ResourceConstructor(cart) in FunctionDictionary -#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd, Default, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd, Default)] pub struct FunctionDictionary { pub name_and_types: Vec<(FunctionName, FunctionType)>, } @@ -102,8 +100,7 @@ impl FunctionDictionary { // if the instance is a resource creation. // Given the Dictionaries do become part of InferredType (InferredType::InstanceType::Dictionaries) // order of component loading into the rib context shouldn't change it's type. -#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct ResourceMethodDictionary { pub map: BTreeMap, } @@ -341,8 +338,7 @@ fn get_resource_method_name(function_name: &str) -> Result, pub interface_name: Option, @@ -513,16 +508,14 @@ impl FullyQualifiedResourceConstructor { } } -#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd)] pub struct FullyQualifiedFunctionName { pub package_name: Option, pub interface_name: Option, pub function_name: String, } -#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, Ord, PartialOrd)] pub struct FullyQualifiedResourceMethod { pub package_name: Option, pub interface_name: Option, @@ -591,8 +584,7 @@ impl Display for FullyQualifiedFunctionName { } } -#[derive(Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)] pub struct FunctionType { pub parameter_types: Vec, pub return_type: Option, @@ -629,61 +621,3 @@ impl FunctionType { .map(|x| AnalysedType::try_from(&x).unwrap()) } } - -mod protobuf { - use crate::FunctionName; - - impl TryFrom for FunctionName { - type Error = String; - - fn try_from( - value: crate::proto::golem::rib::function_name_type::FunctionName, - ) -> Result { - match value { - crate::proto::golem::rib::function_name_type::FunctionName::VariantName(name) => { - Ok(FunctionName::Variant(name)) - } - crate::proto::golem::rib::function_name_type::FunctionName::EnumName(name) => { - Ok(FunctionName::Enum(name)) - } - crate::proto::golem::rib::function_name_type::FunctionName::Function(fqfn) => { - Ok(FunctionName::Function(fqfn.try_into()?)) - } - crate::proto::golem::rib::function_name_type::FunctionName::ResourceConstructor( - fqrc, - ) => Ok(FunctionName::ResourceConstructor(fqrc.try_into()?)), - crate::proto::golem::rib::function_name_type::FunctionName::ResourceMethod( - fqrm, - ) => Ok(FunctionName::ResourceMethod(fqrm.try_into()?)), - } - } - } - - impl From for crate::proto::golem::rib::function_name_type::FunctionName { - fn from(value: FunctionName) -> Self { - match value { - FunctionName::Variant(name) => { - crate::proto::golem::rib::function_name_type::FunctionName::VariantName(name) - } - FunctionName::Enum(name) => { - crate::proto::golem::rib::function_name_type::FunctionName::EnumName(name) - } - FunctionName::Function(fqfn) => { - crate::proto::golem::rib::function_name_type::FunctionName::Function( - fqfn.into(), - ) - } - FunctionName::ResourceConstructor(fqrc) => { - crate::proto::golem::rib::function_name_type::FunctionName::ResourceConstructor( - fqrc.into(), - ) - } - FunctionName::ResourceMethod(fqrm) => { - crate::proto::golem::rib::function_name_type::FunctionName::ResourceMethod( - fqrm.into(), - ) - } - } - } - } -} diff --git a/rib-core/src/registry/raw_type_registry.rs b/rib-core/src/registry/raw_type_registry.rs index ef46c84..6c4a3a7 100644 --- a/rib-core/src/registry/raw_type_registry.rs +++ b/rib-core/src/registry/raw_type_registry.rs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::{AnalysedExport, TypeVariant}; +use crate::analysis::{AnalysedType, TypeResult}; use crate::DynamicParsedFunctionName; -use golem_wasm::analysis::{AnalysedExport, TypeVariant}; -use golem_wasm::analysis::{AnalysedType, TypeResult}; use std::fmt::{Display, Formatter}; // A `FunctionTypeRegistry` is a mapping from a function/variant/enum to the `arguments` and `return types` of that function/variant/enum. diff --git a/rib-core/src/rib_source_span.rs b/rib-core/src/rib_source_span.rs index d029608..f0af616 100644 --- a/rib-core/src/rib_source_span.rs +++ b/rib-core/src/rib_source_span.rs @@ -12,14 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -use desert_rust::BinaryCodec; use std::cmp::Ordering; use std::fmt; use std::fmt::{Debug, Display, Formatter}; use std::hash::{Hash, Hasher}; -#[derive(Clone, Default, BinaryCodec)] -#[desert(evolution())] +#[derive(Clone, Default)] pub struct SourceSpan { start: SourcePosition, end: SourcePosition, @@ -100,8 +98,7 @@ impl Display for SourceSpan { } } -#[derive(Clone, Default, BinaryCodec)] -#[desert(evolution())] +#[derive(Clone, Default)] pub struct SourcePosition { pub line: i32, pub column: i32, diff --git a/rib-core/src/type_checker/exhaustive_pattern_match.rs b/rib-core/src/type_checker/exhaustive_pattern_match.rs index 385cd44..a50cc48 100644 --- a/rib-core/src/type_checker/exhaustive_pattern_match.rs +++ b/rib-core/src/type_checker/exhaustive_pattern_match.rs @@ -52,9 +52,9 @@ pub enum ExhaustivePatternMatchError { } mod internal { + use crate::analysis::TypeVariant; use crate::type_checker::exhaustive_pattern_match::ExhaustivePatternMatchError; use crate::{ArmPattern, ComponentDependencies, Expr}; - use golem_wasm::analysis::TypeVariant; use std::collections::HashMap; use std::ops::Deref; diff --git a/rib-core/src/type_checker/invalid_function_args.rs b/rib-core/src/type_checker/invalid_function_args.rs index 1382746..6e20c66 100644 --- a/rib-core/src/type_checker/invalid_function_args.rs +++ b/rib-core/src/type_checker/invalid_function_args.rs @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::call_type::CallType; use crate::type_checker::missing_fields::find_missing_fields_in_record; use crate::{type_checker, ComponentDependencies, FunctionName}; use crate::{Expr, ExprVisitor, FunctionCallError}; -use golem_wasm::analysis::AnalysedType; // While we have a dedicated generic phases (refer submodules) within type_checker module, // we have this special phase to grab errors in the context function calls. diff --git a/rib-core/src/type_checker/missing_fields.rs b/rib-core/src/type_checker/missing_fields.rs index 628a691..77c29bc 100644 --- a/rib-core/src/type_checker/missing_fields.rs +++ b/rib-core/src/type_checker/missing_fields.rs @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::type_checker::{Path, PathElem}; use crate::Expr; -use golem_wasm::analysis::AnalysedType; pub fn find_missing_fields_in_record(expr: &Expr, expected: &AnalysedType) -> Vec { let mut missing_paths = Vec::new(); diff --git a/rib-core/src/type_inference/call_arguments_inference.rs b/rib-core/src/type_inference/call_arguments_inference.rs index 353bc30..b7ac219 100644 --- a/rib-core/src/type_inference/call_arguments_inference.rs +++ b/rib-core/src/type_inference/call_arguments_inference.rs @@ -54,6 +54,7 @@ pub fn infer_function_call_types( } mod internal { + use crate::analysis::AnalysedType; use crate::call_type::{CallType, InstanceCreationType}; use crate::inferred_type::TypeOrigin; use crate::rib_source_span::SourceSpan; @@ -63,7 +64,6 @@ mod internal { ExpectedType, Expr, FullyQualifiedResourceConstructor, FullyQualifiedResourceMethod, FunctionCallError, FunctionName, InferredType, TypeInternal, TypeMismatchError, }; - use golem_wasm::analysis::AnalysedType; use std::fmt::Display; pub(crate) fn resolve_call_argument_types( @@ -456,15 +456,15 @@ mod internal { mod function_parameters_inference_tests { use test_r::test; + use crate::analysis::{ + AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedType, TypeU32, TypeU64, + }; use crate::function_name::{DynamicParsedFunctionName, DynamicParsedFunctionReference}; use crate::rib_source_span::SourceSpan; use crate::{ ComponentDependencies, ComponentDependencyKey, Expr, InferredType, ParsedFunctionSite, }; use bigdecimal::BigDecimal; - use golem_wasm::analysis::{ - AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedType, TypeU32, TypeU64, - }; use uuid::Uuid; fn get_component_dependencies() -> ComponentDependencies { diff --git a/rib-core/src/type_inference/custom_instance_spec.rs b/rib-core/src/type_inference/custom_instance_spec.rs index c1f51bc..b624316 100644 --- a/rib-core/src/type_inference/custom_instance_spec.rs +++ b/rib-core/src/type_inference/custom_instance_spec.rs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::InterfaceName; -use golem_wasm::analysis::AnalysedType; #[derive(Clone, Debug)] pub struct CustomInstanceSpec { diff --git a/rib-core/src/type_inference/enum_inference.rs b/rib-core/src/type_inference/enum_inference.rs index edfa45a..3cadb21 100644 --- a/rib-core/src/type_inference/enum_inference.rs +++ b/rib-core/src/type_inference/enum_inference.rs @@ -21,9 +21,9 @@ pub fn infer_enums(expr: &mut Expr, component_dependencies: &ComponentDependenci } mod internal { + use crate::analysis::AnalysedType; use crate::call_type::CallType; use crate::{ComponentDependencies, Expr, ExprVisitor}; - use golem_wasm::analysis::AnalysedType; pub(crate) fn convert_identifiers_to_enum_function_calls( expr: &mut Expr, diff --git a/rib-core/src/type_inference/errors.rs b/rib-core/src/type_inference/errors.rs index 1aca7fa..0f6ef72 100644 --- a/rib-core/src/type_inference/errors.rs +++ b/rib-core/src/type_inference/errors.rs @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::rib_source_span::SourceSpan; use crate::type_inference::type_hint::{GetTypeHint, TypeHint}; use crate::{InferredType, Path, PathElem}; -use golem_wasm::analysis::AnalysedType; #[derive(Debug, Clone)] pub struct AmbiguousTypeError { diff --git a/rib-core/src/type_inference/identify_instance_creation.rs b/rib-core/src/type_inference/identify_instance_creation.rs index bbd833b..0f15599 100644 --- a/rib-core/src/type_inference/identify_instance_creation.rs +++ b/rib-core/src/type_inference/identify_instance_creation.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::call_type::{CallType, InstanceCreationType}; use crate::instance_type::InstanceType; use crate::rib_type_error::RibTypeErrorInternal; @@ -21,7 +22,6 @@ use crate::{ CustomError, ExprVisitor, FunctionCallError, InferredType, ParsedFunctionReference, TypeInternal, TypeOrigin, }; -use golem_wasm::analysis::AnalysedType; // Handling the following and making sure the types are inferred fully at this stage. // The expr `Call` will still be expr `Call` itself but CallType will be worker instance creation diff --git a/rib-core/src/type_inference/mod.rs b/rib-core/src/type_inference/mod.rs index 27893ee..5c9e06f 100644 --- a/rib-core/src/type_inference/mod.rs +++ b/rib-core/src/type_inference/mod.rs @@ -66,6 +66,7 @@ mod worker_function_invocation; #[cfg(test)] mod tests { + use crate::analysis::analysed_type::{case, field, list, r#enum, str, u64, unit_case, variant}; use crate::call_type::CallType; use crate::type_checker::Path; use crate::type_inference::global_variable_type_binding::GlobalVariableTypeSpec; @@ -82,11 +83,8 @@ mod tests { RibCompilerConfig, TypeName, VariableId, }; use bigdecimal::BigDecimal; - use golem_wasm::analysis::analysed_type::{ - case, field, list, r#enum, str, u64, unit_case, variant, - }; - use golem_wasm::analysis::analysed_type; + use crate::analysis::analysed_type; use test_r::test; #[test] @@ -2455,6 +2453,11 @@ mod tests { } mod test_utils { + use crate::analysis::analysed_type::u64; + use crate::analysis::{ + AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedFunctionResult, + AnalysedType, TypeU32, + }; use crate::call_type::CallType; use crate::function_name::{DynamicParsedFunctionName, DynamicParsedFunctionReference}; use crate::generic_type_parameter::GenericTypeParameter; @@ -2466,13 +2469,8 @@ mod tests { MatchIdentifier, Number, ParsedFunctionSite, RibCompiler, RibCompilerConfig, VariableId, }; + use crate::{Value, ValueAndType}; use bigdecimal::BigDecimal; - use golem_wasm::analysis::analysed_type::u64; - use golem_wasm::analysis::{ - AnalysedExport, AnalysedFunction, AnalysedFunctionParameter, AnalysedFunctionResult, - AnalysedType, TypeU32, - }; - use golem_wasm::{Value, ValueAndType}; use uuid::Uuid; pub(crate) fn result( @@ -2773,7 +2771,7 @@ mod tests { pub(crate) fn create_none(typ: &AnalysedType) -> ValueAndType { ValueAndType::new( Value::Option(None), - golem_wasm::analysis::analysed_type::option(typ.clone()), + crate::analysis::analysed_type::option(typ.clone()), ) } diff --git a/rib-core/src/type_inference/rib_input_type.rs b/rib-core/src/type_inference/rib_input_type.rs index fd31152..91a36f6 100644 --- a/rib-core/src/type_inference/rib_input_type.rs +++ b/rib-core/src/type_inference/rib_input_type.rs @@ -12,17 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::{Expr, ExprVisitor, InferredExpr, RibCompilationError}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::AnalysedType; use serde::{Deserialize, Serialize}; use std::collections::HashMap; // RibInputTypeInfo refers to the required global inputs to a RibScript // with its type information. Example: `request` variable which should be of the type `Record`. -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec)] -#[desert(evolution())] -#[cfg_attr(feature = "poem", derive(poem_openapi::Object))] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "poem", oai(rename_all = "camelCase"))] #[serde(rename_all = "camelCase")] pub struct RibInputTypeInfo { @@ -71,31 +68,3 @@ impl RibInputTypeInfo { }) } } - -mod protobuf { - use crate::proto::golem::rib::RibInputType as ProtoRibInputType; - use crate::RibInputTypeInfo; - use golem_wasm::analysis::AnalysedType; - use std::collections::HashMap; - - impl TryFrom for RibInputTypeInfo { - type Error = String; - fn try_from(value: ProtoRibInputType) -> Result { - let mut types = HashMap::new(); - for (key, value) in value.types { - types.insert(key, AnalysedType::try_from(&value)?); - } - Ok(RibInputTypeInfo { types }) - } - } - - impl From for ProtoRibInputType { - fn from(value: RibInputTypeInfo) -> Self { - let mut types = HashMap::new(); - for (key, value) in value.types { - types.insert(key, golem_wasm::protobuf::Type::from(&value)); - } - ProtoRibInputType { types } - } - } -} diff --git a/rib-core/src/type_inference/rib_output_type.rs b/rib-core/src/type_inference/rib_output_type.rs index 8c090e6..12441ef 100644 --- a/rib-core/src/type_inference/rib_output_type.rs +++ b/rib-core/src/type_inference/rib_output_type.rs @@ -12,16 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::{InferredExpr, RibCompilationError}; -use desert_rust::BinaryCodec; -use golem_wasm::analysis::AnalysedType; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec)] -#[cfg_attr(feature = "poem", derive(poem_openapi::Object))] +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[cfg_attr(feature = "poem", oai(rename_all = "camelCase"))] #[serde(rename_all = "camelCase")] -#[desert(evolution())] pub struct RibOutputTypeInfo { pub analysed_type: AnalysedType, } @@ -40,27 +37,3 @@ impl RibOutputTypeInfo { Ok(RibOutputTypeInfo { analysed_type }) } } - -mod protobuf { - use crate::proto::golem::rib::RibOutputType as ProtoRibOutputType; - use crate::RibOutputTypeInfo; - use golem_wasm::analysis::AnalysedType; - - impl From for ProtoRibOutputType { - fn from(value: RibOutputTypeInfo) -> Self { - ProtoRibOutputType { - r#type: Some(golem_wasm::protobuf::Type::from(&value.analysed_type)), - } - } - } - - impl TryFrom for RibOutputTypeInfo { - type Error = String; - fn try_from(value: ProtoRibOutputType) -> Result { - let proto_type = value.r#type.ok_or("Missing type")?; - let analysed_type = AnalysedType::try_from(&proto_type)?; - - Ok(RibOutputTypeInfo { analysed_type }) - } - } -} diff --git a/rib-core/src/type_inference/type_hint.rs b/rib-core/src/type_inference/type_hint.rs index 8ffac28..f0152ef 100644 --- a/rib-core/src/type_inference/type_hint.rs +++ b/rib-core/src/type_inference/type_hint.rs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use crate::analysis::AnalysedType; use crate::{InferredType, TypeInternal}; -use golem_wasm::analysis::AnalysedType; use std::fmt; use std::ops::Deref; diff --git a/rib-core/src/type_inference/type_push_down.rs b/rib-core/src/type_inference/type_push_down.rs index ef561bd..870047d 100644 --- a/rib-core/src/type_inference/type_push_down.rs +++ b/rib-core/src/type_inference/type_push_down.rs @@ -247,6 +247,7 @@ pub fn push_types_down(expr: &mut Expr) -> Result<(), RibTypeErrorInternal> { } mod internal { + use crate::analysis::AnalysedType; use crate::call_type::CallType; use crate::rib_source_span::SourceSpan; use crate::rib_type_error::RibTypeErrorInternal; @@ -257,7 +258,6 @@ mod internal { ActualType, AmbiguousTypeError, ArmPattern, ExpectedType, Expr, InferredType, InvalidPatternMatchError, Path, TypeInternal, TypeMismatchError, VariableId, }; - use golem_wasm::analysis::AnalysedType; use std::collections::VecDeque; use std::ops::Deref; diff --git a/rib-core/src/type_parameter.rs b/rib-core/src/type_parameter.rs index 0a36d5b..d007ae9 100644 --- a/rib-core/src/type_parameter.rs +++ b/rib-core/src/type_parameter.rs @@ -15,13 +15,11 @@ use crate::type_parameter_parser::type_parameter; use combine::stream::position; use combine::EasyParser; -use desert_rust::BinaryCodec; use std::fmt; use std::fmt::Display; // The type parameter which can be part of instance creation or worker function call -#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub enum TypeParameter { Interface(InterfaceName), PackageName(PackageName), @@ -68,8 +66,7 @@ impl Display for TypeParameter { } // foo@1.0.0 -#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct InterfaceName { pub name: String, pub version: Option, @@ -86,8 +83,7 @@ impl Display for InterfaceName { } // ns2:pkg2@1.0.0 -#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct PackageName { pub namespace: String, pub package_name: String, @@ -105,8 +101,7 @@ impl Display for PackageName { } // ns2:pkg2/foo@1.0.0 -#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord, BinaryCodec)] -#[desert(evolution())] +#[derive(Debug, Hash, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct FullyQualifiedInterfaceName { pub package_name: PackageName, pub interface_name: InterfaceName, diff --git a/rib-core/src/value.rs b/rib-core/src/value.rs new file mode 100644 index 0000000..d7c95c1 --- /dev/null +++ b/rib-core/src/value.rs @@ -0,0 +1,113 @@ +#[derive(Debug, Clone, PartialEq)] +pub enum Value { + Bool(bool), + U8(u8), + U16(u16), + U32(u32), + U64(u64), + S8(i8), + S16(i16), + S32(i32), + S64(i64), + F32(f32), + F64(f64), + Char(char), + String(String), + List(Vec), + Tuple(Vec), + Record(Vec), + Variant { + case_idx: u32, + case_value: Option>, + }, + Enum(u32), + Flags(Vec), + Option(Option>), + Result(Result>, Option>>), + Handle { + uri: String, + resource_id: u64, + }, +} + +impl std::fmt::Display for Value { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Value::Bool(v) => write!(f, "{v}"), + Value::U8(v) => write!(f, "{v}"), + Value::U16(v) => write!(f, "{v}"), + Value::U32(v) => write!(f, "{v}"), + Value::U64(v) => write!(f, "{v}"), + Value::S8(v) => write!(f, "{v}"), + Value::S16(v) => write!(f, "{v}"), + Value::S32(v) => write!(f, "{v}"), + Value::S64(v) => write!(f, "{v}"), + Value::F32(v) => write!(f, "{v}"), + Value::F64(v) => write!(f, "{v}"), + Value::Char(v) => write!(f, "'{v}'"), + Value::String(v) => write!(f, "\"{v}\""), + Value::List(values) => { + write!(f, "[")?; + for (i, v) in values.iter().enumerate() { + if i > 0 { + write!(f, ", ")?; + } + write!(f, "{v}")?; + } + write!(f, "]") + } + Value::Tuple(values) => { + write!(f, "(")?; + for (i, v) in values.iter().enumerate() { + if i > 0 { + write!(f, ", ")?; + } + write!(f, "{v}")?; + } + write!(f, ")") + } + Value::Record(values) => { + write!(f, "{{")?; + for (i, v) in values.iter().enumerate() { + if i > 0 { + write!(f, ", ")?; + } + write!(f, "{v}")?; + } + write!(f, "}}") + } + Value::Variant { + case_idx, + case_value, + } => { + write!(f, "variant#{case_idx}")?; + if let Some(v) = case_value { + write!(f, "({v})")?; + } + Ok(()) + } + Value::Enum(idx) => write!(f, "enum#{idx}"), + Value::Flags(flags) => { + write!(f, "{{")?; + let mut first = true; + for (i, set) in flags.iter().enumerate() { + if *set { + if !first { + write!(f, ", ")?; + } + write!(f, "flag#{i}")?; + first = false; + } + } + write!(f, "}}") + } + Value::Option(None) => write!(f, "none"), + Value::Option(Some(v)) => write!(f, "some({v})"), + Value::Result(Ok(Some(v))) => write!(f, "ok({v})"), + Value::Result(Ok(None)) => write!(f, "ok"), + Value::Result(Err(Some(v))) => write!(f, "err({v})"), + Value::Result(Err(None)) => write!(f, "err"), + Value::Handle { uri, resource_id } => write!(f, "handle({uri}#{resource_id})"), + } + } +} diff --git a/rib-core/src/value_and_type.rs b/rib-core/src/value_and_type.rs new file mode 100644 index 0000000..420f5cf --- /dev/null +++ b/rib-core/src/value_and_type.rs @@ -0,0 +1,205 @@ +use crate::analysis::AnalysedType; +use crate::value::Value; + +#[derive(Clone, Debug, PartialEq)] +pub struct ValueAndType { + pub value: Value, + pub typ: AnalysedType, +} + +impl ValueAndType { + pub fn new(value: Value, typ: AnalysedType) -> Self { + Self { value, typ } + } +} + +impl std::fmt::Display for ValueAndType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match crate::print_value_and_type(self) { + Ok(s) => write!(f, "{s}"), + Err(_) => write!(f, "{:?}", self.value), + } + } +} + +impl From for Value { + fn from(value_and_type: ValueAndType) -> Self { + value_and_type.value + } +} + +impl From for AnalysedType { + fn from(value_and_type: ValueAndType) -> Self { + value_and_type.typ + } +} + +pub trait IntoValue { + fn into_value(self) -> Value; + fn get_type() -> AnalysedType; +} + +pub trait IntoValueAndType { + fn into_value_and_type(self) -> ValueAndType; +} + +impl IntoValueAndType for T { + fn into_value_and_type(self) -> ValueAndType { + ValueAndType::new(self.into_value(), Self::get_type()) + } +} + +use crate::analysis::analysed_type; + +impl IntoValue for u8 { + fn into_value(self) -> Value { + Value::U8(self) + } + fn get_type() -> AnalysedType { + analysed_type::u8() + } +} + +impl IntoValue for u16 { + fn into_value(self) -> Value { + Value::U16(self) + } + fn get_type() -> AnalysedType { + analysed_type::u16() + } +} + +impl IntoValue for u32 { + fn into_value(self) -> Value { + Value::U32(self) + } + fn get_type() -> AnalysedType { + analysed_type::u32() + } +} + +impl IntoValue for u64 { + fn into_value(self) -> Value { + Value::U64(self) + } + fn get_type() -> AnalysedType { + analysed_type::u64() + } +} + +impl IntoValue for i8 { + fn into_value(self) -> Value { + Value::S8(self) + } + fn get_type() -> AnalysedType { + analysed_type::s8() + } +} + +impl IntoValue for i16 { + fn into_value(self) -> Value { + Value::S16(self) + } + fn get_type() -> AnalysedType { + analysed_type::s16() + } +} + +impl IntoValue for i32 { + fn into_value(self) -> Value { + Value::S32(self) + } + fn get_type() -> AnalysedType { + analysed_type::s32() + } +} + +impl IntoValue for i64 { + fn into_value(self) -> Value { + Value::S64(self) + } + fn get_type() -> AnalysedType { + analysed_type::s64() + } +} + +impl IntoValue for f32 { + fn into_value(self) -> Value { + Value::F32(self) + } + fn get_type() -> AnalysedType { + analysed_type::f32() + } +} + +impl IntoValue for f64 { + fn into_value(self) -> Value { + Value::F64(self) + } + fn get_type() -> AnalysedType { + analysed_type::f64() + } +} + +impl IntoValue for bool { + fn into_value(self) -> Value { + Value::Bool(self) + } + fn get_type() -> AnalysedType { + analysed_type::bool() + } +} + +impl IntoValue for char { + fn into_value(self) -> Value { + Value::Char(self) + } + fn get_type() -> AnalysedType { + analysed_type::chr() + } +} + +impl IntoValue for String { + fn into_value(self) -> Value { + Value::String(self) + } + fn get_type() -> AnalysedType { + analysed_type::str() + } +} + +impl IntoValue for &str { + fn into_value(self) -> Value { + Value::String(self.to_string()) + } + fn get_type() -> AnalysedType { + analysed_type::str() + } +} + +impl IntoValue for Vec { + fn into_value(self) -> Value { + Value::List(self.into_iter().map(|v| v.into_value()).collect()) + } + fn get_type() -> AnalysedType { + analysed_type::list(T::get_type()) + } +} + +impl IntoValue for Option { + fn into_value(self) -> Value { + Value::Option(self.map(|v| Box::new(v.into_value()))) + } + fn get_type() -> AnalysedType { + analysed_type::option(T::get_type()) + } +} + +impl IntoValue for (A, B) { + fn into_value(self) -> Value { + Value::Tuple(vec![self.0.into_value(), self.1.into_value()]) + } + fn get_type() -> AnalysedType { + analysed_type::tuple(vec![A::get_type(), B::get_type()]) + } +} diff --git a/rib-core/src/variable_id.rs b/rib-core/src/variable_id.rs index 2df8989..ae4364e 100644 --- a/rib-core/src/variable_id.rs +++ b/rib-core/src/variable_id.rs @@ -12,14 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use desert_rust::BinaryCodec; use serde::{Deserialize, Serialize}; use std::fmt::Display; -#[derive( - Hash, Eq, Debug, Clone, PartialEq, Ord, PartialOrd, Serialize, Deserialize, BinaryCodec, -)] -#[desert(evolution())] +#[derive(Hash, Eq, Debug, Clone, PartialEq, Ord, PartialOrd, Serialize, Deserialize)] pub enum VariableId { Global(String), Local(String, Option), @@ -137,26 +133,17 @@ impl VariableId { } } -#[derive( - Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec, Ord, PartialOrd, -)] -#[desert(evolution())] +#[derive(Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, Ord, PartialOrd)] pub struct ListComprehensionIdentifier { pub name: String, } -#[derive( - Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec, Ord, PartialOrd, -)] -#[desert(evolution())] +#[derive(Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, Ord, PartialOrd)] pub struct ListAggregationIdentifier { pub name: String, } -#[derive( - Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec, Ord, PartialOrd, -)] -#[desert(evolution())] +#[derive(Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, Ord, PartialOrd)] pub struct MatchIdentifier { pub name: String, pub match_arm_index: usize, // Every match arm across the program is identified by a non-sharing index value. Within a match arm the identifier names cannot be reused @@ -182,100 +169,5 @@ impl Display for VariableId { } } } -#[derive( - Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, BinaryCodec, Ord, PartialOrd, -)] -#[desert(transparent)] +#[derive(Hash, Eq, Debug, Clone, PartialEq, Serialize, Deserialize, Ord, PartialOrd)] pub struct Id(pub(crate) u32); - -mod protobuf { - use crate::proto::golem::rib::VariableId as ProtoVariableId; - use crate::{Id, VariableId}; - - impl TryFrom for VariableId { - type Error = String; - - fn try_from(value: ProtoVariableId) -> Result { - let variable_id = value.variable_id.ok_or("Missing variable_id".to_string())?; - - match variable_id { - crate::proto::golem::rib::variable_id::VariableId::Global(global) => { - Ok(VariableId::Global(global.name)) - } - crate::proto::golem::rib::variable_id::VariableId::Local(local) => Ok( - VariableId::Local(local.name, local.id.map(|x| Id(x as u32))), - ), - crate::proto::golem::rib::variable_id::VariableId::MatchIdentifier( - match_identifier, - ) => Ok(VariableId::MatchIdentifier(crate::MatchIdentifier { - name: match_identifier.name, - match_arm_index: match_identifier.match_arm_index as usize, - })), - crate::proto::golem::rib::variable_id::VariableId::ListComprehensionIdentifier( - list_comprehension, - ) => Ok(VariableId::ListComprehension( - crate::ListComprehensionIdentifier { - name: list_comprehension.name, - }, - )), - crate::proto::golem::rib::variable_id::VariableId::ListAggregationIdentifier( - list_aggregation, - ) => Ok(VariableId::ListReduce(crate::ListAggregationIdentifier { - name: list_aggregation.name, - })), - } - } - } - - impl From for ProtoVariableId { - fn from(value: VariableId) -> Self { - match value { - VariableId::Global(name) => ProtoVariableId { - variable_id: Some( - crate::proto::golem::rib::variable_id::VariableId::Global( - crate::proto::golem::rib::Global { name }, - ), - ), - }, - VariableId::MatchIdentifier(m) => ProtoVariableId { - variable_id: Some( - crate::proto::golem::rib::variable_id::VariableId::MatchIdentifier( - crate::proto::golem::rib::MatchIdentifier { - name: m.name, - match_arm_index: m.match_arm_index as u32, - }, - ), - ), - }, - VariableId::Local(name, id) => ProtoVariableId { - variable_id: Some( - crate::proto::golem::rib::variable_id::VariableId::Local( - crate::proto::golem::rib::Local { - name, - id: id.map(|x| x.0 as u64), - }, - ), - ), - }, - VariableId::ListComprehension(l) => ProtoVariableId { - variable_id: Some( - crate::proto::golem::rib::variable_id::VariableId::ListComprehensionIdentifier( - crate::proto::golem::rib::ListComprehensionIdentifier { - name: l.name, - }, - ), - ), - }, - VariableId::ListReduce(r) => ProtoVariableId { - variable_id: Some( - crate::proto::golem::rib::variable_id::VariableId::ListAggregationIdentifier( - crate::proto::golem::rib::ListAggregationIdentifier { - name: r.name, - }, - ), - ), - }, - } - } - } -} diff --git a/rib-core/src/wasm_wave_text.rs b/rib-core/src/wasm_wave_text.rs new file mode 100644 index 0000000..0df225c --- /dev/null +++ b/rib-core/src/wasm_wave_text.rs @@ -0,0 +1,441 @@ +// Copyright 2024-2025 Golem Cloud +// +// Licensed under the Golem Source License v1.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://license.golem.cloud/LICENSE +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::analysis::AnalysedType; +use crate::{IntoValueAndType, Value, ValueAndType}; +use std::borrow::Cow; +use std::collections::HashSet; +use wasm_wave::wasm::{WasmType, WasmTypeKind, WasmValue, WasmValueError}; +use wasm_wave::{from_str, to_string}; + +pub fn parse_value_and_type( + analysed_type: &AnalysedType, + input: &str, +) -> Result { + let parsed: ValueAndType = from_str(analysed_type, input).map_err(|err| err.to_string())?; + Ok(parsed) +} + +pub fn print_value_and_type(value: &ValueAndType) -> Result { + if value.typ.contains_handle() { + Err("Cannot print handle type".to_string()) + } else { + to_string(value).map_err(|err| err.to_string()) + } +} + +impl WasmValue for ValueAndType { + type Type = AnalysedType; + + fn kind(&self) -> WasmTypeKind { + self.typ.kind() + } + + fn make_bool(val: bool) -> Self { + val.into_value_and_type() + } + + fn make_s8(val: i8) -> Self { + val.into_value_and_type() + } + + fn make_s16(val: i16) -> Self { + val.into_value_and_type() + } + + fn make_s32(val: i32) -> Self { + val.into_value_and_type() + } + + fn make_s64(val: i64) -> Self { + val.into_value_and_type() + } + + fn make_u8(val: u8) -> Self { + val.into_value_and_type() + } + + fn make_u16(val: u16) -> Self { + val.into_value_and_type() + } + + fn make_u32(val: u32) -> Self { + val.into_value_and_type() + } + + fn make_u64(val: u64) -> Self { + val.into_value_and_type() + } + + fn make_f32(val: f32) -> Self { + val.into_value_and_type() + } + + fn make_f64(val: f64) -> Self { + val.into_value_and_type() + } + + fn make_char(val: char) -> Self { + val.into_value_and_type() + } + + fn make_string(val: Cow) -> Self { + val.to_string().into_value_and_type() + } + + fn make_list( + ty: &Self::Type, + vals: impl IntoIterator, + ) -> Result { + Ok(ValueAndType { + value: Value::List(vals.into_iter().map(|vnt| vnt.value).collect()), + typ: ty.clone(), + }) + } + + fn make_record<'a>( + ty: &Self::Type, + fields: impl IntoIterator, + ) -> Result { + Ok(ValueAndType { + value: Value::Record(fields.into_iter().map(|(_, vnt)| vnt.value).collect()), + typ: ty.clone(), + }) + } + + fn make_tuple( + ty: &Self::Type, + vals: impl IntoIterator, + ) -> Result { + Ok(ValueAndType { + value: Value::Tuple(vals.into_iter().map(|vnt| vnt.value).collect()), + typ: ty.clone(), + }) + } + + fn make_variant( + ty: &Self::Type, + case: &str, + val: Option, + ) -> Result { + if let AnalysedType::Variant(typ) = ty { + let case_idx = typ + .cases + .iter() + .position(|pair| pair.name == case) + .ok_or_else(|| WasmValueError::UnknownCase(case.to_string()))? + as u32; + Ok(ValueAndType { + value: Value::Variant { + case_idx, + case_value: val.map(|vnt| Box::new(vnt.value)), + }, + typ: ty.clone(), + }) + } else { + Err(WasmValueError::WrongTypeKind { + kind: WasmTypeKind::Variant, + ty: ty.kind().to_string(), + }) + } + } + + fn make_enum(ty: &Self::Type, case: &str) -> Result { + if let AnalysedType::Enum(typ) = ty { + let case_idx = typ + .cases + .iter() + .position(|c| c == case) + .ok_or_else(|| WasmValueError::UnknownCase(case.to_string()))? + as u32; + Ok(ValueAndType { + value: Value::Enum(case_idx), + typ: ty.clone(), + }) + } else { + Err(WasmValueError::WrongTypeKind { + kind: WasmTypeKind::Enum, + ty: ty.kind().to_string(), + }) + } + } + + fn make_option(ty: &Self::Type, val: Option) -> Result { + Ok(ValueAndType { + value: Value::Option(val.map(|vnt| Box::new(vnt.value))), + typ: ty.clone(), + }) + } + + fn make_result( + ty: &Self::Type, + val: Result, Option>, + ) -> Result { + Ok(ValueAndType { + value: Value::Result( + val.map(|maybe_ok| maybe_ok.map(|vnt| Box::new(vnt.value))) + .map_err(|maybe_err| maybe_err.map(|vnt| Box::new(vnt.value))), + ), + typ: ty.clone(), + }) + } + + fn make_flags<'a>( + ty: &Self::Type, + names: impl IntoIterator, + ) -> Result { + if let AnalysedType::Flags(typ) = ty { + let mut bitmap = Vec::new(); + let names: HashSet<&'a str> = HashSet::from_iter(names); + for name in &typ.names { + bitmap.push(names.contains(name.as_str())); + } + Ok(ValueAndType { + value: Value::Flags(bitmap), + typ: ty.clone(), + }) + } else { + Err(WasmValueError::WrongTypeKind { + kind: WasmTypeKind::Flags, + ty: ty.kind().to_string(), + }) + } + } + + fn unwrap_bool(&self) -> bool { + match self.value { + Value::Bool(val) => val, + _ => panic!("Expected bool, found {self:?}"), + } + } + + fn unwrap_s8(&self) -> i8 { + match self.value { + Value::S8(val) => val, + _ => panic!("Expected s8, found {self:?}"), + } + } + + fn unwrap_s16(&self) -> i16 { + match self.value { + Value::S16(val) => val, + _ => panic!("Expected s16, found {self:?}"), + } + } + + fn unwrap_s32(&self) -> i32 { + match self.value { + Value::S32(val) => val, + _ => panic!("Expected s32, found {self:?}"), + } + } + + fn unwrap_s64(&self) -> i64 { + match self.value { + Value::S64(val) => val, + _ => panic!("Expected s64, found {self:?}"), + } + } + + fn unwrap_u8(&self) -> u8 { + match self.value { + Value::U8(val) => val, + _ => panic!("Expected u8, found {self:?}"), + } + } + + fn unwrap_u16(&self) -> u16 { + match self.value { + Value::U16(val) => val, + _ => panic!("Expected u16, found {self:?}"), + } + } + + fn unwrap_u32(&self) -> u32 { + match self.value { + Value::U32(val) => val, + _ => panic!("Expected u32, found {self:?}"), + } + } + + fn unwrap_u64(&self) -> u64 { + match self.value { + Value::U64(val) => val, + _ => panic!("Expected u64, found {self:?}"), + } + } + + fn unwrap_f32(&self) -> f32 { + match self.value { + Value::F32(val) => val, + _ => panic!("Expected f32, found {self:?}"), + } + } + + fn unwrap_f64(&self) -> f64 { + match self.value { + Value::F64(val) => val, + _ => panic!("Expected f64, found {self:?}"), + } + } + + fn unwrap_char(&self) -> char { + match self.value { + Value::Char(val) => val, + _ => panic!("Expected char, found {self:?}"), + } + } + + fn unwrap_string(&self) -> Cow<'_, str> { + match &self.value { + Value::String(val) => Cow::Borrowed(val), + _ => panic!("Expected string, found {self:?}"), + } + } + + fn unwrap_list(&self) -> Box> + '_> { + match (&self.value, &self.typ) { + (Value::List(vals), AnalysedType::List(typ)) => Box::new(vals.iter().map(|val| { + Cow::Owned(ValueAndType { + value: val.clone(), + typ: (*typ.inner).clone(), + }) + })), + _ => panic!("Expected list, found {self:?}"), + } + } + + fn unwrap_record(&self) -> Box, Cow<'_, Self>)> + '_> { + match (&self.value, &self.typ) { + (Value::Record(vals), AnalysedType::Record(typ)) => { + Box::new(vals.iter().zip(typ.fields.iter()).map(|(val, field)| { + ( + Cow::Borrowed(field.name.as_str()), + Cow::Owned(ValueAndType { + value: val.clone(), + typ: field.typ.clone(), + }), + ) + })) + } + _ => panic!("Expected record, found {self:?}"), + } + } + + fn unwrap_tuple(&self) -> Box> + '_> { + match (&self.value, &self.typ) { + (Value::Tuple(vals), AnalysedType::Tuple(typ)) => { + Box::new(vals.iter().zip(typ.items.iter()).map(|(val, ty)| { + Cow::Owned(ValueAndType { + value: val.clone(), + typ: ty.clone(), + }) + })) + } + _ => panic!("Expected tuple, found {self:?}"), + } + } + + fn unwrap_variant(&self) -> (Cow<'_, str>, Option>) { + match (&self.value, &self.typ) { + ( + Value::Variant { + case_idx, + case_value, + }, + AnalysedType::Variant(typ), + ) => { + let case = &typ.cases[*case_idx as usize]; + ( + Cow::Borrowed(case.name.as_str()), + case_value.as_ref().map(|val| { + Cow::Owned(ValueAndType { + value: *val.clone(), + typ: case.typ.clone().unwrap(), + }) + }), + ) + } + _ => panic!("Expected variant, found {self:?}"), + } + } + + fn unwrap_enum(&self) -> Cow<'_, str> { + match (&self.value, &self.typ) { + (Value::Enum(case_idx), AnalysedType::Enum(typ)) => { + Cow::Borrowed(&typ.cases[*case_idx as usize]) + } + _ => panic!("Expected enum, found {self:?}"), + } + } + + fn unwrap_option(&self) -> Option> { + match (&self.value, &self.typ) { + (Value::Option(Some(val)), AnalysedType::Option(typ)) => { + Some(Cow::Owned(ValueAndType { + value: *val.clone(), + typ: (*typ.inner).clone(), + })) + } + (Value::Option(None), AnalysedType::Option(_)) => None, + _ => panic!("Expected option, found {self:?}"), + } + } + + fn unwrap_result(&self) -> Result>, Option>> { + match (&self.value, &self.typ) { + (Value::Result(Ok(Some(val))), AnalysedType::Result(typ)) => { + Ok(Some(Cow::Owned(ValueAndType { + value: *val.clone(), + typ: *typ + .ok + .as_ref() + .expect("No type information for non-unit ok value") + .clone(), + }))) + } + (Value::Result(Ok(None)), AnalysedType::Result(_)) => Ok(None), + (Value::Result(Err(Some(val))), AnalysedType::Result(typ)) => { + Err(Some(Cow::Owned(ValueAndType { + value: *val.clone(), + typ: *typ + .err + .as_ref() + .expect("No type information for non-unit error value") + .clone(), + }))) + } + (Value::Result(Err(None)), AnalysedType::Result(_)) => Err(None), + _ => panic!("Expected result, found {self:?}"), + } + } + + fn unwrap_flags(&self) -> Box> + '_> { + match (&self.value, &self.typ) { + (Value::Flags(bitmap), AnalysedType::Flags(typ)) => Box::new( + bitmap + .iter() + .zip(typ.names.iter()) + .filter_map(|(is_set, name)| { + if *is_set { + Some(Cow::Borrowed(name.as_str())) + } else { + None + } + }), + ), + _ => panic!("Expected flags, found {self:?}"), + } + } +} diff --git a/rib-core/src/wave.rs b/rib-core/src/wave.rs new file mode 100644 index 0000000..c511f6d --- /dev/null +++ b/rib-core/src/wave.rs @@ -0,0 +1,181 @@ +use crate::analysis::{ + AnalysedFunction, AnalysedType, TypeEnum, TypeFlags, TypeList, TypeOption, TypeRecord, + TypeResult, TypeTuple, TypeVariant, +}; +use std::borrow::Cow; +use std::fmt::Display; +use wasm_wave::wasm::{DisplayType, WasmFunc, WasmType, WasmTypeKind}; + +impl WasmType for AnalysedType { + fn kind(&self) -> WasmTypeKind { + match self { + AnalysedType::Bool(_) => WasmTypeKind::Bool, + AnalysedType::S8(_) => WasmTypeKind::S8, + AnalysedType::U8(_) => WasmTypeKind::U8, + AnalysedType::S16(_) => WasmTypeKind::S16, + AnalysedType::U16(_) => WasmTypeKind::U16, + AnalysedType::S32(_) => WasmTypeKind::S32, + AnalysedType::U32(_) => WasmTypeKind::U32, + AnalysedType::S64(_) => WasmTypeKind::S64, + AnalysedType::U64(_) => WasmTypeKind::U64, + AnalysedType::F32(_) => WasmTypeKind::F32, + AnalysedType::F64(_) => WasmTypeKind::F64, + AnalysedType::Chr(_) => WasmTypeKind::Char, + AnalysedType::Str(_) => WasmTypeKind::String, + AnalysedType::List(_) => WasmTypeKind::List, + AnalysedType::Tuple(_) => WasmTypeKind::Tuple, + AnalysedType::Record(_) => WasmTypeKind::Record, + AnalysedType::Flags(_) => WasmTypeKind::Flags, + AnalysedType::Enum(_) => WasmTypeKind::Enum, + AnalysedType::Option(_) => WasmTypeKind::Option, + AnalysedType::Result { .. } => WasmTypeKind::Result, + AnalysedType::Variant(_) => WasmTypeKind::Variant, + AnalysedType::Handle(_) => WasmTypeKind::Unsupported, + } + } + + fn list_element_type(&self) -> Option { + if let AnalysedType::List(TypeList { inner: ty, .. }) = self { + Some(*ty.clone()) + } else { + None + } + } + + fn record_fields(&self) -> Box, Self)> + '_> { + if let AnalysedType::Record(TypeRecord { fields, .. }) = self { + Box::new( + fields + .iter() + .map(|pair| (Cow::Borrowed(pair.name.as_str()), pair.typ.clone())), + ) + } else { + Box::new(std::iter::empty()) + } + } + + fn tuple_element_types(&self) -> Box + '_> { + if let AnalysedType::Tuple(TypeTuple { items, .. }) = self { + Box::new(items.clone().into_iter()) + } else { + Box::new(std::iter::empty()) + } + } + + fn variant_cases(&self) -> Box, Option)> + '_> { + if let AnalysedType::Variant(TypeVariant { cases, .. }) = self { + Box::new( + cases + .iter() + .map(|case| (Cow::Borrowed(case.name.as_str()), case.typ.clone())), + ) + } else { + Box::new(std::iter::empty()) + } + } + + fn enum_cases(&self) -> Box> + '_> { + if let AnalysedType::Enum(TypeEnum { cases, .. }) = self { + Box::new(cases.iter().map(|name| Cow::Borrowed(name.as_str()))) + } else { + Box::new(std::iter::empty()) + } + } + + fn option_some_type(&self) -> Option { + if let AnalysedType::Option(TypeOption { inner, .. }) = self { + Some(*inner.clone()) + } else { + None + } + } + + fn result_types(&self) -> Option<(Option, Option)> { + if let AnalysedType::Result(TypeResult { ok, err, .. }) = self { + Some(( + ok.as_ref().map(|t| *t.clone()), + err.as_ref().map(|t| *t.clone()), + )) + } else { + None + } + } + + fn flags_names(&self) -> Box> + '_> { + if let AnalysedType::Flags(TypeFlags { names, .. }) = self { + Box::new(names.iter().map(|name| Cow::Borrowed(name.as_str()))) + } else { + Box::new(std::iter::empty()) + } + } +} + +impl WasmFunc for AnalysedFunction { + type Type = AnalysedType; + + fn params(&self) -> Box + '_> { + Box::new(self.parameters.iter().map(|p| p.typ.clone())) + } + + fn param_names(&self) -> Box> + '_> { + Box::new( + self.parameters + .iter() + .map(|p| Cow::Borrowed(p.name.as_str())), + ) + } + + fn results(&self) -> Box + '_> { + Box::new(self.result.iter().map(|r| r.typ.clone())) + } +} + +pub struct DisplayNamedFunc { + pub name: String, + pub func: T, +} + +impl Display for DisplayNamedFunc { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.name)?; + f.write_str("(")?; + let mut param_names = self.func.param_names(); + for (idx, ty) in self.func.params().enumerate() { + if idx != 0 { + f.write_str(", ")?; + } + if let Some(name) = param_names.next() { + write!(f, "{name}: ")?; + } + DisplayType(&ty).fmt(f)? + } + f.write_str(")")?; + + let results = self.func.results().collect::>(); + if results.is_empty() { + return Ok(()); + } + + let mut result_names = self.func.result_names(); + if results.len() == 1 { + let ty = DisplayType(&results.into_iter().next().unwrap()).to_string(); + if let Some(name) = result_names.next() { + write!(f, " -> ({name}: {ty})") + } else { + write!(f, " -> {ty}") + } + } else { + f.write_str(" -> (")?; + for (idx, ty) in results.into_iter().enumerate() { + if idx != 0 { + f.write_str(", ")?; + } + if let Some(name) = result_names.next() { + write!(f, "{name}: ")?; + } + DisplayType(&ty).fmt(f)?; + } + f.write_str(")") + } + } +} diff --git a/rib-repl/Cargo.toml b/rib-repl/Cargo.toml index 877be52..9f49aa3 100644 --- a/rib-repl/Cargo.toml +++ b/rib-repl/Cargo.toml @@ -13,7 +13,6 @@ harness = false [dependencies] rib-core = { workspace = true } -golem-wasm = { workspace = true, default-features = true } anyhow = { workspace = true } async-trait = { workspace = true } diff --git a/rib-repl/src/command/builtin.rs b/rib-repl/src/command/builtin.rs index 1f45660..10c032e 100644 --- a/rib-repl/src/command/builtin.rs +++ b/rib-repl/src/command/builtin.rs @@ -5,7 +5,7 @@ use crossterm::{ execute, terminal::{Clear as TermClear, ClearType}, }; -use golem_wasm::analysis::AnalysedType; +use rib::analysis::AnalysedType; use rib::{CompilerOutput, ComponentDependencies, Expr, RibCompilationError}; use std::io::stdout; diff --git a/rib-repl/src/compiler.rs b/rib-repl/src/compiler.rs index f72368e..91ba44d 100644 --- a/rib-repl/src/compiler.rs +++ b/rib-repl/src/compiler.rs @@ -13,7 +13,7 @@ // limitations under the License. use crate::repl_state::ReplState; -use golem_wasm::analysis::{TypeEnum, TypeVariant}; +use rib::analysis::{TypeEnum, TypeVariant}; use rib::*; use std::collections::HashMap; use std::fmt::Display; diff --git a/rib-repl/src/invoke.rs b/rib-repl/src/invoke.rs index 8826aa7..9dc0e30 100644 --- a/rib-repl/src/invoke.rs +++ b/rib-repl/src/invoke.rs @@ -14,8 +14,8 @@ use crate::repl_state::ReplState; use async_trait::async_trait; -use golem_wasm::analysis::AnalysedType; -use golem_wasm::ValueAndType; +use rib::analysis::AnalysedType; +use rib::ValueAndType; use rib::{ ComponentDependencyKey, EvaluatedFnArgs, EvaluatedFqFn, EvaluatedWorkerName, InstructionId, RibComponentFunctionInvoke, RibFunctionInvokeResult, diff --git a/rib-repl/src/repl_printer.rs b/rib-repl/src/repl_printer.rs index 65c8ba7..faa630b 100644 --- a/rib-repl/src/repl_printer.rs +++ b/rib-repl/src/repl_printer.rs @@ -14,10 +14,10 @@ use crate::ReplBootstrapError; use colored::Colorize; -use golem_wasm::analysis::analysed_type::{record, str, u64}; -use golem_wasm::analysis::{AnalysedResourceMode, AnalysedType, NameTypePair, TypeHandle}; -use golem_wasm::{Value, ValueAndType}; +use rib::analysis::analysed_type::{record, str, u64}; +use rib::analysis::{AnalysedResourceMode, AnalysedType, NameTypePair, TypeHandle}; use rib::*; +use rib::{Value, ValueAndType}; use std::collections::BTreeMap; use std::fmt::Display; diff --git a/rib-repl/src/repl_state.rs b/rib-repl/src/repl_state.rs index fe7c1d0..858ba3c 100644 --- a/rib-repl/src/repl_state.rs +++ b/rib-repl/src/repl_state.rs @@ -14,7 +14,7 @@ use crate::worker_name_gen::ReplWorkerNameGen; use crate::{RawRibScript, WorkerFunctionInvoke}; -use golem_wasm::ValueAndType; +use rib::ValueAndType; use rib::{InstructionId, RibCompiler}; use std::collections::HashMap; use std::path::PathBuf; diff --git a/rib-repl/src/rib_edit.rs b/rib-repl/src/rib_edit.rs index dd03d55..04dfeea 100644 --- a/rib-repl/src/rib_edit.rs +++ b/rib-repl/src/rib_edit.rs @@ -16,8 +16,8 @@ use crate::compiler::{InstanceVariables, ReplCompilerOutput}; use crate::value_generator::generate_value; use crate::CommandRegistry; use colored::Colorize; -use golem_wasm::analysis::{TypeEnum, TypeVariant}; -use golem_wasm::ValueAndType; +use rib::analysis::{TypeEnum, TypeVariant}; +use rib::ValueAndType; use rib::{CustomInstanceSpec, Expr, VariableId}; use rustyline::completion::Completer; use rustyline::highlight::Highlighter; diff --git a/rib-repl/src/value_generator.rs b/rib-repl/src/value_generator.rs index abcd121..5fd4878 100644 --- a/rib-repl/src/value_generator.rs +++ b/rib-repl/src/value_generator.rs @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -use golem_wasm::analysis::AnalysedType; -use golem_wasm::Value; +use rib::analysis::AnalysedType; +use rib::Value; pub fn generate_value(analysed_tpe: &AnalysedType) -> Value { match analysed_tpe {