pub trait CurrentThreadTaskDriver:
Send
+ Sync
+ 'static {
// Required method
fn dispatch(&self, delivery: CurrentThreadTaskDelivery) -> bool;
// Provided methods
fn is_live(&self) -> bool { ... }
fn on_swept(&self) { ... }
}Expand description
Host-turn dispatcher for the CurrentThread runnable queue.
The NAPI binding registers one weak native threadsafe-function driver per importing environment. Its custom Node-API callback owns the fresh host turn and keeps delivery capabilities out of JavaScript. Scheduling through a fresh host turn is required for soundness: arbitrary futures may invoke their waker while holding internal locks, so polling the runnable inline from that wake can self-deadlock.
Required Methods§
Sourcefn dispatch(&self, delivery: CurrentThreadTaskDelivery) -> bool
fn dispatch(&self, delivery: CurrentThreadTaskDelivery) -> bool
Queue one host turn that will call drive_current_thread_tasks with
CurrentThreadTaskDelivery::capability.
The delivery capability is scoped to this exact host registration and
attempt. The registry maps it back to the executor’s one internal
dispatch capability only while this attempt remains current.
false means this driver can no longer dispatch and must be swept. After
returning true, the driver must eventually call either
acknowledge_current_thread_task_delivery or
fail_current_thread_task_delivery with this exact value. A successful
acknowledgement is accepted only after
drive_current_thread_tasks claimed this exact delivery.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".