7
7
pub mod registration;
8
8
9
9
mod class_name;
10
- mod godot_compatible ;
10
+ mod godot_convert ;
11
11
mod return_marshal;
12
12
mod signature;
13
13
14
14
pub use class_name:: * ;
15
- pub use godot_compatible :: * ;
15
+ pub use godot_convert :: * ;
16
16
#[ doc( hidden) ]
17
17
pub use return_marshal:: * ;
18
18
#[ doc( hidden) ]
@@ -25,7 +25,8 @@ use crate::builtin::*;
25
25
use crate :: engine:: global;
26
26
use registration:: method:: MethodParamOrReturnInfo ;
27
27
28
- /// Conversion of GodotFfi-types into/from [`Variant`].
28
+ /// Conversion of [`GodotFfi`] types to/from [`Variant`].
29
+ #[ doc( hidden) ]
29
30
pub trait GodotFfiVariant : Sized + GodotFfi {
30
31
fn ffi_to_variant ( & self ) -> Variant ;
31
32
fn ffi_from_variant ( variant : & Variant ) -> Result < Self , VariantConversionError > ;
@@ -98,38 +99,48 @@ mod sealed {
98
99
}
99
100
}
100
101
101
- /// Types that can represent some Godot type.
102
- ///
103
- /// This trait cannot be implemented for custom user types, for that you should see [`GodotConvert`]
104
- /// instead. A type implements `GodotType` when it can directly represent some primitive type exposed by
105
- /// Godot. For instance, [`i64`] implements `GodotType`, since it can be directly represented by Godot's
106
- /// `int` type. But [`VariantType`] does not implement `GodotType`. Since while it is an enum Godot uses, we
107
- /// have no native way to indicate to Godot that a value should be one of the variants of `VariantType`.
102
+ /// Type that is directly representable in the engine.
108
103
///
109
- /// Unlike [`GodotFfi`], types implementing this trait don't need to fully represent its corresponding Godot
110
- /// type. For instance [`i32`] does not implement [`GodotFfi`] because it cannot represent all values of
111
- /// Godot's `int` type, however it does implement `GodotType` because we can set the metadata of values with
112
- /// this type to indicate that they are 32 bits large.
104
+ /// This trait cannot be implemented for custom user types; for those, [`GodotConvert`] exists instead.
105
+ /// A type implements `GodotType` when Godot has a direct, native representation for it. For instance:
106
+ /// - [`i64`] implements `GodotType`, since it can be directly represented by Godot's `int` type.
107
+ /// - But [`VariantType`] does not implement `GodotType`. While it is an enum Godot uses, we have no native way to indicate
108
+ /// to Godot that a value should be one of the variants of `VariantType`.
109
+ //
110
+ // Unlike `GodotFfi`, types implementing this trait don't need to fully represent its corresponding Godot
111
+ // type. For instance [`i32`] does not implement `GodotFfi` because it cannot represent all values of
112
+ // Godot's `int` type, however it does implement `GodotType` because we can set the metadata of values with
113
+ // this type to indicate that they are 32 bits large.
113
114
pub trait GodotType : GodotConvert < Via = Self > + ToGodot + FromGodot + sealed:: Sealed {
115
+ #[ doc( hidden) ]
114
116
type Ffi : GodotFfiVariant ;
115
117
118
+ #[ doc( hidden) ]
116
119
fn to_ffi ( & self ) -> Self :: Ffi ;
120
+
121
+ #[ doc( hidden) ]
117
122
fn into_ffi ( self ) -> Self :: Ffi ;
123
+
124
+ #[ doc( hidden) ]
118
125
fn try_from_ffi ( ffi : Self :: Ffi ) -> Option < Self > ;
119
126
127
+ #[ doc( hidden) ]
120
128
fn from_ffi ( ffi : Self :: Ffi ) -> Self {
121
129
Self :: try_from_ffi ( ffi) . unwrap ( )
122
130
}
123
131
132
+ #[ doc( hidden) ]
124
133
fn param_metadata ( ) -> sys:: GDExtensionClassMethodArgumentMetadata {
125
134
Self :: Ffi :: default_param_metadata ( )
126
135
}
127
136
137
+ #[ doc( hidden) ]
128
138
fn class_name ( ) -> ClassName {
129
139
// If we use `ClassName::of::<()>()` then this type shows up as `(no base)` in documentation.
130
140
ClassName :: none ( )
131
141
}
132
142
143
+ #[ doc( hidden) ]
133
144
fn property_info ( property_name : & str ) -> PropertyInfo {
134
145
PropertyInfo {
135
146
variant_type : Self :: Ffi :: variant_type ( ) ,
@@ -141,10 +152,12 @@ pub trait GodotType: GodotConvert<Via = Self> + ToGodot + FromGodot + sealed::Se
141
152
}
142
153
}
143
154
155
+ #[ doc( hidden) ]
144
156
fn argument_info ( property_name : & str ) -> MethodParamOrReturnInfo {
145
157
MethodParamOrReturnInfo :: new ( Self :: property_info ( property_name) , Self :: param_metadata ( ) )
146
158
}
147
159
160
+ #[ doc( hidden) ]
148
161
fn return_info ( ) -> Option < MethodParamOrReturnInfo > {
149
162
Some ( MethodParamOrReturnInfo :: new (
150
163
Self :: property_info ( "" ) ,
0 commit comments