From 0d49b45ea9fc568789a330b142144a092480170d Mon Sep 17 00:00:00 2001 From: "user.tax" Date: Fri, 16 Sep 2022 23:15:29 +0800 Subject: [PATCH] feat(napi): add impl>> From for Uint8Array (#1317) Co-authored-by: any --- crates/napi/src/bindgen_runtime/js_values/arraybuffer.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/napi/src/bindgen_runtime/js_values/arraybuffer.rs b/crates/napi/src/bindgen_runtime/js_values/arraybuffer.rs index 332789e7..2e4417d3 100644 --- a/crates/napi/src/bindgen_runtime/js_values/arraybuffer.rs +++ b/crates/napi/src/bindgen_runtime/js_values/arraybuffer.rs @@ -395,3 +395,9 @@ impl_typed_array!(Float64Array, f64, TypedArrayType::Float64); impl_typed_array!(BigInt64Array, i64, TypedArrayType::BigInt64); #[cfg(feature = "napi6")] impl_typed_array!(BigUint64Array, u64, TypedArrayType::BigUint64); + +impl>> From for Uint8Array { + fn from(data: T) -> Self { + Uint8Array::new(data.into()) + } +}