@@ -53,6 +53,23 @@ impl Callable {
53
53
}
54
54
}
55
55
56
+ #[ cfg( since_api = "4.2" ) ]
57
+ fn default_callable_custom_info ( ) -> sys:: GDExtensionCallableCustomInfo {
58
+ sys:: GDExtensionCallableCustomInfo {
59
+ callable_userdata : ptr:: null_mut ( ) ,
60
+ token : ptr:: null_mut ( ) ,
61
+ object_id : 0 ,
62
+ call_func : None ,
63
+ is_valid_func : None , // could be customized, but no real use case yet.
64
+ free_func : None ,
65
+ hash_func : None ,
66
+ equal_func : None ,
67
+ // Op < is only used in niche scenarios and default is usually good enough, see https://github.com/godotengine/godot/issues/81901.
68
+ less_than_func : None ,
69
+ to_string_func : None ,
70
+ }
71
+ }
72
+
56
73
/// Create a callable from a Rust function or closure.
57
74
///
58
75
/// `name` is used for the string representation of the closure, which helps debugging.
@@ -83,16 +100,10 @@ impl Callable {
83
100
84
101
let info = sys:: GDExtensionCallableCustomInfo {
85
102
callable_userdata : Box :: into_raw ( Box :: new ( userdata) ) as * mut std:: ffi:: c_void ,
86
- token : ptr:: null_mut ( ) ,
87
- object : ptr:: null_mut ( ) ,
88
103
call_func : Some ( rust_callable_call_fn :: < F > ) ,
89
- is_valid_func : None , // could be customized, but no real use case yet.
90
104
free_func : Some ( rust_callable_destroy :: < FnWrapper < F > > ) ,
91
- hash_func : None ,
92
- equal_func : None ,
93
- // Op < is only used in niche scenarios and default is usually good enough, see https://github.com/godotengine/godot/issues/81901.
94
- less_than_func : None ,
95
105
to_string_func : Some ( rust_callable_to_string_named :: < F > ) ,
106
+ ..Self :: default_callable_custom_info ( )
96
107
} ;
97
108
98
109
Self :: from_custom_info ( info)
@@ -110,16 +121,12 @@ impl Callable {
110
121
111
122
let info = sys:: GDExtensionCallableCustomInfo {
112
123
callable_userdata : Box :: into_raw ( Box :: new ( userdata) ) as * mut std:: ffi:: c_void ,
113
- token : ptr:: null_mut ( ) ,
114
- object : ptr:: null_mut ( ) ,
115
124
call_func : Some ( rust_callable_call_custom :: < C > ) ,
116
- is_valid_func : None , // could be customized, but no real use case yet.
117
125
free_func : Some ( rust_callable_destroy :: < C > ) ,
118
126
hash_func : Some ( rust_callable_hash :: < C > ) ,
119
127
equal_func : Some ( rust_callable_equal :: < C > ) ,
120
- // Op < is only used in niche scenarios and default is usually good enough, see https://github.com/godotengine/godot/issues/81901.
121
- less_than_func : None ,
122
128
to_string_func : Some ( rust_callable_to_string_display :: < C > ) ,
129
+ ..Self :: default_callable_custom_info ( )
123
130
} ;
124
131
125
132
Self :: from_custom_info ( info)
0 commit comments