godot-rust v0.3 - type-safe signals and async/await
godot-rust v0.3 - type-safe signals and async/await

godot-rust.github.io
May 2025 dev update

cross-posted from: https://vger.social/post/19509421
godot-rust v0.3 brings type-safe signals to the table.
\ If you register a signal:rust#[signal] fn damage_taken(amount: i32);you can now freely connect it with other Rust functions:
rustfn ready(&mut self) { // Connect signal to the method: self.signals().damage_taken().connect(Self::on_damage_taken); // Or to an ad-hoc closure: self.signals().damage_taken().connect(|amount| { println!("Damage taken: {}", amount); }); // Or to a method of another object: let stats: Gd<Stats>; self.signals().damage_taken().connect_other(&stats, |stats, amount| { stats.update_total_damage(amount); }); }Emitting is also type-safe:
rustself.signals().damage_taken().emit(42);Furthermore, you can now await signals, effectively introducing async tasks:
rustgodot::task::spawn(async move { godot_print!("Wait for damage to occur..."); let (dmg,) = player.signals().damage_taken().to_future().await; godot_print!("Player took {dmg} damage."); });There are many other improvements, see devlog and feel free to ask me anything :)
Huge thanks to all the contributors who helped ship these features!
this was originally posted by [@bromeon@mastodon.gamedev.place](https://mastodon.gamedev.place/@bromeon) the project author on reddit. I'm just maintaining some parts of the project.