feat(napi): add from_unknown method on FromNapiValue

This commit is contained in:
LongYinan 2022-04-13 23:50:33 +08:00
parent 73882337cc
commit f05ced0782

View file

@ -89,6 +89,10 @@ pub trait FromNapiValue: Sized {
///
/// this function called to convert napi values to native rust values
unsafe fn from_napi_value(env: sys::napi_env, napi_val: sys::napi_value) -> Result<Self>;
fn from_unknown(value: JsUnknown) -> Result<Self> {
unsafe { Self::from_napi_value(value.0.env, value.0.value) }
}
}
pub trait FromNapiRef {