pub trait JobExecutor: Any {
// Required methods
fn enqueue_job(self: Rc<Self>, job: Job, context: &mut Context);
fn run_jobs(self: Rc<Self>, context: &mut Context) -> JsResult<()>;
// Provided method
async fn run_jobs_async(
self: Rc<Self>,
context: &RefCell<&mut Context>,
) -> JsResult<()>
where Self: Sized { ... }
}Expand description
An executor of ECMAscript Jobs.
This is the main API that allows creating custom event loops.
Required Methods§
Provided Methods§
Sourceasync fn run_jobs_async(
self: Rc<Self>,
context: &RefCell<&mut Context>,
) -> JsResult<()>where
Self: Sized,
async fn run_jobs_async(
self: Rc<Self>,
context: &RefCell<&mut Context>,
) -> JsResult<()>where
Self: Sized,
Asynchronously runs all jobs in the executor.
By default forwards to JobExecutor::run_jobs. Implementors using async should override this
with a proper algorithm to run jobs asynchronously.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".