pub trait TurboTasksBackendApi<B: Backend + 'static>:
TurboTasksCallApi
+ Sync
+ Send {
// Required methods
fn pin(&self) -> Arc<dyn TurboTasksBackendApi<B>>;
fn get_fresh_persistent_task_id(&self) -> Unused<TaskId>;
fn get_fresh_transient_task_id(&self) -> Unused<TaskId>;
unsafe fn reuse_persistent_task_id(&self, id: Unused<TaskId>);
unsafe fn reuse_transient_task_id(&self, id: Unused<TaskId>);
fn schedule(&self, task: TaskId);
fn schedule_backend_foreground_job(&self, job: B::BackendJob);
fn schedule_backend_background_job(&self, job: B::BackendJob);
fn program_duration_until(&self, instant: Instant) -> Duration;
fn is_idle(&self) -> bool;
fn backend(&self) -> &B;
}
Expand description
A subset of the TurboTasks
API that’s exposed to Backend
implementations.
Required Methods§
fn pin(&self) -> Arc<dyn TurboTasksBackendApi<B>>
fn get_fresh_persistent_task_id(&self) -> Unused<TaskId>
fn get_fresh_transient_task_id(&self) -> Unused<TaskId>
Sourceunsafe fn reuse_persistent_task_id(&self, id: Unused<TaskId>)
unsafe fn reuse_persistent_task_id(&self, id: Unused<TaskId>)
§Safety
The caller must ensure that the task id is not used anymore.
Sourceunsafe fn reuse_transient_task_id(&self, id: Unused<TaskId>)
unsafe fn reuse_transient_task_id(&self, id: Unused<TaskId>)
§Safety
The caller must ensure that the task id is not used anymore.
Sourcefn schedule_backend_foreground_job(&self, job: B::BackendJob)
fn schedule_backend_foreground_job(&self, job: B::BackendJob)
Schedule a foreground backend job for execution.
Sourcefn schedule_backend_background_job(&self, job: B::BackendJob)
fn schedule_backend_background_job(&self, job: B::BackendJob)
Schedule a background backend job for execution.
Background jobs are not counted towards activeness of the system. The system is considered idle even with active background jobs.
Sourcefn program_duration_until(&self, instant: Instant) -> Duration
fn program_duration_until(&self, instant: Instant) -> Duration
Returns the duration from the start of the program to the given instant.