From 7b6f177d1496cf57355848cbe9cadff4057d82bf Mon Sep 17 00:00:00 2001 From: Sebastian Moser Date: Wed, 4 Feb 2026 20:41:39 +0100 Subject: [PATCH] some MizePart stuff and other stuff --- Cargo.lock | 4102 ++++++++++++++++++ Cargo.toml | 7 + apps/ppc/Cargo.toml | 8 + apps/ppc/src/main.rs | 20 + parts/cli/Cargo.toml | 8 + parts/cli/src/lib.rs | 72 + parts/js/Cargo.toml | 9 + parts/js/src/lib.rs | 41 + parts/mize/build.rs | 21 +- parts/mize/flake.lock | 42 +- parts/mize/src/core/config.rs | 46 + parts/mize/src/core/error.rs | 128 +- parts/mize/src/core/id.rs | 87 +- parts/mize/src/core/instance/connection.rs | 16 +- parts/mize/src/core/instance/mod.rs | 400 +- parts/mize/src/core/instance/module.rs | 27 +- parts/mize/src/core/instance/store.rs | 26 +- parts/mize/src/core/instance/subscription.rs | 20 +- parts/mize/src/core/instance/tests.rs | 109 +- parts/mize/src/core/instance/updater.rs | 67 +- parts/mize/src/core/item.rs | 260 +- parts/mize/src/core/memstore.rs | 50 +- parts/mize/src/core/proto/mod.rs | 168 +- parts/mize/src/lib.rs | 42 +- parts/mize/src/platform/os/cli.rs | 80 +- parts/mize/src/platform/os/fsstore.rs | 111 +- parts/mize/src/platform/os/main.rs | 166 +- parts/mize/src/platform/os/mod.rs | 173 +- parts/mize/src/platform/os/unix_socket.rs | 95 +- 29 files changed, 5585 insertions(+), 816 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 apps/ppc/Cargo.toml create mode 100644 apps/ppc/src/main.rs create mode 100644 parts/cli/Cargo.toml create mode 100644 parts/cli/src/lib.rs create mode 100644 parts/js/Cargo.toml create mode 100644 parts/js/src/lib.rs create mode 100644 parts/mize/src/core/config.rs diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c6caa25 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4102 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "ascii" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core", + "base64 0.21.7", + "bitflags 1.3.2", + "bytes", + "futures-util", + "headers", + "http 0.2.12", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper", + "tokio", + "tokio-tungstenite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 0.2.12", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-extra" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a320103719de37b7b4da4c8eb629d4573f6bcfd3dfe80d3208806895ccf81d" +dependencies = [ + "axum", + "bytes", + "futures-util", + "http 0.2.12", + "mime", + "pin-project-lite", + "tokio", + "tower", + "tower-http", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-macros" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdca6a10ecad987bda04e95606ef85a5417dcaac1a78455242d72e031e2b6b62" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "az" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be5eb007b7cacc6c660343e96f650fedf4b5a77512399eb952ca6642cf8d13f7" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64-simd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339abbe78e73178762e23bea9dfd08e697eb3f3301cd4be981c0f78ba5859195" +dependencies = [ + "outref", + "vsimd", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.72.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" +dependencies = [ + "bitflags 2.10.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", +] + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[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 = "boxed_error" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17d4f95e880cfd28c4ca5a006cf7f6af52b4bcb7b5866f573b2faa126fb7affb" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "brotli-decompressor" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "buf_redux" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" +dependencies = [ + "memchr", + "safemem", +] + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "calendrical_calculations" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b39595c6ee54a8d0900204ba4c401d0ab4eb45adaf07178e8d017541529e7" +dependencies = [ + "core_maths", + "displaydoc", +] + +[[package]] +name = "capacity_builder" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f2d24a6dcf0cd402a21b65d35340f3a49ff3475dc5fdac91d22d2733e6641c6" +dependencies = [ + "capacity_builder_macros", + "itoa", +] + +[[package]] +name = "capacity_builder_macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b4a6cae9efc04cc6cbb8faf338d2c497c165c83e74509cf4dbedea948bbf6e5" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + +[[package]] +name = "cc" +version = "1.2.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "chunked_transfer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" + +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "4.5.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32" + +[[package]] +name = "cli" +version = "0.1.0" +dependencies = [ + "clap", + "mize", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.4", + "wasm-bindgen", +] + +[[package]] +name = "cooked-waker" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147be55d677052dabc6b22252d5dd0fd4c29c8c27aa4f2fbef0f94aa003b406f" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core_maths" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77745e017f5edba1a9c1d854f6f3a52dac8a12dd5af5d2f54aecf61e43d80d30" +dependencies = [ + "libm", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if 1.0.4", +] + +[[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 = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "daemonize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab8bfdaacb3c887a54d41bdf48d3af8873b3f5566469f8ba21b92057509f116e" +dependencies = [ + "libc", +] + +[[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 = [ + "serde", + "uuid", +] + +[[package]] +name = "deno_core" +version = "0.383.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee60c193b9e93726558e20dca14b36db7fccfebdf4479271e834e52709d101ca" +dependencies = [ + "anyhow", + "az", + "bincode", + "bit-set", + "bit-vec", + "boxed_error", + "bytes", + "capacity_builder", + "cooked-waker", + "deno_core_icudata", + "deno_error", + "deno_ops", + "deno_path_util", + "deno_unsync", + "futures", + "indexmap 2.13.0", + "libc", + "parking_lot", + "percent-encoding", + "pin-project", + "serde", + "serde_json", + "serde_v8", + "smallvec", + "sourcemap", + "static_assertions", + "thiserror 2.0.18", + "tokio", + "url", + "v8", + "wasm_dep_analyzer", +] + +[[package]] +name = "deno_core_icudata" +version = "0.77.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9efff8990a82c1ae664292507e1a5c6749ddd2312898cdf9cd7cb1fd4bc64c6" + +[[package]] +name = "deno_error" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3007d3f1ea92ea503324ae15883aac0c2de2b8cf6fead62203ff6a67161007ab" +dependencies = [ + "deno_error_macro", + "libc", + "serde", + "serde_json", + "tokio", + "url", +] + +[[package]] +name = "deno_error_macro" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b565e60a9685cdf312c888665b5f8647ac692a7da7e058a5e2268a466da8eaf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "deno_ops" +version = "0.259.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e102069f83f92da6cba0867ffc9bfe3a5a98fa8b01e49687da764d64e91810d" +dependencies = [ + "indexmap 2.13.0", + "proc-macro2", + "quote", + "stringcase", + "strum", + "strum_macros", + "syn", + "syn-match", + "thiserror 2.0.18", +] + +[[package]] +name = "deno_path_util" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c7e98943f0d068928906db0c7bde89de684fa32c6a8018caacc4cee2cdd72b" +dependencies = [ + "deno_error", + "percent-encoding", + "sys_traits", + "thiserror 2.0.18", + "url", +] + +[[package]] +name = "deno_unsync" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6742a724e8becb372a74c650a1aefb8924a5b8107f7d75b3848763ea24b27a87" +dependencies = [ + "futures-util", + "parking_lot", + "tokio", +] + +[[package]] +name = "deranged" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "diplomat" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9adb46b05e2f53dcf6a7dfc242e4ce9eb60c369b6b6eb10826a01e93167f59c6" +dependencies = [ + "diplomat_core", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "diplomat-runtime" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0569bd3caaf13829da7ee4e83dbf9197a0e1ecd72772da6d08f0b4c9285c8d29" + +[[package]] +name = "diplomat_core" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51731530ed7f2d4495019abc7df3744f53338e69e2863a6a64ae91821c763df1" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "smallvec", + "strck", + "syn", +] + +[[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 = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "env_filter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf3c259d255ca70051b30e2e95b5446cdb8949ac4cd22c0d7fd634d89f568e2" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c863f0904021b108aa8b2f55046443e6b1ebde8fd4a15c399893aae4fa069f" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "jiff", + "log", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "filetime" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" +dependencies = [ + "cfg-if 1.0.4", + "libc", + "libredox", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "flume" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" +dependencies = [ + "futures-core", + "futures-sink", + "nanorand", + "spin", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fslock" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04412b8935272e3a9bae6f48c7bfff74c2911f60525404edfdd28e49884c3bfb" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if 1.0.4", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if 1.0.4", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "gimli" +version = "0.26.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +dependencies = [ + "fallible-iterator", + "indexmap 1.9.3", + "stable_deref_trait", +] + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "gzip-header" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95cc527b92e6029a62960ad99aa8a6660faa4555fe5f731aab13aa6a921795a2" +dependencies = [ + "crc32fast", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if 1.0.4", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "headers" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +dependencies = [ + "base64 0.21.7", + "bytes", + "headers-core", + "http 0.2.12", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http 0.2.12", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + +[[package]] +name = "home" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[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 = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" + +[[package]] +name = "http_req" +version = "0.12.0" +source = "git+https://github.com/c2vi/http_req#46b0f93087ef6f68a360b303192e30ecb7b055e2" +dependencies = [ + "native-tls", + "unicase", +] + +[[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 = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http 0.2.12", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_calendar" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f0e52e009b6b16ba9c0693578796f2dd4aaa59a7f8f920423706714a89ac4e" +dependencies = [ + "calendrical_calculations", + "displaydoc", + "icu_calendar_data", + "icu_locale", + "icu_locale_core", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_calendar_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527f04223b17edfe0bd43baf14a0cb1b017830db65f3950dc00224860a9a446d" + +[[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" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "532b11722e350ab6bf916ba6eb0efe3ee54b932666afec989465f9243fe6dd60" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_locale_data", + "icu_provider", + "potential_utf", + "tinystr", + "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", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c5f1d16b4c3a2642d3a719f18f6b06070ab0aef246a6418130c955ae08aa831" + +[[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", + "serde", + "stable_deref_trait", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" +dependencies = [ + "rayon", +] + +[[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 = "if_chain" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd62e6b5e86ea8eeeb8db1de02880a6abc01a397b2ebb64b5d74ac255318f5cb" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "interner" +version = "0.2.1" +source = "git+https://github.com/c2vi/interner#746e7586bb65e2e50ac02140c6414574efb2eb4e" + +[[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.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "ixdtf" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84de9d95a6d2547d9b77ee3f25fa0ee32e3c3a6484d47a55adebc0439c077992" + +[[package]] +name = "jiff" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67e8da4c49d6d9909fe03361f9b620f58898859f5c7aded68351e85e71ecf50" +dependencies = [ + "jiff-static", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", +] + +[[package]] +name = "jiff-static" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0c84ee7f197eca9a86c6fd6cb771e55eb991632f15f2bc3ca6ec838929e6e78" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "js_part" +version = "0.1.0" +dependencies = [ + "deno_core", + "mize", + "tokio", +] + +[[package]] +name = "lazy_static" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if 1.0.4", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +dependencies = [ + "bitflags 2.10.0", + "libc", + "redox_syscall 0.7.0", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "minicov" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4869b6a491569605d66d3952bcdf03df789e5b536e5f0cf7758a7f08a55ae24d" +dependencies = [ + "cc", + "walkdir", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "mize" +version = "0.0.1" +dependencies = [ + "axum", + "axum-extra", + "axum-macros", + "ciborium", + "ciborium-io", + "clap", + "colored", + "console_error_panic_hook", + "daemonize", + "dyn-clone", + "flate2", + "flume", + "home", + "http_req", + "interner", + "libloading", + "nix", + "serde", + "serde-wasm-bindgen", + "serde_json", + "sha2", + "sysinfo", + "tar", + "tokio", + "toml", + "tracing", + "tracing-core", + "tracing-subscriber", + "uuid", + "wasm-bindgen", + "wasm-bindgen-cli", + "wasm-bindgen-futures", + "wasm-bindgen-test", + "web-sys", + "wee_alloc", +] + +[[package]] +name = "multipart" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00dec633863867f29cb39df64a397cdf4a6354708ddd7759f70c7fb51c5f9182" +dependencies = [ + "buf_redux", + "httparse", + "log", + "mime", + "mime_guess", + "quick-error", + "rand", + "safemem", + "tempfile", + "twoway", +] + +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.10.0", + "cfg-if 1.0.4", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "ntapi" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c70f219e21142367c70c0b30c6a9e3a14d55b4d12a204d897fbec83a0363f081" +dependencies = [ + "winapi", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", + "rand", +] + +[[package]] +name = "num-conv" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_threads" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +dependencies = [ + "libc", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "oorandom" +version = "11.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" + +[[package]] +name = "openssl" +version = "0.10.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" +dependencies = [ + "bitflags 2.10.0", + "cfg-if 1.0.4", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.111" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "outref" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if 1.0.4", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[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 = "portable-atomic" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "portable-atomic-util" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppc" +version = "0.1.0" +dependencies = [ + "js_part", + "mize", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "redox_syscall" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f3fe0889e69e2ae9e41f4d6c4c0181701d00e4697b356fb1f74173a5e0ee27" +dependencies = [ + "bitflags 2.10.0", +] + +[[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.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c" + +[[package]] +name = "resb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a067ab3b5ca3b4dc307d0de9cf75f9f5e6ca9717b192b2f28a36c83e5de9e76" +dependencies = [ + "potential_utf", + "serde_core", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if 1.0.4", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rouille" +version = "3.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3716fbf57fc1084d7a706adf4e445298d123e4a44294c4e8213caf1b85fcc921" +dependencies = [ + "base64 0.13.1", + "chrono", + "filetime", + "multipart", + "percent-encoding", + "rand", + "serde", + "serde_derive", + "serde_json", + "sha1_smol", + "threadpool", + "time", + "tiny_http", + "url", +] + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +dependencies = [ + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" + +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.10.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-wasm-bindgen" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8302e169f0eddcc139c70f139d19d6467353af16f9fce27e8c30158036a1e16b" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "indexmap 2.13.0", + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[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_v8" +version = "0.292.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0d7af6a35bbed7c8d91b951608bf2e820a077992bf3dde06ef016af6e7b503f" +dependencies = [ + "deno_error", + "num-bigint", + "serde", + "smallvec", + "thiserror 2.0.18", + "v8", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if 1.0.4", + "cpufeatures", + "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 1.0.4", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[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.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[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" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "sourcemap" +version = "9.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "314d62a489431668f719ada776ca1d49b924db951b7450f8974c9ae51ab05ad7" +dependencies = [ + "base64-simd", + "bitvec", + "data-encoding", + "debugid", + "if_chain", + "rustc-hash", + "serde", + "serde_json", + "unicode-id-start", + "url", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strck" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42316e70da376f3d113a68d138a60d8a9883c604fe97942721ec2068dab13a9f" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "stringcase" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72abeda133c49d7bddece6c154728f83eec8172380c80ab7096da9487e20d27c" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-match" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783c4140d7ed89f37116e865b49e5a9fdd28608b9071a9dd1e158b50fc0a31fc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[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 = "sys_traits" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4121e69c72108134f9daf82cf6580269f018f5d8fb8cd3063df17699fbb84cb1" +dependencies = [ + "sys_traits_macros", +] + +[[package]] +name = "sys_traits_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "181f22127402abcf8ee5c83ccd5b408933fec36a6095cf82cda545634692657e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sysinfo" +version = "0.30.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a5b4ddaee55fb2bea2bf0e5000747e5f5c0de765e5a5ff87f4cd106439f4bb3" +dependencies = [ + "cfg-if 1.0.4", + "core-foundation-sys", + "libc", + "ntapi", + "once_cell", + "rayon", + "windows", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tar" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix 1.1.3", + "windows-sys 0.61.2", +] + +[[package]] +name = "temporal_capi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a151e402c2bdb6a3a2a2f3f225eddaead2e7ce7dd5d3fa2090deb11b17aa4ed8" +dependencies = [ + "diplomat", + "diplomat-runtime", + "icu_calendar", + "icu_locale", + "num-traits", + "temporal_rs", + "timezone_provider", + "writeable", + "zoneinfo64", +] + +[[package]] +name = "temporal_rs" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88afde3bd75d2fc68d77a914bece426aa08aa7649ffd0cdd4a11c3d4d33474d1" +dependencies = [ + "core_maths", + "icu_calendar", + "icu_locale", + "ixdtf", + "num-traits", + "timezone_provider", + "tinystr", + "writeable", +] + +[[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 = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if 1.0.4", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "time" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" +dependencies = [ + "deranged", + "libc", + "num-conv", + "num_threads", + "powerfmt", + "serde_core", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "timezone_provider" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9ba0000e9e73862f3e7ca1ff159e2ddf915c9d8bb11e38a7874760f445d993" +dependencies = [ + "tinystr", + "zerotrie", + "zerovec", + "zoneinfo64", +] + +[[package]] +name = "tiny_http" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389915df6413a2e74fb181895f933386023c71110878cd0825588928e64cdc82" +dependencies = [ + "ascii", + "chunked_transfer", + "httpdate", + "log", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.6.2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" +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", + "toml_datetime", + "toml_edit", +] + +[[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_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.13.0", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +dependencies = [ + "bitflags 1.3.2", + "bytes", + "futures-core", + "futures-util", + "http 0.2.12", + "http-body", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", +] + +[[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 = [ + "log", + "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", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[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.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 0.2.12", + "httparse", + "log", + "rand", + "sha1", + "thiserror 1.0.69", + "url", + "utf-8", +] + +[[package]] +name = "twoway" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" +dependencies = [ + "memchr", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-id-start" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81b79ad29b5e19de4260020f8919b443b2ef0277d242ce532ec7b7a2cc8b6007" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "ureq" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d39cb1dbab692d82a977c0392ffac19e188bd9186a9f32806f0aaa859d75585a" +dependencies = [ + "base64 0.22.1", + "brotli-decompressor", + "flate2", + "log", + "percent-encoding", + "rustls", + "rustls-pki-types", + "ureq-proto", + "utf-8", + "webpki-roots", +] + +[[package]] +name = "ureq-proto" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d81f9efa9df032be5934a46a068815a10a042b494b6a58cb0a1a97bb5467ed6f" +dependencies = [ + "base64 0.22.1", + "http 1.4.0", + "httparse", + "log", +] + +[[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.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "v8" +version = "145.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61d9a107e16bae35a0be2bb0096ac1d2318aac352c82edd796ab2b9cac66d8f0" +dependencies = [ + "bindgen", + "bitflags 2.10.0", + "fslock", + "gzip-header", + "home", + "miniz_oxide", + "paste", + "temporal_capi", + "which", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vsimd" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c3082ca00d5a5ef149bb8b555a72ae84c9c59f7250f013ac822ac2e49b19c64" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "walrus" +version = "0.24.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "820a1ca30ceb782a7f4524722a7ee27bd6c4bcde97d48802ba270fd69ff1a954" +dependencies = [ + "anyhow", + "gimli", + "id-arena", + "leb128", + "log", + "rayon", + "walrus-macro", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "walrus-macro" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef06db404cbaed87cb25fd2ca3a62502af485f43383c9641ffcf1479d02fffd" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn", +] + +[[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 = "wasm-bindgen" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if 1.0.4", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-cli" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44ec68e22cd8878c34e01b55fc514eaf75bd3b1c2d095deeb022fa6f8856d174" +dependencies = [ + "anyhow", + "clap", + "env_logger", + "log", + "rouille", + "serde", + "serde_derive", + "serde_json", + "shlex", + "tempfile", + "ureq", + "walrus", + "wasm-bindgen-cli-support", + "wasm-bindgen-test-shared", +] + +[[package]] +name = "wasm-bindgen-cli-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2be60cf36510aa4702ce189517229c3091f4a322a5ec2665a7737ea5956c2b3a" +dependencies = [ + "anyhow", + "base64 0.22.1", + "leb128", + "log", + "rustc-demangle", + "serde", + "serde_json", + "walrus", + "wasm-bindgen-shared", + "wasmparser", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +dependencies = [ + "cfg-if 1.0.4", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45649196a53b0b7a15101d845d44d2dda7374fc1b5b5e2bbf58b7577ff4b346d" +dependencies = [ + "async-trait", + "cast", + "js-sys", + "libm", + "minicov", + "nu-ansi-term", + "num-traits", + "oorandom", + "serde", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", + "wasm-bindgen-test-shared", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f579cdd0123ac74b94e1a4a72bd963cf30ebac343f2df347da0b8df24cdebed2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "wasm-bindgen-test-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8145dd1593bf0fb137dbfa85b8be79ec560a447298955877804640e40c2d6ea" + +[[package]] +name = "wasm-encoder" +version = "0.240.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d642d8c5ecc083aafe9ceb32809276a304547a3a6eeecceb5d8152598bc71f" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm_dep_analyzer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a10e6b67c951a84de7029487e0e0a496860dae49f6699edd279d5ff35b8fbf54" +dependencies = [ + "deno_error", + "thiserror 2.0.18", +] + +[[package]] +name = "wasmparser" +version = "0.240.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b722dcf61e0ea47440b53ff83ccb5df8efec57a69d150e4f24882e4eba7e24a4" +dependencies = [ + "bitflags 2.10.0", + "hashbrown 0.15.5", + "indexmap 2.13.0", + "semver", + "serde", +] + +[[package]] +name = "web-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "memory_units", + "winapi", +] + +[[package]] +name = "which" +version = "6.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" +dependencies = [ + "either", + "home", + "rustix 0.38.44", + "winsafe", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +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 = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "winsafe" +version = "0.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix 1.1.3", +] + +[[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.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7456cf00f0685ad319c5b1693f291a650eaf345e941d082fc4e03df8a03996ac" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1328722bbf2115db7e19d69ebcc15e795719e2d66b60827c6a69a117365e37a0" +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 = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[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 = [ + "serde", + "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", +] + +[[package]] +name = "zmij" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445" + +[[package]] +name = "zoneinfo64" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2e5597efbe7c421da8a7fd396b20b571704e787c21a272eecf35dfe9d386f0" +dependencies = [ + "calendrical_calculations", + "icu_locale_core", + "potential_utf", + "resb", + "serde", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..edce4b8 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[workspace] +resolver = "2" +members = [ + "parts/js", + "apps/ppc", + "parts/mize" +, "parts/cli"] diff --git a/apps/ppc/Cargo.toml b/apps/ppc/Cargo.toml new file mode 100644 index 0000000..61d86f2 --- /dev/null +++ b/apps/ppc/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "ppc" +version = "0.1.0" +edition = "2024" + +[dependencies] +mize = { path = "../../parts/mize" } +js_part = { path = "../../parts/js" } diff --git a/apps/ppc/src/main.rs b/apps/ppc/src/main.rs new file mode 100644 index 0000000..ed5b289 --- /dev/null +++ b/apps/ppc/src/main.rs @@ -0,0 +1,20 @@ +use std::collections::HashMap; + +use config::Config; +use deno_part::JsPart; +use mize::{Mize, MizeError, MizePart, MizeResult, add_parts, mize_err}; +use clap::crate_version; + +fn main() { + let mut mize = Mize::new(); + + add_parts!(&mut mize, Cli::new(&mut mize, "ppc")); + let cli = Cli::get(&mut mize); + cli.with_cmd(|cmd| cmd.version(crate_version!()).author("ppc").about("the ppc desktop program")); + cli.subcommand("test", |sub_matches| { + println!("test ppc..."); + Ok(()) + }); + + mize.run(); +} diff --git a/parts/cli/Cargo.toml b/parts/cli/Cargo.toml new file mode 100644 index 0000000..21811e7 --- /dev/null +++ b/parts/cli/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "cli" +version = "0.1.0" +edition = "2024" + +[dependencies] +clap = { version = "4.5.57", features = ["cargo"] } +mize = { path = "../../parts/mize"} diff --git a/parts/cli/src/lib.rs b/parts/cli/src/lib.rs new file mode 100644 index 0000000..ae318fd --- /dev/null +++ b/parts/cli/src/lib.rs @@ -0,0 +1,72 @@ +use clap::{ArgMatches, Command}; +use std::any::Any; +use std::collections::HashMap; + +use mize::{Mize, MizePart, MizeResult, instance::MizePartGuard}; + +struct CliPart { + mize: Mize, + cmd: Option, + actions: HashMap MizeResult<()>>, +} + +pub fn new(mize: Mize) -> CliPart { + CliPart { + mize, + cmd: None, + actions: HashMap::new(), + } +} + +impl MizePart for CliPart { + fn name(&self) -> &'static str { + "cli" + } + fn get_mize(&mut self) -> &mut Mize { + &mut self.mize + } + fn init(&mut self, _mize: &mut Mize) -> MizeResult<()> { + Ok(()) + } + fn opts(&self, mize: &mut Mize) { + mize.new_opt("cli.name"); + } + fn run(&mut self, _mize: &mut Mize) -> MizeResult<()> { + let matches = self.cmd.take().unwrap().get_matches(); + let sub_cmd = matches.subcommand_name().unwrap(); + let action = self.actions.get(sub_cmd).unwrap(); + action(matches.subcommand_matches(sub_cmd).unwrap()); + Ok(()) + } + fn as_any(&self) -> &dyn std::any::Any { + self + } + fn as_any_mut(&self) -> &dyn std::any::Any { + self + } + fn into_any(self: Box) -> Box { + self + } +} + +impl CliPart { + pub fn subcommand( + &mut self, + cmd: Command, + action: fn(sub_matches: &ArgMatches) -> MizeResult<()>, + ) -> &mut Command { + let cmd = self.cmd.take().unwrap().subcommand(cmd); + self.actions.insert(cmd.get_name().to_string(), action); + self.cmd = Some(cmd); + self.cmd.as_mut().unwrap() + } + pub fn get(mize: &mut Mize) -> MizePartGuard { + let mut dyn_guard = mize.get_part("cli").unwrap(); + let part = dyn_guard.part.take().unwrap(); + let cli_part = part.into_any().downcast::().unwrap(); + MizePartGuard { + mize: dyn_guard.mize.clone(), + part: Some(*cli_part), + } + } +} diff --git a/parts/js/Cargo.toml b/parts/js/Cargo.toml new file mode 100644 index 0000000..8d66d76 --- /dev/null +++ b/parts/js/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "js_part" +version = "0.1.0" +edition = "2024" + +[dependencies] +deno_core = "0.383.0" +mize = { path = "../../parts/mize" } +tokio = { version = "1.49.0", features = ["full"] } diff --git a/parts/js/src/lib.rs b/parts/js/src/lib.rs new file mode 100644 index 0000000..fb751ac --- /dev/null +++ b/parts/js/src/lib.rs @@ -0,0 +1,41 @@ +use deno_core::error::AnyError; +use mize::{Mize, MizePart, MizeResult}; +use std::rc::Rc; + +pub struct JsPart { + mize: Mize, +} + +impl JsPart { + pub fn new(mize: Mize) -> Self { + JsPart { mize } + } +} + +impl MizePart for JsPart { + fn name(&self) -> &'static str { + "js" + } + + fn get_mize(&mut self) -> &mut Mize { + &mut self.mize + } + + fn init(&mut self, mize: &mut Mize) -> MizeResult<()> { + println!("deno part init"); + Ok(()) + } +} + +async fn run_js_file(file_path: &str) -> Result<(), AnyError> { + let main_module = deno_core::resolve_path(file_path, &std::env::current_dir()?)?; + let mut js_runtime = deno_core::JsRuntime::new(deno_core::RuntimeOptions { + module_loader: Some(Rc::new(deno_core::FsModuleLoader)), + ..Default::default() + }); + + let mod_id = js_runtime.load_main_es_module(&main_module).await?; + let result = js_runtime.mod_evaluate(mod_id); + js_runtime.run_event_loop(Default::default()).await?; + result.await +} diff --git a/parts/mize/build.rs b/parts/mize/build.rs index 2d7d405..d85e559 100644 --- a/parts/mize/build.rs +++ b/parts/mize/build.rs @@ -1,10 +1,7 @@ -use std::process::Command; -use std::env; +//use std::env; fn main() { - // compile the string plugin - //let _out_dir = env::var_os("OUT_DIR").unwrap(); //let mut string_module = Command::new("bash"); //string_module.arg("-c"); //string_module.arg("echo hiiiiiiiiiiiiiiiii"); @@ -15,14 +12,14 @@ fn main() { //let _res = string_module.spawn(); //let _child = Command::new("cargo") - //.arg("build") - //.arg("--lib") - //.arg("--manifest-path") - //.arg("/home/me/work/mize/modules/modules/Blob/Cargo.toml") - //.spawn() - //.expect("failed to start wasm build"); + //.arg("build") + //.arg("--lib") + //.arg("--manifest-path") + //.arg("/home/me/work/mize/modules/modules/Blob/Cargo.toml") + //.spawn() + //.expect("failed to start wasm build"); - //to outdir (), using the nightly feature --out-dir to have the result there. By default I get a libhearts.rlib + //to outdir (), using the nightly feature --out-dir to have the result there. By default I get a libhearts.rlib - println!("cargo:rustc-link-arg=-zstack-size=0x1000000"); + //println!("cargo:rustc-link-arg=-zstack-size=0x1000000"); } diff --git a/parts/mize/flake.lock b/parts/mize/flake.lock index a86e68b..98576ee 100644 --- a/parts/mize/flake.lock +++ b/parts/mize/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1725125250, - "narHash": "sha256-CB20rDD5eHikF6mMTTJdwPP1qvyoiyyw1RDUzwIaIF8=", + "lastModified": 1769737823, + "narHash": "sha256-DrBaNpZ+sJ4stXm+0nBX7zqZT9t9P22zbk6m5YhQxS4=", "owner": "ipetkov", "repo": "crane", - "rev": "96fd12c7100e9e05fa1a0a5bd108525600ce282f", + "rev": "b2f45c3830aa96b7456a4c4bc327d04d7a43e1ba", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1748327829, - "narHash": "sha256-TJwbWCsyT9yJkBRTnqKE/YDTiXuEdYHb37WLK4TcAwE=", + "lastModified": 1770102568, + "narHash": "sha256-VYwA9FmakKJ3zLfAd7bdj9xIB9PzfISLoYh6eZl+EuQ=", "owner": "nix-community", "repo": "fenix", - "rev": "26fbcc33a5e94d6d0dc5f467eca8f7a746a54e6c", + "rev": "592daa37b5a3175c61541329b64d6c1972303bc1", "type": "github" }, "original": { @@ -41,11 +41,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -57,11 +57,11 @@ "mize_modules": { "flake": false, "locked": { - "lastModified": 1725362504, - "narHash": "sha256-U0IQ+3SiyLb24BTDUvlnE30LdjjJWJ/P6dHPqxArJXk=", + "lastModified": 1739053120, + "narHash": "sha256-It6j1D3c3eO/O0ptHvZ3c9Ynei08DXX5n6DYonW3g+s=", "owner": "c2vi", "repo": "mize-modules", - "rev": "fa3b462cbe3e63fc9ecada6c4445d366e58a6f86", + "rev": "3bba470c849f7cbaf7eb7858c26aa1c64fd00b33", "type": "github" }, "original": { @@ -72,11 +72,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703637592, - "narHash": "sha256-8MXjxU0RfFfzl57Zy3OfXCITS0qWDNLzlBAdwxGZwfY=", + "lastModified": 1770115704, + "narHash": "sha256-KHFT9UWOF2yRPlAnSXQJh6uVcgNcWlFqqiAZ7OVlHNc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cfc3698c31b1fb9cdcf10f36c9643460264d0ca8", + "rev": "e6eae2ee2110f3d31110d5c222cd395303343b08", "type": "github" }, "original": { @@ -99,11 +99,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1748295258, - "narHash": "sha256-ejRVtsT7fat4mGgDQpgIGKJP+vbr9r4Mo84jRb2bndk=", + "lastModified": 1770026591, + "narHash": "sha256-VZlloygYDmozJwbZZkCSNpiPhNdOW/AA0b6LmNBZ3xU=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "7fa66d67a72bcad236b50907e14f7464c47ecede", + "rev": "74eca73f3b0a41b80228b8e499c7547cc8b2effa", "type": "github" }, "original": { @@ -120,11 +120,11 @@ ] }, "locked": { - "lastModified": 1725157860, - "narHash": "sha256-DhqyM7XJYKj+WAEaYwMtXaYX66tA+lOd31sd5QkxLDM=", + "lastModified": 1770088046, + "narHash": "sha256-4hfYDnUTvL1qSSZEA4CEThxfz+KlwSFQ30Z9jgDguO0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1fd72e343c6890f695243a37b367a1e3b90a49ee", + "rev": "71f9daa4e05e49c434d08627e755495ae222bc34", "type": "github" }, "original": { diff --git a/parts/mize/src/core/config.rs b/parts/mize/src/core/config.rs new file mode 100644 index 0000000..0c6ccb6 --- /dev/null +++ b/parts/mize/src/core/config.rs @@ -0,0 +1,46 @@ +use crate::MizeResult; +use std::collections::HashMap; +use std::sync::{Arc, RwLock}; + +use crate::item::ItemData; +use crate::Mize; + +type ConfigThunk = Box ItemData + Send + Sync>; + +pub struct ConfigOpt { + pub name: String, + pub val: Option, + pub thunk: Option, +} + +#[derive(Clone)] +pub struct ConfigOptNameAndMize { + pub name: String, + pub mize: Mize, +} + +impl ConfigOptNameAndMize { + pub fn default_val(self, val: ItemData) -> ConfigOptNameAndMize { + let mut config_opts = self.mize.config_opts.lock().unwrap(); + let opt = config_opts.get_mut(&self.name).unwrap(); + opt.val = Some(val); + self.clone() + } + pub fn fun(self, thunk: ConfigThunk) -> Self { + let mut config_opts = self.mize.config_opts.lock().unwrap(); + let opt = config_opts.get_mut(&self.name).unwrap(); + opt.thunk = Some(thunk); + self.clone() + } +} + +pub fn gather_config(mize: &mut Mize) -> MizeResult<()> { + let mut config_opts = mize.config_opts.lock().unwrap(); + let parts = mize.parts.lock().unwrap(); + + for part in parts.values() { + part.as_deref().unwrap().opts(&mut mize.clone()); + } + + Ok(()) +} diff --git a/parts/mize/src/core/error.rs b/parts/mize/src/core/error.rs index adeb949..3afea1f 100644 --- a/parts/mize/src/core/error.rs +++ b/parts/mize/src/core/error.rs @@ -1,16 +1,15 @@ +use colored::Colorize; use core::result::Result; use core::result::Result::Ok; use std::collections::HashMap; +use std::fmt::format; use std::fmt::Debug; use std::fmt::Display; -use std::fmt::format; -use std::string::FromUtf8Error; use std::io; -use colored::Colorize; -use tracing::{trace, debug, info, warn, error}; - -use crate::proto::MizeMessage; +use std::string::FromUtf8Error; +use tracing::{debug, error, info, trace, warn}; +//use crate::proto::MizeMessage; #[macro_export] macro_rules! mize_err { @@ -26,7 +25,9 @@ pub trait MizeResultTrait { pub trait IntoMizeResult { fn mize_result(self) -> MizeResult; - fn mize_result_msg(self, msg: S) -> MizeResult where S: std::fmt::Display ; + fn mize_result_msg(self, msg: S) -> MizeResult + where + S: std::fmt::Display; } #[derive(Debug, Clone)] @@ -34,16 +35,18 @@ pub struct MizeError { pub category: Vec, pub code: u32, pub messages: Vec, - pub caused_by_msg: Option, + //pub caused_by_msg: Option, pub code_location: Option, pub backtrace: String, } +/* #[derive(Debug, Clone)] pub struct CausedByMessage { // peer: &Connection, // TODO: add later msg: Box, } +*/ #[derive(Debug, Clone)] pub struct MizeCodeLocation { @@ -54,16 +57,20 @@ pub struct MizeCodeLocation { impl Display for MizeCodeLocation { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "file: {} line: {} column: {}", self.file, self.line, self.column) + write!( + f, + "file: {} line: {} column: {}", + self.file, self.line, self.column + ) } } -impl From<&std::panic::Location <'_>> for MizeCodeLocation { +impl From<&std::panic::Location<'_>> for MizeCodeLocation { fn from(panic_location: &std::panic::Location) -> MizeCodeLocation { let file = panic_location.file().to_string(); let line = panic_location.line(); let column = panic_location.column(); - MizeCodeLocation {file, line, column} + MizeCodeLocation { file, line, column } } } @@ -88,25 +95,28 @@ impl MizeError { category: Vec::new(), code: 0, messages: Vec::new(), - caused_by_msg: None, code_location: Some(caller_location.into()), backtrace: format!("{}", std::backtrace::Backtrace::capture()), - } + }; } - pub fn msg(mut self, msg: E) -> MizeError - where E: std::fmt::Display + pub fn msg(mut self, msg: E) -> MizeError + where + E: std::fmt::Display, { self.messages.push(format!("{}", msg)); return self; } - pub fn category(mut self, category: T) -> MizeError where T: Into { + pub fn category(mut self, category: T) -> MizeError + where + T: Into, + { self.category.push(category.into()); return self; } - - fn send(self) -> MizeError{ + + fn send(self) -> MizeError { self } @@ -134,15 +144,20 @@ impl MizeError { return self.send().add_to_err_item().log(); } - pub fn critical(self){ + pub fn critical(self) { let mut msg_iter = self.messages.iter(); match msg_iter.next() { None => { error!("{} MizeError with code: {}", "CRITICAL".red(), self.code); - }, + } Some(msg) => { - error!("{} MizeError with code: {} - {}", "CRITICAL".red(), self.code, msg); - }, + error!( + "{} MizeError with code: {} - {}", + "CRITICAL".red(), + self.code, + msg + ); + } } for msg in msg_iter { error!("{} {}", "MSG".red(), msg) @@ -150,23 +165,16 @@ impl MizeError { if let Some(location) = self.code_location { error!("{} {}", "LOCATION".red(), location) } - if let Some(caused_by_msg) = self.caused_by_msg { - error!("{} {:?}", "CAUSED_BY_MESSAGE".red(), caused_by_msg) - } panic!(); } pub fn location(mut self, location: MizeCodeLocation) -> MizeError { - self.code_location = Some(location); self } - - } - /* pub trait MizeResultExtension { fn extra_msg(self, msg: E) -> Result @@ -221,70 +229,90 @@ impl From for MizeError { fn from(value: T) -> Self { let caller_location = std::panic::Location::caller(); MizeError::new() - .msg(format!("From {}: {}", std::any::type_name_of_val(&value), value)) + .msg(format!( + "From {}: {}", + std::any::type_name_of_val(&value), + value + )) .location(caller_location.into()) } } -impl MizeResultTrait for MizeResult { +impl MizeResultTrait for MizeResult { fn critical(self) -> T { match self { Ok(val) => val, Err(err) => { err.critical(); unreachable!() - }, + } } } fn as_std(self) -> Result { match self { Ok(val) => Ok(val), - Err(err) => { - Err(MizeErrorWhichImplementsError { inner: err }) - }, + Err(err) => Err(MizeErrorWhichImplementsError { inner: err }), } } } -impl IntoMizeResult for Result where E: std::fmt::Display { +impl IntoMizeResult for Result +where + E: std::fmt::Display, +{ #[track_caller] fn mize_result(self) -> MizeResult { let caller_location = std::panic::Location::caller(); match self { Ok(val) => MizeResult::Ok(val), - Err(err) => MizeResult::Err(MizeError::new() - .category("misc") - .msg(format!("From {}: {}", std::any::type_name_of_val(&err), err))), + Err(err) => MizeResult::Err(MizeError::new().category("misc").msg(format!( + "From {}: {}", + std::any::type_name_of_val(&err), + err + ))), } } #[track_caller] - fn mize_result_msg(self, msg: S) -> MizeResult where S: std::fmt::Display { + fn mize_result_msg(self, msg: S) -> MizeResult + where + S: std::fmt::Display, + { let caller_location = std::panic::Location::caller(); match self { Ok(val) => MizeResult::Ok(val), - Err(err) => MizeResult::Err(MizeError::new() - .category("misc") - .msg(format!("{}", msg)) - .msg(format!("From {}: {}", std::any::type_name_of_val(&err), err))), + Err(err) => MizeResult::Err( + MizeError::new() + .category("misc") + .msg(format!("{}", msg)) + .msg(format!( + "From {}: {}", + std::any::type_name_of_val(&err), + err + )), + ), } } } - fn get_error_by_code(code: u32, caller_location: &std::panic::Location) -> MizeError { let err = MizeError { category: Vec::new(), code: 0, messages: Vec::new(), - caused_by_msg: None, code_location: Some(caller_location.into()), backtrace: format!("{}", std::backtrace::Backtrace::capture()), }; match code { - 109 => err.set_code(109).category("decoding").msg("conversion from utf8 failed"), - 108 => err.set_code(108).category("decoding").msg("serde deserialisation failed"), + 109 => err + .set_code(109) + .category("decoding") + .msg("conversion from utf8 failed"), + 108 => err + .set_code(108) + .category("decoding") + .msg("serde deserialisation failed"), _ => err, } } @@ -305,7 +333,7 @@ impl Display for MizeErrorWhichImplementsError { write!(f, "[ {} ] {}", "BACKTRACE".yellow(), self.inner.backtrace); for msg in &self.inner.messages { - write!(f,"[ {} ] {}", "MSG".yellow(), msg); + write!(f, "[ {} ] {}", "MSG".yellow(), msg); } Ok(()) } @@ -318,5 +346,3 @@ impl From for MizeErrorWhichImplementsError { } impl std::error::Error for MizeErrorWhichImplementsError {} - - diff --git a/parts/mize/src/core/id.rs b/parts/mize/src/core/id.rs index e5a9a07..6d02a49 100644 --- a/parts/mize/src/core/id.rs +++ b/parts/mize/src/core/id.rs @@ -1,11 +1,17 @@ use core::fmt; -use std::{collections::binary_heap::Iter, fmt::write, hash::Hash}; -use interner::{shared::{SharedPool, SharedString, SharedVecString}, Pooled}; +use interner::{ + shared::{SharedPool, SharedString, SharedVecString}, + Pooled, +}; use std::collections::hash_map::RandomState; use std::path::Path; +use std::{collections::binary_heap::Iter, fmt::write, hash::Hash}; -use crate::{instance::{store::Store, Instance}, mize_err}; -use crate::error::{MizeResult, MizeError, MizeResultTrait}; +use crate::error::{MizeError, MizeResult, MizeResultTrait}; +use crate::{ + instance::{store::Store, Mize}, + mize_err, +}; #[derive(Debug, Clone, Hash, Eq, PartialEq)] pub struct MizeId { @@ -14,28 +20,30 @@ pub struct MizeId { } #[derive(Debug, Clone, Hash, Eq, PartialEq)] -pub struct Namespace ( pub SharedString ); +pub struct Namespace(pub SharedString); impl Namespace { pub fn as_string(&self) -> SharedString { self.0.clone() } pub fn as_real_string(&self) -> String { - let a = self.as_string(); + let a = self.as_string(); let b = a.to_string(); return b; } } pub trait IntoMizeId { - fn to_mize_id(self, instance: &Instance) -> MizeResult; + fn to_mize_id(self, instance: &Mize) -> MizeResult; } - impl MizeId { pub fn store_part(&self) -> &str { - self.path.iter().nth(0) - .expect("an empty MizeId found, that should absolutely not be possible!!!!").as_str() + self.path + .iter() + .nth(0) + .expect("an empty MizeId found, that should absolutely not be possible!!!!") + .as_str() } pub fn nth_part(&self, n: usize) -> MizeResult<&str> { @@ -74,34 +82,37 @@ impl fmt::Display for MizeId { } impl IntoMizeId for &str { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { instance.id_from_string(self.to_owned()) } } impl IntoMizeId for String { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { instance.id_from_string(self) } } impl IntoMizeId for &String { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { instance.id_from_string(self.to_owned()) } } impl IntoMizeId for Vec { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { instance.id_from_vec_string(self) } } impl IntoMizeId for Vec<&String> { - fn to_mize_id(self, instance: &Instance) -> MizeResult { - let owned = self.into_iter().map(|s| s.to_owned()).collect::>(); + fn to_mize_id(self, instance: &Mize) -> MizeResult { + let owned = self + .into_iter() + .map(|s| s.to_owned()) + .collect::>(); instance.id_from_vec_string(owned) } } impl IntoMizeId for &[&str] { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { let mut vec: Vec = Vec::new(); for i in self { vec.push((*i).to_owned()) @@ -110,7 +121,7 @@ impl IntoMizeId for &[&str] { } } impl IntoMizeId for Vec<&str> { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { let mut vec: Vec = Vec::new(); for i in self { vec.push((*i).to_owned()) @@ -119,7 +130,7 @@ impl IntoMizeId for Vec<&str> { } } impl IntoMizeId for MizeId { - fn to_mize_id(self, instance: &Instance) -> MizeResult { + fn to_mize_id(self, instance: &Mize) -> MizeResult { Ok(self) } } @@ -127,33 +138,41 @@ impl IntoMizeId for MizeId { // would only work with a global id_pool // for now use Instance::new_id() //impl> From for MizeId { - //fn from(value: T) -> Self { - //let string = value.into(); - //let path: Vec = string.split("/").map(|v| v.to_owned()).collect(); - //return MizeId { MIZE_ID_POOL.get(path) } - //} +//fn from(value: T) -> Self { +//let string = value.into(); +//let path: Vec = string.split("/").map(|v| v.to_owned()).collect(); +//return MizeId { MIZE_ID_POOL.get(path) } +//} //} - #[cfg(test)] mod test { - use crate::instance::Instance; + use crate::instance::Mize; use super::*; #[test] fn test_id() -> MizeResult<()> { - let instance = Instance::empty()?; + let instance = Mize::empty()?; let id_one = instance.new_id("0/config/hi")?; assert_eq!(instance.get_namespace()?, id_one.namespace()); assert_eq!("0", id_one.store_part()); - assert_eq!(vec!["config".to_owned(), "hi".to_owned()], id_one.after_store_part()); + assert_eq!( + vec!["config".to_owned(), "hi".to_owned()], + id_one.after_store_part() + ); let id_two = instance.new_id("test.ns:hello/config/hi")?; - assert_eq!(instance.namespace_from_string("test.ns".to_owned())?, id_two.namespace()); + assert_eq!( + instance.namespace_from_string("test.ns".to_owned())?, + id_two.namespace() + ); assert_eq!("hello", id_two.store_part()); - assert_eq!(vec!["config".to_owned(), "hi".to_owned()], id_one.after_store_part()); + assert_eq!( + vec!["config".to_owned(), "hi".to_owned()], + id_one.after_store_part() + ); let id_three = instance.new_id("0/")?; assert_eq!(instance.get_namespace()?, id_three.namespace()); @@ -161,7 +180,10 @@ mod test { assert_eq!(Vec::::new(), id_three.after_store_part()); let id_four = instance.new_id("test.ns:0/")?; - assert_eq!(instance.namespace_from_string("test.ns".to_owned())?, id_four.namespace()); + assert_eq!( + instance.namespace_from_string("test.ns".to_owned())?, + id_four.namespace() + ); assert_eq!("0", id_four.store_part()); assert_eq!(Vec::::new(), id_four.after_store_part()); @@ -172,9 +194,6 @@ mod test { //TODO: add the parsing form mize:// urls.... - Ok(()) } - - } diff --git a/parts/mize/src/core/instance/connection.rs b/parts/mize/src/core/instance/connection.rs index ee49ae9..32c9e47 100644 --- a/parts/mize/src/core/instance/connection.rs +++ b/parts/mize/src/core/instance/connection.rs @@ -1,12 +1,12 @@ -use flume::{Sender, Receiver}; -use tracing::{trace, debug, info, warn, error}; +use flume::{Receiver, Sender}; +use tracing::{debug, error, info, trace, warn}; +use crate::error::{IntoMizeResult, MizeError, MizeResult}; use crate::id::Namespace; use crate::mize_err; use crate::proto::MizeMessage; -use crate::error::{MizeError, MizeResult, IntoMizeResult}; -use super::Instance; +use super::Mize; use crate::item::{get_raw_from_cbor, Item, ItemData}; // only created with Instance::new_connection() @@ -17,8 +17,8 @@ pub struct Connection { pub ns: Option, } -pub trait ConnListener : Send + Sync { - fn listen(self, instance: Instance) -> MizeResult<()>; +pub trait ConnListener: Send + Sync { + fn listen(self, instance: Mize) -> MizeResult<()>; } impl Connection { @@ -39,7 +39,7 @@ pub fn value_raw_from_peer(item: &mut Item) -> MizeResult { let id = item.id(); let conn_id_str = id.nth_part(2)?; - let conn_id : u64 = conn_id_str.parse()?; + let conn_id: u64 = conn_id_str.parse()?; let tmp_path = id.path(); let mut new_id_str = tmp_path.into_iter(); let skipped = new_id_str.skip(4); @@ -55,5 +55,3 @@ pub fn value_raw_from_peer(item: &mut Item) -> MizeResult { return Ok(data); } - - diff --git a/parts/mize/src/core/instance/mod.rs b/parts/mize/src/core/instance/mod.rs index 0120ef4..60d8988 100644 --- a/parts/mize/src/core/instance/mod.rs +++ b/parts/mize/src/core/instance/mod.rs @@ -1,46 +1,48 @@ +use colored::Colorize; use core::fmt; +use flume::{bounded, unbounded, Receiver, Sender}; +use interner::shared::{StringPool, VecStringPool}; +use std::any::Any; use std::collections::HashMap; use std::fs::create_dir; -use std::{thread, vec}; -use flume::{bounded, Receiver, Sender, unbounded}; +use std::fs::File; +use std::ops::{Deref, DerefMut}; +use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex}; +use std::{thread, vec}; use tracing::{debug, error, info, trace, warn, Instrument}; use uuid::Uuid; -use std::fs::File; -use colored::Colorize; -use std::path::{Path, PathBuf}; -use interner::shared::{VecStringPool, StringPool}; - -use crate::error::{MizeError, MizeResult, IntoMizeResult, MizeResultTrait}; -use crate::instance::store::Store; -use crate::instance::updater::{ updater_thread, updater_thread_async }; +use crate::config::ConfigOptNameAndMize; +use crate::config::{gather_config, ConfigOpt}; +use crate::error::{IntoMizeResult, MizeError, MizeResult, MizeResultTrait}; use crate::id::{IntoMizeId, MizeId, Namespace}; +use crate::instance::store::Store; use crate::instance::subscription::Subscription; +use crate::instance::updater::Operation; +use crate::instance::updater::{updater_thread, updater_thread_async}; use crate::item::{Item, ItemData}; use crate::memstore::MemStore; -use crate::instance::updater::Operation; -use crate::{mize_err, Module}; use crate::proto::MizeMessage; +use crate::{mize_err, Module}; use self::connection::{ConnListener, Connection}; use self::updater::handle_operation; -#[cfg(feature = "async")] -use tokio::runtime::Runtime; #[cfg(feature = "async")] use tokio::runtime::Handle; +#[cfg(feature = "async")] +use tokio::runtime::Runtime; use core::future::Future; use std::thread::JoinHandle; pub mod connection; +pub mod module; +pub mod msg_thread; pub mod store; pub mod subscription; pub mod updater; -pub mod msg_thread; -pub mod module; - // console_log macro // that can be copied into other files for debugging purposes @@ -61,8 +63,17 @@ macro_rules! console_log { ($($t:tt)*) => (unsafe { log(&format_args!($($t)*).to_string())}) } - - +#[macro_export] +macro_rules! add_parts { + ($mize:expr, $($part:expr),+) => { + $( + $mize.add_part( + Box::new($part) + ); + )+ + mize.init_parts(); + }; +} #[cfg(test)] mod tests; @@ -73,16 +84,22 @@ static BUILD_TIME_CONFIG: &str = include_str!(std::env!("MIZE_BUILD_CONFIG")); /// The Instance type is the heart of the mize system #[derive(Clone)] -pub struct Instance { - // a bit a lot of Mutexes isn-it??? +pub struct Mize { + // a bit a lot of Mutexes isn't it??? pub store: Arc>>, connections: Arc>>, next_con_id: Arc>, subs: Arc>>>, - pub modules: Arc>>>, + pub modules: Arc>>>, pub id_pool: Arc>, pub namespace_pool: Arc>, + pub(crate) parts: Arc>>>>, + + part_names: Arc>>, + + pub config_opts: Arc>>, + // the namespace the instance operates in pub namespace: Arc>, @@ -100,18 +117,84 @@ pub struct Instance { } pub struct InstanceRef { - inner: Arc>, + inner: Arc>, } pub struct InstanceAsync { - inner: Arc>, + inner: Arc>, } +pub struct DynMizePartGuard { + pub mize: Mize, + pub part: Option>, +} -impl Instance { - pub fn empty() -> MizeResult { +pub struct MizePartGuard { + pub mize: Mize, + pub part: Option, +} +impl> Deref for MizePartGuard { + type Target = T; + fn deref(&self) -> &Self::Target { + &*self.part.as_deref().unwrap() + } +} + +impl> DerefMut for MizePartGuard { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut *self.part.as_deref_mut().unwrap() + } +} + +impl Drop for MizePartGuard { + fn drop(&mut self) { + let part = self.part.take().unwrap(); + self.mize.give_back_part(Box::new(part)); + } +} + +impl Deref for DynMizePartGuard { + type Target = dyn MizePart + Send + Sync; + + fn deref(&self) -> &Self::Target { + &*self.part.as_deref().unwrap() + } +} + +impl DerefMut for DynMizePartGuard { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut *self.part.as_deref_mut().unwrap() + } +} + +impl Drop for DynMizePartGuard { + fn drop(&mut self) { + self.mize.give_back_part(self.part.take().unwrap()); + } +} + +pub trait MizePart: Any + Send + Sync { + fn name(&self) -> &'static str; + fn get_mize(&mut self) -> &mut Mize; + fn init(&mut self, mize: &mut Mize) -> MizeResult<()> { + Ok(()) + } + fn run(&mut self, mize: &mut Mize) -> MizeResult<()> { + Ok(()) + } + fn deps(&self) -> &'static [&'static str] { + &[] + } + fn opts(&self, mize: &mut Mize) {} + fn as_any(&self) -> &dyn Any; + fn as_any_mut(&self) -> &dyn Any; + fn into_any(self: Box) -> Box; +} + +impl Mize { + pub fn empty() -> MizeResult { let id_pool = Arc::new(Mutex::new(VecStringPool::default())); let namespace_pool_raw = StringPool::default(); let connections = Arc::new(Mutex::new(Vec::new())); @@ -119,27 +202,38 @@ impl Instance { let (op_tx, op_rx) = unbounded(); let give_msg_wait = Arc::new(Mutex::new(HashMap::new())); let create_msg_wait = Arc::new(Mutex::new(None)); - let namespace = Arc::new(Mutex::new(Namespace ( namespace_pool_raw.get("mize.default.namespace") ))); - let self_namespace = Arc::new(Mutex::new(Namespace ( namespace_pool_raw.get("mize.default.namespace") ))); + let namespace = Arc::new(Mutex::new(Namespace( + namespace_pool_raw.get("mize.default.namespace"), + ))); + let self_namespace = Arc::new(Mutex::new(Namespace( + namespace_pool_raw.get("mize.default.namespace"), + ))); - - let mut instance = Instance { + let mut instance = Mize { store: Arc::new(Mutex::new(Box::new(MemStore::new()))), - connections, subs, id_pool, - namespace, self_namespace, op_tx, + parts: Arc::new(Mutex::new(HashMap::new())), + part_names: Arc::new(Mutex::new(Vec::new())), + config_opts: Arc::new(Mutex::new(HashMap::new())), + connections, + subs, + id_pool, + namespace, + self_namespace, + op_tx, namespace_pool: Arc::new(Mutex::new(namespace_pool_raw)), modules: Arc::new(Mutex::new(HashMap::new())), threads: Arc::new(Mutex::new(Vec::new())), next_thread_id: Arc::new(Mutex::new(0)), next_con_id: Arc::new(Mutex::new(1)), - give_msg_wait, create_msg_wait, + give_msg_wait, + create_msg_wait, #[cfg(feature = "async")] - runtime: Arc::new(Mutex::new(Runtime::new().mize_result_msg("Could not create async runtime")?)), + runtime: Arc::new(Mutex::new( + Runtime::new().mize_result_msg("Could not create async runtime")?, + )), }; - - #[cfg(feature = "os-target")] { let instance_clone = instance.clone(); @@ -152,7 +246,6 @@ impl Instance { instance.spawn("updater_thread", closure_two)?; } - // set up async update "threads" when using wasm #[cfg(feature = "wasm-target")] { @@ -180,34 +273,55 @@ impl Instance { #[cfg(feature = "wasm-target")] console_log!("after loading build time config"); - return Ok(instance); } - pub fn new() -> MizeResult { + pub fn new() -> MizeResult { trace!("[ {} ] Instance::new()", "CALL".yellow()); - - let mut instance = Instance::empty()?; - + let mut instance = Mize::empty()?; instance.init(); - - debug!("instance inited with config: {}", instance.get("0/config")?.as_data_full()?); - + debug!( + "instance inited with config: {}", + instance.get("0/config")?.as_data_full()? + ); return Ok(instance); } + pub fn get_part(&mut self, name: &str) -> MizeResult { + match self.parts.lock().unwrap().get_mut(name) { + Some(part) => Ok(DynMizePartGuard { + part: Some(part.take().unwrap()), + mize: self.clone(), + }), + None => Err(mize_err!("Part not found or currently taken")), + } + } + pub fn add_part(&mut self, part: Box) -> MizeResult<()> { + self.part_names.lock().unwrap().push(part.name()); + self.parts.lock().unwrap().insert(part.name(), Some(part)); + Ok(()) + } + fn part_names(&mut self) -> Vec<&'static str> { + self.part_names.lock().unwrap().clone() + } + + pub(crate) fn give_back_part(&mut self, part: Box) { + self.parts.lock().unwrap().insert(part.name(), Some(part)); + } + pub fn init(&mut self) -> MizeResult<()> { + // gather options + gather_config(self)?; // platform specific init code crate::platform::any::instance_init(self)?; // end of platform specific init code - // load the modules, ad specified in the load_modules config match self.get("0/config/load_modules")?.value_string() { Ok(modules_to_load) => { @@ -216,23 +330,21 @@ impl Instance { console_log!("loading module in Instance::init() ... {}", module); self.load_module(module)?; } - }, + } Err(err) => { // no load_modules option is set } } - - debug!("INSTANCE INIT DONE"); Ok(()) } - pub fn with_config(config: ItemData) -> MizeResult { + pub fn with_config(config: ItemData) -> MizeResult { trace!("[ {} ] Instance::with_config()", "CALL".yellow()); trace!("config: {}", config); - let mut instance = Instance::empty()?; + let mut instance = Mize::empty()?; instance.set_blocking("0", config); @@ -254,7 +366,7 @@ impl Instance { let id_of_new_store = new_store.new_id()?; new_store.set(self.id_from_string(id_of_new_store)?, data.to_owned())?; - }; + } *old_store = new_store; @@ -297,9 +409,16 @@ impl Instance { self.op_tx.send(Operation::Set(id, value.into(), None)); Ok(()) } - - pub fn set_blocking>(&self, id: I, value: V) -> MizeResult<()> { - handle_operation(&mut Operation::Set(id.to_mize_id(self)?, value.into(), None), self)?; + + pub fn set_blocking>( + &self, + id: I, + value: V, + ) -> MizeResult<()> { + handle_operation( + &mut Operation::Set(id.to_mize_id(self)?, value.into(), None), + self, + )?; Ok(()) } @@ -309,7 +428,7 @@ impl Instance { match subs_inner.get_mut(&id) { Some(vec) => { vec.push(sub); - }, + } None => { subs_inner.insert(id.clone(), vec![sub]); } @@ -330,26 +449,43 @@ impl Instance { } pub fn id_from_string(&self, string: String) -> MizeResult { - let vec_string: Vec = string.split("/").map(|v| v.to_owned()).filter(|el| el.as_str() != "").collect(); + let vec_string: Vec = string + .split("/") + .map(|v| v.to_owned()) + .filter(|el| el.as_str() != "") + .collect(); self.id_from_vec_string(vec_string) } pub fn id_from_vec_string(&self, mut vec_string: Vec) -> MizeResult { let id_pool_inner = self.id_pool.lock()?; let namespace_inner = self.namespace.lock()?; - let first_el = vec_string.first_mut().ok_or(mize_err!("MizeId was empty"))?; + let first_el = vec_string + .first_mut() + .ok_or(mize_err!("MizeId was empty"))?; - let id = if first_el.contains(":") { // first el is a namespace + store_part + let id = if first_el.contains(":") { + // first el is a namespace + store_part let new_first_el = first_el.clone(); let vec: Vec<&str> = new_first_el.split(":").collect(); - let ns_part = vec.iter().nth(0).ok_or(mize_err!("should really not happen"))?; - let store_part = vec.iter().nth(1).ok_or(mize_err!("mizeid was like 'namespace:/hi', why are you doing that"))?; + let ns_part = vec + .iter() + .nth(0) + .ok_or(mize_err!("should really not happen"))?; + let store_part = vec.iter().nth(1).ok_or(mize_err!( + "mizeid was like 'namespace:/hi', why are you doing that" + ))?; *first_el = store_part.to_owned().to_owned(); - MizeId { path: id_pool_inner.get(vec_string), namespace: self.namespace_from_string(ns_part.to_owned().to_owned())? } + MizeId { + path: id_pool_inner.get(vec_string), + namespace: self.namespace_from_string(ns_part.to_owned().to_owned())?, + } } else { - - MizeId { path: id_pool_inner.get(vec_string), namespace: namespace_inner.clone() } + MizeId { + path: id_pool_inner.get(vec_string), + namespace: namespace_inner.clone(), + } }; trace!("new MizeId made: {:?}", id); @@ -373,14 +509,17 @@ impl Instance { pub fn get_module(&mut self, name: &str) -> MizeResult> { let inner = self.modules.lock()?; - let module = inner.get(name).ok_or(mize_err!("Couldn't get_module('{name}')"))?.clone_module(); + let module = inner + .get(name) + .ok_or(mize_err!("Couldn't get_module('{name}')"))? + .clone_module(); Ok(module) } pub fn namespace_from_string(&self, ns_str: String) -> MizeResult { let namespace_pool_inner = self.namespace_pool.lock()?; - let namespace = Namespace ( namespace_pool_inner.get(ns_str) ); + let namespace = Namespace(namespace_pool_inner.get(ns_str)); Ok(namespace) } @@ -405,7 +544,7 @@ impl Instance { Ok(self.get_namespace()? == self.get_self_namespace()?) } - pub fn add_listener(&mut self, listener: T) -> MizeResult<()> { + pub fn add_listener(&mut self, listener: T) -> MizeResult<()> { let mut instance_clone = self.clone(); self.spawn("some_listener", move || listener.listen(instance_clone)); Ok(()) @@ -416,7 +555,11 @@ impl Instance { let mut next_con_id = self.next_con_id.lock()?; let old_next_con_id = *next_con_id; - let connection = Connection { id: next_con_id.to_owned(), tx, ns: None}; + let connection = Connection { + id: next_con_id.to_owned(), + tx, + ns: None, + }; conn_inner.push(connection); *next_con_id += 1; Ok(old_next_con_id) @@ -425,7 +568,12 @@ impl Instance { pub fn new_connection_join_namespace(&self, tx: Sender) -> MizeResult { let conn_id = self.new_connection(tx)?; - let ns_of_peer_str = self.get(format!("inst/con_by_id/{}/peer/0/config/namespace", conn_id))?.value_string()?; + let ns_of_peer_str = self + .get(format!( + "inst/con_by_id/{}/peer/0/config/namespace", + conn_id + ))? + .value_string()?; let ns_of_peer = self.namespace_from_string(ns_of_peer_str)?; self.connection_set_namespace(conn_id, ns_of_peer.clone()); @@ -459,7 +607,10 @@ impl Instance { } } - return Err(mize_err!("Connection with id {} not known to instance", conn_id)); + return Err(mize_err!( + "Connection with id {} not known to instance", + conn_id + )); Ok(()) } @@ -472,7 +623,10 @@ impl Instance { } } - return Err(mize_err!("Connection with id {} not known to instance", conn_id)); + return Err(mize_err!( + "Connection with id {} not known to instance", + conn_id + )); } pub fn get_connection_by_ns(&self, ns: Namespace) -> MizeResult { @@ -484,11 +638,17 @@ impl Instance { } } - return Err(mize_err!("Connection with namespace {} not known to instance", ns.as_string())); + return Err(mize_err!( + "Connection with namespace {} not known to instance", + ns.as_string() + )); } - pub fn spawn(&mut self, name: &str, func: impl FnOnce() -> MizeResult<()> + Send + 'static) -> MizeResult<()> { - + pub fn spawn( + &mut self, + name: &str, + func: impl FnOnce() -> MizeResult<()> + Send + 'static, + ) -> MizeResult<()> { let mut threads_inner = self.threads.lock()?; let mut next_thread_id = self.next_thread_id.lock()?; @@ -504,10 +664,14 @@ impl Instance { func()?; let mut threads_inner = thread_mutex.lock()?; - *threads_inner = threads_inner.clone().into_iter().filter(|el| match el { - (my_thread_id, _) => false, - (_, _) => true, - }).collect(); + *threads_inner = threads_inner + .clone() + .into_iter() + .filter(|el| match el { + (my_thread_id, _) => false, + (_, _) => true, + }) + .collect(); debug!("thread '{}' stopped", name_to_move); Ok(()) }; @@ -528,7 +692,6 @@ impl Instance { } pub fn give_msg_wait(&self, id: MizeId) -> MizeResult { - let mut give_msg_wait_inner = self.give_msg_wait.lock()?; let (tx, rx) = bounded::(1); @@ -552,9 +715,12 @@ impl Instance { return Ok(data); } - #[cfg(feature = "async")] - pub fn spawn_async + Send + 'static>(&mut self, name: &str, func: F) -> MizeResult<()> { + pub fn spawn_async + Send + 'static>( + &mut self, + name: &str, + func: F, + ) -> MizeResult<()> { let mut threads_inner = self.threads.lock()?; let mut next_thread_id = self.next_thread_id.lock()?; @@ -567,7 +733,6 @@ impl Instance { Ok(()) } - #[cfg(feature = "async")] pub fn async_get_handle(&self) -> Handle { let runtime_inner = self.runtime.lock().unwrap(); @@ -576,10 +741,21 @@ impl Instance { } #[cfg(feature = "async")] - pub fn spawn_async_blocking + Send + Sync + 'static>(&mut self, name: &str, func: F) -> F::Output { - - let mut threads_inner = self.threads.lock().expect("mutex lock failed in spawn_async_blocking"); - let mut next_thread_id = self.next_thread_id.lock().expect("mutex lock failed in spawn_async_blocking"); + pub fn spawn_async_blocking< + F: Future + Send + Sync + 'static, + >( + &mut self, + name: &str, + func: F, + ) -> F::Output { + let mut threads_inner = self + .threads + .lock() + .expect("mutex lock failed in spawn_async_blocking"); + let mut next_thread_id = self + .next_thread_id + .lock() + .expect("mutex lock failed in spawn_async_blocking"); threads_inner.push((*next_thread_id, name.to_owned())); let runtime_inner = self.runtime.lock().unwrap(); @@ -592,7 +768,6 @@ impl Instance { let result = handle.block_on(func); - return result; } @@ -603,15 +778,60 @@ impl Instance { } } - pub fn report_error(err: MizeError) { err.log(); } + + pub fn get_config(&mut self, name: &str) -> MizeResult { + let mut config_opts = self.config_opts.lock().unwrap(); + + let opt = config_opts + .get_mut(name) + .ok_or_else(|| mize_err!("Config opt for {name} not in config_opts"))?; + + // get the cached value + if let Some(val) = opt.val.clone() { + return Ok(val); + } + + // Evaluate the thunk + let thunk = opt + .thunk + .take() + .ok_or_else(|| mize_err!("ConfigOpt {name} does not have a thunk"))?; + let result = thunk(); + + // Cache the result + opt.val = Some(result.clone()); + + return Ok(result); + } + + pub fn new_opt(&mut self, name: &str) -> ConfigOptNameAndMize { + let mut config_opts = self.config_opts.lock().unwrap(); + let opt = ConfigOpt { + name: name.to_owned(), + val: None, + thunk: None, + }; + config_opts.insert(name.to_string(), opt); + ConfigOptNameAndMize { + name: name.to_string(), + mize: self.clone(), + } + } + + pub fn run(&mut self) -> MizeResult<()> { + let mut parts = self.parts.lock().unwrap(); + for part in parts.values_mut() { + part.as_deref_mut().unwrap().run(&mut self.clone())?; + } + Ok(()) + } } -impl fmt::Debug for Instance { +impl fmt::Debug for Mize { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Mize Instance with subs: {:?}", self.subs,) } } - diff --git a/parts/mize/src/core/instance/module.rs b/parts/mize/src/core/instance/module.rs index 8dc4a96..edaee03 100644 --- a/parts/mize/src/core/instance/module.rs +++ b/parts/mize/src/core/instance/module.rs @@ -1,29 +1,25 @@ - - // https://users.rust-lang.org/t/casting-between-trait-object-types/97220/2 use std::ffi::OsString; -use crate::instance::Instance; use crate::error::MizeResult; +use crate::instance::Mize; -pub trait Module: { - fn init(&mut self, instance: &Instance) -> MizeResult<()>; +pub trait Module { + fn init(&mut self, instance: &Mize) -> MizeResult<()>; - fn exit(&mut self, instance: &Instance) -> MizeResult<()>; + fn exit(&mut self, instance: &Mize) -> MizeResult<()>; fn clone_module(&self) -> Box; - // extra traits, that can be implemented // return None if not implemented - fn run_cli(&mut self, instance: &Instance, cmd_line: Vec) -> Option> { + fn run_cli(&mut self, instance: &Mize, cmd_line: Vec) -> Option> { None } } - // console_log macro // that can be copied into other files for debugging purposes #[cfg(feature = "wasm-target")] @@ -43,27 +39,22 @@ macro_rules! console_log { ($($t:tt)*) => (unsafe { log(&format_args!($($t)*).to_string())}) } - -pub struct EmptyModule { -} - +pub struct EmptyModule {} impl Module for EmptyModule { - fn init(&mut self, instance: &Instance) -> MizeResult<()> { + fn init(&mut self, instance: &Mize) -> MizeResult<()> { println!("empty module fn init"); #[cfg(feature = "wasm-target")] console_log!("empty module fn init"); Ok(()) } - fn exit(&mut self, instance: &Instance) -> MizeResult<()> { + fn exit(&mut self, instance: &Mize) -> MizeResult<()> { println!("empty module fn exit"); Ok(()) - } fn clone_module(&self) -> Box { - Box::new(EmptyModule { }) + Box::new(EmptyModule {}) } } - diff --git a/parts/mize/src/core/instance/store.rs b/parts/mize/src/core/instance/store.rs index 7e5012f..f17c837 100644 --- a/parts/mize/src/core/instance/store.rs +++ b/parts/mize/src/core/instance/store.rs @@ -1,19 +1,19 @@ +use dyn_clone::DynClone; use std::fmt::Debug; use std::iter::Map; use std::option::Iter; -use dyn_clone::DynClone; use crate::error::MizeResult; -use crate::item::{Item, ItemData}; use crate::id::MizeId; -use crate::memstore::MemStore; -use crate::instance::Instance; +use crate::instance::Mize; use crate::item::get_raw_from_cbor; +use crate::item::{Item, ItemData}; +use crate::memstore::MemStore; dyn_clone::clone_trait_object!(Store); pub trait Store: DynClone + Send + Sync + Debug { - // should have the ability to be multi threaded, if the underlying implementation supports + // should have the ability to be multi threaded, if the underlying implementation supports // multithreaded IO operations // for now all refs to a store hold a Mutex but this mutex is part of where the MizeStore trait // is implemented, so that there can be a multithreaded implementation @@ -48,7 +48,10 @@ pub struct IdIter { impl IdIter { pub fn new(store: Box) -> MizeResult { - Ok(IdIter { cur_id: store.first_id()?, store }) + Ok(IdIter { + cur_id: store.first_id()?, + store, + }) } } @@ -57,17 +60,12 @@ impl Iterator for IdIter { fn next(&mut self) -> Option { match self.store.next_id(&self.cur_id) { - Err(err) => { - Some(Err(err)) - }, + Err(err) => Some(Err(err)), Ok(Some(new_id)) => { self.cur_id = new_id.clone(); Some(Ok(new_id)) - }, - Ok(None) => { - None - }, + } + Ok(None) => None, } } } - diff --git a/parts/mize/src/core/instance/subscription.rs b/parts/mize/src/core/instance/subscription.rs index 26d2ee3..ddb7577 100644 --- a/parts/mize/src/core/instance/subscription.rs +++ b/parts/mize/src/core/instance/subscription.rs @@ -1,20 +1,20 @@ use core::fmt; -use std::rc::Rc; use flume::Sender; +use std::rc::Rc; use std::sync::Arc; use tracing::trace; +use crate::error::MizeResult; use crate::id::MizeId; use crate::instance::connection::Connection; use crate::item::Item; -use crate::error::MizeResult; use crate::proto::MizeMessage; -use super::Instance; +use super::Mize; #[derive(Clone, Debug)] pub struct Update { - pub instance: Arc, + pub instance: Arc, pub id: MizeId, } @@ -31,7 +31,7 @@ pub enum Subscription { } impl Subscription { - pub fn from_conn(conn: Connection) -> Subscription { + pub fn from_conn(conn: Connection) -> Subscription { Subscription::Connection(conn) } pub fn from_closure(closure: Box MizeResult<()> + Send>) -> Subscription { @@ -45,12 +45,14 @@ impl Subscription { trace!("handleing update"); match &self { Subscription::Connection(conn) => { - let msg = MizeMessage::new_update(update.id.clone(), update.new_item()?.as_data_full()?, conn.id); + let msg = MizeMessage::new_update( + update.id.clone(), + update.new_item()?.as_data_full()?, + conn.id, + ); conn.send(msg)?; } - Subscription::Closure(closure) => { - closure(update)? - } + Subscription::Closure(closure) => closure(update)?, Subscription::Channel(tx) => { tx.send(update); } diff --git a/parts/mize/src/core/instance/tests.rs b/parts/mize/src/core/instance/tests.rs index 9e18292..e1e4214 100644 --- a/parts/mize/src/core/instance/tests.rs +++ b/parts/mize/src/core/instance/tests.rs @@ -1,15 +1,13 @@ - use tracing_subscriber::registry::Data; use crate::item::IntoItemData; use super::*; - #[test] fn test_sort_keys() -> MizeResult<()> { - - let mut data = ItemData::from_toml(r#" + let mut data = ItemData::from_toml( + r#" [hi] test = 4 @@ -19,9 +17,11 @@ fn test_sort_keys() -> MizeResult<()> { [config.test] inner = "inner" - "#)?; + "#, + )?; - let data_sorted = ItemData::from_toml(r#" + let data_sorted = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" test = { inner = "inner" } @@ -29,19 +29,19 @@ fn test_sort_keys() -> MizeResult<()> { [hi] test = 4 - "#)?; + "#, + )?; data.sort_keys()?; assert_eq!(data.to_json()?, data_sorted.to_json()?); - Ok(()) } #[test] fn test_get_module_hash() -> MizeResult<()> { - let mut instance = Instance::empty()?; + let mut instance = Mize::empty()?; use crate::platform::os::get_module_hash; let selector_toml = r#" @@ -64,7 +64,7 @@ fn test_get_module_hash() -> MizeResult<()> { #[test] fn test_set_store_path() -> MizeResult<()> { - let instance = Instance::empty()?; + let instance = Mize::empty()?; let store_path = "/home/me/.mize".to_owned(); @@ -83,23 +83,27 @@ fn test_set_store_path() -> MizeResult<()> { #[test] fn test_set_sub_path() -> MizeResult<()> { - let instance = Instance::empty()?; + let instance = Mize::empty()?; - let data = ItemData::from_toml(r#" + let data = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "inner" - "#)?; + "#, + )?; - let data_two = ItemData::from_toml(r#" + let data_two = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "new inner" - "#)?; + "#, + )?; let item = instance.new_item()?; instance.set_blocking(item.id(), data.clone())?; @@ -107,11 +111,23 @@ fn test_set_sub_path() -> MizeResult<()> { assert_eq!(item.as_data_full()?, data); // try to set a sub path of item - instance.set_blocking(vec![item.id().store_part(), "config", "test", "inner"], "new inner".into_item_data())?; + instance.set_blocking( + vec![item.id().store_part(), "config", "test", "inner"], + "new inner".into_item_data(), + )?; // the contents of item should then be like data_two - println!("item with id '{}': {}", item.id(), instance.get(vec![item.id().store_part()])?.as_data_full()?); - assert_eq!(instance.get(vec![item.id().store_part(), "config", "test", "inner"])?.as_data_full()?, ItemData::from_string("new inner")); + println!( + "item with id '{}': {}", + item.id(), + instance.get(vec![item.id().store_part()])?.as_data_full()? + ); + assert_eq!( + instance + .get(vec![item.id().store_part(), "config", "test", "inner"])? + .as_data_full()?, + ItemData::from_string("new inner") + ); assert_eq!(item.as_data_full()?, data_two); Ok(()) @@ -119,23 +135,30 @@ fn test_set_sub_path() -> MizeResult<()> { #[test] fn test_itemdata_set_path() -> MizeResult<()> { - let mut data = ItemData::from_toml(r#" + let mut data = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "inner" - "#)?; + "#, + )?; - let data_two = ItemData::from_toml(r#" + let data_two = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "new inner" - "#)?; + "#, + )?; - data.set_path(vec!["config", "test", "inner"], ItemData::from_string("new inner"))?; + data.set_path( + vec!["config", "test", "inner"], + ItemData::from_string("new inner"), + )?; assert_eq!(data, data_two); @@ -144,57 +167,71 @@ fn test_itemdata_set_path() -> MizeResult<()> { #[test] fn test_itemdata_merge() -> MizeResult<()> { - let mut data = ItemData::from_toml(r#" + let mut data = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "inner" - "#)?; + "#, + )?; - let data_two = ItemData::from_toml(r#" + let data_two = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "new inner" - "#)?; + "#, + )?; - assert_eq!(data.get_path(vec!["config", "test", "inner"])?, ItemData::from_string("inner")); + assert_eq!( + data.get_path(vec!["config", "test", "inner"])?, + ItemData::from_string("inner") + ); data.merge(data_two.clone()); assert_eq!(data, data_two); - assert_eq!(data.get_path(vec!["config", "test", "inner"])?, ItemData::from_string("new inner")); + assert_eq!( + data.get_path(vec!["config", "test", "inner"])?, + ItemData::from_string("new inner") + ); Ok(()) } #[test] fn test_item_merge() -> MizeResult<()> { - let instance = Instance::empty()?; + let instance = Mize::empty()?; let mut item = instance.new_item()?; // here the item should contain "empty" data assert_eq!(item.as_data_full()?, ItemData::new()); - let data = ItemData::from_toml(r#" + let data = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "inner" - "#)?; + "#, + )?; - let data_two = ItemData::from_toml(r#" + let data_two = ItemData::from_toml( + r#" [config] hi = "hello from config/hi" [config.test] inner = "new inner" - "#)?; + "#, + )?; item.merge(data.clone())?; @@ -213,7 +250,6 @@ fn test_item_merge() -> MizeResult<()> { // also the item should be updated assert_eq!(item.as_data_full()?, data_two); - Ok(()) } @@ -225,6 +261,3 @@ fn test_cant_set_non_existent_item() -> () { instance.set_blocking("5", "hello world".into_item_data()).expect("correct panic"); } */ - - - diff --git a/parts/mize/src/core/instance/updater.rs b/parts/mize/src/core/instance/updater.rs index 77209a0..d91e8b1 100644 --- a/parts/mize/src/core/instance/updater.rs +++ b/parts/mize/src/core/instance/updater.rs @@ -1,28 +1,23 @@ use flume::Receiver; -use tracing::{error, trace, warn}; use std::borrow::BorrowMut; use std::sync::Arc; +use tracing::{error, trace, warn}; -use crate::mize_err; -use crate::{instance::Instance, item::ItemData}; +use crate::error::{MizeError, MizeResult, MizeResultTrait}; use crate::id::MizeId; -use crate:: error::{MizeResult, MizeError, MizeResultTrait}; +use crate::mize_err; use crate::proto::{MessageCmd, MizeMessage}; +use crate::{instance::Mize, item::ItemData}; use super::connection::{self, Connection}; use super::subscription::{Subscription, Update}; - #[derive(Debug)] pub enum Operation { Set(MizeId, ItemData, Option), // bool: is_from_update_msg Msg(MizeMessage), } - - - - // console_log macro // that can be copied into other files for debugging purposes #[cfg(feature = "wasm-target")] @@ -46,15 +41,11 @@ macro_rules! console_log { macro_rules! console_log { // Note that this is using the `log` function imported above during // `bare_bones` - ($($t:tt)*) => () + ($($t:tt)*) => {}; } //end of console_log macro - - - - -pub async fn updater_thread_async(operation_rx : Receiver, instance: Instance) -> () { +pub async fn updater_thread_async(operation_rx: Receiver, instance: Mize) -> () { let mut count = 0; console_log!("inside an updater thread"); @@ -84,11 +75,10 @@ pub async fn updater_thread_async(operation_rx : Receiver, instance: error!("OPERATION {} FAILED: {:?}", count, operation); err.log(); } - } } -pub fn updater_thread(operation_rx : Receiver, instance: &Instance) -> MizeResult<()> { +pub fn updater_thread(operation_rx: Receiver, instance: &Mize) -> MizeResult<()> { let mut count = 0; loop { @@ -109,13 +99,11 @@ pub fn updater_thread(operation_rx : Receiver, instance: &Instance) - error!("OPERATION FAILED: {:?}", operation); err.log(); } - } Ok(()) } -pub fn handle_operation(operation: &mut Operation, instance: &Instance) -> MizeResult<()> { - +pub fn handle_operation(operation: &mut Operation, instance: &Mize) -> MizeResult<()> { match operation { Operation::Set(id, value, maybe_conn) => { let item_data: ItemData = value.to_owned(); @@ -130,7 +118,6 @@ pub fn handle_operation(operation: &mut Operation, instance: &Instance) -> MizeR id: id.clone(), }; for sub in vec.iter_mut() { - // don't handle sub of type connection, in case the update comes from this // connection if let Some(conn) = maybe_conn { @@ -144,15 +131,13 @@ pub fn handle_operation(operation: &mut Operation, instance: &Instance) -> MizeR sub.handle(update.clone()); } } - }, - Operation::Msg(msg) => { - handle_msg(msg, instance)? - }, + } + Operation::Msg(msg) => handle_msg(msg, instance)?, } Ok(()) } -fn handle_msg(msg: &mut MizeMessage, instance: &Instance) -> MizeResult<()> { +fn handle_msg(msg: &mut MizeMessage, instance: &Mize) -> MizeResult<()> { match msg.cmd()? { MessageCmd::Get => { let id = msg.id(instance)?; @@ -160,7 +145,7 @@ fn handle_msg(msg: &mut MizeMessage, instance: &Instance) -> MizeResult<()> { let item = instance.get(id.clone())?; let msg = MizeMessage::new_give(id, item.as_data_full()?, msg.conn_id); connection.send(msg)?; - }, + } MessageCmd::GetSub => { let id = msg.id(instance)?; @@ -170,21 +155,23 @@ fn handle_msg(msg: &mut MizeMessage, instance: &Instance) -> MizeResult<()> { connection.send(msg)?; let sub = Subscription::from_conn(connection.clone()); instance.sub(id, sub)?; - }, + } MessageCmd::Sub => { let id = msg.id(instance)?; let mut connection = instance.get_connection(msg.conn_id)?.clone(); let sub = Subscription::from_conn(connection.clone()); instance.sub(id, sub)?; - }, + } MessageCmd::Update => { let data = msg.data()?; let id = msg.id(instance)?; let connection = instance.get_connection(msg.conn_id)?; - instance.op_tx.send(Operation::Set(id.clone(), data, Some(connection))); - }, + instance + .op_tx + .send(Operation::Set(id.clone(), data, Some(connection))); + } // this should check, if the update is valid // but for now, we do just always accept it @@ -192,8 +179,10 @@ fn handle_msg(msg: &mut MizeMessage, instance: &Instance) -> MizeResult<()> { let data = msg.data()?; let id = msg.id(instance)?; let connection = instance.get_connection(msg.conn_id)?; - instance.op_tx.send(Operation::Set(id.clone(), data, Some(connection))); - }, + instance + .op_tx + .send(Operation::Set(id.clone(), data, Some(connection))); + } MessageCmd::Give => { let id = msg.id(instance)?; @@ -204,9 +193,12 @@ fn handle_msg(msg: &mut MizeMessage, instance: &Instance) -> MizeResult<()> { tx.send(data.clone()); } } else { - warn!("got give msg for id '{}', that has no one waiting for it", id); + warn!( + "got give msg for id '{}', that has no one waiting for it", + id + ); } - }, + } MessageCmd::Create => { println!("instance.store: {:?}", instance.clone().store); @@ -225,10 +217,7 @@ fn handle_msg(msg: &mut MizeMessage, instance: &Instance) -> MizeResult<()> { } _ => { return Err(mize_err!("got a message, that is not handeled")); - }, + } } Ok(()) } - - - diff --git a/parts/mize/src/core/item.rs b/parts/mize/src/core/item.rs index 2821f80..6d96043 100644 --- a/parts/mize/src/core/item.rs +++ b/parts/mize/src/core/item.rs @@ -1,44 +1,43 @@ -use tracing::{debug, error, info, instrument, trace, warn, Instrument}; +use colored::Colorize; +use core::fmt; use serde::Deserialize; use serde::Serialize; -use core::fmt; use std::fmt::Debug; -use std::{i128, string}; -use std::{collections::HashMap, path::PathBuf, io::Cursor, fmt::Display}; use std::fs::File; -use std::rc::Rc; -use colored::Colorize; use std::io; +use std::rc::Rc; +use std::{collections::HashMap, fmt::Display, io::Cursor, path::PathBuf}; +use std::{i128, string}; +use tracing::{debug, error, info, instrument, trace, warn, Instrument}; use tracing::{span, Level}; -use crate::error::{MizeError, MizeResult, IntoMizeResult}; -use crate::instance::{connection, Instance}; -use crate::instance::store::Store; +use crate::error::{IntoMizeResult, MizeError, MizeResult}; use crate::id::MizeId; +use crate::instance::connection::value_raw_con_by_id; +use crate::instance::store::Store; +use crate::instance::{connection, Mize}; use crate::mize_err; use crate::proto::MizeMessage; use ciborium::Value as CborValue; -use crate::instance::connection::value_raw_con_by_id; - // a item always has to do with a Instance, which takes care of how it is updated #[derive(Debug, Clone)] pub struct Item<'a> { id: MizeId, - pub instance: &'a Instance + pub instance: &'a Mize, } // without an Instance it is not an item, but only the "data of an item" // and this type for now is just an alias to CborValue #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ItemData ( pub CborValue ); +pub struct ItemData(pub CborValue); impl Item<'_> { pub fn id(&self) -> MizeId { self.id.clone() } - pub fn new(id: MizeId, instance: &Instance) -> Item { + pub fn new(id: MizeId, instance: &Mize) -> Item { Item { id, instance } } @@ -57,31 +56,43 @@ impl Item<'_> { pub fn as_data_full(&self) -> MizeResult { let id = self.id(); - // the instance we are if id.store_part() == "self" { debug!("getting item '{}' from self", self.id()); match id.nth_part(1)? { - "con_by_id" => { return value_raw_con_by_id(&mut self.clone()); }, - "namespace" => { + "con_by_id" => { + return value_raw_con_by_id(&mut self.clone()); + } + "namespace" => { let namespace_inner = self.instance.namespace.lock()?; return Ok(ItemData::from_string(namespace_inner.as_real_string())); - }, + } "self_namespace" => { let namespace_inner = self.instance.self_namespace.lock()?; return Ok(ItemData::from_string(namespace_inner.as_real_string())); - }, + } "config" => { - let rest_path = id.path.into_iter().skip(2).map(|v| v.to_owned()).collect::>().join("/"); - let id_for_store = self.instance.new_id("0/config".to_owned() + "/" + rest_path.as_str())?; + let rest_path = id + .path + .into_iter() + .skip(2) + .map(|v| v.to_owned()) + .collect::>() + .join("/"); + let id_for_store = self + .instance + .new_id("0/config".to_owned() + "/" + rest_path.as_str())?; let store = self.instance.store.lock()?; let data = store.get_value_data_full(id_for_store)?; return Ok(data); } - _ => {}, + _ => {} } - return Err(mize_err!("a /self path, but the next element in the path '{:?}' is not valid", id.nth_part(1))); + return Err(mize_err!( + "a /self path, but the next element in the path '{:?}' is not valid", + id.nth_part(1) + )); } let self_namespace_inner = self.instance.self_namespace.lock()?; @@ -91,27 +102,31 @@ impl Item<'_> { if id.store_part() == "inst" { match id.nth_part(1)? { - "con_by_id" => { return value_raw_con_by_id(&mut self.clone()); }, - "namespace" => { + "con_by_id" => { + return value_raw_con_by_id(&mut self.clone()); + } + "namespace" => { let namespace_inner = self.instance.namespace.lock()?; return Ok(ItemData::from_string(namespace_inner.as_real_string())); - }, - "self_namespace" => { + } + "self_namespace" => { let namespace_inner = self.instance.self_namespace.lock()?; return Ok(ItemData::from_string(namespace_inner.as_real_string())); - }, - _ => {}, + } + _ => {} } } let store_inner = self.instance.store.lock()?; return store_inner.get_value_data_full(self.id()); - - } else { let mut connection = self.instance.get_connection_by_ns(self.id().namespace())?; - debug!("getting item '{}' from connection '{}' from store", self.id(), connection.id); + debug!( + "getting item '{}' from connection '{}' from store", + self.id(), + connection.id + ); let msg = MizeMessage::new_get(self.id(), connection.id); connection.send(msg); @@ -121,8 +136,7 @@ impl Item<'_> { } #[instrument(name = "fn.ItemData::merge")] - pub fn merge + Debug >(&mut self, mut value: V) -> MizeResult<()> { - + pub fn merge + Debug>(&mut self, mut value: V) -> MizeResult<()> { let mut data = self.as_data_full()?; //let mut data = data_full.get_path(id_path_without_store_part)?; trace!("item::merge data: {:?}", data); @@ -135,25 +149,28 @@ impl Item<'_> { // handle the case of /self/* if self.id().store_part() == "self" { - let rest_path = self.id().path.into_iter().skip(1).map(|v| v.to_owned()).collect::>().join("/"); - let id_for_store = self.instance.new_id("0".to_owned() + "/" + rest_path.as_str())?; + let rest_path = self + .id() + .path + .into_iter() + .skip(1) + .map(|v| v.to_owned()) + .collect::>() + .join("/"); + let id_for_store = self + .instance + .new_id("0".to_owned() + "/" + rest_path.as_str())?; let store_inner = self.instance.store.lock()?; store_inner.set(id_for_store, data)?; - - } else if self.instance.we_are_namespace()? { - let store_inner = self.instance.store.lock()?; store_inner.set(self.id(), data)?; - } else { - let namespace = self.id().namespace(); let mut connection = self.instance.get_connection_by_ns(namespace)?; let msg = MizeMessage::new_update_request(self.id(), data, connection.id); connection.send(msg)?; - } Ok(()) @@ -178,11 +195,12 @@ impl ItemData { } pub fn from_toml(toml_string: &str) -> MizeResult { - let toml_deserializer = toml::Deserializer::new(&toml_string); - let value = CborValue::deserialize(toml_deserializer) - .mize_result_msg(format!("Could not deserialize the toml string: {}", &toml_string))?; + let value = CborValue::deserialize(toml_deserializer).mize_result_msg(format!( + "Could not deserialize the toml string: {}", + &toml_string + ))?; return Ok(value.into_item_data()); } @@ -197,14 +215,14 @@ impl ItemData { pub fn from_string>(into_string: S) -> ItemData { let string = into_string.into(); let data = CborValue::Text(string); - return ItemData (data); + return ItemData(data); } pub fn to_json(self) -> MizeResult { - let mut result: Vec = Vec::new(); - self.0.serialize(&mut serde_json::Serializer::new(&mut result))?; + self.0 + .serialize(&mut serde_json::Serializer::new(&mut result))?; Ok(String::from_utf8(result)?) } @@ -212,8 +230,10 @@ impl ItemData { pub fn from_json(json_str: String) -> MizeResult { let mut json_deserializer = serde_json::Deserializer::from_str(json_str.as_str()); - let value = CborValue::deserialize(&mut json_deserializer) - .mize_result_msg(format!("could not deserialize the json string: {}", json_str))?; + let value = CborValue::deserialize(&mut json_deserializer).mize_result_msg(format!( + "could not deserialize the json string: {}", + json_str + ))?; return Ok(value.into_item_data()); } @@ -227,7 +247,7 @@ impl ItemData { } pub fn from_cbor(cbor: CborValue) -> ItemData { - ItemData (cbor) + ItemData(cbor) } pub fn sort_keys(&mut self) -> MizeResult<()> { @@ -247,7 +267,7 @@ impl ItemData { return CborValue::Bool(true).into_item_data(); } if let Ok(int) = value_str.parse::() { - return int.into_item_data() + return int.into_item_data(); } return CborValue::Text(value_str).into_item_data(); } @@ -262,12 +282,12 @@ impl ItemData { pub fn get_path(&self, path: P) -> MizeResult { let path = path.into_path(); - Ok(item_data_get_path(&self.0, path)?.to_owned().into_item_data()) + Ok(item_data_get_path(&self.0, path)? + .to_owned() + .into_item_data()) } - } - impl Default for ItemData { fn default() -> Self { ItemData::new() @@ -275,7 +295,6 @@ impl Default for ItemData { } pub fn data_from_string(data_string: String) -> MizeResult { - let mut data = ItemData::new(); // in case it's just a string @@ -290,15 +309,25 @@ pub fn data_from_string(data_string: String) -> MizeResult { continue; } - let path = option.split("=").nth(0) - .ok_or(MizeError::new().msg(format!("Failed to parse Option: option '{}' has an empty path (thing before =)", option)))?; + let path = option + .split("=") + .nth(0) + .ok_or(MizeError::new().msg(format!( + "Failed to parse Option: option '{}' has an empty path (thing before =)", + option + )))?; //trace!("data_from_string: path: {}", path); - let value = option.split("=").nth(1) - .ok_or(MizeError::new().msg(format!("Failed to parse Option: option '{}' has an empty value (thing after =)", option)))?; + let value = option + .split("=") + .nth(1) + .ok_or(MizeError::new().msg(format!( + "Failed to parse Option: option '{}' has an empty value (thing after =)", + option + )))?; //trace!("data_from_string: value: {}", value); - + let mut path_vec = Vec::new(); path_vec.extend(path.split(".")); @@ -333,18 +362,20 @@ pub fn item_data_get_path(data: &CborValue, path: Vec) -> MizeResult<&Cb } } } - }, + } val => { return Err(MizeError::new() - .msg(format!("Failed to get path '{:?}' from ItemData, the data at '{}' is not a map", path, path_el)) + .msg(format!( + "Failed to get path '{:?}' from ItemData, the data at '{}' is not a map", + path, path_el + )) .msg(format!("{:?} is: {:?}", path_el, val))); - }, + } }; item_data_get_path(sub_data, path_iter.collect()) } pub fn item_data_sort_keys(data: &mut CborValue) -> MizeResult<()> { - // for a list, sort each item of the list if data.is_array() { for el in data.as_array_mut().unwrap().iter_mut() { @@ -356,7 +387,7 @@ pub fn item_data_sort_keys(data: &mut CborValue) -> MizeResult<()> { if data.is_map() { let map: &mut Vec<(CborValue, CborValue)> = data.as_map_mut().unwrap(); //map.sort_by_key(|el| el.0); - map.sort_by(|a,b| { + map.sort_by(|a, b| { match a.0.partial_cmp(&b.0) { Some(val) => val, None => { @@ -375,7 +406,11 @@ pub fn item_data_sort_keys(data: &mut CborValue) -> MizeResult<()> { Ok(()) } -pub fn item_data_set_path(data: &mut CborValue, path: Vec, data_to_set: &CborValue) -> MizeResult<()> { +pub fn item_data_set_path( + data: &mut CborValue, + path: Vec, + data_to_set: &CborValue, +) -> MizeResult<()> { //trace!("[ {} ] item_data_set_path()", "CALL".yellow()); //trace!("[ {} ] data: {}", "ARG".yellow(), data.clone().into_item_data()); //trace!("[ {} ] path: {:?}", "ARG".yellow(), path); @@ -395,11 +430,11 @@ pub fn item_data_set_path(data: &mut CborValue, path: Vec, data_to_set: // our base case *data = data_to_set.to_owned(); return Ok(()); - }, + } }; match data { CborValue::Map(ref mut map) => { - for (key, val) in &mut * map { + for (key, val) in &mut *map { if let CborValue::Text(key_str) = key { if key_str == &path_el { //trace!("item_data_set_path: setting key {key_str} in map with recursive call"); @@ -417,7 +452,7 @@ pub fn item_data_set_path(data: &mut CborValue, path: Vec, data_to_set: item_data_set_path(&mut inner_value, path_iter.collect(), data_to_set); map.push((CborValue::Text(path_el.clone()), inner_value)); return Ok(()); - }, + } CborValue::Null => { //trace!("item_data_set_path: CborValue::Null case"); let mut inner_value = CborValue::Null; @@ -427,18 +462,21 @@ pub fn item_data_set_path(data: &mut CborValue, path: Vec, data_to_set: *data = CborValue::Map(map_vec); return Ok(()); - }, + } val => { return Err(MizeError::new() - .msg(format!("Failed to get path '{:?}' from ItemData, the data at '{}' is not a map", path, path_el)) + .msg(format!( + "Failed to get path '{:?}' from ItemData, the data at '{}' is not a map", + path, path_el + )) .msg(format!("{:?} is: {:?}", path_el, val))); - }, + } }; return Err(MizeError::new().msg("unreachable")); } -pub fn item_data_merge(merge_into: &mut CborValue, other: &CborValue){ +pub fn item_data_merge(merge_into: &mut CborValue, other: &CborValue) { // needs to be recursive match (merge_into, other) { @@ -447,25 +485,24 @@ pub fn item_data_merge(merge_into: &mut CborValue, other: &CborValue){ (CborValue::Map(ref mut merge_into_map), CborValue::Map(ref other_map)) => { // go through other_map and merge those keys/values to merge_into for (other_key, other_val) in other_map { - // so find that same vale in merge_into, if exists recursively merge, else just add to // vec let mut found_value = CborValue::Null; let mut value_found = false; let mut new_value_for_merge_into: Vec<(CborValue, CborValue)> = Vec::new(); // here we collect the - // new contents of the - // map, to assign later - // to merge_into_map + // new contents of the + // map, to assign later + // to merge_into_map for (merge_into_key, merge_into_val) in merge_into_map.clone() { if merge_into_key == *other_key { value_found = true; found_value = merge_into_val.to_owned(); // if we found it, also don't add it to new_value_for_merge_into - } else { //if not found push to new_value_for_merge_into - new_value_for_merge_into.push((merge_into_key.to_owned(), merge_into_val.to_owned())); + new_value_for_merge_into + .push((merge_into_key.to_owned(), merge_into_val.to_owned())); } } @@ -475,7 +512,6 @@ pub fn item_data_merge(merge_into: &mut CborValue, other: &CborValue){ // to asign push to new_value_for_merge_into, because the old was removed already new_value_for_merge_into.push((other_key.to_owned(), found_value)); - } else { // if not found, just add the other_key/val to new_value_for_merge_into new_value_for_merge_into.push((other_key.to_owned(), other_val.to_owned())); @@ -488,8 +524,7 @@ pub fn item_data_merge(merge_into: &mut CborValue, other: &CborValue){ // if other is Null, don't asign // this is gonna have repercussions.... because it's not clean behaviour - (merge_into, CborValue::Null) => { - } + (merge_into, CborValue::Null) => {} // in any other case we just want to set merge_into to other // also this is the base case @@ -513,27 +548,30 @@ pub fn get_raw_from_cbor<'a>(value: &'a CborValue, path: Vec<&String>) -> MizeRe CborValue::Bytes(vec) => { trace!("[ {} ] ret value: {:?}", "RET".yellow(), &vec[..]); return Ok(&vec[..]); - }, - CborValue::Text(string) => { + } + CborValue::Text(string) => { trace!("[ {} ] ret value: {:?}", "RET".yellow(), string.as_bytes()); return Ok(string.as_bytes()); - }, + } other => { - return Err(mize_err!("path is empty and the value: '{:?}' is neither Bytes nor Text", other)); - }, + return Err(mize_err!( + "path is empty and the value: '{:?}' is neither Bytes nor Text", + other + )); + } }; - }, + } }; - + match value { CborValue::Bytes(vec) => { trace!("[ {} ] ret value: {:?}", "RET".yellow(), &vec[..]); return Ok(&vec[..]); - }, - CborValue::Text(string) => { + } + CborValue::Text(string) => { trace!("[ {} ] ret value: {:?}", "RET".yellow(), string.as_bytes()); return Ok(string.as_bytes()); - }, + } CborValue::Map(map) => { let mut inner_val: &CborValue = &CborValue::Null; let mut inner_val_found = false; @@ -547,12 +585,19 @@ pub fn get_raw_from_cbor<'a>(value: &'a CborValue, path: Vec<&String>) -> MizeRe } } } - + // if there is no value at that path if inner_val_found == false { return Err(MizeError::new() // jesus christ, this is a pfusch... - .msg(format!("get_raw_from_cbor: Path '{}' not Found", path.clone().into_iter().map(|v| v.to_owned()).collect::>().join("/")))) + .msg(format!( + "get_raw_from_cbor: Path '{}' not Found", + path.clone() + .into_iter() + .map(|v| v.to_owned()) + .collect::>() + .join("/") + ))); } //path_iter.next(); @@ -560,9 +605,11 @@ pub fn get_raw_from_cbor<'a>(value: &'a CborValue, path: Vec<&String>) -> MizeRe let ret_value = get_raw_from_cbor(inner_val, inner_path); trace!("[ {} ] ret value: {:?}", "RET".yellow(), ret_value); return ret_value; - }, - _ => Err(MizeError::new() - .msg(format!("get_raw_from_cbor: value is not a map, text or bytes ... value: {:?}", value))), + } + _ => Err(MizeError::new().msg(format!( + "get_raw_from_cbor: value is not a map, text or bytes ... value: {:?}", + value + ))), } } @@ -613,7 +660,7 @@ impl IntoItemData for &String { } impl IntoItemData for CborValue { fn into_item_data(self) -> ItemData { - ItemData ( self ) + ItemData(self) } } impl IntoItemData for ItemData { @@ -630,8 +677,9 @@ impl IntoItemData for i128 { impl fmt::Display for ItemData { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "ItemData: "); - let display_writer = DisplayWriter (f); - self.0.serialize(&mut serde_json::Serializer::pretty(display_writer)) + let display_writer = DisplayWriter(f); + self.0 + .serialize(&mut serde_json::Serializer::pretty(display_writer)) .map_err(|serde_err| std::fmt::Error) } } @@ -641,13 +689,15 @@ struct DisplayWriter<'a, 'b>(&'a mut fmt::Formatter<'b>); impl<'a, 'b> io::Write for DisplayWriter<'a, 'b> { fn write(&mut self, bytes: &[u8]) -> std::result::Result { - - self.0.write_str(&String::from_utf8_lossy(bytes)) + self.0 + .write_str(&String::from_utf8_lossy(bytes)) .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?; Ok(bytes.len()) } - fn flush(&mut self) -> std::result::Result<(), std::io::Error> { todo!() } + fn flush(&mut self) -> std::result::Result<(), std::io::Error> { + todo!() + } } impl PartialEq for ItemData { @@ -662,5 +712,3 @@ impl PartialEq for ItemData { } } impl Eq for ItemData {} - - diff --git a/parts/mize/src/core/memstore.rs b/parts/mize/src/core/memstore.rs index d545a0b..7d930c5 100644 --- a/parts/mize/src/core/memstore.rs +++ b/parts/mize/src/core/memstore.rs @@ -1,17 +1,17 @@ +use ciborium::Value as CborValue; +use colored::Colorize; use std::collections::binary_heap::Iter; use std::collections::HashMap; use std::iter::Map; use std::sync::{Arc, Mutex}; -use ciborium::Value as CborValue; use tracing::{instrument, trace}; -use colored::Colorize; +use crate::error::{IntoMizeResult, MizeError, MizeResult}; use crate::id::MizeId; -use crate::instance::store::{Store, IdIter}; -use crate::error::{MizeError, MizeResult, IntoMizeResult}; -use crate::item::{Item, ItemData}; -use crate::instance::Instance; +use crate::instance::store::{IdIter, Store}; +use crate::instance::Mize; use crate::item::get_raw_from_cbor; +use crate::item::{Item, ItemData}; use crate::mize_err; #[derive(Clone, Debug)] @@ -37,13 +37,12 @@ impl Store for MemStore { let path = id.after_store_part(); old_data.set_path(path, data)?; inner.map.insert(id_to_u64(id)?, old_data); - } else { // if no data exists for that store_part, just insert inner.map.insert(id_to_u64(id)?, data); } - return Ok(()) + return Ok(()); } fn get_links(&self, item: Item) -> MizeResult> { let inner = self.inner.lock()?; @@ -65,12 +64,17 @@ impl Store for MemStore { #[instrument(name="fn.MemStore::get_value_raw" skip(self))] fn get_value_raw(&self, id: MizeId) -> MizeResult> { - trace!("[ {} ] id: {:?}", "ARG".yellow(), id); + trace!("[ {} ] id: {:?}", "ARG".yellow(), id); let inner = self.inner.lock()?; - let cbor_val = inner.map.get(&id_to_u64(id.clone())?) - .ok_or(MizeError::new() - .msg(format!("Item with store_part: {}, id: {} does not exist in MemStore", id_to_u64(id.clone())?, id)))?; + let cbor_val = inner + .map + .get(&id_to_u64(id.clone())?) + .ok_or(MizeError::new().msg(format!( + "Item with store_part: {}, id: {} does not exist in MemStore", + id_to_u64(id.clone())?, + id + )))?; let path = id.path(); let mut id_iter = path.iter(); @@ -94,7 +98,6 @@ impl Store for MemStore { return Ok(ret_data); } fn id_iter(&self) -> MizeResult { - IdIter::new(Box::new(self.to_owned())) } @@ -104,7 +107,6 @@ impl Store for MemStore { let mut id = str_to_u64(prev_id_str)?; loop { - id += 1; if id > inner.next_id { @@ -114,7 +116,6 @@ impl Store for MemStore { if inner.map.contains_key(&id) { println!("returning: {}", id); return Ok(Some(format!("{}", id))); - } else { // try id +1 continue; @@ -129,8 +130,13 @@ impl Store for MemStore { impl MemStore { pub fn new() -> MemStore { - let inner = MemStoreInner { map: HashMap::new(), next_id: 0 }; - return MemStore { inner: Arc::new(Mutex::new(inner)) }; + let inner = MemStoreInner { + map: HashMap::new(), + next_id: 0, + }; + return MemStore { + inner: Arc::new(Mutex::new(inner)), + }; } } @@ -139,10 +145,8 @@ fn id_to_u64(id: MizeId) -> MizeResult { } fn str_to_u64(id_str: &str) -> MizeResult { - id_str.parse() - .mize_result_msg(format!("Could not parse the store_part of mizeid {} into a u64 for the MemStore", id_str)) + id_str.parse().mize_result_msg(format!( + "Could not parse the store_part of mizeid {} into a u64 for the MemStore", + id_str + )) } - - - - diff --git a/parts/mize/src/core/proto/mod.rs b/parts/mize/src/core/proto/mod.rs index e7e6d0a..edf3866 100644 --- a/parts/mize/src/core/proto/mod.rs +++ b/parts/mize/src/core/proto/mod.rs @@ -1,10 +1,15 @@ use core::fmt; -use std::io; use serde::Serialize; +use std::io; use ciborium::{value::Integer, Value as CborValue}; -use crate::{error::{IntoMizeResult, MizeError, MizeResult}, id::MizeId, instance::{self, connection::Connection, Instance}, item::{IntoItemData, ItemData}}; +use crate::{ + error::{IntoMizeResult, MizeError, MizeResult}, + id::MizeId, + instance::{self, connection::Connection, Mize}, + item::{IntoItemData, ItemData}, +}; #[derive(Clone)] pub struct MizeMessage { @@ -39,18 +44,22 @@ pub enum MessageCmd { Sub, } - - - impl MizeMessage { pub fn new(value: CborValue, conn_id: u64) -> MizeMessage { MizeMessage { value, conn_id } } pub fn new_get(id: MizeId, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_GET.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_GET.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let value = CborValue::Map(vec![cmd, id]); @@ -58,9 +67,16 @@ impl MizeMessage { } pub fn new_get_sub(id: MizeId, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_GET_SUB.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_GET_SUB.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let value = CborValue::Map(vec![cmd, id]); @@ -68,9 +84,16 @@ impl MizeMessage { } pub fn new_sub(id: MizeId, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_SUB.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_SUB.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let value = CborValue::Map(vec![cmd, id]); @@ -78,16 +101,26 @@ impl MizeMessage { } pub fn new_create(conn_id: u64) -> MizeMessage { - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_CREATE.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_CREATE.into()), + ); let value = CborValue::Map(vec![cmd]); MizeMessage::new(value, conn_id) } pub fn new_create_reply(id: MizeId, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_CREATE_REPLY.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_CREATE_REPLY.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let value = CborValue::Map(vec![cmd, id]); @@ -95,9 +128,16 @@ impl MizeMessage { } pub fn new_give(id: MizeId, data: ItemData, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_GIVE.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_GIVE.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let data = (CborValue::Integer(MSG_DATA.into()), data.cbor().to_owned()); let value = CborValue::Map(vec![cmd, id, data]); @@ -106,9 +146,16 @@ impl MizeMessage { } pub fn new_update_request(id: MizeId, data: ItemData, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_UPDATE_REQUEST.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_UPDATE_REQUEST.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let data = (CborValue::Integer(MSG_DATA.into()), data.cbor().to_owned()); let value = CborValue::Map(vec![cmd, id, data]); @@ -117,9 +164,16 @@ impl MizeMessage { } pub fn new_update(id: MizeId, data: ItemData, conn_id: u64) -> MizeMessage { - let id_path = id.path().into_iter().map(|string| CborValue::Text(string.to_owned())).collect(); + let id_path = id + .path() + .into_iter() + .map(|string| CborValue::Text(string.to_owned())) + .collect(); - let cmd = (CborValue::Integer(MSG_CMD.into()), CborValue::Integer(CMD_UPDATE.into())); + let cmd = ( + CborValue::Integer(MSG_CMD.into()), + CborValue::Integer(CMD_UPDATE.into()), + ); let id = (CborValue::Integer(MSG_ID.into()), CborValue::Array(id_path)); let data = (CborValue::Integer(MSG_DATA.into()), data.cbor().to_owned()); let value = CborValue::Map(vec![cmd, id, data]); @@ -137,7 +191,7 @@ impl MizeMessage { CborValue::Map(val) => val, _ => { return Err(MizeError::new().msg("Message was not a map")); - }, + } }; //check if in this map there is a c, otherwise return err @@ -172,20 +226,19 @@ impl MizeMessage { 8 => MessageCmd::Sub, _ => { return Err(MizeError::new().msg("error cmd of msg was not a valid command")); - }, + } }; return Ok(cmd); } - pub fn id_str(&mut self) -> MizeResult> { // return err, if msg is not a map let msg_as_map = match &self.value { CborValue::Map(val) => val, _ => { return Err(MizeError::new().msg("Message was not a map")); - }, + } }; let vec_value = { @@ -206,26 +259,25 @@ impl MizeMessage { CborValue::Array(inner) => inner, _ => { return Err(MizeError::new().msg("Id is not a vector")); - }, + } } }; let mut vec_string: Vec = Vec::new(); for val in vec_value { match val { - CborValue::Text(text) => { - vec_string.push(text.to_owned()) - }, + CborValue::Text(text) => vec_string.push(text.to_owned()), _ => { - return Err(MizeError::new().msg("one in the vec of the id in a msg is not of type Text")); - }, + return Err(MizeError::new() + .msg("one in the vec of the id in a msg is not of type Text")); + } } } Ok(vec_string) } - pub fn id(&mut self, instance: &Instance) -> MizeResult { + pub fn id(&mut self, instance: &Mize) -> MizeResult { let id_str = self.id_str()?; return instance.new_id(id_str); } @@ -236,7 +288,7 @@ impl MizeMessage { CborValue::Map(val) => val, _ => { return Err(MizeError::new().msg("Message was not a map")); - }, + } }; let data = { @@ -252,7 +304,7 @@ impl MizeMessage { } } } - if ! found { + if !found { return Err(MizeError::new().msg("error getting the data value form a msg")); } tmp_val @@ -262,30 +314,30 @@ impl MizeMessage { } } - // thanks to: https://stackoverflow.com/a/61768916 struct DisplayWriter<'a, 'b>(&'a mut fmt::Formatter<'b>); impl<'a, 'b> io::Write for DisplayWriter<'a, 'b> { fn write(&mut self, bytes: &[u8]) -> std::result::Result { - - self.0.write_str(&String::from_utf8_lossy(bytes)) + self.0 + .write_str(&String::from_utf8_lossy(bytes)) .map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))?; Ok(bytes.len()) } - fn flush(&mut self) -> std::result::Result<(), std::io::Error> { todo!() } + fn flush(&mut self) -> std::result::Result<(), std::io::Error> { + todo!() + } } impl fmt::Display for MizeMessage { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut err = false; match self.to_owned().cmd() { Ok(cmd) => { writeln!(f, "MizeMessage with cmd: {:?}", cmd); - }, + } Err(e) => { writeln!(f, "MizeMessage with unparsable cmd"); err = true; @@ -296,7 +348,7 @@ impl fmt::Display for MizeMessage { Ok(id) => { let id_str = id.join("/"); writeln!(f, "\tid: {:?}", id_str); - }, + } Err(e) => { writeln!(f, "\t msg has no id"); //err = true; @@ -307,40 +359,44 @@ impl fmt::Display for MizeMessage { Ok(data) => { let value = data.cbor(); write!(f, "\tdata: "); - let display_writer = DisplayWriter (f); - if let Err(e) = value.serialize(&mut serde_json::Serializer::pretty(display_writer)) - .map_err(|serde_err| std::fmt::Error) { - writeln!(f, "serialize err: {:?}", e); - err = true; + let display_writer = DisplayWriter(f); + if let Err(e) = value + .serialize(&mut serde_json::Serializer::pretty(display_writer)) + .map_err(|serde_err| std::fmt::Error) + { + writeln!(f, "serialize err: {:?}", e); + err = true; } - }, + } Err(e) => { writeln!(f, "\t msg has no data"); //err = true; - }, + } } if err { write!(f, "Full msg: "); - let display_writer = DisplayWriter (f); - self.value.serialize(&mut serde_json::Serializer::pretty(display_writer)) - .map_err(|serde_err| std::fmt::Error).mize_result_msg("serialize error") - .inspect_err(|e| { e.clone().log(); }); + let display_writer = DisplayWriter(f); + self.value + .serialize(&mut serde_json::Serializer::pretty(display_writer)) + .map_err(|serde_err| std::fmt::Error) + .mize_result_msg("serialize error") + .inspect_err(|e| { + e.clone().log(); + }); } Ok(()) - } } impl fmt::Debug for MizeMessage { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "\nMizeMessage: "); - let display_writer = DisplayWriter (f); + let display_writer = DisplayWriter(f); let value = self.to_owned().value(); - value.serialize(&mut serde_json::Serializer::pretty(display_writer)) + value + .serialize(&mut serde_json::Serializer::pretty(display_writer)) .map_err(|serde_err| std::fmt::Error) } } - - diff --git a/parts/mize/src/lib.rs b/parts/mize/src/lib.rs index 693e83e..6aadcee 100644 --- a/parts/mize/src/lib.rs +++ b/parts/mize/src/lib.rs @@ -1,11 +1,10 @@ - -#![ allow( warnings ) ] +#![allow(warnings)] static PROTO_VERSION: u8 = 1; #[macro_export] macro_rules! test_println { - ($($arg:tt)*) => { + ($($arg:tt)*) => { #[cfg(test)] print!("[[ {} ]] ", <&str as colored::Colorize>::blue("TEST")); @@ -20,7 +19,7 @@ macro_rules! test_println { #[macro_export] macro_rules! test_print { - ($($arg:tt)*) => { + ($($arg:tt)*) => { #[cfg(test)] print!("[[ {} ]] ", <&str as colored::Colorize>::blue("TEST")); @@ -32,20 +31,22 @@ macro_rules! test_print { // the core part has the code that can run on any platform mod core { - pub mod memstore; + pub mod config; + pub mod error; + pub mod id; pub mod instance; pub mod item; - pub mod id; + pub mod memstore; pub mod proto; - pub mod error; pub mod types; } -pub use core::*; -pub use core::instance::module::Module; -pub use core::instance::Instance; pub use core::error::MizeError; pub use core::error::MizeResult; +pub use core::instance::module::Module; +pub use core::instance::Mize; +pub use core::instance::MizePart; +pub use core::*; use std::path::PathBuf; // platform specific stuff @@ -67,7 +68,6 @@ pub mod platform { #[cfg(not(any(feature = "os-target", feature = "wasm-target")))] pub use super::super::instance_init; - //////////// load_module #[cfg(feature = "os-target")] pub use super::os::load_module; @@ -78,7 +78,6 @@ pub mod platform { #[cfg(not(any(feature = "os-target", feature = "wasm-target")))] pub use super::super::load_module; - //////////// fetch_module #[cfg(feature = "os-target")] pub use super::os::fetch_module; @@ -88,16 +87,19 @@ pub mod platform { #[cfg(not(any(feature = "os-target", feature = "wasm-target")))] pub use super::super::fetch_module; - } } +pub fn instance_init(instance: &mut core::instance::Mize) {} -pub fn instance_init(instance: &mut core::instance::Instance) {} - - -pub fn load_module(instance: &mut core::instance::Instance, name: &str, path: Option) -> MizeResult<()> { Ok(()) } - -pub fn fetch_module(instance: &mut core::instance::Instance, name: &str) -> MizeResult { Ok("oh noooooooooooooo, something went really really wrong, if this ends up in the executable....".to_owned()) } - +pub fn load_module( + instance: &mut core::instance::Mize, + name: &str, + path: Option, +) -> MizeResult<()> { + Ok(()) +} +pub fn fetch_module(instance: &mut core::instance::Mize, name: &str) -> MizeResult { + Ok("oh noooooooooooooo, something went really really wrong, if this ends up in the executable....".to_owned()) +} diff --git a/parts/mize/src/platform/os/cli.rs b/parts/mize/src/platform/os/cli.rs index e9b9ba9..cccaff7 100644 --- a/parts/mize/src/platform/os/cli.rs +++ b/parts/mize/src/platform/os/cli.rs @@ -1,30 +1,28 @@ +use clap::ArgMatches; use core::result::Result::Err; use core::unimplemented; +use flume::bounded; +use home::home_dir; +use mize::mize_err; use std::ffi::OsString; +use std::io::Read; use std::path::PathBuf; use std::str::FromStr; -use clap::ArgMatches; -use home::home_dir; -use flume::bounded; -use mize::mize_err; -use std::io::Read; use tracing::debug; use mize::error::{IntoMizeResult, MizeError, MizeResult, MizeResultTrait}; -use mize::instance::Instance; -use mize::platform::os::config_from_cli_args; -use mize::instance::subscription::Update; -use mize::platform::os::fsstore::FileStore; use mize::instance::subscription::Subscription; +use mize::instance::subscription::Update; +use mize::instance::Mize; use mize::item::{IntoItemData, ItemData}; - - +use mize::platform::os::config_from_cli_args; +use mize::platform::os::fsstore::FileStore; pub fn get(sub_matches: &ArgMatches) -> MizeResult<()> { + let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; - let instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; - - let id = sub_matches.get_one::("id") + let id = sub_matches + .get_one::("id") .ok_or(MizeError::new().msg("No id Argument specified"))?; let item = instance.get(id)?; @@ -44,15 +42,12 @@ pub fn get(sub_matches: &ArgMatches) -> MizeResult<()> { return Ok(()); } - pub fn call(sub_matches: &ArgMatches) -> MizeResult<()> { Ok(()) } - pub fn create(sub_matches: &ArgMatches) -> MizeResult<()> { - - let mut instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; + let mut instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; let item = instance.new_item()?; @@ -62,37 +57,32 @@ pub fn create(sub_matches: &ArgMatches) -> MizeResult<()> { return Ok(()); } - pub fn is_running(sub_matches: &ArgMatches) -> MizeResult<()> { - println!("not implemented"); Err(mize_err!("not implemented")) } - pub fn mount(sub_matches: &ArgMatches) -> MizeResult<()> { Ok(()) } - pub fn run(sub_matches: &ArgMatches) -> MizeResult<()> { - - let instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; + let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; instance.wait(); return Ok(()); } - pub fn set(sub_matches: &ArgMatches) -> MizeResult<()> { + let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; - let instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; - - let id = sub_matches.get_one::("id") + let id = sub_matches + .get_one::("id") .ok_or(MizeError::new().msg("No id Argument specified"))?; - let value = sub_matches.get_one::("value") + let value = sub_matches + .get_one::("value") .ok_or(MizeError::new().msg("No value Argument specified"))?; instance.set_blocking(id, value.into_item_data())?; @@ -100,12 +90,11 @@ pub fn set(sub_matches: &ArgMatches) -> MizeResult<()> { Ok(()) } - pub fn show(sub_matches: &ArgMatches) -> MizeResult<()> { + let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; - let instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; - - let id = sub_matches.get_one::("id") + let id = sub_matches + .get_one::("id") .ok_or(MizeError::new().msg("No id Argument specified"))?; let item = instance.get(id)?; @@ -124,14 +113,12 @@ pub fn show(sub_matches: &ArgMatches) -> MizeResult<()> { Ok(()) } - pub fn stop(sub_matches: &ArgMatches) -> MizeResult<()> { Ok(()) } - pub fn gui(sub_matches: &ArgMatches) -> MizeResult<()> { - let mut instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; + let mut instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; instance.load_module("mme")?; @@ -141,8 +128,7 @@ pub fn gui(sub_matches: &ArgMatches) -> MizeResult<()> { } pub fn format_cbor(sub_matches: &ArgMatches) -> MizeResult<()> { - - let mut input: Vec = Vec::new(); + let mut input: Vec = Vec::new(); let stdin = std::io::stdin(); let mut handle = stdin.lock(); //handle.read_to_end(&mut input); @@ -155,20 +141,26 @@ pub fn format_cbor(sub_matches: &ArgMatches) -> MizeResult<()> { Ok(()) } - pub fn run_from_module(cmd: &str, sub_matches: &ArgMatches) -> MizeResult<()> { let default = OsString::default(); - let mut sub_cmd_line: Vec = sub_matches.get_many::("").unwrap().map(|e| e.to_owned()).collect(); + let mut sub_cmd_line: Vec = sub_matches + .get_many::("") + .unwrap() + .map(|e| e.to_owned()) + .collect(); sub_cmd_line.insert(0, OsString::from_str(cmd)?); - let mut instance = Instance::with_config(config_from_cli_args(sub_matches)?)?; + let mut instance = Mize::with_config(config_from_cli_args(sub_matches)?)?; debug!("loading module '{}'", cmd); instance.load_module(cmd)?; - instance.get_module(cmd)?.run_cli(&instance, sub_cmd_line) - .ok_or(mize_err!("The Module '{cmd}' does not implement the run_cli() functionality"))??; + instance + .get_module(cmd)? + .run_cli(&instance, sub_cmd_line) + .ok_or(mize_err!( + "The Module '{cmd}' does not implement the run_cli() functionality" + ))??; Ok(()) } - diff --git a/parts/mize/src/platform/os/fsstore.rs b/parts/mize/src/platform/os/fsstore.rs index db05787..465a2b2 100644 --- a/parts/mize/src/platform/os/fsstore.rs +++ b/parts/mize/src/platform/os/fsstore.rs @@ -1,20 +1,20 @@ -use std::fs; -use std::path::{Path, PathBuf}; -use std::fs::OpenOptions; -use sysinfo::{System, Pid, ProcessRefreshKind, RefreshKind}; -use std::io::Write; use ciborium::Value as CborValue; +use std::fs; +use std::fs::OpenOptions; +use std::io::Write; +use std::path::{Path, PathBuf}; +use sysinfo::{Pid, ProcessRefreshKind, RefreshKind, System}; use tracing::debug; +use crate::core::id::MizeId; +use crate::core::item::{Item, ItemData}; +use crate::error::{IntoMizeResult, MizeError, MizeResult}; use crate::instance::store::IdIter; +use crate::instance::{self, Mize}; +use crate::item::get_raw_from_cbor; use crate::item::IntoItemData; use crate::memstore::MemStore; use crate::{core::instance::store::Store, mize_err}; -use crate::error::{IntoMizeResult, MizeResult, MizeError}; -use crate::core::item::{ItemData, Item}; -use crate::core::id::MizeId; -use crate::item::get_raw_from_cbor; -use crate::instance::{self, Instance}; use tokio::net::UnixStream; #[derive(Clone, Debug)] @@ -24,7 +24,6 @@ pub struct FileStore { impl FileStore { pub fn new(path_str: &str) -> MizeResult { - let path = Path::new(path_str); // create that path if it does not exist @@ -50,19 +49,25 @@ impl FileStore { fs::write(path.join("next_id"), "1"); } - Ok(FileStore { path: Path::new(&path).to_owned() }) + Ok(FileStore { + path: Path::new(&path).to_owned(), + }) } - pub fn store_is_opened(store_path: String, instance: &mut Instance) -> MizeResult { - + pub fn store_is_opened(store_path: String, instance: &mut Mize) -> MizeResult { // this was the old method.... //let valid_pid_file = valid_pid_file(Path::new(&store_path))?.is_some(); - let can_connect_to_sock = match instance.spawn_async_blocking("con_test_thread", try_connect_to_sock(store_path.clone())) { + let can_connect_to_sock = match instance + .spawn_async_blocking("con_test_thread", try_connect_to_sock(store_path.clone())) + { Ok(_) => true, Err(_) => false, }; - debug!("MiZe Store at {} opened: {}", store_path, can_connect_to_sock); + debug!( + "MiZe Store at {} opened: {}", + store_path, can_connect_to_sock + ); Ok(can_connect_to_sock) } } @@ -76,11 +81,16 @@ async fn try_connect_to_sock(store_path: String) -> MizeResult<()> { impl Store for FileStore { fn new_id(&self) -> MizeResult { - - let mut next_id: u64 = String::from_utf8(fs::read(self.path.join("next_id")) - .mize_result_msg(format!("could not read next_id at '{}'", self.path.display()))?)? + let mut next_id: u64 = + String::from_utf8(fs::read(self.path.join("next_id")).mize_result_msg(format!( + "could not read next_id at '{}'", + self.path.display() + ))?)? .parse() - .mize_result_msg(format!("could not parse next_id at '{}' to u64", self.path.display()))?; + .mize_result_msg(format!( + "could not parse next_id at '{}' to u64", + self.path.display() + ))?; let id_string = format!("{}", next_id); @@ -92,7 +102,11 @@ impl Store for FileStore { } fn set(&self, id: MizeId, data: ItemData) -> MizeResult<()> { - let path = self.path.join("store").join(id.namespace_str()).join(id.store_part()); + let path = self + .path + .join("store") + .join(id.namespace_str()) + .join(id.store_part()); fs::create_dir_all(self.path.join("store").join(id.namespace_str()))?; let file = OpenOptions::new().write(true).create(true).open(path)?; @@ -110,12 +124,18 @@ impl Store for FileStore { } fn get_value_raw(&self, id: MizeId) -> MizeResult> { - let path = self.path.join("store").join(id.namespace_str()).join(id.store_part()); + let path = self + .path + .join("store") + .join(id.namespace_str()) + .join(id.store_part()); let file = OpenOptions::new().read(true).create(true).open(path)?; - let cbor_val: CborValue = ciborium::from_reader(file) - .mize_result_msg(format!("could not read file '{}' from FileStore", self.path.join("store").join(id.store_part()).display()))?; + let cbor_val: CborValue = ciborium::from_reader(file).mize_result_msg(format!( + "could not read file '{}' from FileStore", + self.path.join("store").join(id.store_part()).display() + ))?; let path = id.path(); let mut id_iter = path.iter(); @@ -126,15 +146,27 @@ impl Store for FileStore { } fn get_value_data_full(&self, id: MizeId) -> MizeResult { - let file_path = self.path.join("store").join(id.namespace_str()).join(id.store_part()); - if !file_path.exists() { - - } - let file = OpenOptions::new().read(true).open(file_path.clone()) - .map_err(|e| mize_err!("fsstoree: Unable to open '{}', err: {}", file_path.display(), e))?; + let file_path = self + .path + .join("store") + .join(id.namespace_str()) + .join(id.store_part()); + if !file_path.exists() {} + let file = OpenOptions::new() + .read(true) + .open(file_path.clone()) + .map_err(|e| { + mize_err!( + "fsstoree: Unable to open '{}', err: {}", + file_path.display(), + e + ) + })?; - let cbor_value: CborValue = ciborium::from_reader(file) - .mize_result_msg(format!("could not read file '{}' from FileStore", self.path.join("store").join(id.store_part()).display()))?; + let cbor_value: CborValue = ciborium::from_reader(file).mize_result_msg(format!( + "could not read file '{}' from FileStore", + self.path.join("store").join(id.store_part()).display() + ))?; let data: ItemData = cbor_value.into_item_data(); let tmp = id.path(); @@ -157,7 +189,6 @@ impl Store for FileStore { } fn valid_pid_file(path: &Path) -> MizeResult> { - let pid_file_path = path.join("pid"); // if the pid file does not exist, there is no pid... @@ -166,10 +197,15 @@ fn valid_pid_file(path: &Path) -> MizeResult> { } // read pid file - let pid: u32 = String::from_utf8(fs::read(&pid_file_path) - .mize_result_msg(format!("Could not read contents of pid file at '{}'", pid_file_path.display()))?)? - .parse() - .mize_result_msg(format!("Could not parse contents of pid file at '{}' to u32", pid_file_path.display()))?; + let pid: u32 = String::from_utf8(fs::read(&pid_file_path).mize_result_msg(format!( + "Could not read contents of pid file at '{}'", + pid_file_path.display() + ))?)? + .parse() + .mize_result_msg(format!( + "Could not parse contents of pid file at '{}' to u32", + pid_file_path.display() + ))?; if Path::new("/proc").join(format!("{}", pid)).exists() { return Ok(Some(pid)); @@ -177,4 +213,3 @@ fn valid_pid_file(path: &Path) -> MizeResult> { return Ok(None); } } - diff --git a/parts/mize/src/platform/os/main.rs b/parts/mize/src/platform/os/main.rs index f5847a9..3b74d14 100644 --- a/parts/mize/src/platform/os/main.rs +++ b/parts/mize/src/platform/os/main.rs @@ -1,28 +1,27 @@ +#![allow(warnings)] -#![ allow( warnings ) ] - +use clap::builder::OsStr; +use clap::{crate_version, Arg, Command}; +use clap::{ArgAction, ArgMatches}; use std::ffi::OsString; use std::path::PathBuf; use std::process::exit; -use clap::builder::OsStr; -use clap::{ArgAction, ArgMatches}; -use clap::{Arg, crate_version, Command}; -use mize::error::{MizeError, MizeResult}; -use mize::{instance, Instance}; -use mize::item::ItemData; -use tokio::sync::{Mutex, mpsc}; -use std::sync::Arc; -use std::io::Write; use colored::Colorize; -use std::env; -use tracing_subscriber::fmt::Subscriber; -use tracing::Level; -use tracing::level_filters::LevelFilter; -use tracing_subscriber::filter::EnvFilter; +use mize::error::{MizeError, MizeResult}; +use mize::item::ItemData; use mize::platform::os::logging::init_logger; +use mize::{instance, Mize}; +use std::env; +use std::io::Write; +use std::sync::Arc; +use tokio::sync::{mpsc, Mutex}; +use tracing::level_filters::LevelFilter; +use tracing::Level; +use tracing_subscriber::filter::EnvFilter; +use tracing_subscriber::fmt::Subscriber; -use tracing::{trace, debug, info, warn, error}; +use tracing::{debug, error, info, trace, warn}; mod cli; @@ -74,7 +73,8 @@ fn main() { // some unknown command passed Some((cmd, sub_matches)) => cli::run_from_module(cmd, sub_matches), - None => Err(MizeError::new().msg("No subcommand was passed. use --help to list availavle comamnds.")), + None => Err(MizeError::new() + .msg("No subcommand was passed. use --help to list availavle comamnds.")), }; if let Err(err) = result { @@ -83,105 +83,83 @@ fn main() { } } - - - fn cli_matches() -> clap::ArgMatches { - - let main = Command::new(APPNAME) .version(crate_version!()) .author("Sebastian Moser") .about("The MiZe Command line tool") .allow_external_subcommands(true) - .arg(Arg::new("verbose") - .long("verbose") - .short('v') - .action(ArgAction::Count) - .global(true) + .arg( + Arg::new("verbose") + .long("verbose") + .short('v') + .action(ArgAction::Count) + .global(true), ) - .arg(Arg::new("log-level") - .long("log-level") - .value_name("LOGLEVEL") - .help("set the log-level to one of OFF, ERROR, WARN, INFO, DEBUG, TRACE") - .global(true) + .arg( + Arg::new("log-level") + .long("log-level") + .value_name("LOGLEVEL") + .help("set the log-level to one of OFF, ERROR, WARN, INFO, DEBUG, TRACE") + .global(true), ) - .arg(Arg::new("silent") - .long("silent") - .action(ArgAction::SetTrue) - .help("set the log-level to OFF") - .global(true) + .arg( + Arg::new("silent") + .long("silent") + .action(ArgAction::SetTrue) + .help("set the log-level to OFF") + .global(true), ) - .arg(Arg::new("folder") - .short('f') - .long("folder") - .help("The folder the Instance stores all it's data and the socket for connections") - .global(true) + .arg( + Arg::new("folder") + .short('f') + .long("folder") + .help("The folder the Instance stores all it's data and the socket for connections") + .global(true), ) - .arg(Arg::new("config") - .short('c') - .long("config") - .help("overwrite config options") - .global(true) + .arg( + Arg::new("config") + .short('c') + .long("config") + .help("overwrite config options") + .global(true), ) - .arg(Arg::new("config-file") - .long("config-file") - .help("specify a config file") - .global(true) + .arg( + Arg::new("config-file") + .long("config-file") + .help("specify a config file") + .global(true), ) .subcommand( - Command::new("run") + Command::new("run") .aliases(["r"]) - .about("Run a MiZe Instance") - ) - .subcommand(Command::new("stop") - .about("Stop a MiZe Instance") - ) + .about("Run a MiZe Instance"), + ) + .subcommand(Command::new("stop").about("Stop a MiZe Instance")) + .subcommand(Command::new("mount").aliases(["m"])) .subcommand( - Command::new("mount") - .aliases(["m"]) - ) - .subcommand( - Command::new("get") + Command::new("get") .aliases(["g"]) .arg(Arg::new("id").help("The id or path to get")) - .arg(Arg::new("recurse") - .short('r') - .action(ArgAction::Count) - ) - ) + .arg(Arg::new("recurse").short('r').action(ArgAction::Count)), + ) .subcommand( - Command::new("set") + Command::new("set") .aliases(["s"]) .arg(Arg::new("id").help("The id or path to set")) - .arg(Arg::new("value").help("The value to set the path to")) - ) + .arg(Arg::new("value").help("The value to set the path to")), + ) .subcommand( - Command::new("show") + Command::new("show") .aliases(["so"]) - .arg(Arg::new("id").help("The id or path to sub to and show")) - ) - .subcommand( - Command::new("call") - .aliases(["c"]) - ) - .subcommand( - Command::new("create") - .aliases(["cr"]) - ) - .subcommand( - Command::new("is-running") - .aliases(["isr"]) - ) - .subcommand( - Command::new("gui") - ) - .subcommand( - Command::new("format-cbor") - ) + .arg(Arg::new("id").help("The id or path to sub to and show")), + ) + .subcommand(Command::new("call").aliases(["c"])) + .subcommand(Command::new("create").aliases(["cr"])) + .subcommand(Command::new("is-running").aliases(["isr"])) + .subcommand(Command::new("gui")) + .subcommand(Command::new("format-cbor")) .arg_required_else_help(true); return main.get_matches(); } - - diff --git a/parts/mize/src/platform/os/mod.rs b/parts/mize/src/platform/os/mod.rs index 5ce3be8..37f85c8 100644 --- a/parts/mize/src/platform/os/mod.rs +++ b/parts/mize/src/platform/os/mod.rs @@ -1,25 +1,25 @@ use ciborium::Value as CborValue; +use clap::ArgMatches; +use flate2::bufread::GzDecoder; use serde::Deserialize; +use sha2::{Digest, Sha256, Sha512}; use std::env::VarError; use std::fs; -use tracing::{debug, error, info, trace, warn}; -use clap::ArgMatches; -use std::path::{Path, PathBuf}; -use std::time::UNIX_EPOCH; -use sha2::{Sha256, Sha512, Digest}; -use flate2::bufread::GzDecoder; -use tar::Archive; use std::fs::File; use std::io::copy; +use std::path::{Path, PathBuf}; +use std::time::UNIX_EPOCH; +use tar::Archive; +use tracing::{debug, error, info, trace, warn}; -use crate::id::MizeId; -use crate::instance::store::Store; -use crate::instance::Instance; use crate::error::{IntoMizeResult, MizeError, MizeResult}; +use crate::id::MizeId; +use crate::instance::module::EmptyModule; +use crate::instance::store::Store; +use crate::instance::Mize; use crate::item::{data_from_string, IntoItemData, ItemData}; use crate::memstore::MemStore; use crate::{mize_err, Module}; -use crate::instance::module::EmptyModule; use self::fsstore::FileStore; @@ -33,8 +33,7 @@ mod unix_socket; use crate::platform::os::unix_socket::UnixListener; //mod web; - -pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { +pub fn os_instance_init(instance: &mut Mize) -> MizeResult<()> { // this is the code, that runs to initialize an Instance on a system with an os present. ////// load MIZE_CONFIG_FILE as the instance, which is item 0 @@ -43,16 +42,19 @@ pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { let config = config_from_file(config_file_path)?; debug!("env var MIZE_CONFIG_FILE present"); instance.set_blocking("0", config)?; - trace!("config after MIZE_CONFIG_FILE env var: {}", instance.get("self/config")?); + trace!( + "config after MIZE_CONFIG_FILE env var: {}", + instance.get("self/config")? + ); } Err(var_err) => match var_err { VarError::NotPresent => { debug!("env var MIZE_CONFIG_FILE NOT present"); - }, + } VarError::NotUnicode(_) => { warn!("env var MIZE_CONFIG_FILE is not Unicode, so not reading it") - }, - } + } + }, }; ////// load config from MIZE_CONFIG env var @@ -61,44 +63,49 @@ pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { let config = data_from_string(config_string)?; debug!("env var MIZE_CONFIG present"); instance.set_blocking("self/config", config)?; - trace!("config after MIZE_CONFIG env var: {}", instance.get("self/config")?); + trace!( + "config after MIZE_CONFIG env var: {}", + instance.get("self/config")? + ); } Err(var_err) => match var_err { VarError::NotPresent => { debug!("env var MIZE_CONFIG NOT present") - }, + } VarError::NotUnicode(_) => { warn!("env var MIZE_CONFIG is not Unicode, so not reading it") - }, - } + } + }, }; - ////// if a config.store_path is set, upgrade to the filestore there let mut test = instance.get("0")?.as_data_full()?; let mut store_path = match instance.get("self/config/store_path")?.value_string() { - Ok(path) => { - path - }, + Ok(path) => path, Err(e) => { // the default store_path: $HOME/.mize let home_dir = if let Some(dir) = std::env::home_dir() { dir } else { - return Err(mize_err!("could not get home_dir and store_path is not set in the config")); + return Err(mize_err!( + "could not get home_dir and store_path is not set in the config" + )); }; let store_path_buff = home_dir.join(".mize"); let store_path = store_path_buff.display().to_string(); - instance.set_blocking("self/config/store_path", store_path.clone().into_item_data())?; + instance.set_blocking( + "self/config/store_path", + store_path.clone().into_item_data(), + )?; let store_path = instance.get("self/config/store_path")?.value_string()?; println!("store_path: {}", store_path); store_path - }, + } }; if FileStore::store_is_opened(store_path.to_owned(), instance)? { @@ -117,7 +124,6 @@ pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { { error!("CONNECTING... would connect, but that is not implemented on windows yet"); } - } else { // else open it ourselves let file_store = FileStore::new(store_path.as_str())?; @@ -132,7 +138,7 @@ pub fn os_instance_init(instance: &mut Instance) -> MizeResult<()> { #[cfg(target_family = "windows")] { - warn!("would add a Listener on a local socket, but that is not yet implemented for windows");; + warn!("would add a Listener on a local socket, but that is not yet implemented for windows"); } } @@ -149,15 +155,24 @@ pub fn seconds_since_modification(path: &Path) -> MizeResult { Ok(duration.as_secs()) } -pub fn get_module_hash(instance: &mut Instance, name: &str, mut options: ItemData) -> MizeResult<(String, String)> { - +pub fn get_module_hash( + instance: &mut Mize, + name: &str, + mut options: ItemData, +) -> MizeResult<(String, String)> { let mut selector_data = instance.get("self/config/selector")?.as_data_full()?; // handle the case, when we want a module for not the system we are running on... println!("get_module_hash: name: {}", name); let mut name_parts = name.split("."); - if name_parts.next().ok_or(mize_err!("no 0th element in the modName"))? == "cross" { - let system = name_parts.next().ok_or(mize_err!("no 1th element in the modName"))?; + if name_parts + .next() + .ok_or(mize_err!("no 0th element in the modName"))? + == "cross" + { + let system = name_parts + .next() + .ok_or(mize_err!("no 1th element in the modName"))?; let mod_name: String = name_parts.collect(); println!("get_module_hash: mod_name: {}", mod_name); if mod_name == "" { @@ -183,7 +198,8 @@ pub fn get_module_hash(instance: &mut Instance, name: &str, mut options: ItemDat let result = hasher.finalize(); - let mut hex: String = result.iter() + let mut hex: String = result + .iter() .map(|b| format!("{:02x}", b).to_string()) .collect::>() .join(""); @@ -191,25 +207,46 @@ pub fn get_module_hash(instance: &mut Instance, name: &str, mut options: ItemDat hex.truncate(32); return Ok((hex, selector_str)); - } -fn download_module(instance: &mut Instance, store_path: &str, module_url: &str, module_hash: &str, module_name: &str, module_selector: &str) -> MizeResult<()> { - - +fn download_module( + instance: &mut Mize, + store_path: &str, + module_url: &str, + module_hash: &str, + module_name: &str, + module_selector: &str, +) -> MizeResult<()> { let tmp_file_path_gz = format!("{}/{}.tar.gz", store_path, module_hash); - let tmp_gz_file = if !PathBuf::from(tmp_file_path_gz.clone()).exists() { - + let tmp_gz_file = if !PathBuf::from(tmp_file_path_gz.clone()).exists() { let mut tmp_gz_file = File::create(&tmp_file_path_gz)?; - debug!("downloading module '{}' with hash: {}", module_name, module_hash); + debug!( + "downloading module '{}' with hash: {}", + module_name, module_hash + ); - let response = http_req::request::get(format!("http://{}/mize/dist/{}-{}.tar.gz", module_url, module_hash, module_name), &mut tmp_gz_file)?; + let response = http_req::request::get( + format!( + "http://{}/mize/dist/{}-{}.tar.gz", + module_url, module_hash, module_name + ), + &mut tmp_gz_file, + )?; let code = response.status_code(); if code != 200.into() { - return Err(mize_err!("failed to get module '{}' with hash '{}' and selector: {}", module_name, module_hash, module_selector).msg(format!("the http request to fetch the module returned a status code of: {}", code))); + return Err(mize_err!( + "failed to get module '{}' with hash '{}' and selector: {}", + module_name, + module_hash, + module_selector + ) + .msg(format!( + "the http request to fetch the module returned a status code of: {}", + code + ))); } tmp_gz_file @@ -233,10 +270,15 @@ fn download_module(instance: &mut Instance, store_path: &str, module_url: &str, Ok(()) } -pub fn fetch_module(instance: &mut Instance, module_name: &str) -> MizeResult { - +pub fn fetch_module(instance: &mut Mize, module_name: &str) -> MizeResult { let module_name_with_slashes = module_name.replace(".", "/"); - if let Ok(module_path) = instance.get(format!("self/config/module_dir/{}", module_name_with_slashes))?.value_string() { + if let Ok(module_path) = instance + .get(format!( + "self/config/module_dir/{}", + module_name_with_slashes + ))? + .value_string() + { // in case a dir is configured, which holds the modules output return Ok(module_path); } else { @@ -245,29 +287,41 @@ pub fn fetch_module(instance: &mut Instance, module_name: &str) -> MizeResult) -> MizeResult<()> { - - let module_path = if path.is_some() { +pub fn load_module(instance: &mut Mize, module_name: &str, path: Option) -> MizeResult<()> { + let module_path = if path.is_some() { format!("{}/lib/libmize_module_{}.so", path.unwrap(), module_name) - - } else { - format!("{}/lib/libmize_module_{}.so", fetch_module(instance, module_name)?, module_name) + } else { + format!( + "{}/lib/libmize_module_{}.so", + fetch_module(instance, module_name)?, + module_name + ) }; let lib = unsafe { libloading::Library::new(module_path)? }; - let func: libloading::Symbol, Instance) -> ()> = unsafe { lib.get(format!("get_mize_module_{}", module_name).as_bytes())? }; + let func: libloading::Symbol< + unsafe extern "C" fn(&mut Box, Mize) -> (), + > = unsafe { lib.get(format!("get_mize_module_{}", module_name).as_bytes())? }; let mut module: Box = Box::new(EmptyModule {}); @@ -289,7 +343,6 @@ pub fn load_module(instance: &mut Instance, module_name: &str, path: Option MizeResult { - let mut config = ItemData::new(); if let Some(config_file_path) = matches.get_one::("config-file") { @@ -305,9 +358,7 @@ pub fn config_from_cli_args(matches: &ArgMatches) -> MizeResult { return Ok(config); } - pub fn config_from_file(file_path: String) -> MizeResult { - let toml_string = fs::read_to_string(&file_path) .mize_result_msg(format!("Could not read file {} as mize config", &file_path))?; @@ -315,7 +366,3 @@ pub fn config_from_file(file_path: String) -> MizeResult { return Ok(item_data); } - - - - diff --git a/parts/mize/src/platform/os/unix_socket.rs b/parts/mize/src/platform/os/unix_socket.rs index 12e2f38..3786a1a 100644 --- a/parts/mize/src/platform/os/unix_socket.rs +++ b/parts/mize/src/platform/os/unix_socket.rs @@ -1,15 +1,15 @@ +use ciborium::Value as CborValue; +use flume::{unbounded, Receiver, Sender}; use std::fs; use std::path::{Path, PathBuf}; -use tokio::net::{UnixListener as TokioUnixListener, UnixStream}; +use tokio::io::{AsyncReadExt, AsyncWriteExt, Interest}; use tokio::net::unix::{OwnedReadHalf, OwnedWriteHalf}; -use tokio::io::{Interest, AsyncReadExt, AsyncWriteExt}; -use flume::{Receiver, Sender, unbounded}; -use ciborium::Value as CborValue; -use tracing::{info, warn, debug}; +use tokio::net::{UnixListener as TokioUnixListener, UnixStream}; +use tracing::{debug, info, warn}; +use crate::error::{IntoMizeResult, MizeError, MizeResult}; use crate::instance::connection::{ConnListener, Connection}; -use crate::instance::{self, Instance}; -use crate::error::{MizeError, MizeResult, IntoMizeResult}; +use crate::instance::{self, Mize}; use crate::proto::{self, MizeMessage}; pub struct UnixListener { @@ -18,19 +18,30 @@ pub struct UnixListener { impl UnixListener { pub fn new(store_path: PathBuf) -> MizeResult { - Ok(UnixListener { sock_path: store_path.join("sock").to_owned() }) + Ok(UnixListener { + sock_path: store_path.join("sock").to_owned(), + }) } - } +pub fn connect(instance: &mut Mize, store_path: PathBuf) -> MizeResult<()> { + let conn_id = instance.spawn_async_blocking( + "unix_connection", + connect_async(instance.clone(), store_path), + )?; -pub fn connect(instance: &mut Instance, store_path: PathBuf) -> MizeResult<()> { - let conn_id = instance.spawn_async_blocking("unix_connection", connect_async(instance.clone(), store_path) )?; - - let ns_of_peer_str = instance.get(format!("inst/con_by_id/{}/peer/0/config/namespace", conn_id))?.value_string()?; + let ns_of_peer_str = instance + .get(format!( + "inst/con_by_id/{}/peer/0/config/namespace", + conn_id + ))? + .value_string()?; let ns_of_peer = instance.namespace_from_string(ns_of_peer_str)?; - info!("connect_async ... ns_of_peer: {}", ns_of_peer.clone().as_string()); + info!( + "connect_async ... ns_of_peer: {}", + ns_of_peer.clone().as_string() + ); instance.connection_set_namespace(conn_id, ns_of_peer.clone()); instance.set_namespace(ns_of_peer); @@ -38,15 +49,13 @@ pub fn connect(instance: &mut Instance, store_path: PathBuf) -> MizeResult<()> { Ok(()) } - -async fn connect_async(mut instance: Instance, store_path: PathBuf) -> MizeResult { +async fn connect_async(mut instance: Mize, store_path: PathBuf) -> MizeResult { let mut stream = UnixStream::connect(store_path.join("sock")).await?; let (unix_read, unix_write) = stream.into_split(); let (send_tx, send_rx) = unbounded::(); - - let conn_id = instance.new_connection(send_tx)?; + let conn_id = instance.new_connection(send_tx)?; let cloned_instance = instance.clone(); instance.spawn("incomming", move || { @@ -58,7 +67,6 @@ async fn connect_async(mut instance: Instance, store_path: PathBuf) -> MizeResul Ok(()) }); - let outgoing_cloned_instance = instance.clone(); instance.spawn("outgoing", move || { let result = unix_outgoing(unix_write, send_rx, outgoing_cloned_instance, conn_id); @@ -72,31 +80,32 @@ async fn connect_async(mut instance: Instance, store_path: PathBuf) -> MizeResul return Ok(conn_id); } - impl ConnListener for UnixListener { - fn listen(self, mut instance: Instance) -> MizeResult<()> { + fn listen(self, mut instance: Mize) -> MizeResult<()> { instance.spawn_async("unix listen async", unix_listen(self, instance.clone())); Ok(()) } } - -async fn unix_listen(listener: UnixListener, mut instance: Instance) -> MizeResult<()> { +async fn unix_listen(listener: UnixListener, mut instance: Mize) -> MizeResult<()> { // remove the file at sock_path if it already exists fs::remove_file(&listener.sock_path); - let listener = TokioUnixListener::bind(&listener.sock_path) - .mize_result_msg(format!("Could not bind to unix socket at '{}'", listener.sock_path.display()))?; + let listener = TokioUnixListener::bind(&listener.sock_path).mize_result_msg(format!( + "Could not bind to unix socket at '{}'", + listener.sock_path.display() + ))?; loop { - let (mut unix_sock, addr) = listener.accept().await + let (mut unix_sock, addr) = listener + .accept() + .await .mize_result_msg("Error while accepting Unix sock connection")?; info!("new connection"); let (send_tx, send_rx) = unbounded::(); let (unix_read, unix_write) = unix_sock.into_split(); - let conn_id = instance.new_connection(send_tx)?; let cloned_instance = instance.clone(); instance.spawn("incomming", move || { @@ -120,21 +129,35 @@ async fn unix_listen(listener: UnixListener, mut instance: Instance) -> MizeResu } } - -fn unix_outgoing(mut unix_write: OwnedWriteHalf, send_rx: Receiver, mut instance: Instance, conn_id: u64) -> MizeResult<()> { +fn unix_outgoing( + mut unix_write: OwnedWriteHalf, + send_rx: Receiver, + mut instance: Mize, + conn_id: u64, +) -> MizeResult<()> { for msg in send_rx { debug!("unix outgoing got msg: {}", msg); - let adapter = MyCiboriumWriter { inner: &mut unix_write, instance: &mut instance }; + let adapter = MyCiboriumWriter { + inner: &mut unix_write, + instance: &mut instance, + }; let value = msg.value(); ciborium::into_writer(&value, adapter)? } Ok(()) } -fn unix_incomming(mut unix_read: OwnedReadHalf, mut instance: Instance, conn_id: u64) -> MizeResult<()> { +fn unix_incomming( + mut unix_read: OwnedReadHalf, + mut instance: Mize, + conn_id: u64, +) -> MizeResult<()> { loop { //println!("unix incoming loop..."); - let adapter = MyCiboriumReader { inner: &mut unix_read, instance: &mut instance }; + let adapter = MyCiboriumReader { + inner: &mut unix_read, + instance: &mut instance, + }; let value: CborValue = ciborium::from_reader(adapter)?; if let CborValue::Integer(_) = value { break; @@ -146,10 +169,9 @@ fn unix_incomming(mut unix_read: OwnedReadHalf, mut instance: Instance, conn_id: Ok(()) } - struct MyCiboriumWriter<'a> { inner: &'a mut OwnedWriteHalf, - instance: &'a mut Instance, + instance: &'a mut Mize, } impl<'a> ciborium_io::Write for MyCiboriumWriter<'a> { @@ -172,7 +194,7 @@ impl<'a> ciborium_io::Write for MyCiboriumWriter<'a> { struct MyCiboriumReader<'a> { inner: &'a mut OwnedReadHalf, - instance: &'a mut Instance, + instance: &'a mut Mize, } async fn test(test: &mut OwnedReadHalf, buf: &mut [u8]) { @@ -204,9 +226,8 @@ impl<'a> ciborium_io::Read for MyCiboriumReader<'a> { // if we read 0 bytes, that means the reader stream closed and we should terminate the // connection //if num_read == 0 { - //return Err(MizeError::new().msg("ReceiverStream closed")); + //return Err(MizeError::new().msg("ReceiverStream closed")); //} Ok(()) } } -