0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-12 16:59:32 -05:00
denoland-deno/cli/napi/util.rs
林炳权 1a26898377 chore: update to Rust 1.76 (#22376)
Update to Rust 1.76
2024-02-15 10:32:21 +05:30

8 lines
372 B
Rust

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
use deno_runtime::deno_napi::*;
pub fn get_array_buffer_ptr(ab: v8::Local<v8::ArrayBuffer>) -> *mut u8 {
// SAFETY: Thanks to the null pointer optimization, NonNull<T> and Option<NonNull<T>> are guaranteed
// to have the same size and alignment.
unsafe { std::mem::transmute(ab.data()) }
}