feat(napi): add impl<T: Into<Vec<u8>>> From<T> for Uint8Array (#1317)

Co-authored-by: any <any@user.tax>
This commit is contained in:
user.tax 2022-09-16 23:15:29 +08:00 committed by GitHub
parent ea18170779
commit 0d49b45ea9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -395,3 +395,9 @@ impl_typed_array!(Float64Array, f64, TypedArrayType::Float64);
impl_typed_array!(BigInt64Array, i64, TypedArrayType::BigInt64); impl_typed_array!(BigInt64Array, i64, TypedArrayType::BigInt64);
#[cfg(feature = "napi6")] #[cfg(feature = "napi6")]
impl_typed_array!(BigUint64Array, u64, TypedArrayType::BigUint64); impl_typed_array!(BigUint64Array, u64, TypedArrayType::BigUint64);
impl<T: Into<Vec<u8>>> From<T> for Uint8Array {
fn from(data: T) -> Self {
Uint8Array::new(data.into())
}
}