From d151318131d461e070fb65ebd0306cffd475d02b Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sat, 10 Oct 2020 19:00:21 +0800 Subject: [PATCH] fix(napi): TypedArray napi < 6 compatible issue --- napi/src/js_values/arraybuffer.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/napi/src/js_values/arraybuffer.rs b/napi/src/js_values/arraybuffer.rs index d8017209..3aac6a65 100644 --- a/napi/src/js_values/arraybuffer.rs +++ b/napi/src/js_values/arraybuffer.rs @@ -40,7 +40,9 @@ pub enum TypedArrayType { Uint32, Float32, Float64, + #[cfg(napi6)] BigInt64, + #[cfg(napi6)] BigUint64, } @@ -56,7 +58,9 @@ impl From for TypedArrayType { sys::napi_typedarray_type::napi_uint32_array => Self::Uint32, sys::napi_typedarray_type::napi_float32_array => Self::Float32, sys::napi_typedarray_type::napi_float64_array => Self::Float64, + #[cfg(napi6)] sys::napi_typedarray_type::napi_bigint64_array => Self::BigInt64, + #[cfg(napi6)] sys::napi_typedarray_type::napi_biguint64_array => Self::BigUint64, } } @@ -74,7 +78,9 @@ impl From for sys::napi_typedarray_type { TypedArrayType::Uint32 => sys::napi_typedarray_type::napi_uint32_array, TypedArrayType::Float32 => sys::napi_typedarray_type::napi_float32_array, TypedArrayType::Float64 => sys::napi_typedarray_type::napi_float64_array, + #[cfg(napi6)] TypedArrayType::BigInt64 => sys::napi_typedarray_type::napi_bigint64_array, + #[cfg(napi6)] TypedArrayType::BigUint64 => sys::napi_typedarray_type::napi_biguint64_array, } }