pub struct PromiseState {
pub status: PromiseStatus,
pub reactions: Vec<PromiseReaction>,
pub handled: bool,
pub resolved: bool,
}Expand description
A Promise’s state, shared between the promise object and its resolve/reject
functions.
Behind an Rc for the same reason a proxy’s slots are: the resolve and reject
functions handed to an executor have to settle this promise later, from a call site
that only has the function.
Fields§
§status: PromiseStatusPending, or the value it settled with.
reactions: Vec<PromiseReaction>The then reactions waiting on it, in registration order.
handled: boolWhether a rejection has been seen by a handler.
A rejection that never is becomes an unhandled-rejection report, which the reference makes fatal at the end of the job queue.
resolved: bool[[AlreadyResolved]], the record the resolving functions share.
It is not the status: resolving with a thenable leaves the promise Pending
while the adoption job is queued, yet a later reject from the same pair must be a
no-op (Promise/exception-after-resolve-in-executor).