Trait napi_h::bindgen_prelude::ValidateNapiValue
source · pub trait ValidateNapiValue: FromNapiValue + TypeName {
// Provided method
unsafe fn validate(
env: napi_env,
napi_val: napi_value
) -> Result<napi_value> { ... }
}
Provided Methods§
sourceunsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
§Safety
this function called to validate whether napi value passed to rust is valid type
The reason why this function return napi_value
is that if a Promise<T>
passed in
we need to return Promise.reject(T)
, not the T
.
So we need to create Promise.reject(T)
in this function.
Object Safety§
This trait is not object safe.