Struct v8::CreateParams

source ·
pub struct CreateParams { /* private fields */ }
Expand description

Initial configuration parameters for a new Isolate.

Implementations§

source§

impl CreateParams

source

pub fn counter_lookup_callback( self, callback: extern "C" fn(name: *const char) -> *mut i32 ) -> Self

Enables the host application to provide a mechanism for recording statistics counters.

source

pub fn snapshot_blob(self, data: impl Allocated<[u8]>) -> Self

Explicitly specify a startup snapshot blob.

source

pub fn array_buffer_allocator( self, array_buffer_allocator: impl Into<SharedPtr<ArrayBufferAllocator>> ) -> Self

The ArrayBuffer::ArrayBufferAllocator to use for allocating and freeing the backing store of ArrayBuffers.

source

pub fn has_set_array_buffer_allocator(&self) -> bool

Check if array_buffer_allocator has already been called. Useful to some embedders that might want to set an allocator but not overwrite if one was already set by a user.

source

pub fn external_references(self, ext_refs: impl Allocated<[isize]>) -> Self

Specifies an optional nullptr-terminated array of raw addresses in the embedder that V8 can match against during serialization and use for deserialization. This array and its content must stay valid for the entire lifetime of the isolate.

source

pub fn allow_atomics_wait(self, value: bool) -> Self

Whether calling Atomics.wait (a function that may block) is allowed in this isolate. This can also be configured via SetAllowAtomicsWait.

source

pub fn only_terminate_in_safe_scope(self, value: bool) -> Self

Termination is postponed when there is no active SafeForTerminationScope.

source

pub fn embedder_wrapper_type_info_offsets( self, embedder_wrapper_type_index: int, embedder_wrapper_object_index: int ) -> Self

The following parameters describe the offsets for addressing type info for wrapped API objects and are used by the fast C API (for details see v8-fast-api-calls.h).

source

pub fn heap_limits(self, initial: usize, max: usize) -> Self

Configures the constraints with reasonable default values based on the provided lower and upper bounds.

By default V8 starts with a small heap and dynamically grows it to match the set of live objects. This may lead to ineffective garbage collections at startup if the live set is large. Setting the initial heap size avoids such garbage collections. Note that this does not affect young generation garbage collections.

When the heap size approaches max, V8 will perform series of garbage collections and invoke the NearHeapLimitCallback. If the garbage collections do not help and the callback does not increase the limit, then V8 will crash with V8::FatalProcessOutOfMemory.

The heap size includes both the young and the old generation.

§Arguments
  • initial - The initial heap size or zero in bytes
  • max - The hard limit for the heap size in bytes

Trait Implementations§

source§

impl Debug for CreateParams

source§

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

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

impl Default for CreateParams

source§

fn default() -> CreateParams

Returns the “default value” for a 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>,

§

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>,

§

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.