This is an automated archive made by the Lemmit Bot.

The original was posted on /r/rust by /u/bromeon on 2025-05-31 22:42:06+00:00.


godot-rust v0.3 brings type-safe signals to the table.

If you register a signal:

#[signal]
fn damage_taken(amount: i32);

you can now freely connect it with other Rust functions:

fn 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:

self.signals().damage_taken().emit(42);

Furthermore, you can now await signals, effectively introducing async tasks:

godot::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!