@@ -36,7 +36,7 @@ use std::sync::{Arc, LazyLock};
36
36
use std:: time:: Instant ;
37
37
use v8:: {
38
38
Context , ContextOptions , ContextScope , Function , FunctionCallbackArguments , HandleScope , Isolate , IsolateHandle ,
39
- Local , Object , OwnedIsolate , Value ,
39
+ Local , Object , OwnedIsolate , ReturnValue , Value ,
40
40
} ;
41
41
42
42
mod de;
@@ -847,16 +847,16 @@ type FnRet<'s> = ExcResult<Local<'s, Value>>;
847
847
fn register_host_fun (
848
848
scope : & mut HandleScope < ' _ > ,
849
849
name : & str ,
850
- fun : impl for < ' s > Fn ( & mut HandleScope < ' s > , FunctionCallbackArguments < ' s > ) -> FnRet < ' s > ,
850
+ fun : impl Copy + for <' s > Fn ( & mut HandleScope < ' s > , FunctionCallbackArguments < ' s > ) -> FnRet < ' s > ,
851
851
) {
852
852
let name = v8_interned_string ( scope, name) . into ( ) ;
853
- let fun = Function :: new ( scope, & adapt_fun ( fun) ) . unwrap ( ) . into ( ) ;
853
+ let fun = Function :: new ( scope, adapt_fun ( fun) ) . unwrap ( ) . into ( ) ;
854
854
global ( scope) . set ( scope, name, fun) . unwrap ( ) ;
855
855
}
856
856
857
857
fn adapt_fun (
858
- fun : impl for < ' s > Fn ( & mut HandleScope < ' s > , FunctionCallbackArguments < ' s > ) -> FnRet < ' s > ,
859
- ) -> impl for < ' s > Fn ( & mut HandleScope < ' s > , FunctionCallbackArguments < ' s > , v8 :: ReturnValue < Value > ) {
858
+ fun : impl Copy + for <' s > Fn ( & mut HandleScope < ' s > , FunctionCallbackArguments < ' s > ) -> FnRet < ' s > ,
859
+ ) -> impl Copy + for <' s > Fn ( & mut HandleScope < ' s > , FunctionCallbackArguments < ' s > , ReturnValue < Value > ) {
860
860
move |scope, args, mut rv| {
861
861
if let Ok ( value) = fun ( scope, args) {
862
862
rv. set ( value) ;
0 commit comments