diff --git a/Cargo.lock b/Cargo.lock index c1c55d7..edf7ba7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f47983a1084940ba9a39c077a8c63e55c619388be5476ac04c804cfbd1e63459" dependencies = [ "accesskit", - "hashbrown 0.15.1", + "hashbrown 0.15.2", "immutable-chunkmap", ] @@ -27,7 +27,7 @@ checksum = "7329821f3bd1101e03a7d2e03bd339e3ac0dc64c70b4c9f9ae1949e3ba8dece1" dependencies = [ "accesskit", "accesskit_consumer", - "hashbrown 0.15.1", + "hashbrown 0.15.2", "objc2", "objc2-app-kit", "objc2-foundation", @@ -41,7 +41,7 @@ checksum = "24fcd5d23d70670992b823e735e859374d694a3d12bfd8dd32bd3bd8bedb5d81" dependencies = [ "accesskit", "accesskit_consumer", - "hashbrown 0.15.1", + "hashbrown 0.15.2", "paste", "static_assertions", "windows 0.58.0", @@ -66,6 +66,7 @@ name = "actuate" version = "0.11.0" dependencies = [ "actuate-macros", + "ahash", "bevy", "bevy_app", "bevy_ecs", @@ -73,6 +74,9 @@ dependencies = [ "bevy_math", "bevy_time", "bevy_utils", + "crossbeam-queue", + "futures", + "hashbrown 0.15.2", "reqwest", "serde", "slotmap", @@ -1751,6 +1755,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -2106,6 +2119,21 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + [[package]] name = "futures-channel" version = "0.3.31" @@ -2113,6 +2141,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -2121,6 +2150,17 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.31" @@ -2140,6 +2180,17 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "futures-sink" version = "0.3.31" @@ -2158,10 +2209,16 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ + "futures-channel", "futures-core", + "futures-io", + "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", + "slab", ] [[package]] @@ -2411,10 +2468,12 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ + "allocator-api2", + "equivalent", "foldhash", ] @@ -2725,7 +2784,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.1", + "hashbrown 0.15.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 0b5df63..6cb2dac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,11 +9,12 @@ repository = "https://github.com/actuate-rs/actuate" [features] animation = ["ecs", "dep:bevy_math", "dep:bevy_time"] ecs = ["dep:bevy_app", "dep:bevy_ecs", "dep:bevy_hierarchy", "dep:bevy_utils"] -executor = [] +executor = ["std", "dep:tokio"] rt = ["executor", "tokio/rt-multi-thread"] +std = [] tracing = ["dep:tracing"] full = ["animation", "ecs", "rt", "tracing"] -default = [] +default = ["std"] [workspace] members = [ @@ -23,16 +24,20 @@ members = [ [dependencies] actuate-macros = { version = "0.1.6", path = "macros" } +ahash = { version = "0.8.11", default-features = false } bevy_app = { version = "0.15.0", optional = true } bevy_ecs = { version = "0.15.0", optional = true } bevy_hierarchy = { version = "0.15.0", optional = true } bevy_math = { version = "0.15.0", optional = true } bevy_time = { version = "0.15.0", optional = true } bevy_utils = { version = "0.15.0", optional = true } +crossbeam-queue = { version = "0.3.11", default-features = false, features = ["alloc"] } +futures = "0.3.31" +hashbrown = "0.15.2" slotmap = "1.0.7" thiserror = "2.0.3" tracing = { version = "0.1.40", optional = true } -tokio = { version = "1.41.1", features = ["sync"] } +tokio = { version = "1.41.1", features = ["sync"], optional = true } typeid = "1.0.2" [dev-dependencies] diff --git a/examples/core/composer.rs b/examples/core/composer.rs index b3b88c7..f5b3afa 100644 --- a/examples/core/composer.rs +++ b/examples/core/composer.rs @@ -32,6 +32,7 @@ fn main() { .unwrap(); let mut composer = Composer::new(App); - composer.compose().unwrap(); - composer.compose().unwrap(); + composer.try_compose().unwrap().unwrap(); + + assert!(composer.try_compose().is_none()); } diff --git a/examples/core/error_handling.rs b/examples/core/error_handling.rs index 9368337..e3d55fa 100644 --- a/examples/core/error_handling.rs +++ b/examples/core/error_handling.rs @@ -35,5 +35,5 @@ fn main() { .unwrap(); let mut composer = Composer::new(App); - assert!(composer.compose().is_ok()); + assert!(composer.try_compose().unwrap().is_ok()); } diff --git a/src/animation.rs b/src/animation.rs index 73787bb..b2787bf 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -17,10 +17,10 @@ struct State { } /// Use an animated value. -pub fn use_animated( - cx: ScopeState, - make_initial: impl FnOnce() -> T, -) -> UseAnimated { +pub fn use_animated(cx: ScopeState, make_initial: impl FnOnce() -> T) -> UseAnimated +where + T: VectorSpace + Send + 'static, +{ let start_cell = use_world_once(cx, |time: Res