@@ -142,48 +142,9 @@ use std::{fmt, ops};
142
142
/// Exporting `DynGd<T, D>` is possible only via [`OnEditor`] or [`Option`].
143
143
/// `DynGd<T, D>` can also be exported directly as an element of an array such as `Array<DynGd<T, D>>`.
144
144
///
145
- /// Since `DynGd<T, D>` expresses shared functionality `D` among classes inheriting `T`,
146
- /// `#[export]` for `DynGd<T, D>` where `T` is a concrete Rust class is not allowed.
147
- ///
148
- /// ```compile_fail
149
- ///
150
- /// use godot::prelude::*;
151
- ///
152
- /// trait Health { /* ... */ }
153
- ///
154
- /// #[derive(GodotClass)]
155
- /// # #[class(init)]
156
- /// struct Monster { /* ... */ }
157
- ///
158
- /// #[godot_dyn]
159
- /// impl Health for Monster { /* ... */ }
160
- ///
161
- /// #[derive(GodotClass)]
162
- /// #[class(init, base = Node)]
163
- /// struct MyClass {
164
- /// #[export]
165
- /// dyn_concrete: Option<DynGd<Monster, dyn Health>>,
166
- /// }
167
- /// ```
168
- ///
169
- /// Consider using `Gd<T>` instead in such cases:
170
- ///
171
- /// ```
172
- /// use godot::prelude::*;
173
- ///
174
- /// #[derive(GodotClass)]
175
- /// #[class(init, base = Node)]
176
- /// struct Monster { /* ... */ }
177
- ///
178
- /// /* ... */
179
- ///
180
- /// #[derive(GodotClass)]
181
- /// #[class(init, base = Node)]
182
- /// struct MyClass {
183
- /// #[export]
184
- /// dyn_concrete: Option<Gd<Monster>>,
185
- /// }
186
- /// ```
145
+ /// Since `DynGd<T, D>` represents shared functionality `D` across classes inheriting from `T`,
146
+ /// consider using `#[export] Gd<T>` instead of `#[export] DynGd<T, D>`
147
+ /// in cases when `T` is a concrete Rust `GodotClass`.
187
148
///
188
149
/// ## Node based classes
189
150
///
@@ -562,7 +523,7 @@ where
562
523
/// Consider exporting `Option<Gd<T>>` instead of `Option<DynGd<T, D>>` for user-declared GDExtension classes.
563
524
impl < T , D > Export for Option < DynGd < T , D > >
564
525
where
565
- T : GodotClass + Bounds < Exportable = bounds:: Yes , Declarer = bounds :: DeclEngine > ,
526
+ T : GodotClass + Bounds < Exportable = bounds:: Yes > ,
566
527
D : ?Sized + ' static ,
567
528
{
568
529
fn export_hint ( ) -> PropertyHintInfo {
@@ -599,12 +560,12 @@ where
599
560
D : ?Sized + ' static ,
600
561
{
601
562
fn get_property ( & self ) -> Self :: Via {
602
- OnEditor :: < DynGd < T , D > > :: get_property_inner ( self )
563
+ Self :: get_property_inner ( self )
603
564
}
604
565
605
566
fn set_property ( & mut self , value : Self :: Via ) {
606
567
// `set_property` can't be delegated to Gd<T>, since we have to set `erased_obj` as well.
607
- OnEditor :: < DynGd < T , D > > :: set_property_inner ( self , value)
568
+ Self :: set_property_inner ( self , value)
608
569
}
609
570
}
610
571
@@ -613,8 +574,8 @@ where
613
574
/// Consider exporting `OnEditor<Gd<T>>` instead of `OnEditor<DynGd<T, D>>` for user-declared GDExtension classes.
614
575
impl < T , D > Export for OnEditor < DynGd < T , D > >
615
576
where
616
- OnEditor < DynGd < T , D > > : Var ,
617
- T : GodotClass + Bounds < Exportable = bounds:: Yes , Declarer = bounds :: DeclEngine > ,
577
+ Self : Var ,
578
+ T : GodotClass + Bounds < Exportable = bounds:: Yes > ,
618
579
D : ?Sized + ' static ,
619
580
{
620
581
fn export_hint ( ) -> PropertyHintInfo {
0 commit comments