Function mozjs::jsapi::GetArrayBufferMaybeSharedLengthAndData

source ยท
pub unsafe extern "C" fn GetArrayBufferMaybeSharedLengthAndData(
    obj: *mut JSObject,
    length: *mut usize,
    isSharedMemory: *mut bool,
    data: *mut *mut u8,
)
Expand description

Get the length, sharedness, and data from an ArrayBufferMaybeShared subtypes.

The computed length and data pointer may be invalidated by a GC or by an unshared array buffer becoming detached. Callers must take care not to perform any actions that could trigger a GC or result in an unshared array buffer becoming detached. If such actions nonetheless must be performed, callers should perform this call a second time (and sensibly handle results that may be different from those returned the first time). (Sharedness is an immutable characteristic of an array buffer or shared array buffer, so that boolean remains valid across GC or detaching.)

|obj| must be an ArrayBufferMaybeShared subtype: an ArrayBuffer or a SharedArrayBuffer.

|*length| will be set to bytes in the buffer.

|*isSharedMemory| will be set to true if it is a SharedArrayBuffer, otherwise to false.

|*data| will be set to a pointer to the bytes in the buffer.