pub struct TurboTasks<B: Backend + 'static> { /* private fields */ }
Implementations§
Source§impl<B: Backend + 'static> TurboTasks<B>
impl<B: Backend + 'static> TurboTasks<B>
pub fn new(backend: B) -> Arc<Self>
pub fn pin(&self) -> Arc<Self>
Sourcepub fn spawn_root_task<T, F, Fut>(&self, functor: F) -> TaskId
pub fn spawn_root_task<T, F, Fut>(&self, functor: F) -> TaskId
Creates a new root task
pub fn dispose_root_task(&self, task_id: TaskId)
Sourcepub fn spawn_once_task<T, Fut>(&self, future: Fut) -> TaskId
pub fn spawn_once_task<T, Fut>(&self, future: Fut) -> TaskId
Creates a new root task, that is only executed once. Dependencies will not invalidate the task.
pub async fn run_once<T: TraceRawVcs + Send + 'static>( &self, future: impl Future<Output = Result<T>> + Send + 'static, ) -> Result<T>
pub fn dynamic_call( &self, fn_type: FunctionId, this: Option<RawVc>, arg: Box<dyn MagicAny>, persistence: TaskPersistence, ) -> RawVc
pub fn trait_call( &self, trait_type: TraitTypeId, trait_fn_name: Cow<'static, str>, this: RawVc, arg: Box<dyn MagicAny>, persistence: TaskPersistence, ) -> RawVc
pub async fn wait_foreground_done(&self)
pub fn get_in_progress_count(&self) -> usize
Sourcepub async fn wait_task_completion(
&self,
id: TaskId,
consistency: ReadConsistency,
) -> Result<()>
pub async fn wait_task_completion( &self, id: TaskId, consistency: ReadConsistency, ) -> Result<()>
Waits for the given task to finish executing. This works by performing an untracked read, and discarding the value of the task output.
ReadConsistency::Eventual
means that this will return after the task executes, but
before all dependencies have completely settled.
ReadConsistency::Strong
means that this will also wait for the task and all dependencies
to fully settle before returning.
As this function is typically called in top-level code that waits for results to be ready
for the user to access, most callers should use ReadConsistency::Strong
.
pub async fn get_or_wait_update_info( &self, aggregation: Duration, ) -> (Duration, usize)
pub async fn update_info( &self, aggregation: Duration, timeout: Duration, ) -> Option<(Duration, usize)>
Sourcepub async fn get_or_wait_aggregated_update_info(
&self,
aggregation: Duration,
) -> UpdateInfo
pub async fn get_or_wait_aggregated_update_info( &self, aggregation: Duration, ) -> UpdateInfo
Returns UpdateInfo with all updates aggregated over a given duration
(aggregation
). Will wait until an update happens.
Sourcepub async fn aggregated_update_info(
&self,
aggregation: Duration,
timeout: Duration,
) -> Option<UpdateInfo>
pub async fn aggregated_update_info( &self, aggregation: Duration, timeout: Duration, ) -> Option<UpdateInfo>
Returns UpdateInfo with all updates aggregated over a given duration
(aggregation
). Will only return None when the timeout is reached while
waiting for the first update.
pub async fn wait_background_done(&self)
pub async fn stop_and_wait(&self)
pub fn backend(&self) -> &B
Trait Implementations§
Source§impl<B: Backend + 'static> TurboTasksApi for TurboTasks<B>
impl<B: Backend + 'static> TurboTasksApi for TurboTasks<B>
Source§fn detached_for_testing(
&self,
fut: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
fn detached_for_testing( &self, fut: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>
Creates a future that inherits the current task id and task state. The current global task will wait for this future to be dropped before exiting.
fn pin(&self) -> Arc<dyn TurboTasksApi>
fn invalidate(&self, task: TaskId)
fn invalidate_with_reason( &self, task: TaskId, reason: StaticOrArc<dyn InvalidationReason>, )
fn invalidate_serialization(&self, task: TaskId)
Source§fn notify_scheduled_tasks(&self)
fn notify_scheduled_tasks(&self)
schedule_notify_tasks_set()
fn try_read_task_output( &self, task: TaskId, consistency: ReadConsistency, ) -> Result<Result<RawVc, EventListener>>
Source§fn try_read_task_output_untracked(
&self,
task: TaskId,
consistency: ReadConsistency,
) -> Result<Result<RawVc, EventListener>>
fn try_read_task_output_untracked( &self, task: TaskId, consistency: ReadConsistency, ) -> Result<Result<RawVc, EventListener>>
fn try_read_task_cell( &self, task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<Result<TypedCellContent, EventListener>>
Source§fn try_read_task_cell_untracked(
&self,
task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<Result<TypedCellContent, EventListener>>
fn try_read_task_cell_untracked( &self, task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<Result<TypedCellContent, EventListener>>
Source§fn try_read_own_task_cell_untracked(
&self,
current_task: TaskId,
index: CellId,
options: ReadCellOptions,
) -> Result<TypedCellContent>
fn try_read_own_task_cell_untracked( &self, current_task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<TypedCellContent>
Source§fn try_read_local_output(
&self,
execution_id: ExecutionId,
local_task_id: LocalTaskId,
) -> Result<Result<RawVc, EventListener>>
fn try_read_local_output( &self, execution_id: ExecutionId, local_task_id: LocalTaskId, ) -> Result<Result<RawVc, EventListener>>
RawVc::LocalOutput
. If the task has completed, returns the RawVc
the local
task points to. Read morefn read_task_collectibles( &self, task: TaskId, trait_id: TraitTypeId, ) -> TaskCollectiblesMap
fn emit_collectible(&self, trait_type: TraitTypeId, collectible: RawVc)
fn unemit_collectible( &self, trait_type: TraitTypeId, collectible: RawVc, count: u32, )
fn unemit_collectibles( &self, trait_type: TraitTypeId, collectibles: &TaskCollectiblesMap, )
fn read_own_task_cell( &self, task: TaskId, index: CellId, options: ReadCellOptions, ) -> Result<TypedCellContent>
fn update_own_task_cell( &self, task: TaskId, index: CellId, content: CellContent, )
fn connect_task(&self, task: TaskId)
fn mark_own_task_as_finished(&self, task: TaskId)
fn set_own_task_aggregation_number(&self, task: TaskId, aggregation_number: u32)
fn mark_own_task_as_session_dependent(&self, task: TaskId)
fn task_statistics(&self) -> &TaskStatisticsApi
fn stop_and_wait(&self) -> Pin<Box<dyn Future<Output = ()> + Send + 'static>>
fn subscribe_to_compilation_events( &self, event_types: Option<Vec<String>>, ) -> Receiver<Arc<dyn CompilationEvent>>
fn send_compilation_event(&self, event: Arc<dyn CompilationEvent>)
Source§impl<B: Backend + 'static> TurboTasksBackendApi<B> for TurboTasks<B>
impl<B: Backend + 'static> TurboTasksBackendApi<B> for TurboTasks<B>
Source§fn schedule_notify_tasks(&self, tasks: &[TaskId])
fn schedule_notify_tasks(&self, tasks: &[TaskId])
Enqueues tasks for notification of changed dependencies. This will
eventually call dependent_cell_updated()
on all tasks.
Source§fn schedule_notify_tasks_set(&self, tasks: &TaskIdSet)
fn schedule_notify_tasks_set(&self, tasks: &TaskIdSet)
Enqueues tasks for notification of changed dependencies. This will
eventually call dependent_cell_updated()
on all tasks.
fn pin(&self) -> Arc<dyn TurboTasksBackendApi<B>>
fn schedule_backend_background_job(&self, id: BackendJobId)
fn schedule_backend_foreground_job(&self, id: BackendJobId)
fn try_foreground_done(&self) -> Result<(), EventListener>
fn wait_foreground_done_excluding_own<'a>( &'a self, ) -> Option<Pin<Box<dyn Future<Output = ()> + Send + 'a>>>
fn schedule(&self, task: TaskId)
Source§fn program_duration_until(&self, instant: Instant) -> Duration
fn program_duration_until(&self, instant: Instant) -> Duration
fn get_fresh_persistent_task_id(&self) -> Unused<TaskId>
fn get_fresh_transient_task_id(&self) -> Unused<TaskId>
Source§fn read_task_state_dyn(&self, func: &mut dyn FnMut(&B::TaskState))
fn read_task_state_dyn(&self, func: &mut dyn FnMut(&B::TaskState))
TurboTasksBackendApiExt::read_task_state
. Callers
should prefer the extension trait’s version of this method.Source§fn write_task_state_dyn(&self, func: &mut dyn FnMut(&mut B::TaskState))
fn write_task_state_dyn(&self, func: &mut dyn FnMut(&mut B::TaskState))
TurboTasksBackendApiExt::write_task_state
. Callers
should prefer the extension trait’s version of this method.Source§impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B>
impl<B: Backend + 'static> TurboTasksCallApi for TurboTasks<B>
Source§fn dynamic_call(
&self,
func: FunctionId,
this: Option<RawVc>,
arg: Box<dyn MagicAny>,
persistence: TaskPersistence,
) -> RawVc
fn dynamic_call( &self, func: FunctionId, this: Option<RawVc>, arg: Box<dyn MagicAny>, persistence: TaskPersistence, ) -> RawVc
Source§fn native_call(
&self,
func: FunctionId,
this: Option<RawVc>,
arg: Box<dyn MagicAny>,
persistence: TaskPersistence,
) -> RawVc
fn native_call( &self, func: FunctionId, this: Option<RawVc>, arg: Box<dyn MagicAny>, persistence: TaskPersistence, ) -> RawVc
Source§fn trait_call(
&self,
trait_type: TraitTypeId,
trait_fn_name: Cow<'static, str>,
this: RawVc,
arg: Box<dyn MagicAny>,
persistence: TaskPersistence,
) -> RawVc
fn trait_call( &self, trait_type: TraitTypeId, trait_fn_name: Cow<'static, str>, this: RawVc, arg: Box<dyn MagicAny>, persistence: TaskPersistence, ) -> RawVc
self
object.
Uses a wrapper task to resolvefn run_once( &self, future: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>, ) -> TaskId
fn run_once_with_reason( &self, reason: StaticOrArc<dyn InvalidationReason>, future: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>, ) -> TaskId
fn run_once_process( &self, future: Pin<Box<dyn Future<Output = Result<()>> + Send + 'static>>, ) -> TaskId
Auto Trait Implementations§
impl<B> !Freeze for TurboTasks<B>
impl<B> !RefUnwindSafe for TurboTasks<B>
impl<B> Send for TurboTasks<B>
impl<B> Sync for TurboTasks<B>
impl<B> Unpin for TurboTasks<B>where
B: Unpin,
impl<B> !UnwindSafe for TurboTasks<B>
Blanket Implementations§
§impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<TT, B> TurboTasksBackendApiExt<B> for TT
impl<TT, B> TurboTasksBackendApiExt<B> for TT
Source§fn read_task_state<T>(&self, func: impl FnOnce(&B::TaskState) -> T) -> T
fn read_task_state<T>(&self, func: impl FnOnce(&B::TaskState) -> T) -> T
Backend::TaskState
. Read moreSource§fn write_task_state<T>(&self, func: impl FnOnce(&mut B::TaskState) -> T) -> T
fn write_task_state<T>(&self, func: impl FnOnce(&mut B::TaskState) -> T) -> T
Backend::TaskState
. Read more