fix(napi): move JsValuesTupleIntoVec trait to function.rs
This commit is contained in:
parent
f69771e2d4
commit
f625328868
2 changed files with 8 additions and 9 deletions
|
@ -3,13 +3,14 @@ use std::ptr;
|
|||
use super::{FromNapiValue, ToNapiValue, TypeName, ValidateNapiValue};
|
||||
|
||||
pub use crate::JsFunction;
|
||||
use crate::{
|
||||
check_pending_exception, check_status, sys, threadsafe_function::JsValuesTupleIntoVec, Env,
|
||||
NapiRaw, Result, ValueType,
|
||||
};
|
||||
use crate::{check_pending_exception, check_status, sys, Env, NapiRaw, Result, ValueType};
|
||||
|
||||
impl ValidateNapiValue for JsFunction {}
|
||||
|
||||
pub trait JsValuesTupleIntoVec {
|
||||
fn into_vec(self, env: sys::napi_env) -> Result<Vec<sys::napi_value>>;
|
||||
}
|
||||
|
||||
/// A JavaScript function.
|
||||
/// It can only live in the scope of a function call.
|
||||
/// If you want to use it outside the scope of a function call, you can turn it into a reference.
|
||||
|
|
|
@ -8,7 +8,9 @@ use std::ptr::{self, null_mut};
|
|||
use std::sync::atomic::{AtomicBool, AtomicPtr, Ordering};
|
||||
use std::sync::{Arc, RwLock, RwLockWriteGuard, Weak};
|
||||
|
||||
use crate::bindgen_runtime::{FromNapiValue, ToNapiValue, TypeName, ValidateNapiValue};
|
||||
use crate::bindgen_runtime::{
|
||||
FromNapiValue, JsValuesTupleIntoVec, ToNapiValue, TypeName, ValidateNapiValue,
|
||||
};
|
||||
use crate::{check_status, sys, Env, JsError, JsUnknown, Result, Status};
|
||||
|
||||
/// ThreadSafeFunction Context object
|
||||
|
@ -254,10 +256,6 @@ impl<T: 'static, ES: ErrorStrategy::T> Clone for ThreadsafeFunction<T, ES> {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait JsValuesTupleIntoVec {
|
||||
fn into_vec(self, env: sys::napi_env) -> Result<Vec<sys::napi_value>>;
|
||||
}
|
||||
|
||||
impl<T: ToNapiValue> JsValuesTupleIntoVec for T {
|
||||
#[allow(clippy::not_unsafe_ptr_arg_deref)]
|
||||
fn into_vec(self, env: sys::napi_env) -> Result<Vec<sys::napi_value>> {
|
||||
|
|
Loading…
Reference in a new issue