Struct SnapshotCreator

Source
#[repr(C)]
pub struct SnapshotCreator(/* private fields */);
Expand description

Helper class to create a snapshot data blob.

Implementations§

Source§

impl SnapshotCreator

Source

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.

Source§

impl SnapshotCreator

Source

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.

Source

pub fn add_isolate_data<T>(&mut self, data: Local<'_, T>) -> usize
where 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.

Source

pub fn add_context_data<T>( &mut self, context: Local<'_, Context>, data: Local<'_, T>, ) -> usize
where 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.

Source

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.

Source

pub unsafe fn get_owned_isolate(&mut self) -> OwnedIsolate

This is marked unsafe because it should be called at most once per snapshot creator.

Trait Implementations§

Source§

impl Debug for SnapshotCreator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for SnapshotCreator

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.