diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..42efe73 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +target/* +.rust-analyzer/* diff --git a/Cargo.lock b/Cargo.lock index da92b93..911dd3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,87 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + [[package]] name = "allocator-api2" version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "android-activity" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd" +dependencies = [ + "android-properties", + "bitflags", + "cc", + "jni", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", + "thiserror 2.0.17", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_log-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84521a3cf562bc62942e294181d9eef17eb38ceb8c68677bc49f144e4c3d4f8d" + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56" + +[[package]] +name = "assert_type_match" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f548ad2c4031f2902e3edc1f29c29e835829437de49562d8eb5dc5584d3a1043" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-channel" version = "2.5.0" @@ -20,6 +95,60 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8034a681df4aed8b8edbd7fbe472401ecf009251c8b40556b304567052e294c5" +dependencies = [ + "async-lock", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + [[package]] name = "async-task" version = "4.7.1" @@ -38,15 +167,146 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "atomicow" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301801c08259e328a1c7da556608c0c22687708831b22024dbd3a57ea741e6de" +dependencies = [ + "portable-atomic", + "portable-atomic-util", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bevy_android" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e5e2a949be318bf7184eb084622892afcc1e8b2af44973ac53ab53201756e0" +dependencies = [ + "android-activity", +] + +[[package]] +name = "bevy_app" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671ae6f3a8d84f9ed696c531a138558596e041231a8414b6efeafa8469e841f9" +dependencies = [ + "bevy_derive", + "bevy_ecs", + "bevy_platform", + "bevy_reflect", + "bevy_tasks", + "bevy_utils", + "console_error_panic_hook", + "ctrlc", + "downcast-rs", + "log", + "thiserror 2.0.17", + "variadics_please", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "bevy_asset" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a05907de6a362d2c609a7a1d1b4dca3b58b768f746b719ca1a3c7dfa87d391" +dependencies = [ + "async-broadcast", + "async-channel", + "async-fs", + "async-io", + "async-lock", + "atomicow", + "bevy_android", + "bevy_app", + "bevy_asset_macros", + "bevy_diagnostic", + "bevy_ecs", + "bevy_platform", + "bevy_reflect", + "bevy_tasks", + "bevy_utils", + "bitflags", + "blake3", + "crossbeam-channel", + "derive_more", + "disqualified", + "downcast-rs", + "either", + "futures-io", + "futures-lite", + "futures-util", + "js-sys", + "ron", + "serde", + "stackfuture", + "thiserror 2.0.17", + "tracing", + "uuid", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "bevy_asset_macros" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9444998cc37b51dfd1572c23a501865733ea65619a7d88b47aa654ae2290a4f" +dependencies = [ + "bevy_macro_utils", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bevy_derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "293df2b2f7ed65ef2ce02b2e7359faac1a9a92a8cc96c182c9de77eb06049ae0" +dependencies = [ + "bevy_macro_utils", + "quote", + "syn", +] + +[[package]] +name = "bevy_diagnostic" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a73e11555051f37c3e0e9ef7775e77108f2482310242996fb5bb6ef8b685b78e" +dependencies = [ + "atomic-waker", + "bevy_app", + "bevy_ecs", + "bevy_platform", + "bevy_tasks", + "bevy_time", + "const-fnv1a-hash", + "log", +] + [[package]] name = "bevy_ecs" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24637a7c8643cab493f4085cda6bde4895f0e0816699c59006f18819da2ca0b8" +checksum = "4654b9b3535fa7813d2878a50e1b5ad80a361dc1c913b96ded57667f65d70a01" dependencies = [ + "arrayvec", "bevy_ecs_macros", "bevy_platform", "bevy_ptr", + "bevy_reflect", "bevy_tasks", "bevy_utils", "bitflags", @@ -57,29 +317,61 @@ dependencies = [ "indexmap", "log", "nonmax", + "serde", "slotmap", "smallvec", - "thiserror", + "thiserror 2.0.17", "variadics_please", ] +[[package]] +name = "bevy_ecs_macro_logic" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee0b98a74141ce8dce4654c60020ebbaefab32646f42af6bbae55f282ae65ff7" +dependencies = [ + "bevy_macro_utils", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "bevy_ecs_macros" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb14c18ca71e11c69fbae873c2db129064efac6d52e48d0127d37bfba1acfa8" +checksum = "4dc958a194d226d618404e0fea99a3c8b4146207a00a3ba07fa712bf71607240" dependencies = [ + "bevy_ecs_macro_logic", "bevy_macro_utils", "proc-macro2", "quote", "syn", ] +[[package]] +name = "bevy_log" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2017a5fe12ea230d00cfdca00c65c262924be26e0324f7e0033c64f8cc265888" +dependencies = [ + "android_log-sys", + "bevy_app", + "bevy_ecs", + "bevy_platform", + "bevy_utils", + "tracing", + "tracing-log", + "tracing-oslog", + "tracing-subscriber", + "tracing-wasm", +] + [[package]] name = "bevy_macro_utils" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7272fca0bf30d8ca2571a803598856104b63e5c596d52850f811ed37c5e1e3" +checksum = "746a19912c6dc1bbe79188778573e8a253d5832c696b2fcb95578c17b29ff7ba" dependencies = [ "proc-macro2", "quote", @@ -89,41 +381,127 @@ dependencies = [ [[package]] name = "bevy_mod_props" -version = "2.0.0" +version = "3.0.0" dependencies = [ + "bevy_app", + "bevy_asset", "bevy_ecs", + "bevy_scene", "estr", - "thiserror", + "thiserror 2.0.17", ] [[package]] name = "bevy_platform" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b29ea749a8e85f98186ab662f607b885b97c804bb14cdb0cdf838164496d474" +checksum = "3120670bb2308980f723477c9d82476fcda31f08be9b256c3f0acdee82a65094" dependencies = [ + "critical-section", "foldhash", "futures-channel", - "hashbrown", + "futures-lite", + "hashbrown 0.16.1", + "js-sys", "portable-atomic", "portable-atomic-util", "serde", "spin", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-time", + "windows-sys", ] [[package]] name = "bevy_ptr" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f98cbc6d34bbdb58240b72ed1731931b4991a893b3a3238bb7c42ae054aa676" +checksum = "b511e89f7078fd21fdea77061a0ca3e737297c7011bb10c073e0aecb17c9fea6" + +[[package]] +name = "bevy_reflect" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92abd59cbba1524c1847e9a50f74d94e6b7836c80a8edfa9c47e59f7fd81021d" +dependencies = [ + "assert_type_match", + "bevy_platform", + "bevy_ptr", + "bevy_reflect_derive", + "bevy_utils", + "derive_more", + "disqualified", + "downcast-rs", + "erased-serde", + "foldhash", + "glam", + "indexmap", + "inventory", + "serde", + "smallvec", + "smol_str", + "thiserror 2.0.17", + "uuid", + "variadics_please", + "wgpu-types", +] + +[[package]] +name = "bevy_reflect_derive" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fa4e6b97fd2d582dd5ed96762a70d04505a477c833cf4f69d016dcd03d2d04" +dependencies = [ + "bevy_macro_utils", + "indexmap", + "proc-macro2", + "quote", + "syn", + "uuid", +] + +[[package]] +name = "bevy_scene" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a3c891148c40e1352fc41001c0e1894ba63fc4e2d3aca33447343c4122b782" +dependencies = [ + "bevy_app", + "bevy_asset", + "bevy_derive", + "bevy_ecs", + "bevy_log", + "bevy_platform", + "bevy_reflect", + "bevy_scene_macros", + "bevy_utils", + "smallvec", + "thiserror 2.0.17", + "tracing", + "variadics_please", +] + +[[package]] +name = "bevy_scene_macros" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4bc33a36a4e9e344985a96cd8b4abc816cf2c5d2fa002d72fd7bcd11396589c" +dependencies = [ + "bevy_ecs_macro_logic", + "bevy_macro_utils", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "bevy_tasks" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990ffedd374dd2c4fe8f0fd4bcefd5617d1ee59164b6c3fcc356a69b48e26e8e" +checksum = "fa34e6b9b804851ec08a41c0346c859d82e2fa98c906d74b965ee61bbbb688e4" dependencies = [ - "async-channel", + "async-executor", "async-task", "atomic-waker", "bevy_platform", @@ -131,17 +509,32 @@ dependencies = [ "derive_more", "futures-lite", "heapless", - "pin-project", + "web-task", +] + +[[package]] +name = "bevy_time" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c21e3be2aa4426ea1e0a7036d3d1dbbded84c319459d9f3e2a616b33563372f2" +dependencies = [ + "bevy_app", + "bevy_ecs", + "bevy_platform", + "log", ] [[package]] name = "bevy_utils" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e258c44d869f9c41ac0f88a16815c67f2569eb9fff4716828a40273d127b6f84" +checksum = "3aceea6c7ffdd568f866d5ca4dfe50c33440c54f7bc230c13a9ba7ab0c91aed1" dependencies = [ + "async-channel", "bevy_platform", "disqualified", + "indexmap", + "thread_local", ] [[package]] @@ -149,6 +542,45 @@ name = "bitflags" version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +dependencies = [ + "serde_core", +] + +[[package]] +name = "blake3" +version = "1.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aa83c34e62843d924f905e0f5c866eb1dd6545fc4d719e803d9ba6030371fce" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "cpufeatures", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blocking" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83f8d02be6967315521be875afa792a316e28d57b5a2d401897e2a7921b7f21" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] [[package]] name = "bumpalo" @@ -156,12 +588,72 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" + +[[package]] +name = "cc" +version = "1.2.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -172,6 +664,61 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "const-fnv1a-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b13ea120a812beba79e34316b3942a857c86ec1593cb34f27bb28272ce2cca" + +[[package]] +name = "const_panic" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e262cdaac42494e3ae34c43969f9cdeb7da178bdb4b66fa6a1ea2edb4c8ae652" +dependencies = [ + "typewit", +] + +[[package]] +name = "constant_time_eq" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-queue" version = "0.3.12" @@ -193,6 +740,17 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40a998414a3656e7a11ca59d55598ce7df58daafd742e783844e80bbd8d500dd" +[[package]] +name = "ctrlc" +version = "3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0b1fab2ae45819af2d0731d60f2afe17227ebb1a1538a236da84c93e9a60162" +dependencies = [ + "dispatch2", + "nix", + "windows-sys", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -214,18 +772,63 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags", + "block2", + "libc", + "objc2", +] + [[package]] name = "disqualified" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9c272297e804878a2a4b707cfcfc6d2328b5bb936944613b4fdf2b9269afdfd" +[[package]] +name = "downcast-rs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117240f60069e65410b3ae1bb213295bd828f707b5bec6596a1afc8793ce0cbc" + +[[package]] +name = "either" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e" + [[package]] name = "equivalent" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" +[[package]] +name = "erased-serde" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + [[package]] name = "estr" version = "1.2.0" @@ -234,7 +837,7 @@ checksum = "e2e77c7dfb1a984132a140c98a805b5f12f8e8707420dda9a6ad698bc50fc041" dependencies = [ "byteorder", "crossfig", - "hashbrown", + "hashbrown 0.16.1", "libabort", "lock_api", "rapidhash", @@ -248,6 +851,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" dependencies = [ "concurrent-queue", + "parking", "pin-project-lite", ] @@ -261,6 +865,18 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + [[package]] name = "fixedbitset" version = "0.5.7" @@ -284,9 +900,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-lite" @@ -294,10 +916,75 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" dependencies = [ + "fastrand", "futures-core", + "futures-io", + "parking", "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", +] + +[[package]] +name = "glam" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f70749695b063ecbf6b62949ccccde2e733ec3ecbbd71d467dca4e5c6c97cca0" +dependencies = [ + "serde_core", +] + [[package]] name = "hash32" version = "0.3.1" @@ -316,8 +1003,16 @@ dependencies = [ "allocator-api2", "equivalent", "foldhash", + "serde", + "serde_core", ] +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + [[package]] name = "heapless" version = "0.9.2" @@ -329,16 +1024,116 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "hermit-abi" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" + [[package]] name = "indexmap" -version = "2.12.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", +] + +[[package]] +name = "inventory" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f0c30c76f2f4ccee3fe55a2435f691ca00c0e4bd87abe4f4a851b1d4dac39b" +dependencies = [ + "rustversion", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.17", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn", ] +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53b44bfcdb3f8d5837a46dae1ca9660a837176eee74a28b229bc626816589102" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libabort" version = "0.1.9" @@ -348,6 +1143,18 @@ dependencies = [ "rustversion-detect", ] +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + [[package]] name = "lock_api" version = "0.4.14" @@ -359,9 +1166,18 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "matchers" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] [[package]] name = "memchr" @@ -369,6 +1185,47 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + [[package]] name = "nonmax" version = "0.5.5" @@ -376,30 +1233,93 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" [[package]] -name = "pin-project" -version = "1.1.10" +name = "nu-ansi-term" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "pin-project-internal", + "windows-sys", ] [[package]] -name = "pin-project-internal" -version = "1.1.10" +name = "num_enum" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate", "proc-macro2", "quote", "syn", ] [[package]] -name = "pin-project-lite" -version = "0.2.16" +name = "objc2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f" +dependencies = [ + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "polling" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys", +] [[package]] name = "portable-atomic" @@ -416,6 +1336,15 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit", +] + [[package]] name = "proc-macro2" version = "1.0.103" @@ -434,6 +1363,18 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "rapidhash" version = "4.1.1" @@ -443,6 +1384,65 @@ dependencies = [ "rustversion", ] +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "ron" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81116b9531d61eabc41aeb228e4b6b2435bcca3233b98cf3b3077d4e6e9debb3" +dependencies = [ + "bitflags", + "once_cell", + "serde", + "serde_derive", + "typeid", + "unicode-ident", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -455,12 +1455,27 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cfa9e87e97427c3a1b472eace073b2bc577ad0e1444c128d938b3d5bcdacb17" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + [[package]] name = "serde" version = "1.0.228" @@ -468,6 +1483,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", + "serde_derive", ] [[package]] @@ -490,6 +1506,43 @@ dependencies = [ "syn", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd_cesu8" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f90157bb87cddf702797c5dadfa0be7d266cdf49e22da2fcaa32eff75b2c33" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + [[package]] name = "slotmap" version = "1.0.7" @@ -505,6 +1558,15 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +[[package]] +name = "smol_str" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead" +dependencies = [ + "serde", +] + [[package]] name = "spin" version = "0.10.0" @@ -521,6 +1583,15 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "stackfuture" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115beb9c69db2393ff10b75a1b8587a51716e5551d015001e55320ed279d32f9" +dependencies = [ + "const_panic", +] + [[package]] name = "syn" version = "2.0.111" @@ -532,13 +1603,33 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + [[package]] name = "thiserror" version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -552,20 +1643,29 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + [[package]] name = "toml_datetime" -version = "0.7.3" +version = "1.1.1+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.23.7" +version = "0.25.12+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +checksum = "d2153edc6955a6c354fad8f5efd38b6a8769bdccf9fe50f8e1329f81b0baa5d7" dependencies = [ "indexmap", "toml_datetime", @@ -575,13 +1675,109 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.1.2+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" dependencies = [ "winnow", ] +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-oslog" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76902d2a8d5f9f55a81155c08971734071968c90f2d9bfe645fe700579b2950" +dependencies = [ + "cc", + "cfg-if", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "tracing-wasm" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07" +dependencies = [ + "tracing", + "tracing-subscriber", + "wasm-bindgen", +] + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typewit" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "214ca0b2191785cbc06209b9ca1861e048e39b5ba33574b3cedd58363d5bb5f6" + [[package]] name = "unicode-ident" version = "1.0.22" @@ -594,6 +1790,24 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "uuid" +version = "1.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf80a72845275afea99e7f2b434723d3bc7e38470fcd1c7ed39a599c73319a53" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "variadics_please" version = "1.1.0" @@ -611,11 +1825,162 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b067c0c11094aef6b7a801c1e34a26affafdf3d051dba08456b868789aaf9a4" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c62df1340f32221cb9c54d6a27b030e3dba64361d4a95bed55f9aacb44da291d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167ce5e579f6bcf889c4f7175a8a5a585de84e8ff93976ce393efa5f2837aab1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3997c7839262f4ef12cf90b818d6340c18e80f263f1a94bf157d0ec4420380e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.126" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1b4cb0cc549fcf58d7dfc081778139b3d283a081644e833e84682ad71cea24" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8622dcb61c0bcc9fffa6938bed81210af2da9a7e4a1a834b2e37a59b6dfb6141" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-task" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cdc136a53ccd64a1211f107ccc34404769fbcc0f165f1afa065f5d88ab93538" +dependencies = [ + "async-task", + "cfg-if", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wgpu-types" +version = "29.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84bf84cd9ca8ca45e2b223a3868f1adf9bfc0c66aeac212e76ee7e40fdadf8f5" +dependencies = [ + "bitflags", + "bytemuck", + "js-sys", + "log", + "raw-window-handle", + "serde", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + [[package]] name = "winnow" -version = "0.7.13" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" dependencies = [ "memchr", ] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" diff --git a/Cargo.toml b/Cargo.toml index bb7b324..b4db2cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,16 @@ [package] name = "bevy_mod_props" -version = "2.0.0" +version = "3.0.0" edition = "2024" license = "MIT OR Apache-2.0" description = "Bevy utilities for high-specificity programming." [dependencies] -bevy_ecs = { version = "0.18.0", default-features = false } +bevy_ecs = { version = "0.19.0", default-features = false } thiserror = "2.0.17" estr = "1.2.0" + +[dev-dependencies] +bevy_app = "0.19.0" +bevy_asset = "0.19.0" +bevy_scene = "0.19.0" diff --git a/changelog.md b/changelog.md index 23547fc..4bed1d1 100644 --- a/changelog.md +++ b/changelog.md @@ -5,12 +5,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 1.0.0 - 2025-11-23 +## 3.0.0 - 2026-07-04 -- Factored out of another project and open-sourced. +- Updated to bevy `v0.19`. +- Split the ECS roles of `Props` into the `EntityProps` component and the + `GlobalProps` resource, as required by bevy `v0.19` (`Resource` now implies + `Component`). `Props` itself is now a plain data type; both wrappers + dereference to it, and the extension traits work unchanged. ## 2.0.0 - 2026-01-28 - Moved from `ustr` to `estr` (a fork of `ustr`). - Updated to bevy `v0.18`. - Improved link following. + +## 1.0.0 - 2025-11-23 + +- Factored out of another project and open-sourced. diff --git a/readme.md b/readme.md index e074c79..8ec0ad5 100644 --- a/readme.md +++ b/readme.md @@ -6,5 +6,6 @@ This crate adds several utilities to bevy, with a focus on stringly-typed inform | `bevy` | `bevy_mod_props` | |:-------:|:----------------:| -| 0.17 | 1.0.0 | +| 0.19 | 3.0.0 | | 0.18 | 2.0.0 | +| 0.17 | 1.0.0 | diff --git a/src/links/ext.rs b/src/links/ext.rs index 52615ba..f8d5dc7 100644 --- a/src/links/ext.rs +++ b/src/links/ext.rs @@ -151,9 +151,6 @@ impl<'w> LinksFollowExt<'w> for EntityWorldMut<'w> { fn explore_link(self, name: impl Into) -> EntityHashMap> { let targets = self.list_linked(name); let world = self.into_world_mut(); - match world.get_entity_mut(&targets) { - Ok(entities) => entities, - Err(_) => EntityHashMap::default(), - } + world.get_entity_mut(&targets).unwrap_or_default() } } diff --git a/src/props/ext.rs b/src/props/ext.rs index 0b6dd71..65eefcf 100644 --- a/src/props/ext.rs +++ b/src/props/ext.rs @@ -8,7 +8,7 @@ use bevy_ecs::{ }; use estr::Estr; -use super::{Props, Value}; +use super::{EntityProps, GlobalProps, Props, Value}; // ----------------------------------------------------------------------------- // Immutable properties access @@ -17,6 +17,9 @@ static EMPTY_PROPS: LazyLock = LazyLock::new(Props::new); /// Adds [`Props`] access to [`World`], [`DeferredWorld`], [`EntityRef`], and /// [`EntityWorldMut`]. +/// +/// The world implementations read the [`GlobalProps`] resource, and the +/// entity implementations read the [`EntityProps`] component. pub trait PropsExt { /// Returns a read-only set of properties assoceated with this object. fn props(&self) -> &Props; @@ -34,8 +37,8 @@ pub trait PropsExt { impl PropsExt for World { fn props(&self) -> &Props { - match self.get_resource::() { - Some(p) => p, + match self.get_resource::() { + Some(p) => &p.0, None => &EMPTY_PROPS, } } @@ -43,8 +46,8 @@ impl PropsExt for World { impl<'w> PropsExt for DeferredWorld<'w> { fn props(&self) -> &Props { - match self.get_resource::() { - Some(p) => p, + match self.get_resource::() { + Some(p) => &p.0, None => &EMPTY_PROPS, } } @@ -52,8 +55,8 @@ impl<'w> PropsExt for DeferredWorld<'w> { impl<'w> PropsExt for EntityRef<'w> { fn props(&self) -> &Props { - match self.get::() { - Some(p) => p, + match self.get::() { + Some(p) => &p.0, None => &EMPTY_PROPS, } } @@ -61,8 +64,8 @@ impl<'w> PropsExt for EntityRef<'w> { impl<'w> PropsExt for EntityWorldMut<'w> { fn props(&self) -> &Props { - match self.get::() { - Some(p) => p, + match self.get::() { + Some(p) => &p.0, None => &EMPTY_PROPS, } } @@ -72,6 +75,9 @@ impl<'w> PropsExt for EntityWorldMut<'w> { // Mutable properties access /// Adds mutable [`Props`] access to [`World`] and [`EntityWorldMut`]. +/// +/// The [`GlobalProps`] resource or [`EntityProps`] component is inserted +/// automatically if not already present. pub trait PropsMutExt { /// Provides mutable access to the set of properties assoceated with this object. fn props_mut(&mut self) -> &mut Props; @@ -89,13 +95,18 @@ pub trait PropsMutExt { impl PropsMutExt for World { fn props_mut(&mut self) -> &mut Props { - self.get_resource_or_init::().into_inner() + &mut self.get_resource_or_init::().into_inner().0 } } impl<'w> PropsMutExt for EntityWorldMut<'w> { fn props_mut(&mut self) -> &mut Props { - self.entry::().or_default().into_mut().into_inner() + &mut self + .entry::() + .or_default() + .into_mut() + .into_inner() + .0 } } diff --git a/src/props/mod.rs b/src/props/mod.rs index 6164a5b..c5b8394 100644 --- a/src/props/mod.rs +++ b/src/props/mod.rs @@ -1,8 +1,9 @@ //! Adds named properties to entities. //! //! This module is all about the [`Props`] type; you can think of this as being -//! basically a mapping `String => bool | f32 | String` which can be used -//! as either a component or a resource. +//! basically a mapping `String => bool | f32 | String`. Props can be attached +//! to individual entities with the [`EntityProps`] component, or stored +//! world-wide with the [`GlobalProps`] resource. //! //! ```rust //! # use bevy_mod_props::prelude::*; @@ -42,19 +43,19 @@ //! Props are designed to be easy to read and write, and generally prioritizes //! ergonomics over explicet error handling. //! -//! # Extention Traits +//! # Extension Traits //! -//! Props can be set globally (by using `Props` as a resource) or -//! on specific entities (by using. `Props` component). A number of extention -//! traits are avalible to allow props to be modified from the world, entity -//! refs, or commands +//! Props can be set globally (by using the [`GlobalProps`] resource) or on +//! specific entities (by using the [`EntityProps`] component). A number of +//! extension traits are available to allow props to be modified from the +//! world, entity refs, or commands //! //! ```rust //! # use bevy_mod_props::prelude::*; //! # use bevy_ecs::prelude::*; //! # //! # fn foo(thingy: f32) { } -//! fn global_props_resource_system(props: Res) { +//! fn global_props_resource_system(props: Res) { //! let thingy = props.get("thingy"); //! foo(thingy); //! } @@ -64,7 +65,7 @@ //! foo(thingy); //! } //! -//! fn local_props_component_system(props: Single<&Props>) { +//! fn local_props_component_system(props: Single<&EntityProps>) { //! let thingy = props.get("thingy"); //! foo(thingy); //! } @@ -79,7 +80,10 @@ use std::collections::btree_map::*; use std::fmt; -use std::ops::{Add, AddAssign, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Sub, SubAssign}; +use std::ops::{ + Add, AddAssign, Deref, DerefMut, Div, DivAssign, Index, IndexMut, Mul, MulAssign, Sub, + SubAssign, +}; use std::sync::LazyLock; use bevy_ecs::component::Component; @@ -776,17 +780,18 @@ impl DivAssign for Value { // ----------------------------------------------------------------------------- // Property Maps -/// A simple key-value property store, accessable either as a component or a -/// resource. +/// A simple key-value property store. /// /// Properties have string keys and either boolean, numeric, or string -/// values. It is often more convivient to work through the extension traits -/// [`PropsExt`], [`PropsMutExt`], and [`PropCommandsExt`]. +/// values. To store props in the ECS, wrap them in the [`EntityProps`] +/// component or the [`GlobalProps`] resource. It is often more convenient to +/// work through the extension traits [`PropsExt`], [`PropsMutExt`], and +/// [`PropCommandsExt`]. /// /// When accessing a property, if a value has not been set or has the wrong /// type, the property should be treated as if it has the default value of the -/// correct type. For example, toggling a -#[derive(Component, Resource, Default, Clone, Debug)] +/// correct type. +#[derive(Default, Clone, Debug)] pub struct Props { properties: BTreeMap, } @@ -904,3 +909,92 @@ impl IntoIterator for Props { self.properties.into_iter() } } + +// ----------------------------------------------------------------------------- +// ECS Wrappers + +/// [`Props`] attached to a single entity, as a component. +/// +/// Bevy requires components and resources to be distinct types, so this and +/// [`GlobalProps`] wrap [`Props`] for each role. Both dereference to +/// [`Props`], and are usually accessed through the extension traits +/// [`PropsExt`], [`PropsMutExt`], and [`PropCommandsExt`] rather than +/// directly. +/// +/// ```rust +/// # use bevy_ecs::prelude::*; +/// # use bevy_mod_props::prelude::*; +/// # let mut world = World::new(); +/// let entity = world +/// .spawn(EntityProps(Props::new().with("health", 100.0))) +/// .id(); +/// assert_eq!(world.entity(entity).get_prop::("health"), 100.0); +/// ``` +#[derive(Component, Default, Clone, Debug)] +pub struct EntityProps(pub Props); + +impl Deref for EntityProps { + type Target = Props; + + fn deref(&self) -> &Props { + &self.0 + } +} + +impl DerefMut for EntityProps { + fn deref_mut(&mut self) -> &mut Props { + &mut self.0 + } +} + +impl From for EntityProps { + fn from(props: Props) -> EntityProps { + EntityProps(props) + } +} + +impl From for Props { + fn from(props: EntityProps) -> Props { + props.0 + } +} + +/// [`Props`] stored world-wide, as a resource. +/// +/// See [`EntityProps`] for the entity-scoped equivalent. +/// +/// ```rust +/// # use bevy_ecs::prelude::*; +/// # use bevy_mod_props::prelude::*; +/// # let mut world = World::new(); +/// world.insert_resource(GlobalProps(Props::new().with("difficulty", 2.0))); +/// assert_eq!(world.get_prop::("difficulty"), 2.0); +/// ``` +#[derive(Resource, Default, Clone, Debug)] +pub struct GlobalProps(pub Props); + +impl Deref for GlobalProps { + type Target = Props; + + fn deref(&self) -> &Props { + &self.0 + } +} + +impl DerefMut for GlobalProps { + fn deref_mut(&mut self) -> &mut Props { + &mut self.0 + } +} + +impl From for GlobalProps { + fn from(props: Props) -> GlobalProps { + GlobalProps(props) + } +} + +impl From for Props { + fn from(props: GlobalProps) -> Props { + props.0 + } +} diff --git a/src/registry/ext.rs b/src/registry/ext.rs index 29e125c..16e073b 100644 --- a/src/registry/ext.rs +++ b/src/registry/ext.rs @@ -4,14 +4,14 @@ use bevy_ecs::{ entity::{Entity, EntityHashSet, EntityNotSpawnedError}, system::EntityCommands, world::{ - error::EntityMutableFetchError, unsafe_world_cell::UnsafeWorldCell, DeferredWorld, - EntityMut, EntityRef, EntityWorldMut, World, WorldEntityFetch, + DeferredWorld, EntityMut, EntityRef, EntityWorldMut, World, WorldEntityFetch, + error::EntityMutableFetchError, unsafe_world_cell::UnsafeWorldCell, }, }; use estr::Estr; use thiserror::Error; -use super::{Class, EntityNotFoundError, Identity, Registry, EMPTY_SET}; +use super::{Class, EMPTY_SET, EntityNotFoundError, Identity, Registry}; // ----------------------------------------------------------------------------- // Registry Access diff --git a/src/registry/mod.rs b/src/registry/mod.rs index 3770b9d..3af2dbf 100644 --- a/src/registry/mod.rs +++ b/src/registry/mod.rs @@ -79,7 +79,7 @@ pub struct EntityNotFoundError { #[derive(Component, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Hash, Debug)] #[component(immutable)] #[component(on_insert = Identity::on_insert)] -#[component(on_replace = Identity::on_replace)] +#[component(on_discard = Identity::on_discard)] pub struct Identity(Estr); impl Identity { @@ -96,7 +96,7 @@ impl Identity { if owner != context.entity { // The name is already in use by a different entity, remove the component and return an error world.commands().entity(context.entity).remove::(); - let error_handler = world.default_error_handler(); + let error_handler = world.fallback_error_handler(); error_handler( NameTakenError { name, @@ -124,7 +124,7 @@ impl Identity { if owner != context.entity { // The name is already in use by a different entity, remove the component and return an error world.commands().entity(context.entity).remove::(); - let error_handler = world.default_error_handler(); + let error_handler = world.fallback_error_handler(); error_handler( NameTakenError { name, @@ -147,7 +147,7 @@ impl Identity { } } - fn on_replace(mut world: DeferredWorld, context: HookContext) { + fn on_discard(mut world: DeferredWorld, context: HookContext) { let Identity(name) = *world.entity(context.entity).get::().unwrap(); if let Some(mut registry) = world.get_resource_mut::() { if let Some(registration) = registry.reigrations.get_mut(&context.entity) { @@ -188,7 +188,7 @@ impl Deref for Identity { #[derive(Component, Copy, Clone, Eq, PartialEq, PartialOrd, Ord, Hash, Debug)] #[component(immutable)] #[component(on_insert = Class::on_insert)] -#[component(on_replace = Class::on_replace)] +#[component(on_discard = Class::on_discard)] pub struct Class(Estr); impl Class { @@ -220,7 +220,7 @@ impl Class { } } - fn on_replace(mut world: DeferredWorld, context: HookContext) { + fn on_discard(mut world: DeferredWorld, context: HookContext) { let Class(class) = *world.entity(context.entity).get::().unwrap(); if let Some(mut registry) = world.get_resource_mut::() { registry.reigrations.get_mut(&context.entity).unwrap().class = None; diff --git a/tests/bsn.rs b/tests/bsn.rs new file mode 100644 index 0000000..eceb585 --- /dev/null +++ b/tests/bsn.rs @@ -0,0 +1,86 @@ +//! Tests that props types compose with bevy's `bsn!` scene notation. + +use bevy_app::{App, TaskPoolPlugin}; +use bevy_asset::AssetPlugin; +use bevy_ecs::prelude::*; +use bevy_mod_props::prelude::*; +use bevy_scene::{ScenePlugin, prelude::*}; + +/// Creates an app with the minimal plugins needed to spawn scenes. +fn test_app() -> App { + let mut app = App::new(); + app.add_plugins(( + TaskPoolPlugin::default(), + AssetPlugin::default(), + ScenePlugin, + )); + app +} + +/// `EntityProps` is `Default + Clone`, so it qualifies as a pass-through +/// [`bevy_ecs::template::Template`] without any extra derives. +#[test] +fn entity_props_spawns_with_defaults() { + let mut app = test_app(); + let world = app.world_mut(); + let entity = world.spawn_scene(bsn! { EntityProps }).unwrap().id(); + + assert!(world.entity(entity).contains::()); + assert_eq!(world.entity(entity).props().iter().count(), 0); +} + +#[test] +fn entity_props_accepts_expressions() { + let mut app = test_app(); + let world = app.world_mut(); + let entity = world + .spawn_scene(bsn! { + EntityProps({Props::new().with("health", 100.0).with("name", "frodo")}) + }) + .unwrap() + .id(); + + assert_eq!(world.entity(entity).get_prop::("health"), 100.0); + assert_eq!(world.entity(entity).get_prop::("name"), "frodo"); +} + +#[test] +fn entity_props_work_in_scene_hierarchies() { + let mut app = test_app(); + let world = app.world_mut(); + let root = world + .spawn_scene(bsn! { + EntityProps({Props::new().with("depth", 0.0)}) + Children [ + EntityProps({Props::new().with("depth", 1.0)}) + ] + }) + .unwrap() + .id(); + + assert_eq!(world.entity(root).get_prop::("depth"), 0.0); + let child = world.entity(root).get::().unwrap()[0]; + assert_eq!(world.entity(child).get_prop::("depth"), 1.0); +} + +/// When scenes are composed, a later `EntityProps` patch replaces the whole +/// property map; props from the base scene are not merged key-by-key. +#[test] +fn composed_scenes_replace_props_wholesale() { + fn base() -> impl Scene { + bsn! { EntityProps({Props::new().with("health", 100.0)}) } + } + + let mut app = test_app(); + let world = app.world_mut(); + let entity = world + .spawn_scene(bsn! { + base() + EntityProps({Props::new().with("mana", 50.0)}) + }) + .unwrap() + .id(); + + assert_eq!(world.entity(entity).get_prop::("mana"), 50.0); + assert_eq!(world.entity(entity).get_prop::("health"), 0.0); +} diff --git a/tests/props.rs b/tests/props.rs new file mode 100644 index 0000000..433ff34 --- /dev/null +++ b/tests/props.rs @@ -0,0 +1,50 @@ +//! Tests for entity and global props. + +use bevy_ecs::prelude::*; +use bevy_mod_props::prelude::*; + +/// Entity props and global props must not interfere with each other. As of +/// bevy 0.19 resources are components on singleton entities, so a single type +/// used as both a resource and a component would despawn other holders on +/// every insert. `EntityProps` and `GlobalProps` exist to prevent exactly +/// that. +#[test] +fn entity_and_global_props_are_independent() { + let mut world = World::new(); + + let frodo = world.spawn_empty().set_prop("name", "frodo").id(); + let sam = world.spawn_empty().set_prop("name", "sam").id(); + world.set_prop("name", "middle_earth"); + + assert_eq!(world.entity(frodo).get_prop::("name"), "frodo"); + assert_eq!(world.entity(sam).get_prop::("name"), "sam"); + assert_eq!(world.get_prop::("name"), "middle_earth"); +} + +#[test] +fn props_are_readable_through_queries() { + let mut world = World::new(); + + world.spawn(EntityProps(Props::new().with("health", 100.0))); + world.insert_resource(GlobalProps(Props::new().with("difficulty", 2.0))); + + let entity_props = world.query::<&EntityProps>().single(&world).unwrap(); + assert_eq!(entity_props["health"], 100.0); + + let global_props = world.resource::(); + assert_eq!(global_props["difficulty"], 2.0); +} + +#[test] +fn commands_write_props() { + let mut world = World::new(); + + let frodo = world.spawn_empty().id(); + let mut commands = world.commands(); + commands.entity(frodo).set_prop("has_ring", true); + commands.set_prop("age_of_ring", 4867.0); + world.flush(); + + assert!(world.entity(frodo).get_prop::("has_ring")); + assert_eq!(world.get_prop::("age_of_ring"), 4867.0); +}