pub trait TurboTasksBackendApiExt<B: Backend + 'static>: TurboTasksBackendApi<B> {
// Provided methods
fn read_task_state<T>(&self, func: impl FnOnce(&B::TaskState) -> T) -> T { ... }
fn write_task_state<T>(
&self,
func: impl FnOnce(&mut B::TaskState) -> T,
) -> T { ... }
}
Expand description
An extension trait for methods of TurboTasksBackendApi
that are not object-safe. This is
automatically implemented for all TurboTasksBackendApi
s using a blanket impl.
Provided Methods§
Sourcefn 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
Allows modification of the Backend::TaskState
.
This function holds open a non-exclusive read lock that blocks writes, so func
is expected
to execute quickly in order to release the lock.
Sourcefn 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
Allows modification of the Backend::TaskState
.
This function holds open a write lock, so func
is expected to execute quickly in order to
release the lock.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.