We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 786a994 + 08cfadf commit cf16a91Copy full SHA for cf16a91
godot-core/src/obj/gd.rs
@@ -654,6 +654,16 @@ impl<T: GodotClass> Debug for Gd<T> {
654
}
655
656
657
+impl<T: GodotClass> std::hash::Hash for Gd<T> {
658
+ /// ⚠️ Hashes this object based on its instance ID.
659
+ ///
660
+ /// # Panics
661
+ /// When `self` is dead.
662
+ fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
663
+ self.instance_id().hash(state);
664
+ }
665
+}
666
+
667
// Gd unwinding across panics does not invalidate any invariants;
668
// its mutability is anyway present, in the Godot engine.
669
impl<T: GodotClass> std::panic::UnwindSafe for Gd<T> {}
0 commit comments