mirror of
https://github.com/denoland/rusty_v8.git
synced 2025-03-09 21:47:00 -04:00
20 lines
645 B
Rust
20 lines
645 B
Rust
use crate::CachedData;
|
|
use crate::UnboundModuleScript;
|
|
use crate::UniqueRef;
|
|
|
|
extern "C" {
|
|
fn v8__UnboundModuleScript__CreateCodeCache(
|
|
script: *const UnboundModuleScript,
|
|
) -> *mut CachedData<'static>;
|
|
}
|
|
|
|
impl UnboundModuleScript {
|
|
/// Creates and returns code cache for the specified unbound_module_script.
|
|
/// This will return nullptr if the script cannot be serialized. The
|
|
/// CachedData returned by this function should be owned by the caller.
|
|
pub fn create_code_cache(&self) -> Option<UniqueRef<CachedData<'static>>> {
|
|
unsafe {
|
|
UniqueRef::try_from_raw(v8__UnboundModuleScript__CreateCodeCache(self))
|
|
}
|
|
}
|
|
}
|