feat(napi): add from_unknown method on FromNapiValue
This commit is contained in:
parent
73882337cc
commit
f05ced0782
1 changed files with 4 additions and 0 deletions
|
@ -89,6 +89,10 @@ pub trait FromNapiValue: Sized {
|
||||||
///
|
///
|
||||||
/// this function called to convert napi values to native rust values
|
/// 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>;
|
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 {
|
pub trait FromNapiRef {
|
||||||
|
|
Loading…
Reference in a new issue