@@ -154,7 +154,6 @@ impl Callable {
154
154
///
155
155
/// This constructor only allows the callable to be invoked from the same thread as creating it. If you need to invoke it from any thread,
156
156
/// use [`from_sync_fn`][Self::from_sync_fn] instead (requires crate feature `experimental-threads`; only enable if really needed).
157
- #[ cfg( since_api = "4.2" ) ]
158
157
pub fn from_local_fn < R , F , S > ( name : S , rust_function : F ) -> Self
159
158
where
160
159
R : ToGodot ,
@@ -201,9 +200,10 @@ impl Callable {
201
200
///
202
201
/// After the first invocation, subsequent calls will panic with a message indicating the callable has already been consumed. This is
203
202
/// useful for deferred operations that should only execute once. For repeated execution, use [`from_local_fn()][Self::from_local_fn].
204
- pub ( crate ) fn from_once_fn < F , S > ( name : S , rust_function : F ) -> Self
203
+ pub ( crate ) fn from_once_fn < R , F , S > ( name : S , rust_function : F ) -> Self
205
204
where
206
- F : ' static + FnOnce ( & [ & Variant ] ) -> Variant ,
205
+ R : ToGodot ,
206
+ F : ' static + FnOnce ( & [ & Variant ] ) -> R ,
207
207
S : meta:: AsArg < GString > ,
208
208
{
209
209
meta:: arg_into_owned!( name) ;
@@ -213,6 +213,7 @@ impl Callable {
213
213
let rust_fn_once = rust_fn_once
214
214
. take ( )
215
215
. expect ( "callable created with from_once_fn() has already been consumed" ) ;
216
+
216
217
rust_fn_once ( args)
217
218
} )
218
219
}
@@ -265,14 +266,15 @@ impl Callable {
265
266
/// });
266
267
/// ```
267
268
#[ cfg( feature = "experimental-threads" ) ]
268
- pub fn from_sync_fn < F , S > ( name : S , rust_function : F ) -> Self
269
+ pub fn from_sync_fn < R , F , S > ( name : S , rust_function : F ) -> Self
269
270
where
270
- F : ' static + Send + Sync + FnMut ( & [ & Variant ] ) -> Variant ,
271
+ R : ToGodot ,
272
+ F : ' static + Send + Sync + FnMut ( & [ & Variant ] ) -> R ,
271
273
S : meta:: AsArg < GString > ,
272
274
{
273
275
meta:: arg_into_owned!( name) ;
274
276
275
- Self :: from_fn_wrapper :: < F , Variant > ( FnWrapper {
277
+ Self :: from_fn_wrapper :: < F , R > ( FnWrapper {
276
278
rust_function,
277
279
name,
278
280
thread_id : None ,
0 commit comments