From b9c5127b4037e261188784058003fda9941fc533 Mon Sep 17 00:00:00 2001 From: Doonv <58695417+doonv@users.noreply.github.com> Date: Sat, 2 Dec 2023 00:54:53 +0200 Subject: [PATCH] 02/12/2023 --- Cargo.lock | 479 +++++++++++------- Cargo.toml | 5 +- examples/resource.rs | 7 +- src/{parser.rs => command.rs} | 14 - src/{parser => command}/lexer.rs | 0 src/{parser => command}/parser.rs | 25 +- src/{parser => command}/runner.rs | 333 +++++------- src/{parser => command}/runner/environment.rs | 6 +- src/{parser => command}/runner/stdlib.rs | 5 +- src/command/runner/value.rs | 143 ++++++ src/lib.rs | 6 +- src/logging/log_plugin.rs | 22 +- src/prelude.rs | 2 +- src/ui.rs | 35 +- 14 files changed, 608 insertions(+), 474 deletions(-) rename src/{parser.rs => command.rs} (67%) rename src/{parser => command}/lexer.rs (100%) rename src/{parser => command}/parser.rs (94%) rename src/{parser => command}/runner.rs (73%) rename src/{parser => command}/runner/environment.rs (97%) rename src/{parser => command}/runner/stdlib.rs (94%) create mode 100644 src/command/runner/value.rs diff --git a/Cargo.lock b/Cargo.lock index 582aa16..3ba2d89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -192,9 +192,9 @@ dependencies = [ [[package]] name = "arboard" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac57f2b058a76363e357c056e4f74f1945bf734d37b8b3ef49066c4787dde0fc" +checksum = "aafb29b107435aa276664c1db8954ac27a6e105cdad3c88287a199eb0e313c08" dependencies = [ "clipboard-win", "core-graphics", @@ -236,7 +236,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" dependencies = [ - "event-listener", + "event-listener 2.5.3", "futures-core", ] @@ -247,21 +247,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" dependencies = [ "concurrent-queue", - "event-listener", + "event-listener 2.5.3", "futures-core", ] +[[package]] +name = "async-channel" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +dependencies = [ + "concurrent-queue", + "event-listener 4.0.0", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-executor" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" +checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock", + "async-lock 3.1.2", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite", + "futures-lite 2.0.1", "slab", ] @@ -271,10 +284,10 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", "blocking", - "futures-lite", + "futures-lite 1.13.0", ] [[package]] @@ -283,7 +296,18 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ - "event-listener", + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea8b3453dd7cc96711834b75400d671b73e3656975fa68d9f277163b7f7e316" +dependencies = [ + "event-listener 4.0.0", + "event-listener-strategy", + "pin-project-lite", ] [[package]] @@ -339,18 +363,18 @@ checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" [[package]] name = "bevy" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329e344f835f5a9a4c46a6d1d57371f726aa2c482d1bd669b2b9c4eb1ee91fd7" +checksum = "e4bc7e09282a82a48d70ade0c4c1154b0fd7882a735a39c66766a5d0f4718ea9" dependencies = [ "bevy_internal", ] [[package]] name = "bevy_a11y" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271b812e5734f5056a400f7d64592dd82d6c0e6179389c2f066f433ab8bc7692" +checksum = "68080288c932634f6563d3a8299efe0ddc9ea6787539c4c771ba250d089a94f0" dependencies = [ "accesskit", "bevy_app", @@ -360,9 +384,9 @@ dependencies = [ [[package]] name = "bevy_animation" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab94187a1253433e14f175293d8a86ec1c2822fda2a17807908f11ec21f45f00" +checksum = "7aa37683b1281e1ba8cf285644e6e3f0704f14b3901c5ee282067ff7ff6f4a56" dependencies = [ "bevy_app", "bevy_asset", @@ -379,9 +403,9 @@ dependencies = [ [[package]] name = "bevy_app" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172d532ea812e5954fa814dae003c207f2a0b20c6e50431787c94a7159677ece" +checksum = "d41731817993f92e4363dd3335558e779e290bc71eefc0b5547052b85810907e" dependencies = [ "bevy_derive", "bevy_ecs", @@ -395,13 +419,13 @@ dependencies = [ [[package]] name = "bevy_asset" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb2b67984088b23e223cfe9ec1befd89a110665a679acb06839bc4334ed37d6" +checksum = "935984568f75867dd7357133b06f4b1502cd2be55e4642d483ce597e46e63bff" dependencies = [ "async-broadcast", "async-fs", - "async-lock", + "async-lock 2.8.0", "bevy_app", "bevy_asset_macros", "bevy_ecs", @@ -414,7 +438,7 @@ dependencies = [ "crossbeam-channel", "downcast-rs", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "js-sys", "parking_lot", "ron", @@ -427,9 +451,9 @@ dependencies = [ [[package]] name = "bevy_asset_macros" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3245193e90fc8abcf1059a467cb224501dcda083d114c67c10ac66b7171e3a" +checksum = "3f48b9bbe4ec605e4910b5cd1e1a0acbfbe0b80af5f3bcc4489a9fdd1e80058c" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -439,9 +463,9 @@ dependencies = [ [[package]] name = "bevy_audio" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478de80ff25cb7decbcb22797774d1597e8c32914e81431c67d64faadc08f84a" +checksum = "18a69889e1bfa4dbac4e641536b94f91c441da55796ad9832e77836b8264688b" dependencies = [ "bevy_app", "bevy_asset", @@ -457,9 +481,9 @@ dependencies = [ [[package]] name = "bevy_core" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025e6800b73048092a55c3611e9327ad4c4c17b60517ec1c0086bb40b4b19ea8" +checksum = "3daa24502a14839509f02407bc7e48299fe84d260877de23b60662de0f4f4b6c" dependencies = [ "bevy_app", "bevy_ecs", @@ -472,9 +496,9 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e4b08a2d53ba62d9ec1fca3f7f4e0f556e9f59e1c8e63a4b7c2a18c0701152c" +checksum = "b4b77c4fca6e90edbe2e72da7bc9aa7aed7dfdfded0920ae0a0c845f5e11084a" dependencies = [ "bevy_app", "bevy_asset", @@ -494,9 +518,9 @@ dependencies = [ [[package]] name = "bevy_derive" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24bf40259be12a1a24d9fd536f5ff18d31eeb5665b77e2732899783be6edc5d6" +checksum = "f484318350462c58ba3942a45a656c1fd6b6e484a6b6b7abc3a787ad1a51e500" dependencies = [ "bevy_macro_utils", "quote", @@ -518,9 +542,9 @@ dependencies = [ [[package]] name = "bevy_diagnostic" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b5a99a9fb6cd7d1eb1714fad193944a0317f0887a15cccb8309c8d37951132" +checksum = "fa38ca5967d335cc1006a0e0f1a86c350e2f15fd1878449f61d04cd57a7c4060" dependencies = [ "bevy_app", "bevy_core", @@ -533,18 +557,18 @@ dependencies = [ [[package]] name = "bevy_ecs" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae11a1f467c372b50e9d4b55e78370f5420c9db7416200cc441cc84f08174dd3" +checksum = "7709fbd22f81fb681534cd913c41e1cd18b17143368743281195d7f024b61aea" dependencies = [ - "async-channel", + "async-channel 1.9.0", "bevy_ecs_macros", "bevy_ptr", "bevy_reflect", "bevy_tasks", "bevy_utils", "downcast-rs", - "event-listener", + "event-listener 2.5.3", "fixedbitset", "rustc-hash", "serde", @@ -554,9 +578,9 @@ dependencies = [ [[package]] name = "bevy_ecs_macros" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f642c2b67c4d0daf8edf15074f6351457eb487a34b3de1290c760d8f3ac9ec16" +checksum = "a8843aa489f159f25cdcd9fee75cd7d221a7098a71eaa72cb2d6b40ac4e3f1ba" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -579,9 +603,9 @@ dependencies = [ [[package]] name = "bevy_encase_derive" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65b9fb5a62c4e3ab70caaa839470d35fa932001b1b34b08bc7f7f1909bd2b3a7" +checksum = "5328a3715e933ebbff07d0e99528dc423c4f7a53590ed1ac19a120348b028990" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -589,9 +613,9 @@ dependencies = [ [[package]] name = "bevy_gilrs" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad31cc2c84315e0759d793d6c5bcb7d8789bbc16359c98d1b766e708c1bbae49" +checksum = "9b81ca2ebf66cbc7f998f1f142b15038ffe3c4ae1d51f70adda26dcf51b0c4ca" dependencies = [ "bevy_app", "bevy_ecs", @@ -605,9 +629,9 @@ dependencies = [ [[package]] name = "bevy_gizmos" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d1cc978b91f416b23eb16f00e69f95c3a04582021827d8082e92d4725cc510" +checksum = "db232274ddca2ae452eb2731b98267b795d133ddd14013121bc7daddde1c7491" dependencies = [ "bevy_app", "bevy_asset", @@ -625,9 +649,9 @@ dependencies = [ [[package]] name = "bevy_gltf" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f933745c0c86e2c07948def581259b466f99708328657054e956275430ccfd7" +checksum = "85adc6b1fc86687bf67149e0bafaa4d6da432232fa956472d1b37f19121d3ace" dependencies = [ "base64 0.13.1", "bevy_animation", @@ -655,9 +679,9 @@ dependencies = [ [[package]] name = "bevy_hierarchy" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fa240011fce8ee23f9b46e5a26a628a31d7860d6d2e4e0e361bb3ea6d5a703" +checksum = "06bd477152ce2ae1430f5e0a4f19216e5785c22fee1ab23788b5982dc59d1a55" dependencies = [ "bevy_app", "bevy_core", @@ -670,9 +694,9 @@ dependencies = [ [[package]] name = "bevy_input" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e86e241b3a10b79f65a69205552546723b855d3d4c1bd8261637c076144d32f" +checksum = "cab9a599189b2a694c182d60cd52219dd9364f9892ff542d87799b8e45d9e6dc" dependencies = [ "bevy_app", "bevy_ecs", @@ -684,9 +708,9 @@ dependencies = [ [[package]] name = "bevy_internal" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55124e486814c4d3632d5cfad9c4f4e46d052c028593ec46fef5bfbfb0f840b1" +checksum = "f124bece9831afd80897815231072d51bfe3ac58c6bb58eca8880963b6d0487c" dependencies = [ "bevy_a11y", "bevy_animation", @@ -723,9 +747,9 @@ dependencies = [ [[package]] name = "bevy_log" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "011417debf7868b45932bb97fc0d5bfdeaf9304e324aa94840e2f1e6deeed69d" +checksum = "0dc10ba1d225a8477b9e80a1bf797d8a8b8274e83c9b24fb4d9351aec9229755" dependencies = [ "android_log-sys", "bevy_app", @@ -739,9 +763,9 @@ dependencies = [ [[package]] name = "bevy_macro_utils" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6fba87c6d069fcbcd8a48625ca8ab4392ad40d2b260863ce7d641a0f42986d" +checksum = "e566640c6b6dced73d2006c764c2cffebe1a82be4809486c4a5d7b4b50efed4d" dependencies = [ "proc-macro2", "quote", @@ -752,9 +776,9 @@ dependencies = [ [[package]] name = "bevy_math" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "752764558a1f429c20704c3b836a019fa308961c43fdfef4f08e339d456c96be" +checksum = "58ddc2b76783939c530178f88e5711a1b01044d7b02db4033e2eb8b43b6cf4ec" dependencies = [ "glam", "serde", @@ -762,18 +786,18 @@ dependencies = [ [[package]] name = "bevy_mikktspace" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b596c41a56f2268ec7cde560edc588bc7b5886e4b49c8b27c4dcc9f7c743424c" +checksum = "8ec4962977a746d870170532fc92759e04d3dbcae8b7b82e7ca3bb83b1d75277" dependencies = [ "glam", ] [[package]] name = "bevy_pbr" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb6a35a78d355cc21c10f277dcd171eca65e30a90e76eb89f4dacf606621fe1" +checksum = "520bfd2a898c74f84ea52cfb8eb061f37373ad15e623489d5f75d27ebd6138fe" dependencies = [ "bevy_app", "bevy_asset", @@ -797,15 +821,15 @@ dependencies = [ [[package]] name = "bevy_ptr" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308a02679f6ce21ef71de20fae6d6a2016c07baa21d8e8d0558e6b7851e8adf2" +checksum = "c77ec20c8fafcdc196508ef5ccb4f0400a8d193cb61f7b14a36ed9a25ad423cf" [[package]] name = "bevy_reflect" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd56914a8ad57621d7a1a099f7e6b1f7482c9c76cedc9c3d4c175a203939c5d" +checksum = "d7921f15fc944c9c8ad01d7dbcea6505b8909c6655cd9382bab1407181556038" dependencies = [ "bevy_math", "bevy_ptr", @@ -822,9 +846,9 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f627907c40ac552f798423447fc331fc1ddacd94c5f7a2a70942eb06bc8447" +checksum = "b4a8c5475f216e751ef4452a1306b00711f33d2d04d9f149e4c845dfeb6753a0" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -835,11 +859,11 @@ dependencies = [ [[package]] name = "bevy_render" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90d777f4c51bd58e9e40777c6cb8dde0778df7e2c5298b3f9e3455bd12a9856c" +checksum = "bdefdd3737125b0d94a6ff20bb70fa8cfe9d7d5dcd72ba4dfe6c5f1d30d9f6e4" dependencies = [ - "async-channel", + "async-channel 1.9.0", "bevy_app", "bevy_asset", "bevy_core", @@ -862,7 +886,7 @@ dependencies = [ "codespan-reporting", "downcast-rs", "encase", - "futures-lite", + "futures-lite 1.13.0", "hexasphere", "image", "js-sys", @@ -881,9 +905,9 @@ dependencies = [ [[package]] name = "bevy_render_macros" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b00c3d0abff94a729460fc9aa95c2ceac71b49b3041166bb5ba3098e9657e7" +checksum = "64d86bfc5a1e7fbeeaec0c4ceab18155530f5506624670965db3415f75826bea" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -893,9 +917,9 @@ dependencies = [ [[package]] name = "bevy_scene" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6294396a6375f0b14341d8003408c10aa040e3f833ac8bd49677170ec55d73" +checksum = "e7df078b5e406e37c8a1c6ba0d652bf105fde713ce3c3efda7263fe27467eee5" dependencies = [ "bevy_app", "bevy_asset", @@ -914,9 +938,9 @@ dependencies = [ [[package]] name = "bevy_sprite" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f7d1f88a6e5497fdafd95c20984a1d1b5517bc39d51600b4988cd60c51837a" +checksum = "c7cc0c9d946e17e3e0aaa202f182837bc796c4f862b2e5a805134f873f21cf7f" dependencies = [ "bevy_app", "bevy_asset", @@ -940,23 +964,23 @@ dependencies = [ [[package]] name = "bevy_tasks" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a45be906618192515bc613e46546150089adbb4a82178dc462045acd1e89e92" +checksum = "f4fefa7fe0da8923525f7500e274f1bd60dbd79918a25cf7d0dfa0a6ba15c1cf" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-executor", "async-task", "concurrent-queue", - "futures-lite", + "futures-lite 1.13.0", "wasm-bindgen-futures", ] [[package]] name = "bevy_text" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c136af700af4f87c94f68d6e019528c371bf09ebf4a8ff7468bb3c73806b34f5" +checksum = "3a9a79d49ca06170d69149949b134c14e8b99ace1444c1ca2cd4743b19d5b055" dependencies = [ "ab_glyph", "bevy_app", @@ -976,9 +1000,9 @@ dependencies = [ [[package]] name = "bevy_time" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b29709cadf22d318a0b7c79f763e9c5ac414292bd0e850066fa935959021b276" +checksum = "e6250d76eed3077128b6a3d004f9f198b01107800b9824051e32bb658054e837" dependencies = [ "bevy_app", "bevy_ecs", @@ -990,9 +1014,9 @@ dependencies = [ [[package]] name = "bevy_transform" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70262c51e915b6224129206d23823364e650cf5eb5f4b6ce3ee379f608c180d2" +checksum = "d541e0c292edbd96afae816ee680e02247422423ccd5dc635c1e211a20ed64be" dependencies = [ "bevy_app", "bevy_ecs", @@ -1004,9 +1028,9 @@ dependencies = [ [[package]] name = "bevy_ui" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd5ecbf2dceaab118769dd870e34d780bfde556af561fd10d8d613b0f237297e" +checksum = "d785e3b75dabcb2a8ad0d50933f8f3446d59e512cabc2d2a145e28c2bb8792ba" dependencies = [ "bevy_a11y", "bevy_app", @@ -1034,14 +1058,14 @@ dependencies = [ [[package]] name = "bevy_utils" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e75d4a34ef0b15dffd1ee9079ef1f0f5139527e192b9d5708b3e158777c753" +checksum = "7915222f4a08ccc782e08d10b751b42e5f9d786e697d0cb3fd09333cb7e8b6ea" dependencies = [ "ahash", "bevy_utils_proc_macros", "getrandom", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "instant", "nonmax", "petgraph", @@ -1052,9 +1076,9 @@ dependencies = [ [[package]] name = "bevy_utils_proc_macros" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7dfd3735a61a1b681ed1e176afe4eae731bbb03e51ad871e9eb39e76a2d170e" +checksum = "7aafecc952b6b8eb1a93c12590bd867d25df2f4ae1033a01dfdfc3c35ebccfff" dependencies = [ "proc-macro2", "quote", @@ -1063,9 +1087,9 @@ dependencies = [ [[package]] name = "bevy_window" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e60d1830b3fbd7db5bfea7ac9fcd0f5e1d1af88c91ab469e697ab176d8b3140b" +checksum = "41ee72bf7f974000e9b31bb971a89387f1432ba9413f35c4fef59fef49767260" dependencies = [ "bevy_a11y", "bevy_app", @@ -1079,9 +1103,9 @@ dependencies = [ [[package]] name = "bevy_winit" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8294e78c6a1f9c34d36501a377c5d20bf0fa23a0958187bb270187741448ba" +checksum = "1eb71f287eca9006dda998784c7b931e400ae2cc4c505da315882a8b082f21ad" dependencies = [ "accesskit_winit", "approx", @@ -1104,9 +1128,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.68.1" +version = "0.69.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" +checksum = "9ffcebc3849946a7170a05992aac39da343a90676ab392c51a4280981d6379c2" dependencies = [ "bitflags 2.4.1", "cexpr", @@ -1192,16 +1216,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel", - "async-lock", + "async-channel 2.1.1", + "async-lock 3.1.2", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite", + "futures-lite 2.0.1", "piper", "tracing", ] @@ -1397,9 +1421,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -1407,9 +1431,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-graphics" @@ -1448,9 +1472,9 @@ dependencies = [ [[package]] name = "coreaudio-sys" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8478e5bdad14dce236b9898ea002eabfa87cbe14f0aa538dbe3b6a4bec4332d" +checksum = "f3120ebb80a9de008e638ad833d4127d50ea3d3a960ea23ea69bc66d9358a028" dependencies = [ "bindgen", ] @@ -1527,9 +1551,9 @@ checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "dispatch" @@ -1659,6 +1683,27 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +dependencies = [ + "event-listener 4.0.0", + "pin-project-lite", +] + [[package]] name = "fastrand" version = "1.9.0" @@ -1749,9 +1794,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -1783,11 +1828,25 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +dependencies = [ + "fastrand 2.0.1", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", +] + [[package]] name = "gethostname" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177" dependencies = [ "libc", "winapi", @@ -1808,9 +1867,9 @@ dependencies = [ [[package]] name = "gilrs" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62fd19844d0eb919aca41d3e4ea0e0b6bf60e1e827558b101c269015b8f5f27a" +checksum = "9e9eec02069fcbd7abe00a28adf216547774889129a777cb5e53fdfb75d59f09" dependencies = [ "fnv", "gilrs-core", @@ -1821,17 +1880,18 @@ dependencies = [ [[package]] name = "gilrs-core" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccc99e9b8d63ffcaa334c4babfa31f46e156618a11f63efb6e8e6bcb37b830d" +checksum = "178769da179a47b187837d1ab2b5b9b684a21180166a77a4ca37e7e58ee3833d" dependencies = [ "core-foundation", + "inotify", "io-kit-sys", "js-sys", "libc", "libudev-sys", "log", - "nix 0.26.4", + "nix 0.27.1", "uuid", "vec_map", "wasm-bindgen", @@ -1841,9 +1901,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "glam" @@ -1959,7 +2019,7 @@ checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" dependencies = [ "bitflags 2.4.1", "gpu-descriptor-types", - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -1995,9 +2055,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", "allocator-api2", @@ -2069,9 +2129,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2109,7 +2169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -2118,6 +2178,26 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" +[[package]] +name = "inotify" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" +dependencies = [ + "bitflags 1.3.2", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "instant" version = "0.1.12" @@ -2132,9 +2212,9 @@ dependencies = [ [[package]] name = "io-kit-sys" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2d4429acc1deff0fbdece0325b4997bdb02b2c245ab7023fd5deca0f6348de" +checksum = "4769cb30e5dcf1710fc6730d3e94f78c47723a014a567de385e113c737394640" dependencies = [ "core-foundation-sys", "mach2", @@ -2213,9 +2293,9 @@ checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -2393,9 +2473,9 @@ checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] @@ -2466,9 +2546,9 @@ dependencies = [ [[package]] name = "naga_oil" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa9518ff79ae8a98c3abe3897d873a85561d1b5642981c2245c1c4b9b2429d" +checksum = "4ac54c77b3529887f9668d3dd81e955e58f252b31a333f836e3548c06460b958" dependencies = [ "bit-set", "codespan-reporting", @@ -2522,7 +2602,6 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset", ] [[package]] @@ -2534,6 +2613,18 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", + "memoffset", +] + +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "libc", ] [[package]] @@ -2554,9 +2645,9 @@ dependencies = [ [[package]] name = "nonmax" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99756f5493e135528f0cd660ac67b4c3a542bb65a3565efe92bb2c2317eb3669" +checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" [[package]] name = "ntapi" @@ -2839,9 +2930,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" @@ -2910,9 +3001,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -3098,18 +3189,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -3168,9 +3259,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" dependencies = [ "serde", ] @@ -3236,9 +3327,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.10" +version = "0.29.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a18d114d420ada3a891e6bc8e96a2023402203296a47cdd65083377dad18ba5" +checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" dependencies = [ "cfg-if", "core-foundation-sys", @@ -3262,9 +3353,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -3280,22 +3371,22 @@ dependencies = [ [[package]] name = "thiserror-core" -version = "1.0.38" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" +checksum = "c001ee18b7e5e3f62cbf58c7fe220119e68d902bb7443179c0c8aef30090e999" dependencies = [ "thiserror-core-impl", ] [[package]] name = "thiserror-core-impl" -version = "1.0.38" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" +checksum = "e4c60d69f36615a077cc7663b9cb8e42275722d23e58a7fa3d2c7f2915d09d04" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.39", ] [[package]] @@ -3507,9 +3598,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -3518,9 +3609,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.5.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ "getrandom", "serde", @@ -3568,9 +3659,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3578,9 +3669,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -3593,9 +3684,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -3605,9 +3696,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3615,9 +3706,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -3628,9 +3719,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wayland-scanner" @@ -3645,9 +3736,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -3678,9 +3769,9 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wgpu" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed547920565c56c7a29afb4538ac5ae5048865a5d2f05bff3ad4fbeb921a9a2c" +checksum = "752e44d3998ef35f71830dd1ad3da513e628e2e4d4aedb0ab580f850827a0b41" dependencies = [ "arrayvec", "cfg-if", @@ -4075,12 +4166,12 @@ dependencies = [ [[package]] name = "x11rb" -version = "0.10.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" +checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" dependencies = [ "gethostname", - "nix 0.24.3", + "nix 0.26.4", "winapi", "winapi-wsapoll", "x11rb-protocol", @@ -4088,11 +4179,11 @@ dependencies = [ [[package]] name = "x11rb-protocol" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" +checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc" dependencies = [ - "nix 0.24.3", + "nix 0.26.4", ] [[package]] @@ -4109,18 +4200,18 @@ checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" [[package]] name = "zerocopy" -version = "0.7.25" +version = "0.7.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +checksum = "f43de342578a3a14a9314a2dab1942cbfcbe5686e1f91acdc513058063eafe18" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.25" +version = "0.7.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +checksum = "e1012d89e3acb79fad7a799ce96866cfb8098b74638465ea1b1533d35900ca90" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index f497e03..c1cb489 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] ahash = "0.8.6" -bevy = "0.12.0" +bevy = "0.12.1" bevy_egui = "0.23.0" chrono = "0.4.31" logos = "0.13.0" @@ -22,3 +22,6 @@ opt-level = 1 # Enable high optimizations for dependencies (incl. Bevy), but not for our code: [profile.dev.package."*"] opt-level = 3 + +[lints] +clippy.useless_format = "allow" diff --git a/examples/resource.rs b/examples/resource.rs index c7019d3..caa4aa8 100644 --- a/examples/resource.rs +++ b/examples/resource.rs @@ -1,4 +1,7 @@ -use bevy::{log::LogPlugin, prelude::*}; +use bevy::{ + log::{Level, LogPlugin}, + prelude::*, +}; use bevy_dev_console::prelude::*; #[derive(Resource, Reflect, Default, Debug)] @@ -17,6 +20,7 @@ enum MyEnum { struct MyStruct { number1: f64, number2: f64, + number3: f32, string: String, } @@ -28,6 +32,7 @@ fn main() { .insert_resource(MyStruct { number1: 52138.0, number2: -123.8, + number3: 0.0, string: "hi there :)".to_string(), }) .add_plugins(( diff --git a/src/parser.rs b/src/command.rs similarity index 67% rename from src/parser.rs rename to src/command.rs index 8da8d0d..f7c8f44 100644 --- a/src/parser.rs +++ b/src/command.rs @@ -32,19 +32,5 @@ impl Command for ExecuteConsoleCommand { } Err(err) => error!("{err:#?}"), } - - // let mut engine = rhai::Engine::new(); - - // engine.on_print(|str| info!("{str}")); - - // let res = engine.eval_with_scope::(&mut scope.0, command); - - // match res { - // Ok(val) => match val.0 { - // Dynamci - // _ => info!("{val}") - // }, - // Err(err) => error!("{err}"), - // } } } diff --git a/src/parser/lexer.rs b/src/command/lexer.rs similarity index 100% rename from src/parser/lexer.rs rename to src/command/lexer.rs diff --git a/src/parser/parser.rs b/src/command/parser.rs similarity index 94% rename from src/parser/parser.rs rename to src/command/parser.rs index cf6b973..e8860b0 100644 --- a/src/parser/parser.rs +++ b/src/command/parser.rs @@ -9,7 +9,7 @@ use super::{ Environment, Spanned, }; -pub type AST = Vec>; +pub type Ast = Vec>; macro_rules! expect { ($tokens:ident, $token:pat, $tokenexpr:expr) => { @@ -46,9 +46,9 @@ pub enum Expression { ForLoop { index_name: String, loop_count: u64, - block: AST, + block: Ast, }, - MemberExpression { + Member { left: Box>, right: String, }, @@ -86,13 +86,22 @@ pub enum ParseError { got: Token, span: Span, }, + ExpectedEndline(Spanned), UnexpectedToken(Spanned), } -pub fn parse(tokens: &mut TokenStream, environment: &Environment) -> Result { +pub fn parse(tokens: &mut TokenStream, environment: &Environment) -> Result { let mut ast = Vec::new(); - while let Some(_) = tokens.peek() { + while tokens.peek().is_some() { ast.push(parse_expression(tokens, environment)?); + match tokens.next() { + Some(Ok(Token::SemiColon)) => continue, + Some(Ok(token)) => return Err(ParseError::ExpectedEndline(tokens.wrap_span(token))), + Some(Err(FailedToLexCharacter)) => { + return Err(ParseError::FailedToLexCharacter(tokens.span())) + } + None => break, + } } Ok(ast) } @@ -146,7 +155,7 @@ fn parse_expression( None => return Err(ParseError::ExpectedMoreTokens(tokens.peek_span())), }) } -fn parse_block(tokens: &mut TokenStream, environment: &Environment) -> Result { +fn parse_block(tokens: &mut TokenStream, environment: &Environment) -> Result { expect!(tokens, Token::LeftBracket, Token::LeftBracket); let ast = parse(tokens, environment)?; expect!(tokens, Token::RightBracket, Token::RightBracket); @@ -297,7 +306,7 @@ fn parse_primary( let right = tokens.slice().to_string(); expr = Spanned { span: expr.span.start..tokens.span().end, - value: Expression::MemberExpression { + value: Expression::Member { left: Box::new(expr), right, }, @@ -354,7 +363,7 @@ fn parse_object( #[cfg(test)] mod tests { - use crate::parser::Environment; + use crate::command::Environment; use super::{super::lexer::TokenStream, parse}; diff --git a/src/parser/runner.rs b/src/command/runner.rs similarity index 73% rename from src/parser/runner.rs rename to src/command/runner.rs index aa5e8cf..5984a31 100644 --- a/src/parser/runner.rs +++ b/src/command/runner.rs @@ -1,13 +1,14 @@ use std::rc::Weak; use std::{cell::RefCell, rc::Rc}; -use self::environment::{Environment, Function, ResultContainer, Variable}; +use self::environment::{Environment, ResultContainer}; use super::{ - parser::{Expression, Operator, AST}, + parser::{Ast, Expression, Operator}, Spanned, }; use ahash::AHashMap; +use bevy::reflect::ReflectRef; use bevy::{ prelude::*, reflect::{ @@ -19,6 +20,9 @@ use logos::Span; pub mod environment; pub mod stdlib; +pub mod value; + +pub use value::Value; /// Container for every value needed by evaluation functions. pub struct EvalParams<'a, 'b, 'c> { @@ -27,138 +31,6 @@ pub struct EvalParams<'a, 'b, 'c> { registrations: &'c [&'c TypeRegistration], } -/// A runtime value -#[derive(Debug)] -pub enum Value { - /// Nothing at all - None, - /// A number, for simplicity only f64s are used. - Number(f64), - /// A string... there isn't much to say about this one. - String(String), - /// A reference. - /// - /// References are very similar to rust's ownership and borrowing. - /// We achieve this by storing every variable as a [`Rc>`], - /// and having only the owner of the value have a strong reference, - /// while every other value has a weak reference. This causes - /// [`Rc::try_unwrap`] to succeed every time. - /// - /// This isn't partically efficent, so: - /// TODO: Create a custom type this! - Reference(Weak>), - StructObject { - name: String, - map: AHashMap>>, - }, - /// A reference to a dynamic value. (aka a reference.) - DynamicValue(Box), - Object(AHashMap>>), -} - -impl Value { - pub fn try_format(&self, span: Span) -> Result { - match self { - Value::None => Ok(format!("()")), - Value::Number(number) => Ok(format!("{number}")), - Value::String(string) => Ok(format!("\"{string}\"")), - Value::Reference(reference) => { - if let Some(rc) = reference.upgrade() { - Ok(rc.borrow().try_format(span)?) - } else { - Err(RunError::ReferenceToMovedData(span)) - } - } - Value::Object(map) => { - let mut string = String::new(); - string.push('{'); - for (key, value) in map { - string += &format!("\n\t{key}: {},", value.borrow().try_format(span.clone())?); - } - if map.len() > 0 { - string.push('\n'); - } - string.push('}'); - Ok(string) - } - Value::StructObject { name, map } => { - let mut string = String::new(); - string += &format!("{name} {{"); - for (key, value) in map { - string += &format!("\n\t{key}: {},", value.borrow().try_format(span.clone())?); - } - if map.len() > 0 { - string.push('\n'); - } - string.push('}'); - Ok(string) - } - Value::DynamicValue(value) => Ok(format!("{value:#?}")), - } - } -} - -impl From for ResultContainer { - fn from(value: Value) -> Self { - ResultContainer(Ok(value)) - } -} -impl From<()> for Value { - fn from((): ()) -> Self { - Value::None - } -} -impl From<()> for ResultContainer { - fn from((): ()) -> Self { - ResultContainer(Ok(Value::None)) - } -} -impl From for Value { - fn from(number: f64) -> Self { - Value::Number(number) - } -} -impl From for ResultContainer { - fn from(number: f64) -> Self { - ResultContainer(Ok(Value::Number(number))) - } -} -impl From for Value { - fn from(string: String) -> Self { - Value::String(string) - } -} - -impl TryFrom> for Value { - type Error = RunError; - - fn try_from(value: Spanned) -> Result { - Ok(value.value) - } -} -impl TryFrom> for f64 { - type Error = RunError; - - fn try_from(value: Spanned) -> Result { - if let Value::Number(number) = value.value { - Ok(number) - } else { - todo!() - } - } -} -impl TryFrom> for String { - type Error = RunError; - - fn try_from(value: Spanned) -> Result { - if let Value::String(string) = value.value { - Ok(string) - } else { - todo!() - } - } -} - #[derive(Debug)] pub enum RunError { VariableNotFound(Span), @@ -173,7 +45,7 @@ pub enum RunError { CannotBorrowValue(std::ops::Range), } -pub fn run(ast: AST, world: &mut World) { +pub fn run(ast: Ast, world: &mut World) { // Temporarily remove the [`Environment`] resource to gain // mutability without needing a mutable reference. let Some(mut environment) = world.remove_non_send_resource::() else { @@ -236,21 +108,23 @@ pub fn run(ast: AST, world: &mut World) { world.insert_non_send_resource(environment); } -fn eval_expression(expr: Spanned, params: EvalParams) -> Result { - let EvalParams { +fn eval_expression( + expr: Spanned, + EvalParams { world, environment, registrations, - } = params; + }: EvalParams, +) -> Result { match expr.value { Expression::VarAssign { name, value } => match name.value { Expression::Variable(var) => { if let Some(registration) = registrations .iter() - .find(|v| v.type_info().type_path_table().short_path() == &var) + .find(|v| v.type_info().type_path_table().short_path() == var) { set_resource( - value, + *value, EvalParams { world, environment, @@ -284,7 +158,7 @@ fn eval_expression(expr: Spanned, params: EvalParams) -> Result {}", fancy_debug_print(registration, world)); Ok(Value::None) @@ -340,15 +214,37 @@ fn eval_expression(expr: Spanned, params: EvalParams) -> Result todo!("for loop {index_name}, {loop_count}, {block:#?}"), - Expression::MemberExpression { left, right } => eval_member_expression( - *left, - right, - EvalParams { - world, - environment, - registrations, - }, - ), + Expression::Member { left, right } => { + let result = eval_member_expression( + *left, + right, + EvalParams { + world, + environment, + registrations, + }, + )?; + match result { + Reflectable::Value(value) => Ok(value), + Reflectable::StructField(mut field) => { + let field = field.unwrap(); + let field_ref = field.reflect_ref(); + match field_ref { + ReflectRef::Struct(_) => todo!(), + ReflectRef::TupleStruct(_) => todo!(), + ReflectRef::Tuple(_) => todo!(), + ReflectRef::List(_) => todo!(), + ReflectRef::Array(_) => todo!(), + ReflectRef::Map(_) => todo!(), + ReflectRef::Enum(_) => todo!(), + ReflectRef::Value(value) => { + debug!("{value:?}"); + } + } + Ok(Value::None) + } + } + } Expression::UnaryOp(expr) => { let expr = eval_expression( *expr, @@ -426,17 +322,44 @@ fn eval_expression(expr: Spanned, params: EvalParams) -> Result Ok(Value::None), Expression::Function { name, arguments } => { environment.function_scope(&name, move |environment, function| { - (function.body)(arguments, EvalParams { world, environment, registrations }) + (function.body)( + arguments, + EvalParams { + world, + environment, + registrations, + }, + ) }) } } } -fn eval_member_expression( +enum Reflectable<'a> { + Value(Value), + StructField(ReflectStructField<'a>), +} +struct ReflectStructField<'a> { + string: String, + mut_reflect: Mut<'a, dyn Reflect>, +} +impl<'a> ReflectStructField<'a> { + fn unwrap(&'a mut self) -> &'a mut dyn Reflect { + let ReflectMut::Struct(dyn_struct) = self.mut_reflect.reflect_mut() else { + unreachable!() + }; + let field = dyn_struct + .field_mut(&self.string) + .expect("no field on struct"); + + field + } +} +fn eval_member_expression<'a>( left: Spanned, right: String, - params: EvalParams, -) -> Result { + params: EvalParams<'a, 'a, 'a>, +) -> Result, RunError> { let left_span = left.span.clone(); let EvalParams { world, @@ -447,44 +370,42 @@ fn eval_member_expression( Expression::Variable(variable) => { if let Some(registration) = registrations .iter() - .find(|v| v.type_info().type_path_table().short_path() == &variable) + .find(|v| v.type_info().type_path_table().short_path() == variable) { - let Some(mut var) = mut_dyn_reflect(world, registration) else { - return Ok(Value::None); + let Some(var): Option> = mut_dyn_reflect(world, registration) + else { + todo!() }; - let reflect_mut = var.reflect_mut(); - - match reflect_mut { - ReflectMut::Struct(dyn_struct) => { - let field = dyn_struct.field(&right).expect("no field on struct"); - - if let Some(number) = field.downcast_ref::() { - Ok(Value::Number(*number)) - } else { - Ok(Value::DynamicValue(field.clone_value())) - } + let reflect = var.reflect_ref(); + + match reflect { + ReflectRef::Struct(_) => { + Ok(Reflectable::StructField(ReflectStructField { + string: right, + mut_reflect: var, + })) } - ReflectMut::TupleStruct(_) => todo!(), - ReflectMut::Tuple(_) => todo!(), - ReflectMut::List(_) => todo!(), - ReflectMut::Array(_) => todo!(), - ReflectMut::Map(_) => todo!(), - ReflectMut::Enum(_) => todo!(), - ReflectMut::Value(_) => todo!(), + _ => todo!(), } } else { let reference = environment.get(&variable, left_span)?.borrow(); - let map = match &*reference { - Value::Number(number) => return Ok(Value::Number(*number)), - Value::StructObject { map, .. } | Value::Object(map) => map, + match &*reference { + Value::Number(number) => { + return Ok(Reflectable::Value(Value::Number(*number))) + } + Value::Dynamic(value) => { + dbg!(value); + Ok(Reflectable::Value(Value::None)) + } + Value::StructObject { map, .. } | Value::Object(map) => { + if let Some(value) = map.get(&right) { + let weak = Rc::downgrade(value); + Ok(Reflectable::Value(Value::Reference(weak))) + } else { + todo!() + } + } value => todo!("{value:?}"), - }; - - if let Some(value) = map.get(&right) { - let weak = Rc::downgrade(value); - Ok(Value::Reference(weak)) - } else { - todo!() } } } @@ -501,7 +422,9 @@ fn eval_member_expression( match left { Value::StructObject { map, .. } => { if let Some(value) = map.get(&right) { - Ok(Value::Reference(Rc::downgrade(value))) + Ok(Reflectable::Value(Value::Reference( + Rc::downgrade(value), + ))) } else { Err(RunError::FieldNotFoundInStruct(left_span)) } @@ -513,7 +436,7 @@ fn eval_member_expression( } fn set_resource( - expr: Box>, + expr: Spanned, params: EvalParams, var: String, registration: &TypeRegistration, @@ -534,7 +457,7 @@ fn set_resource( Expression::Variable(value) => match enum_info.variant(&value) { Some(VariantInfo::Unit(_)) => { let mut reflect: Mut<'_, dyn Reflect> = - get_mut_reflect(world, registration).unwrap(); + mut_dyn_reflect(world, registration).unwrap(); let ReflectMut::Enum(enum_reflect) = reflect.reflect_mut() else { unreachable!() }; @@ -578,14 +501,14 @@ fn set_resource( Value::Reference(..) => todo!("todo reference"), Value::StructObject { .. } => todo!("todo structobject"), Value::Object(..) => todo!("todo object"), - Value::DynamicValue(..) => todo!("todo dynamicvalue"), + Value::Dynamic(..) => todo!("todo dynamicvalue"), } } dbg!("what"); let mut reflect: Mut<'_, dyn Reflect> = - get_mut_reflect(world, registration).unwrap(); + mut_dyn_reflect(world, registration).unwrap(); let ReflectMut::Enum(enum_reflect) = reflect.reflect_mut() else { unreachable!() }; @@ -640,33 +563,6 @@ fn eval_object( Ok(map) } -fn get_mut_reflect<'a>( - world: &'a mut World, - registration: &TypeRegistration, -) -> Option> { - if let Some(component_id) = world.components().get_resource_id(registration.type_id()) { - let res = world.get_resource_mut_by_id(component_id).unwrap(); - let reflect_from_ptr = registration.data::().unwrap(); - let val: Mut<'a, dyn Reflect> = - res.map_unchanged(|ptr| unsafe { reflect_from_ptr.as_reflect_mut(ptr) }); - Some(val) - } else { - error!("Couldn't find component for resource registration"); - None - } -} - -// fn eval_variable_name( -// name: Box>, -// environment: &Environment, -// ) -> Result<&Rc>, RunError> { -// match name.value { -// Expression::Variable(variable) => Ok(environment.get(&variable, name.span)?), -// Expression::MemberExpression { left, right } => Ok(todo!()), -// _ => Ok(todo!()), -// } -// } - /// A massive function that takes in a type registration and the world and then /// does all the hard work of printing out the type nicely. fn fancy_debug_print(registration: &TypeRegistration, world: &mut World) -> String { @@ -754,7 +650,7 @@ fn fancy_debug_print(registration: &TypeRegistration, world: &mut World) -> Stri fn mut_dyn_reflect<'a>( world: &'a mut World, - registration: &TypeRegistration, + registration: &'a TypeRegistration, ) -> Option> { let Some(component_id) = world.components().get_resource_id(registration.type_id()) else { error!( @@ -765,6 +661,7 @@ fn mut_dyn_reflect<'a>( }; let resource = world.get_resource_mut_by_id(component_id).unwrap(); let reflect_from_ptr = registration.data::().unwrap(); + // SAFETY: from the context it is known that `ReflectFromPtr` was made for the type of the `MutUntyped` let val: Mut = resource.map_unchanged(|ptr| unsafe { reflect_from_ptr.as_reflect_mut(ptr) }); Some(val) diff --git a/src/parser/runner/environment.rs b/src/command/runner/environment.rs similarity index 97% rename from src/parser/runner/environment.rs rename to src/command/runner/environment.rs index 27e9910..95e53a3 100644 --- a/src/parser/runner/environment.rs +++ b/src/command/runner/environment.rs @@ -4,7 +4,7 @@ use ahash::AHashMap; use logos::Span; use super::{eval_expression, stdlib, EvalParams, RunError, Value}; -use crate::parser::{parser::Expression, Spanned}; +use crate::command::{parser::Expression, Spanned}; /// Get around implementation of Result causing stupid errors pub(super) struct ResultContainer(pub Result); @@ -19,10 +19,10 @@ impl, E> From> for ResultContainer { ResultContainer(result.map(|v| v.into())) } } - +pub type FunctionType = dyn Fn(Vec>, EvalParams) -> Result; pub struct Function { pub argument_count: usize, - pub body: Box>, EvalParams) -> Result>, + pub body: Box, } /// Trait that represents a [`Fn`] that can be turned into a [`Function`]. diff --git a/src/parser/runner/stdlib.rs b/src/command/runner/stdlib.rs similarity index 94% rename from src/parser/runner/stdlib.rs rename to src/command/runner/stdlib.rs index 539f04c..fcd6d5d 100644 --- a/src/parser/runner/stdlib.rs +++ b/src/command/runner/stdlib.rs @@ -1,9 +1,8 @@ use std::cell::Ref; use bevy::log::info; -use logos::Span; -use crate::parser::{Environment, Spanned}; +use crate::command::{Environment, Spanned}; use super::{RunError, Value}; @@ -31,7 +30,7 @@ fn ref_depth(value: Value) -> f64 { _ => 0.0, } } - + match value { Value::Reference(reference) => { ref_depth_reference(reference.upgrade().unwrap().borrow()) + 1.0 diff --git a/src/command/runner/value.rs b/src/command/runner/value.rs new file mode 100644 index 0000000..9620c7e --- /dev/null +++ b/src/command/runner/value.rs @@ -0,0 +1,143 @@ +use std::rc::Weak; +use std::{cell::RefCell, rc::Rc}; + +use super::environment::ResultContainer; +use super::RunError; + +use super::super::Spanned; +use ahash::AHashMap; +use bevy::reflect::Reflect; + +use logos::Span; + +/// A runtime value +#[derive(Debug)] +pub enum Value { + /// Nothing at all + None, + /// A number, for simplicity only f64s are used. + Number(f64), + /// A string... there isn't much to say about this one. + String(String), + /// A reference. + /// + /// References are very similar to rust's ownership and borrowing. + /// We achieve this by storing every variable as a [`Rc>`], + /// and having only the owner of the value have a strong reference, + /// while every other value has a weak reference. This causes + /// [`Rc::try_unwrap`] to succeed every time. + /// + /// This isn't partically efficent, so: + /// TODO: Create a custom type this! + Reference(Weak>), + StructObject { + name: String, + map: AHashMap>>, + }, + /// A reference to a dynamic value. (aka a reference.) + Dynamic(Box), + Object(AHashMap>>), +} + +impl Value { + pub fn try_format(&self, span: Span) -> Result { + match self { + Value::None => Ok(format!("()")), + Value::Number(number) => Ok(format!("{number}")), + Value::String(string) => Ok(format!("\"{string}\"")), + Value::Reference(reference) => { + if let Some(rc) = reference.upgrade() { + Ok(rc.borrow().try_format(span)?) + } else { + Err(RunError::ReferenceToMovedData(span)) + } + } + Value::Object(map) => { + let mut string = String::new(); + string.push('{'); + for (key, value) in map { + string += &format!("\n\t{key}: {},", value.borrow().try_format(span.clone())?); + } + if map.len() > 0 { + string.push('\n'); + } + string.push('}'); + Ok(string) + } + Value::StructObject { name, map } => { + let mut string = String::new(); + string += &format!("{name} {{"); + for (key, value) in map { + string += &format!("\n\t{key}: {},", value.borrow().try_format(span.clone())?); + } + if map.len() > 0 { + string.push('\n'); + } + string.push('}'); + Ok(string) + } + Value::Dynamic(value) => Ok(format!("dyn {value:#?}")), + } + } +} + +impl From for ResultContainer { + fn from(value: Value) -> Self { + ResultContainer(Ok(value)) + } +} +impl From<()> for Value { + fn from((): ()) -> Self { + Value::None + } +} +impl From<()> for ResultContainer { + fn from((): ()) -> Self { + ResultContainer(Ok(Value::None)) + } +} +impl From for Value { + fn from(number: f64) -> Self { + Value::Number(number) + } +} +impl From for ResultContainer { + fn from(number: f64) -> Self { + ResultContainer(Ok(Value::Number(number))) + } +} +impl From for Value { + fn from(string: String) -> Self { + Value::String(string) + } +} + +impl TryFrom> for Value { + type Error = RunError; + + fn try_from(value: Spanned) -> Result { + Ok(value.value) + } +} +impl TryFrom> for f64 { + type Error = RunError; + + fn try_from(value: Spanned) -> Result { + if let Value::Number(number) = value.value { + Ok(number) + } else { + todo!() + } + } +} +impl TryFrom> for String { + type Error = RunError; + + fn try_from(value: Spanned) -> Result { + if let Value::String(string) = value.value { + Ok(string) + } else { + todo!() + } + } +} diff --git a/src/lib.rs b/src/lib.rs index 86e5eca..8719000 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,17 +1,17 @@ use bevy::prelude::*; use bevy_egui::EguiPlugin; -use parser::Environment; +use command::Environment; use ui::ConsoleUiState; mod logging; -mod parser; +mod command; pub mod prelude; mod ui; pub struct DevConsolePlugin; impl Plugin for DevConsolePlugin { fn build(&self, app: &mut App) { - if app.is_plugin_added::() == false { + if !app.is_plugin_added::() { app.add_plugins(EguiPlugin); } diff --git a/src/logging/log_plugin.rs b/src/logging/log_plugin.rs index e358c63..82e91d6 100644 --- a/src/logging/log_plugin.rs +++ b/src/logging/log_plugin.rs @@ -26,20 +26,15 @@ mod android_tracing; static GLOBAL: tracy_client::ProfiledAllocator = tracy_client::ProfiledAllocator::new(std::alloc::System, 100); -pub mod prelude { - //! The Bevy Log Prelude. - #[doc(hidden)] - pub use bevy::utils::tracing::{ - debug, debug_span, error, error_span, info, info_span, trace, trace_span, warn, warn_span, - }; -} - -use bevy::ecs::{ - event::{Event, EventWriter}, - system::{Res, Resource}, -}; use bevy::utils::tracing::Subscriber; pub use bevy::utils::tracing::{warn, Level}; +use bevy::{ + ecs::{ + event::{Event, EventWriter}, + system::{Res, Resource}, + }, + log::trace, +}; use bevy::app::{App, Plugin, Update}; use tracing_log::LogTracer; @@ -107,7 +102,7 @@ pub struct LogPlugin { impl Default for LogPlugin { fn default() -> Self { Self { - filter: "wgpu=error,naga=warn".to_string(), + filter: "wgpu=error,naga=warn,bevy_dev_console=trace".to_string(), level: Level::INFO, } } @@ -124,6 +119,7 @@ impl Plugin for LogPlugin { old_handler(infos); })); } + trace!("a"); let finished_subscriber; let default_filter = { format!("{},{}", self.level, self.filter) }; diff --git a/src/prelude.rs b/src/prelude.rs index d2a878c..f00ba48 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -1,3 +1,3 @@ pub use crate::logging::log_plugin::LogPlugin; pub use crate::DevConsolePlugin; -pub use crate::parser::Environment; +pub use crate::command::Environment; diff --git a/src/ui.rs b/src/ui.rs index d3e461b..c4ed82c 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -3,12 +3,9 @@ //! Made with [`bevy_egui`] use bevy::prelude::*; use bevy::utils::tracing::Level; -use bevy_egui::{ - egui::{Color32, Margin}, - *, -}; +use bevy_egui::*; -use crate::{logging::log_plugin::LogMessage, parser::ExecuteConsoleCommand}; +use crate::{logging::log_plugin::LogMessage, command::ExecuteConsoleCommand}; #[derive(Default, Resource)] pub struct ConsoleUiState { @@ -35,7 +32,7 @@ pub fn ui( if key.just_pressed(KeyCode::Return) && !state.command.trim().is_empty() { info!(name: "console_command", "$ {}", state.command.trim()); // Get the owned command by replacing it with an empty string - let command = std::mem::replace(&mut state.command, String::new()); + let command = std::mem::take(&mut state.command); commands.add(ExecuteConsoleCommand(command)); } @@ -49,7 +46,7 @@ pub fn ui( // Thus we create a bottom panel first, where our text edit and submit button resides. egui::TopBottomPanel::bottom("bottom panel") - .frame(egui::Frame::none().outer_margin(Margin { + .frame(egui::Frame::none().outer_margin(egui::Margin { left: 0.0, right: 5.0, top: 5. + 6., @@ -73,10 +70,8 @@ pub fn ui( .auto_shrink([false, true]) .show(ui, |ui| { ui.vertical(|ui| { - let mut id = 0; - for (message, is_new) in &mut state.log { + for (id, (message, is_new)) in state.log.iter_mut().enumerate() { add_log(ui, id, message, is_new); - id += 1; } }); }); @@ -86,7 +81,7 @@ pub fn ui( fn add_log( ui: &mut egui::Ui, - id: i32, + id: usize, LogMessage { message, name, @@ -103,7 +98,8 @@ fn add_log( const FONT_ID: egui::FontId = egui::FontId::monospace(CONSOLE_FONT_SIZE); ui.push_id(id, |ui| { - let time = chrono::DateTime::::from(*time); + let time_utc = chrono::DateTime::::from(*time); + let time = chrono::DateTime::::from(*time); let res = ui .horizontal_wrapped(|ui| { ui.label(egui::RichText::new(time.format("%H:%M").to_string()).font(FONT_ID)); @@ -116,8 +112,8 @@ fn add_log( return; } let level_color = match *level { - Level::TRACE => egui::Color32::from_rgb(74, 165, 240), - Level::DEBUG => egui::Color32::from_rgb(200, 114, 226), + Level::TRACE => egui::Color32::from_rgb(200, 114, 226), + Level::DEBUG => egui::Color32::from_rgb(74, 165, 240), Level::INFO => egui::Color32::from_rgb(140, 194, 101), Level::WARN => egui::Color32::from_rgb(209, 143, 82), Level::ERROR => egui::Color32::from_rgb(231, 118, 128), @@ -142,10 +138,19 @@ fn add_log( ui.horizontal(|ui| { ui.label(egui::RichText::new("Time:").color(egui::Color32::WHITE)); ui.label( - egui::RichText::new(time.to_rfc3339_opts(chrono::SecondsFormat::Micros, true)) + egui::RichText::new(time.format("%x %X %:z").to_string()) .color(egui::Color32::GRAY), ); }); + ui.horizontal(|ui| { + ui.label(egui::RichText::new("Time (UTC):").color(egui::Color32::WHITE)); + ui.label( + egui::RichText::new( + time_utc.to_rfc3339_opts(chrono::SecondsFormat::Micros, true), + ) + .color(egui::Color32::GRAY), + ); + }); ui.horizontal(|ui| { ui.label(egui::RichText::new("Name:").color(egui::Color32::WHITE)); ui.label(egui::RichText::new(*name).color(egui::Color32::GRAY));