fix(napi): block_on type (#1911)

This commit is contained in:
LongYinan 2024-01-24 17:13:42 +08:00 committed by GitHub
parent 57bcee590b
commit b4345d1375
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,9 +65,9 @@ where
/// Runs a future to completion
/// This is blocking, meaning that it pauses other execution until the future is complete,
/// only use it when it is absolutely necessary, in other places use async functions instead.
pub fn block_on<F>(fut: F) -> F::Output
pub fn block_on<F, O>(fut: F) -> F::Output
where
F: 'static + Send + Future<Output = ()>,
F: 'static + Send + Future<Output = O>,
{
RT.read().unwrap().as_ref().unwrap().block_on(fut)
}