File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,28 @@ pub trait Upcast<T> {
178
178
}
179
179
}
180
180
181
+ impl < T > Upcast < T > for T {
182
+ unsafe fn upcast_ptr ( this : * const Self ) -> * const Self {
183
+ this
184
+ }
185
+
186
+ unsafe fn from_base_ptr ( base : * const T ) -> * const Self {
187
+ base
188
+ }
189
+
190
+ fn upcast ( & self ) -> & Self {
191
+ self
192
+ }
193
+
194
+ fn upcast_mut ( & mut self ) -> & mut Self {
195
+ self
196
+ }
197
+
198
+ fn upcast_pin ( self : Pin < & mut Self > ) -> Pin < & mut Self > {
199
+ self
200
+ }
201
+ }
202
+
181
203
/// This trait is automatically implemented by CXX-Qt and you most likely do not need to manually implement it.
182
204
/// Trait for downcasting to a subclass, provided the subclass implements [Upcast] to this type.
183
205
/// Returns `None` in cases where `Sub` isn't a child class of `Self`.
You can’t perform that action at this time.
0 commit comments