Skip to content

Commit 017f695

Browse files
committed
v8: fix register_host_fun / adapt_fun
1 parent 7ee9714 commit 017f695

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/core/src/host/v8/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use std::sync::{Arc, LazyLock};
3636
use std::time::Instant;
3737
use v8::{
3838
Context, ContextOptions, ContextScope, Function, FunctionCallbackArguments, HandleScope, Isolate, IsolateHandle,
39-
Local, Object, OwnedIsolate, Value,
39+
Local, Object, OwnedIsolate, ReturnValue, Value,
4040
};
4141

4242
mod de;
@@ -847,16 +847,16 @@ type FnRet<'s> = ExcResult<Local<'s, Value>>;
847847
fn register_host_fun(
848848
scope: &mut HandleScope<'_>,
849849
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>,
851851
) {
852852
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();
854854
global(scope).set(scope, name, fun).unwrap();
855855
}
856856

857857
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>) {
860860
move |scope, args, mut rv| {
861861
if let Ok(value) = fun(scope, args) {
862862
rv.set(value);

0 commit comments

Comments
 (0)