Skip to main content

Job

Enum Job 

Source
pub enum Job {
    Reaction {
        handler: Option<Value>,
        argument: Value,
        rejected: bool,
        promise: Gc<JsObject>,
    },
    Thenable {
        then: Value,
        value: Value,
        promise: Gc<JsObject>,
    },
    Import {
        specifier: String,
        referrer: String,
        promise: Gc<JsObject>,
    },
    GeneratorResume {
        generator: Gc<JsObject>,
        promise: Gc<JsObject>,
        kind: ResumeKind,
        value: Value,
    },
    Resume {
        coroutine: Gc<JsObject>,
        promise: Gc<JsObject>,
        kind: ResumeKind,
        value: Value,
    },
}
Expand description

One microtask.

The queue holds data rather than closures because its contents are GC values: a closure would be invisible to the collector, and a pending reaction is exactly the kind of thing that must keep its handlers and its promise alive.

Variants§

§

Reaction

A then reaction about to run.

Fields

§handler: Option<Value>

The onFulfilled/onRejected to call, or None for the pass-through case.

§argument: Value

The value or reason to call it with.

§rejected: bool

Whether the source promise rejected, which decides the pass-through kind.

§promise: Gc<JsObject>

The promise the answer settles.

§

Thenable

Adopt a thenable: call its then with the adopting promise’s resolve/reject.

Fields

§then: Value

The then that was found on the value.

§value: Value

The thenable itself, which becomes then’s this.

§promise: Gc<JsObject>

The promise being resolved.

§

Import

A pending import(specifier).

Fields

§specifier: String

The specifier, already converted to a string.

§referrer: String

The module that asked, which the specifier resolves against.

§promise: Gc<JsObject>

The promise import() handed back.

§

GeneratorResume

An async generator resuming after the value it awaited settled.

Fields

§generator: Gc<JsObject>

The async generator to continue.

§promise: Gc<JsObject>

The promise the pending method returned.

§kind: ResumeKind

Whether this delivers the value or raises the reason.

§value: Value

The settled value, or the rejection reason.

§

Resume

An async function resuming after the value it awaited settled.

Fields

§coroutine: Gc<JsObject>

The body, parked in a coroutine.

§promise: Gc<JsObject>

The promise the async function handed its caller.

§kind: ResumeKind

Whether this resumption delivers a value or raises one.

§value: Value

The settled value, or the rejection reason.

Trait Implementations§

Source§

impl Trace for Job

Source§

fn trace(&self, tracer: &mut Tracer<'_>)

Report every Gc owned by self to tracer.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Job

§

impl !Send for Job

§

impl !Sync for Job

§

impl !UnwindSafe for Job

§

impl Forget for Job

§

impl Freeze for Job
where *const GcBox<JsString> is !null: Freeze, *const GcBox<JsObject> is !null: Freeze, *const GcBox<JsSymbol> is !null: Freeze, *const GcBox<BigInt> is !null: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for Job

§

impl Unpin for Job
where *const GcBox<JsString> is !null: Unpin, *const GcBox<JsObject> is !null: Unpin, *const GcBox<JsSymbol> is !null: Unpin, *const GcBox<BigInt> is !null: Unpin, *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Job
where *const GcBox<JsString> is !null: UnsafeUnpin, *const GcBox<JsObject> is !null: UnsafeUnpin, *const GcBox<JsSymbol> is !null: UnsafeUnpin, *const GcBox<BigInt> is !null: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.