#[non_exhaustive]pub enum Job {
PromiseJob(PromiseJob),
AsyncJob(NativeAsyncJob),
TimeoutJob(TimeoutJob),
IntervalJob(IntervalJob),
GenericJob(GenericJob),
FinalizationRegistryCleanupJob(NativeAsyncJob),
}Expand description
A job that needs to be handled by a JobExecutor.
§Requirements
The specification defines many types of jobs, but all of them must adhere to a set of requirements:
- At some future point in time, when there is no running execution context and the execution
context stack is empty, the implementation must:
- Perform any host-defined preparation steps.
- Invoke the Job Abstract Closure.
- Perform any host-defined cleanup steps, after which the execution context stack must be empty.
- Only one Job may be actively undergoing evaluation at any point in time.
- Once evaluation of a Job starts, it must run to completion before evaluation of any other Job starts.
- The Abstract Closure must return a normal completion, implementing its own handling of errors.
Boa is a little bit flexible on the last requirement, since it allows jobs to return either values or errors, but the rest of the requirements must be followed for all conformant implementations.
Additionally, each job type can have additional requirements that must also be followed in addition to the previous ones.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PromiseJob(PromiseJob)
A Promise-related job.
See PromiseJob for more information.
AsyncJob(NativeAsyncJob)
A Future-related job.
See NativeAsyncJob for more information.
TimeoutJob(TimeoutJob)
A generic job that is to be executed after a number of milliseconds.
See TimeoutJob for more information.
IntervalJob(IntervalJob)
A generic job that is to be executed after intervals of a number of milliseconds.
See TimeoutJob for more information.
GenericJob(GenericJob)
A generic job.
See GenericJob for more information.
FinalizationRegistryCleanupJob(NativeAsyncJob)
A job that will eventually cleanup a FinalizationRegistry.
This job differs slightly from the spec; originally it’s defined
as being enqueued exactly when a FinalizationRegistry needs to call
FinalizationRegistry::cleanup, but here it’s defined as an async
job that suspends execution until it receives a signal from the engine
that the FinalizationRegistry needs to be cleaned up.
§Execution
As described on the spec’s section about execution,
Because calling
HostEnqueueFinalizationRegistryCleanupJobis optional, registered objects in aFinalizationRegistrydo not necessarily hold thatFinalizationRegistrylive. Implementations may omitFinalizationRegistrycallbacks for any reason, e.g., if theFinalizationRegistryitself becomes dead, or if the application is shutting down.
For this reason, it is recommended to exclude FinalizationRegistry cleanup
jobs from any condition that exits from JobExecutor::run_jobs.
By the same token, it is recommended to execute FinalizationRegistry cleanup
jobs separately from all other enqueued NativeAsyncJobs, prioritizing the
execution of all other jobs if possible.
Trait Implementations§
Source§impl From<GenericJob> for Job
impl From<GenericJob> for Job
Source§fn from(job: GenericJob) -> Self
fn from(job: GenericJob) -> Self
Source§impl From<IntervalJob> for Job
impl From<IntervalJob> for Job
Source§fn from(job: IntervalJob) -> Self
fn from(job: IntervalJob) -> Self
Source§impl From<NativeAsyncJob> for Job
impl From<NativeAsyncJob> for Job
Source§fn from(native_async_job: NativeAsyncJob) -> Self
fn from(native_async_job: NativeAsyncJob) -> Self
Source§impl From<PromiseJob> for Job
impl From<PromiseJob> for Job
Source§fn from(promise_job: PromiseJob) -> Self
fn from(promise_job: PromiseJob) -> Self
Source§impl From<TimeoutJob> for Job
impl From<TimeoutJob> for Job
Source§fn from(job: TimeoutJob) -> Self
fn from(job: TimeoutJob) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for Job
impl !Send for Job
impl !Sync for Job
impl !UnwindSafe for Job
impl Freeze for Job
impl Unpin for Job
impl UnsafeUnpin for Job
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.