Skip to main content

set_immutable

Function set_immutable 

Source
pub fn set_immutable(ab: &ArrayBuffer<'_>)
Expand description

Mark an ArrayBuffer as immutable: subsequent writes through any Uint8Array / DataView view silently fail (or TypeError in strict mode), and .transfer() throws TypeError: ArrayBuffer is immutable.

Calling this on an already-immutable buffer is a no-op. Calling it on a detached buffer is a no-op (QuickJS returns -1 internally). The flag is checked at write/transfer time, not at create time, so the buffer can be initialised with bytes before being sealed.