From 742d3ed97f8e439a5807dbbfece6c23935525bce Mon Sep 17 00:00:00 2001 From: Taym Haddadi Date: Mon, 29 Jan 2024 12:57:50 +0100 Subject: Make HeapFloat32Array generic (#31167) * Make HeapFloat32Array generic Signed-off-by: Bentaimia Haddadi * Define all the methods defaults on the HeapTypedArray trait Signed-off-by: Bentaimia Haddadi * Use generic type instead of trait Signed-off-by: Bentaimia Haddadi --------- Signed-off-by: Bentaimia Haddadi --- components/script/dom/gamepadpose.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'components/script/dom/gamepadpose.rs') diff --git a/components/script/dom/gamepadpose.rs b/components/script/dom/gamepadpose.rs index 60b2e4521a7..709c6fd7648 100644 --- a/components/script/dom/gamepadpose.rs +++ b/components/script/dom/gamepadpose.rs @@ -3,9 +3,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use dom_struct::dom_struct; -use js::typedarray::Float32Array; +use js::typedarray::{Float32, Float32Array}; -use super::bindings::typedarrays::HeapFloat32Array; +use super::bindings::typedarrays::HeapTypedArray; use crate::dom::bindings::codegen::Bindings::GamepadPoseBinding::GamepadPoseMethods; use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; @@ -16,17 +16,17 @@ use crate::script_runtime::JSContext; pub struct GamepadPose { reflector_: Reflector, #[ignore_malloc_size_of = "mozjs"] - position: HeapFloat32Array, + position: HeapTypedArray, #[ignore_malloc_size_of = "mozjs"] - orientation: HeapFloat32Array, + orientation: HeapTypedArray, #[ignore_malloc_size_of = "mozjs"] - linear_vel: HeapFloat32Array, + linear_vel: HeapTypedArray, #[ignore_malloc_size_of = "mozjs"] - angular_vel: HeapFloat32Array, + angular_vel: HeapTypedArray, #[ignore_malloc_size_of = "mozjs"] - linear_acc: HeapFloat32Array, + linear_acc: HeapTypedArray, #[ignore_malloc_size_of = "mozjs"] - angular_acc: HeapFloat32Array, + angular_acc: HeapTypedArray, } // TODO: support gamepad discovery @@ -35,12 +35,12 @@ impl GamepadPose { fn new_inherited() -> GamepadPose { GamepadPose { reflector_: Reflector::new(), - position: HeapFloat32Array::default(), - orientation: HeapFloat32Array::default(), - linear_vel: HeapFloat32Array::default(), - angular_vel: HeapFloat32Array::default(), - linear_acc: HeapFloat32Array::default(), - angular_acc: HeapFloat32Array::default(), + position: HeapTypedArray::default(), + orientation: HeapTypedArray::default(), + linear_vel: HeapTypedArray::default(), + angular_vel: HeapTypedArray::default(), + linear_acc: HeapTypedArray::default(), + angular_acc: HeapTypedArray::default(), } } -- cgit v1.2.3