File tree Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Expand file tree Collapse file tree 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -985,7 +985,10 @@ impl<T: ArrayElement> Var for Array<T> {
985
985
}
986
986
}
987
987
988
- impl < T : ArrayElement > Export for Array < T > {
988
+ impl < T > Export for Array < T >
989
+ where
990
+ T : ArrayElement + Export ,
991
+ {
989
992
fn export_hint ( ) -> PropertyHintInfo {
990
993
// If T == Variant, then we return "Array" builtin type hint.
991
994
if Self :: has_variant_t ( ) {
Original file line number Diff line number Diff line change @@ -65,6 +65,47 @@ pub trait Export: Var {
65
65
}
66
66
}
67
67
68
+ /// This function only exists as a place to add doc-tests for the `Export` trait.
69
+ ///
70
+ /// Test with export of exportable type should succeed:
71
+ /// ```no_run
72
+ /// use godot::prelude::*;
73
+ ///
74
+ /// #[derive(GodotClass)]
75
+ /// #[class(init)]
76
+ /// struct Foo {
77
+ /// #[export]
78
+ /// obj: Option<Gd<Resource>>,
79
+ /// #[export]
80
+ /// array: Array<Gd<Resource>>,
81
+ /// }
82
+ /// ```
83
+ ///
84
+ /// Tests with export of non-exportable type should fail:
85
+ /// ```compile_fail
86
+ /// use godot::prelude::*;
87
+ ///
88
+ /// #[derive(GodotClass)]
89
+ /// #[class(init)]
90
+ /// struct Foo {
91
+ /// #[export]
92
+ /// obj: Option<Gd<Object>>,
93
+ /// }
94
+ /// ```
95
+ ///
96
+ /// ```compile_fail
97
+ /// use godot::prelude::*;
98
+ ///
99
+ /// #[derive(GodotClass)]
100
+ /// #[class(init)]
101
+ /// struct Foo {
102
+ /// #[export]
103
+ /// array: Array<Gd<Object>>,
104
+ /// }
105
+ /// ```
106
+ #[ allow( dead_code) ]
107
+ fn export_doctests ( ) { }
108
+
68
109
// ----------------------------------------------------------------------------------------------------------------------------------------------
69
110
// Blanket impls for Option<T>
70
111
You can’t perform that action at this time.
0 commit comments