File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -134,10 +134,18 @@ unsafe impl Bounds for NoBase {
134
134
/// This trait must only be implemented for subclasses of `Base`.
135
135
///
136
136
/// Importantly, this means it is always safe to upcast a value of type `Gd<Self>` to `Gd<Base>`.
137
- pub unsafe trait Inherits < Base : GodotClass > : GodotClass { }
137
+ pub unsafe trait Inherits < Base : GodotClass > : GodotClass {
138
+ /// True iff `Self == Base`.
139
+ ///
140
+ /// Exists because something like C++'s [`std::is_same`](https://en.cppreference.com/w/cpp/types/is_same.html) is notoriously difficult
141
+ /// in stable Rust, due to lack of specialization.
142
+ const IS_SAME_CLASS : bool = false ;
143
+ }
138
144
139
145
// SAFETY: Every class is a subclass of itself.
140
- unsafe impl < T : GodotClass > Inherits < T > for T { }
146
+ unsafe impl < T : GodotClass > Inherits < T > for T {
147
+ const IS_SAME_CLASS : bool = true ;
148
+ }
141
149
142
150
/// Trait that defines a `T` -> `dyn Trait` relation for use in [`DynGd`][crate::obj::DynGd].
143
151
///
You can’t perform that action at this time.
0 commit comments