The usage of u64 vs usize is not unified for indices of the types backed by ArrayBuffer.
We want to use usize wherever possible.
For example:
|
/// Returns the `byte_offset` field property of [`JsDataView`] as a u64 integer |
|
#[inline] |
|
pub fn byte_offset(&self, context: &mut Context) -> JsResult<u64> { |
|
DataView::get_byte_offset(&self.inner.clone().upcast().into(), &[], context) |
|
.map(|v| v.as_number().expect("byte_offset value must be a number") as u64) |
|
} |
|
|
|
/// The internal representation of an `ArrayBuffer` object. |
|
#[derive(Debug, Clone, Trace, Finalize, JsData)] |
|
pub struct ArrayBuffer { |
|
/// The `[[ArrayBufferData]]` internal slot. |
|
#[unsafe_ignore_trace] |
|
data: Option<AlignedVec<u8>>, |
|
|
|
/// The `[[ArrayBufferMaxByteLength]]` internal slot. |
|
max_byte_len: Option<u64>, |
|
|
|
/// The `[[ArrayBufferDetachKey]]` internal slot. |
|
detach_key: JsValue, |
|
} |
|
|
The usage of
u64vsusizeis not unified for indices of the types backed byArrayBuffer.We want to use
usizewherever possible.For example:
boa/core/engine/src/object/builtins/jsdataview.rs
Lines 180 to 186 in 27959b2
boa/core/engine/src/builtins/array_buffer/mod.rs
Lines 200 to 213 in 27959b2