Struct v8::SnapshotCreator
source · [−]#[repr(C)]pub struct SnapshotCreator(_);
Expand description
Helper class to create a snapshot data blob.
Implementations
sourceimpl SnapshotCreator
impl SnapshotCreator
sourcepub fn new(external_references: Option<&'static ExternalReferences>) -> Self
pub fn new(external_references: Option<&'static ExternalReferences>) -> Self
Create and enter an isolate, and set it up for serialization. The isolate is created from scratch.
sourceimpl SnapshotCreator
impl SnapshotCreator
sourcepub fn set_default_context(&mut self, context: Local<'_, Context>)
pub fn set_default_context(&mut self, context: Local<'_, Context>)
Set the default context to be included in the snapshot blob. The snapshot will not contain the global proxy, and we expect one or a global object template to create one, to be provided upon deserialization.
sourcepub fn add_isolate_data<T>(&mut self, data: Local<'_, T>) -> usizewhere
for<'l> Local<'l, T>: Into<Local<'l, Data>>,
pub fn add_isolate_data<T>(&mut self, data: Local<'_, T>) -> usizewhere
for<'l> Local<'l, T>: Into<Local<'l, Data>>,
Attach arbitrary v8::Data
to the isolate snapshot, which can be
retrieved via HandleScope::get_context_data_from_snapshot_once()
after
deserialization. This data does not survive when a new snapshot is created
from an existing snapshot.
sourcepub fn add_context_data<T>(
&mut self,
context: Local<'_, Context>,
data: Local<'_, T>
) -> usizewhere
for<'l> Local<'l, T>: Into<Local<'l, Data>>,
pub fn add_context_data<T>(
&mut self,
context: Local<'_, Context>,
data: Local<'_, T>
) -> usizewhere
for<'l> Local<'l, T>: Into<Local<'l, Data>>,
Attach arbitrary v8::Data
to the context snapshot, which can be
retrieved via HandleScope::get_context_data_from_snapshot_once()
after
deserialization. This data does not survive when a new snapshot is
created from an existing snapshot.
sourcepub fn create_blob(
&mut self,
function_code_handling: FunctionCodeHandling
) -> Option<StartupData>
pub fn create_blob(
&mut self,
function_code_handling: FunctionCodeHandling
) -> Option<StartupData>
Creates a snapshot data blob. This must not be called from within a handle scope.
sourcepub unsafe fn get_owned_isolate(&mut self) -> OwnedIsolate
pub unsafe fn get_owned_isolate(&mut self) -> OwnedIsolate
This is marked unsafe because it should be called at most once per snapshot creator.