Struct v8::MicrotaskQueue

source ·
#[repr(C)]
pub struct MicrotaskQueue(/* private fields */);
Expand description

Represents the microtask queue, where microtasks are stored and processed. https://html.spec.whatwg.org/multipage/webappapis.html#microtask-queue https://html.spec.whatwg.org/multipage/webappapis.html#enqueuejob(queuename,-job,-arguments) https://html.spec.whatwg.org/multipage/webappapis.html#perform-a-microtask-checkpoint

A MicrotaskQueue instance may be associated to multiple Contexts by passing it to Context::New(), and they can be detached by Context::DetachGlobal(). The embedder must keep the MicrotaskQueue instance alive until all associated Contexts are gone or detached.

Use the same instance of MicrotaskQueue for all Contexts that may access each other synchronously. E.g. for Web embedding, use the same instance for all origins that share the same URL scheme and eTLD+1.

Implementations§

source§

impl MicrotaskQueue

source

pub fn new(isolate: &mut Isolate, policy: MicrotasksPolicy) -> UniqueRef<Self>

source

pub fn enqueue_microtask( &self, isolate: &mut Isolate, microtask: Local<'_, Function> )

source

pub fn perform_checkpoint(&self, isolate: &mut Isolate)

Adds a callback to notify the embedder after microtasks were run. The callback is triggered by explicit RunMicrotasks call or automatic microtasks execution (see Isolate::SetMicrotasksPolicy).

Callback will trigger even if microtasks were attempted to run, but the microtasks queue was empty and no single microtask was actually executed.

Executing scripts inside the callback will not re-trigger microtasks and the callback.

source

pub fn is_running_microtasks(&self) -> bool

Removes callback that was installed by AddMicrotasksCompletedCallback.

source

pub fn get_microtasks_scope_depth(&self) -> i32

Returns the current depth of nested MicrotasksScope that has kRunMicrotasks.

Trait Implementations§

source§

impl Debug for MicrotaskQueue

source§

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

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

impl Drop for MicrotaskQueue

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

§

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.