diff --git a/.vscode/settings.json b/.vscode/settings.json index f4fe30c19..f7116e9e8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "rust-analyzer.linkedProjects": [ "Cargo.toml", + "examples/bridge_echo/Cargo.toml", "examples/cat_facts/Cargo.toml", "examples/counter/Cargo.toml", "examples/hello_world/Cargo.toml", diff --git a/examples/bridge_echo/Cargo.lock b/examples/bridge_echo/Cargo.lock index 85124cfb2..5a688adc8 100644 --- a/examples/bridge_echo/Cargo.lock +++ b/examples/bridge_echo/Cargo.lock @@ -71,6 +71,17 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "1.1.1" @@ -134,6 +145,15 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "askama" version = "0.12.1" @@ -334,9 +354,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "attribute-derive" -version = "0.8.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c94f43ede6f25dab1dea046bff84d85dea61bd49aba7a9011ad66c0d449077b" +checksum = "c124f12ade4e670107b132722d0ad1a5c9790bcbc1b265336369ea05626b4498" dependencies = [ "attribute-derive-macro", "proc-macro2", @@ -346,13 +366,13 @@ dependencies = [ [[package]] name = "attribute-derive-macro" -version = "0.8.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b409e2b2d2dc206d2c0ad3575a93f001ae21a1593e2d0c69b69c308e63f3b422" +checksum = "8b217a07446e0fb086f83401a98297e2d81492122f5874db5391bd270a185f88" dependencies = [ "collection_literals", "interpolator", - "manyhow", + "proc-macro-error", "proc-macro-utils", "proc-macro2", "quote", @@ -432,6 +452,15 @@ dependencies = [ "generic-array", ] +[[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 = "blocking" version = "1.4.0" @@ -454,6 +483,12 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "bytemuck" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" + [[package]] name = "bytes" version = "0.5.6" @@ -513,6 +548,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "num-traits", +] + [[package]] name = "ciborium" version = "0.2.1" @@ -633,11 +677,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d379af7f68bfc21714c6c7dea883544201741d2ce8274bb12fa54f89507f52a7" dependencies = [ "async-trait", + "json5", "lazy_static", "nom", "pathdiff", + "ron", + "rust-ini", "serde", + "serde_json", "toml", + "yaml-rust", ] [[package]] @@ -713,7 +762,7 @@ dependencies = [ "hmac", "percent-encoding", "rand 0.8.5", - "sha2", + "sha2 0.9.9", "time", "version_check", ] @@ -785,6 +834,16 @@ dependencies = [ "syn 2.0.37", ] +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + [[package]] name = "crypto-mac" version = "0.10.1" @@ -903,18 +962,46 @@ dependencies = [ "generic-array", ] +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", +] + [[package]] name = "discard" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "dlv-list" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + [[package]] name = "drain_filter_polyfill" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "669a445ee724c5c69b1b06fe0b63e70a1c84bc9bb7d9696cd4f4e3ec45050408" +[[package]] +name = "educe" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0042ff8246a363dbe77d2ceedb073339e85a804b9a47636c6e016a9a32c05f" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "either" version = "1.9.0" @@ -930,6 +1017,19 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enum-ordinalize" +version = "3.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bf1fa3f06bbff1ea5b1a9c7b14aa992a39657db60a2759457328d7e058f49ee" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -963,6 +1063,12 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fast-srgb8" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd2e7510819d6fbf51a5545c8f922716ecfb14df168a3242f7d33e0239efe6a1" + [[package]] name = "fastrand" version = "1.9.0" @@ -1256,6 +1362,9 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] [[package]] name = "hashbrown" @@ -1290,7 +1399,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" dependencies = [ - "digest", + "digest 0.9.0", "hmac", ] @@ -1301,7 +1410,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac", - "digest", + "digest 0.9.0", ] [[package]] @@ -1543,15 +1652,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.9" @@ -1567,6 +1667,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -1584,9 +1695,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "leptos" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3885e75a25bbf43c95350cf2f6b9f5228a3d911e28512c44c2a6c8aa49e9c9" +checksum = "65154cd0fc2f505a1676b870d5c055dec9dafe4d6081358ef1d7e357d6f222c5" dependencies = [ "cfg-if", "leptos_config", @@ -1597,16 +1708,24 @@ dependencies = [ "server_fn", "tracing", "typed-builder", - "typed-builder-macro", - "wasm-bindgen", - "web-sys", +] + +[[package]] +name = "leptos_chart" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fead51e104614563b9b1f952e0489da0ea40160ec7f58a4b5f58a641b69de171" +dependencies = [ + "leptos", + "log", + "theta-chart", ] [[package]] name = "leptos_config" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3936a83035a4ec03487792d8c9c2c5ad00c269d09701d102630ac5c31caa463" +checksum = "0108f6c8409c99fcf25f4c55a56b4bf9afeeb58f643879bb115d4258b9e22979" dependencies = [ "config", "regex", @@ -1617,18 +1736,19 @@ dependencies = [ [[package]] name = "leptos_dom" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cbea8aeea07633b3559818fa963c03857751fbafc6bb4a73c995662836070e1" +checksum = "a5a92b7a30d6e1363233211babdd59fdd983f28dc3aa6aebbd7bfbdd15630c73" dependencies = [ "async-recursion", "cfg-if", "drain_filter_polyfill", + "educe", "futures", "getrandom 0.2.10", "html-escape", "indexmap 2.0.2", - "itertools 0.10.5", + "itertools", "js-sys", "leptos_reactive", "once_cell", @@ -1647,9 +1767,9 @@ dependencies = [ [[package]] name = "leptos_hot_reload" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b56ec18e255737108b4f4d570c1c4f036f54a9989befe2658758500b636ebda4" +checksum = "6ef84aede40b027d1a4addd9bd54c89de722272429f7b21da40b04f9ebe5e3b2" dependencies = [ "anyhow", "camino", @@ -1665,15 +1785,15 @@ dependencies = [ [[package]] name = "leptos_macro" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae8be584ba63e002cec113e0a831f2ba17ad452104781a2b1b65555db049779" +checksum = "9cc27567e059d8ab630a33bf782a81bb2e10178011b8c97c080aafcf09c4e5e0" dependencies = [ "attribute-derive", "cfg-if", "convert_case 0.6.0", "html-escape", - "itertools 0.11.0", + "itertools", "leptos_hot_reload", "prettyplease", "proc-macro-error", @@ -1688,16 +1808,15 @@ dependencies = [ [[package]] name = "leptos_reactive" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ec5366c79892fa8232dcfa6f05d610d0fd780af155fea8c466e77da18e744f" +checksum = "1b4fc821e6a8646635b721dd58b5604b5c447eb3b21c464b3837cd2063a6b209" dependencies = [ "base64 0.21.4", "cfg-if", "futures", "indexmap 2.0.2", "js-sys", - "pin-project", "rustc-hash", "self_cell", "serde", @@ -1713,9 +1832,9 @@ dependencies = [ [[package]] name = "leptos_server" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f4f7221a323c029877ffb09e97d38cc805f1a5821f9554ecf0e7f6852100c" +checksum = "cc28e6ae7ca7bd36fc865fb844ecb27ddf72a0eb9514b7ee45d0cad6cf930c7d" dependencies = [ "inventory", "lazy_static", @@ -1755,6 +1874,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -1781,35 +1906,22 @@ dependencies = [ ] [[package]] -name = "manyhow" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516b76546495d933baa165075b95c0a15e8f7ef75e53f56b19b7144d80fd52bd" -dependencies = [ - "manyhow-macros", - "proc-macro2", - "quote", - "syn 2.0.37", -] - -[[package]] -name = "manyhow-macros" -version = "0.8.1" +name = "matchers" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ba072c0eadade3160232e70893311f1f8903974488096e2eb8e48caba2f0cf1" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "proc-macro-utils", - "proc-macro2", - "quote", + "regex-automata 0.1.10", ] [[package]] -name = "matchers" -version = "0.1.0" +name = "matrixmultiply" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" dependencies = [ - "regex-automata 0.1.10", + "autocfg", + "rawpointer", ] [[package]] @@ -1860,6 +1972,33 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "nalgebra" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" +dependencies = [ + "approx", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "nom" version = "7.1.3" @@ -1880,6 +2019,56 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.16.0" @@ -1929,6 +2118,16 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] + [[package]] name = "overload" version = "0.1.1" @@ -1941,6 +2140,29 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56d80efc4b6721e8be2a10a5df21a30fa0b470f1539e53d8b4e6e75faf938b63" +[[package]] +name = "palette" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e2f34147767aa758aa649415b50a69eeb46a67f9dc7db8011eeb3d84b351dc" +dependencies = [ + "approx", + "fast-srgb8", + "palette_derive", + "phf 0.11.2", +] + +[[package]] +name = "palette_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7db010ec5ff3d4385e4f133916faacd9dad0f6a09394c92d825b3aed310fa0a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "parking" version = "2.1.1" @@ -1988,24 +2210,89 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pest" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c022f1e7b65d6a24c0dbbd5fb344c66881bc01f3e5ae74a1c8100f2f985d98a4" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35513f630d46400a977c4cb58f78e1bfbe01434316e60c37d27b9ad6139c66d8" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc9fc1b9e7057baba189b5c626e2d6f40681ae5b6eb064dc7c7834101ec8123a" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.37", +] + +[[package]] +name = "pest_meta" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df74e9e7ec4053ceb980e7c0c8bd3594e977fde1af91daba9c928e8e8c6708d" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.8", +] + [[package]] name = "phf" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ - "phf_macros", - "phf_shared", + "phf_macros 0.10.0", + "phf_shared 0.10.0", "proc-macro-hack", ] +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros 0.11.2", + "phf_shared 0.11.2", +] + [[package]] name = "phf_generator" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" dependencies = [ - "phf_shared", + "phf_shared 0.10.0", + "rand 0.8.5", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared 0.11.2", "rand 0.8.5", ] @@ -2015,14 +2302,27 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" dependencies = [ - "phf_generator", - "phf_shared", + "phf_generator 0.10.0", + "phf_shared 0.10.0", "proc-macro-hack", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator 0.11.2", + "phf_shared 0.11.2", + "proc-macro2", + "quote", + "syn 2.0.37", +] + [[package]] name = "phf_shared" version = "0.10.0" @@ -2032,6 +2332,15 @@ dependencies = [ "siphasher", ] +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.3" @@ -2296,6 +2605,12 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + [[package]] name = "redox_syscall" version = "0.3.5" @@ -2383,6 +2698,17 @@ dependencies = [ "winreg", ] +[[package]] +name = "ron" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a" +dependencies = [ + "base64 0.13.1", + "bitflags", + "serde", +] + [[package]] name = "rstml" version = "0.11.2" @@ -2397,6 +2723,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2447,6 +2783,15 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -2538,7 +2883,7 @@ checksum = "f8c9331265d81c61212dc75df7b0836544ed8e32dba77a522f113805ff9a948e" dependencies = [ "heck 0.3.3", "include_dir", - "phf", + "phf 0.10.1", "serde", "serde-reflection", "textwrap", @@ -2624,9 +2969,9 @@ dependencies = [ [[package]] name = "server_fn" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29eefae61211e81059a092a3428612c475a3a28e0ea4fb3fd49b0a940d837f84" +checksum = "3fcddd58a35e4fd00f15dac8f2fc08deed175d8178b2c3e615f59a7e7be6fed7" dependencies = [ "ciborium", "const_format", @@ -2648,9 +2993,9 @@ dependencies = [ [[package]] name = "server_fn_macro" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f68140099f8e55bd526dc176d17d341189bf669d45216c4797ddc344610a84a4" +checksum = "9083155d5a075eda2d08f18663e4789e0d447a1000b225bc4e1746e849c95c8e" dependencies = [ "const_format", "proc-macro-error", @@ -2663,9 +3008,9 @@ dependencies = [ [[package]] name = "server_fn_macro_default" -version = "0.5.0" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee874f357d640ad221ba0c27c2559fa3d1434f7f7bbf688a34118518c5924b7" +checksum = "8dba6c99de6539ec3193130f764427ead9d784a76ca3126f38e56a6a0b7a2f3d" dependencies = [ "server_fn_macro", "syn 2.0.37", @@ -2692,13 +3037,24 @@ version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if", "cpufeatures", - "digest", + "digest 0.9.0", "opaque-debug", ] +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sharded-slab" version = "0.1.6" @@ -2748,6 +3104,19 @@ dependencies = [ "libc", ] +[[package]] +name = "simba" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", + "wide", +] + [[package]] name = "siphasher" version = "0.3.11" @@ -2968,6 +3337,18 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "theta-chart" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc1c58ed53cc331cbf490d4ba183b9941361c6765a20cadb473dac9c59fb5b5" +dependencies = [ + "approx", + "chrono", + "nalgebra", + "palette", +] + [[package]] name = "thiserror" version = "1.0.49" @@ -3191,22 +3572,13 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "typed-builder" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34085c17941e36627a879208083e25d357243812c30e7d7387c3b954f30ade16" -dependencies = [ - "typed-builder-macro", -] - -[[package]] -name = "typed-builder-macro" -version = "0.16.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f03ca4cb38206e2bef0700092660bb74d696f808514dae47fa1467cbfe26e96e" +checksum = "64cba322cb9b7bc6ca048de49e83918223f35e7a86311267013afff257004870" dependencies = [ "proc-macro2", "quote", - "syn 2.0.37", + "syn 1.0.109", ] [[package]] @@ -3215,6 +3587,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "unicase" version = "2.7.0" @@ -3566,6 +3944,7 @@ dependencies = [ "console_error_panic_hook", "console_log", "leptos", + "leptos_chart", "log", "shared", ] @@ -3589,6 +3968,16 @@ dependencies = [ "nom", ] +[[package]] +name = "wide" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebecebefc38ff1860b4bc47550bbfa63af5746061cf0d29fcd7fa63171602598" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3702,6 +4091,15 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "yansi" version = "1.0.0-rc.1" diff --git a/examples/bridge_echo/shared/src/app.rs b/examples/bridge_echo/shared/src/app.rs index 0fbe857a5..bd0461bca 100644 --- a/examples/bridge_echo/shared/src/app.rs +++ b/examples/bridge_echo/shared/src/app.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + // ANCHOR: app use crux_core::render::Render; use crux_macros::Effect; @@ -5,19 +7,28 @@ use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug)] pub enum Event { + Start(usize), + Stop, Tick, NewPeriod, } +const EMA_ALPHA: f64 = 0.2; // TODO tune! + #[derive(Default, Debug, PartialEq)] pub struct Model { + sample_period: Option, log: Vec, count: usize, + rate: f64, // per second } #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct ViewModel { pub count: usize, + pub rate: f64, + pub log: Vec, + pub running: bool, } #[cfg_attr(feature = "typegen", derive(crux_macros::Export))] @@ -38,9 +49,48 @@ impl crux_core::App for App { fn update(&self, event: Self::Event, model: &mut Self::Model, caps: &Self::Capabilities) { match event { - Event::Tick => model.count += 1, + Event::Start(msecs) => { + if model.sample_period.is_some() { + return; + } + + model.count = 0; + model.rate = 0.0; + model.log = vec![]; + model.sample_period = Some(Duration::from_millis(msecs as u64)); + } + Event::Stop => { + if model.sample_period.is_none() { + return; + } + + model.sample_period = None; + } + Event::Tick => { + if model.sample_period.is_none() { + return; + } + + model.count += 1 + } Event::NewPeriod => { - model.log.push(model.count); + let Some(period_duration) = model.sample_period else { + return; + }; + + // Normalise count to 'per second' scale + let count_per_second = + model.count as f64 * (1000.0 / period_duration.as_millis() as f64); + + model.log.push(count_per_second as usize); + + // Filter with an exponential moving average + model.rate = if model.rate > 0.0 { + model.rate * (1.0 - EMA_ALPHA) + EMA_ALPHA * count_per_second + } else { + count_per_second + }; + model.count = 0; } }; @@ -49,7 +99,12 @@ impl crux_core::App for App { } fn view(&self, model: &Self::Model) -> Self::ViewModel { - ViewModel { count: model.count } + ViewModel { + count: model.count, + rate: model.rate, + log: model.log.clone(), + running: model.sample_period.is_some(), + } } } // ANCHOR_END: impl_app @@ -61,19 +116,133 @@ mod test { use super::*; use crux_core::{assert_effect, testing::AppTester}; + #[test] + fn start_resets_everything() { + let app = AppTester::::default(); + let mut model = Model { + sample_period: None, + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + app.update(Event::Start(1000), &mut model); + + let expected = Model { + sample_period: Some(Duration::from_millis(1000)), + log: vec![], + count: 0, + rate: 0.0, + }; + + assert_eq!(model, expected); + } + + #[test] + fn start_does_nothing_when_already_running() { + let app = AppTester::::default(); + let mut model = Model { + sample_period: Some(Duration::from_millis(300)), + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + app.update(Event::Start(1000), &mut model); + + let expected = Model { + sample_period: Some(Duration::from_millis(300)), + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + assert_eq!(model, expected); + } + + #[test] + fn stop_resets_sample_period() { + let app = AppTester::::default(); + let mut model = Model { + sample_period: Some(Duration::from_millis(300)), + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + app.update(Event::Stop, &mut model); + + let expected = Model { + sample_period: None, + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + assert_eq!(model, expected); + } + + #[test] + fn stop_does_nothing_when_not_running() { + let app = AppTester::::default(); + let mut model = Model { + sample_period: None, + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + app.update(Event::Stop, &mut model); + + let expected = Model { + sample_period: None, + log: vec![20, 23, 42], + count: 57, + rate: 45.0, + }; + + assert_eq!(model, expected); + } + #[test] fn shows_initial_count() { let app = AppTester::::default(); let model = Model::default(); let actual_view = app.view(&model); - let expected_view = ViewModel { count: 0 }; + let expected_view = ViewModel { + count: 0, + rate: 0.0, + log: vec![], + running: false, + }; + + assert_eq!(actual_view, expected_view); + } + + #[test] + fn increments_count_when_running() { + let app = AppTester::::default(); + let mut model = Model::default(); + + app.update(Event::Start(500), &mut model); + app.update(Event::Tick, &mut model); + app.update(Event::Tick, &mut model); + app.update(Event::Tick, &mut model); + + let actual_view = app.view(&model); + let expected_view = ViewModel { + count: 3, + rate: 0.0, + log: vec![], + running: true, + }; assert_eq!(actual_view, expected_view); } #[test] - fn increments_count() { + fn ignores_tick_when_not_running() { let app = AppTester::::default(); let mut model = Model::default(); @@ -82,7 +251,12 @@ mod test { app.update(Event::Tick, &mut model); let actual_view = app.view(&model); - let expected_view = ViewModel { count: 3 }; + let expected_view = ViewModel { + count: 0, + rate: 0.0, + log: vec![], + running: false, + }; assert_eq!(actual_view, expected_view); } @@ -92,6 +266,7 @@ mod test { let app = AppTester::::default(); let mut model = Model::default(); + app.update(Event::Start(200), &mut model); app.update(Event::Tick, &mut model); app.update(Event::Tick, &mut model); app.update(Event::Tick, &mut model); @@ -102,8 +277,10 @@ mod test { app.update(Event::Tick, &mut model); let expected = Model { - log: vec![3, 2], + sample_period: Some(Duration::from_millis(200)), + log: vec![15, 10], count: 1, + rate: 15.0 * (1.0 - EMA_ALPHA) + 10.0 * EMA_ALPHA, }; assert_eq!(model, expected); } @@ -113,6 +290,7 @@ mod test { let app = AppTester::::default(); let mut model = Model::default(); + app.update(Event::Start(500), &mut model); let update = app.update(Event::Tick, &mut model); assert_effect!(update, Effect::Render(_)); @@ -123,6 +301,7 @@ mod test { let app = AppTester::::default(); let mut model = Model::default(); + app.update(Event::Start(500), &mut model); let update = app.update(Event::NewPeriod, &mut model); assert_effect!(update, Effect::Render(_)); diff --git a/examples/bridge_echo/web-leptos/Cargo.toml b/examples/bridge_echo/web-leptos/Cargo.toml index 1691b15c6..0aa087220 100644 --- a/examples/bridge_echo/web-leptos/Cargo.toml +++ b/examples/bridge_echo/web-leptos/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" [dependencies] console_error_panic_hook = "0.1.7" console_log = "1.0.0" -leptos = { version = "0.5.0", features = ["csr"] } +leptos = { version = "0.4.1", features = ["csr"] } +leptos_chart = { version = "0.1.2", features = ["LineChart"] } log = "0.4.20" shared = { path = "../shared" } diff --git a/examples/bridge_echo/web-leptos/index.html b/examples/bridge_echo/web-leptos/index.html index 8368d02e5..936986547 100644 --- a/examples/bridge_echo/web-leptos/index.html +++ b/examples/bridge_echo/web-leptos/index.html @@ -1,11 +1,14 @@ - + + - Leptos Counter + Leptos Bridge Benchmark - - - + + + + + diff --git a/examples/bridge_echo/web-leptos/src/main.rs b/examples/bridge_echo/web-leptos/src/main.rs index dca0e1887..70c2f39f9 100644 --- a/examples/bridge_echo/web-leptos/src/main.rs +++ b/examples/bridge_echo/web-leptos/src/main.rs @@ -3,44 +3,93 @@ mod core; use std::time::Duration; use leptos::{ - component, create_effect, create_signal, set_timeout, view, IntoView, SignalGet, SignalSet, - SignalUpdate, + component, create_effect, create_signal, set_timeout, view, IntoView, Scope, SignalGet, + SignalGetUntracked, SignalSet, SignalUpdate, }; +use leptos_chart::{Cartesian, LineChart, Series}; use shared::Event; +const PERIOD: u64 = 1000; + #[component] -fn RootComponent() -> impl IntoView { +fn RootComponent(cx: Scope) -> impl IntoView { let core = core::new(); - let (view, render) = create_signal(core.view()); - let (event, set_event) = create_signal(Event::Tick); - let (clock, set_clock) = create_signal(0u64); + let (view, render) = create_signal(cx, core.view()); + let (event, set_event) = create_signal(cx, Event::Tick); + let (clock, set_clock) = create_signal(cx, 0u64); - create_effect(move |_| { + create_effect(cx, move |_| { core::update(&core, event.get(), render); }); - // When render happens, send a new tick immediately - create_effect(move |_| { - view.get(); - set_timeout(move || set_event.set(Event::Tick), Duration::from_millis(0)); + // When render happens, send a new tick immediately, if running + create_effect(cx, move |_| { + if view.get().running { + set_timeout(move || set_event.set(Event::Tick), Duration::from_millis(0)); + } }); // Start a new period every second - create_effect(move |_| { + create_effect(cx, move |_| { clock.get(); - set_timeout( - move || { - set_event.set(Event::NewPeriod); - set_clock.update(|c| *c += 1); - }, - Duration::from_millis(1000), - ) + if view.get_untracked().running { + set_timeout( + move || { + set_event.set(Event::NewPeriod); + set_clock.update(|c| *c += 1); + }, + Duration::from_millis(PERIOD), + ) + } }); - view! { -
-

{move || view.get().count}

+ let chart = move || { + clock.get(); + + let log: Vec<_> = view.get_untracked().log; + + let count = log.len() as i64; + // let max = *log.iter().max().unwrap_or(&0); + + let (x, y) = if count > 0 { + ( + (1..=count).collect::>(), + log.iter().map(|i| *i as f64).collect::>(), + ) + } else { + (vec![0, 1], vec![0.0, 1.0]) + }; + + log::debug!("Chart: {:?}, {:?}", x, y); + + Cartesian::new(Series::from(x), Series::from(y)).set_view(420, 380, 3, 100, 100, 20) + }; + + view! {cx, +
+
+

{move || format!("{:.2}", view.get().rate)}

+

{move || view.get().count}

+

+ +

+
+ {move || { + let chart = chart(); + + view! {cx, } + }}
} } @@ -49,7 +98,7 @@ fn main() { _ = console_log::init_with_level(log::Level::Debug); console_error_panic_hook::set_once(); - leptos::mount_to_body(|| { - view! { } + leptos::mount_to_body(|cx| { + view! { cx, } }); }