@@ -209,6 +209,8 @@ pub mod ffi {
209209 pub unsafe fn local_is_float64_array ( value : & Local ) -> bool ;
210210 pub unsafe fn local_is_bigint64_array ( value : & Local ) -> bool ;
211211 pub unsafe fn local_is_biguint64_array ( value : & Local ) -> bool ;
212+ pub unsafe fn local_is_float16_array ( value : & Local ) -> bool ;
213+ pub unsafe fn local_is_uint8clamped_array ( value : & Local ) -> bool ;
212214 pub unsafe fn local_is_array_buffer ( value : & Local ) -> bool ;
213215 pub unsafe fn local_is_array_buffer_view ( value : & Local ) -> bool ;
214216 pub unsafe fn local_is_function ( value : & Local ) -> bool ;
@@ -376,6 +378,11 @@ pub mod ffi {
376378 array : & Local ,
377379 index : usize ,
378380 ) -> u64 ;
381+ pub unsafe fn local_uint8clamped_array_get (
382+ isolate : * mut Isolate ,
383+ array : & Local ,
384+ index : usize ,
385+ ) -> u8 ;
379386
380387 // Global<T>
381388 pub unsafe fn global_reset ( value : Pin < & mut Global > ) ;
@@ -815,6 +822,7 @@ pub struct Float32Array;
815822pub struct Float64Array ;
816823pub struct BigInt64Array ;
817824pub struct BigUint64Array ;
825+ pub struct Uint8ClampedArray ;
818826
819827// Generic Local<'a, T> handle with lifetime
820828#[ derive( Debug ) ]
@@ -1010,6 +1018,18 @@ impl<'a, T> Local<'a, T> {
10101018 unsafe { ffi:: local_is_biguint64_array ( & self . handle ) }
10111019 }
10121020
1021+ /// Returns true if the value is a `Float16Array`.
1022+ pub fn is_float16_array ( & self ) -> bool {
1023+ // SAFETY: handle is valid within the current HandleScope.
1024+ unsafe { ffi:: local_is_float16_array ( & self . handle ) }
1025+ }
1026+
1027+ /// Returns true if the value is a `Uint8ClampedArray`.
1028+ pub fn is_uint8clamped_array ( & self ) -> bool {
1029+ // SAFETY: handle is valid within the current HandleScope.
1030+ unsafe { ffi:: local_is_uint8clamped_array ( & self . handle ) }
1031+ }
1032+
10131033 /// Returns true if the value is an `ArrayBuffer`.
10141034 pub fn is_array_buffer ( & self ) -> bool {
10151035 // SAFETY: handle is valid within the current HandleScope.
@@ -1229,6 +1249,7 @@ impl_local_cast!(Float32Array -> Value, is_float32_array);
12291249impl_local_cast ! ( Float64Array -> Value , is_float64_array) ;
12301250impl_local_cast ! ( BigInt64Array -> Value , is_bigint64_array) ;
12311251impl_local_cast ! ( BigUint64Array -> Value , is_biguint64_array) ;
1252+ impl_local_cast ! ( Uint8ClampedArray -> Value , is_uint8clamped_array) ;
12321253
12331254// TypedArray base type to Value. Uses `is_array_buffer_view` which also matches
12341255// `DataView`, but this is acceptable because `TypedArray` is only constructed from
@@ -1246,6 +1267,7 @@ impl_local_cast!(Float32Array -> TypedArray, is_float32_array);
12461267impl_local_cast ! ( Float64Array -> TypedArray , is_float64_array) ;
12471268impl_local_cast ! ( BigInt64Array -> TypedArray , is_bigint64_array) ;
12481269impl_local_cast ! ( BigUint64Array -> TypedArray , is_biguint64_array) ;
1270+ impl_local_cast ! ( Uint8ClampedArray -> TypedArray , is_uint8clamped_array) ;
12491271
12501272// Upcasts to Object (Function, Array, TypedArray are all Object subtypes in V8)
12511273impl_local_cast ! ( Function -> Object , is_function) ;
@@ -1634,6 +1656,11 @@ impl_typed_array_from_js!(Float32Array, is_float32_array, "Float32Array");
16341656impl_typed_array_from_js ! ( Float64Array , is_float64_array, "Float64Array" ) ;
16351657impl_typed_array_from_js ! ( BigInt64Array , is_bigint64_array, "BigInt64Array" ) ;
16361658impl_typed_array_from_js ! ( BigUint64Array , is_biguint64_array, "BigUint64Array" ) ;
1659+ impl_typed_array_from_js ! (
1660+ Uint8ClampedArray ,
1661+ is_uint8clamped_array,
1662+ "Uint8ClampedArray"
1663+ ) ;
16371664
16381665impl_typed_array ! ( Uint8Array , u8 , local_uint8_array_get) ;
16391666impl_typed_array ! ( Uint16Array , u16 , local_uint16_array_get) ;
@@ -1645,6 +1672,8 @@ impl_typed_array!(Float32Array, f32, local_float32_array_get);
16451672impl_typed_array ! ( Float64Array , f64 , local_float64_array_get) ;
16461673impl_typed_array ! ( BigInt64Array , i64 , local_bigint64_array_get) ;
16471674impl_typed_array ! ( BigUint64Array , u64 , local_biguint64_array_get) ;
1675+ // Uint8ClampedArray has the same element type as Uint8Array; clamping is a write-side JS concern.
1676+ impl_typed_array ! ( Uint8ClampedArray , u8 , local_uint8clamped_array_get) ;
16481677
16491678// =============================================================================
16501679// `String`-specific implementations
0 commit comments