暴露一种使用嵌入器拥有的内存来支持 ArrayBuffer/SharedArrayBuffer 的方法
作者: Shine-neko创建于 2026年7月25日更新于 2026年7月30日
// On the JS wrapper:
impl JsArrayBuffer {
/// Create an ArrayBuffer that aliases len bytes at ptr.
///
/// # Safety
/// The caller must keep the region valid and unmoved for the buffer's
/// lifetime, and must not alias it mutably from Rust while JS may run.
pub unsafe fn from_external_ptr(
ptr: *mut u8,
len: usize,
context: &mut Context,
…
内容来源: boa-dev/boa