diff --git a/documentation/docs/configuration.md b/documentation/docs/configuration.md index 8e36f47b..092dccc4 100644 --- a/documentation/docs/configuration.md +++ b/documentation/docs/configuration.md @@ -29,3 +29,4 @@ rinf = { version = "0.0.0", features = ["feature-name"] } - `rt-multi-thread`: Starts a worker thread for each CPU core available on the system within the `tokio` runtime by enabling its `rt-multi-thread` feature. By default, the `tokio` runtime uses only one thread. Enabling this feature allows the `tokio` runtime to utilize all the cores on your computer. This feature does not affect applications on the web platform. - `show-backtrace`: Prints the full backtrace in the CLI when a panic occurs in debug mode. In general, backtrace is not very helpful when debugging async apps, so consider using [`tracing`](https://crates.io/crates/tracing) for logging purposes. Note that this feature does not affect debugging on the web platform. +- `bevy`: Implements the `Event` trait from `bevy_ecs` for `DartSignal`, allowing Bevy's entity component system to listen for events from Dart. diff --git a/rust_crate/Cargo.toml b/rust_crate/Cargo.toml index a24716d9..4deaeadd 100644 --- a/rust_crate/Cargo.toml +++ b/rust_crate/Cargo.toml @@ -11,6 +11,10 @@ rust-version = "1.70" [features] rt-multi-thread = ["tokio/rt-multi-thread"] show-backtrace = ["backtrace"] +bevy = ["bevy_ecs"] + +[dependencies] +bevy_ecs = { version = "0.13", optional = true } [target.'cfg(not(target_family = "wasm"))'.dependencies] os-thread-local = "0.1.3" diff --git a/rust_crate/src/interface.rs b/rust_crate/src/interface.rs index 2bf3fe15..0578de13 100644 --- a/rust_crate/src/interface.rs +++ b/rust_crate/src/interface.rs @@ -10,6 +10,7 @@ use super::interface_web::*; /// Optionally, a custom binary called `binary` can also be included. /// This type is generic, and the message /// can be of any type declared in Protobuf. +#[cfg_attr(feature = "bevy", derive(bevy_ecs::event::Event))] pub struct DartSignal { /// The message instance of a struct generated by Protobuf. pub message: T,