mirror of
https://github.com/napi-rs/napi-rs.git
synced 2025-12-08 19:56:07 +00:00
Revert "fix(napi): callback should be Fn rather than FnOnce" (#2791)
This reverts commit 7449e5f5cc24e3b92e83aeba68991da7cf8a5b2c.
This commit is contained in:
parent
78d76709fa
commit
b6f883a053
@ -463,17 +463,14 @@ impl<T: FromNapiValue + 'static> futures_core::Stream for Reader<T> {
|
||||
None => return Poll::Ready(None),
|
||||
}
|
||||
}
|
||||
let waker = cx.waker().clone();
|
||||
let state = self.state.clone();
|
||||
let state_in_catch = state.clone();
|
||||
let waker = cx.waker().clone();
|
||||
self.inner.call_with_return_value(
|
||||
Ok(()),
|
||||
ThreadsafeFunctionCallMode::NonBlocking,
|
||||
move |iterator, _| {
|
||||
let iterator = iterator?;
|
||||
let state = state.clone();
|
||||
let state_in_catch = state_in_catch.clone();
|
||||
let waker = waker.clone();
|
||||
iterator
|
||||
.then(move |cx| {
|
||||
if cx.value.done {
|
||||
|
||||
@ -481,7 +481,7 @@ impl<
|
||||
}
|
||||
|
||||
/// Call the ThreadsafeFunction, and handle the return value with a callback
|
||||
pub fn call_with_return_value<F: 'static + Fn(Result<Return>, Env) -> Result<()>>(
|
||||
pub fn call_with_return_value<F: 'static + FnOnce(Result<Return>, Env) -> Result<()>>(
|
||||
&self,
|
||||
value: Result<T, ErrorStatus>,
|
||||
mode: ThreadsafeFunctionCallMode,
|
||||
@ -590,7 +590,7 @@ impl<
|
||||
}
|
||||
|
||||
/// Call the ThreadsafeFunction, and handle the return value with a callback
|
||||
pub fn call_with_return_value<F: 'static + Fn(Result<Return>, Env) -> Result<()>>(
|
||||
pub fn call_with_return_value<F: 'static + FnOnce(Result<Return>, Env) -> Result<()>>(
|
||||
&self,
|
||||
value: T,
|
||||
mode: ThreadsafeFunctionCallMode,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user