File tree 1 file changed +30
-2
lines changed
gdnative-core/src/core_types 1 file changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -592,8 +592,36 @@ impl StringName {
592
592
impl_basic_traits_as_sys ! {
593
593
for StringName as godot_string_name {
594
594
Drop => godot_string_name_destroy;
595
- Eq => godot_string_name_operator_equal;
596
- Ord => godot_string_name_operator_less;
595
+
596
+ // Note: Godot's equal/less implementations contained a bug until Godot 3.5, see https://github.com/godot-rust/godot-rust/pull/912
597
+ // Thus explicit impl as a workaround for now
598
+ // Eq => godot_string_name_operator_equal;
599
+ // Ord => godot_string_name_operator_less;
600
+ }
601
+ }
602
+
603
+ impl PartialEq for StringName {
604
+ #[ inline]
605
+ fn eq ( & self , other : & Self ) -> bool {
606
+ // Slow but correct -- see comment above
607
+ self . to_godot_string ( ) == other. to_godot_string ( )
608
+ }
609
+ }
610
+
611
+ impl Eq for StringName { }
612
+
613
+ impl PartialOrd for StringName {
614
+ #[ inline]
615
+ fn partial_cmp ( & self , other : & Self ) -> Option < Ordering > {
616
+ Some ( Ord :: cmp ( self , other) )
617
+ }
618
+ }
619
+
620
+ impl Ord for StringName {
621
+ #[ inline]
622
+ fn cmp ( & self , other : & Self ) -> Ordering {
623
+ // Slow but correct -- see comment above
624
+ Ord :: cmp ( & self . to_godot_string ( ) , & other. to_godot_string ( ) )
597
625
}
598
626
}
599
627
You can’t perform that action at this time.
0 commit comments