pub struct ExecCtx<E = Box<dyn Error + Sync + Send>> { /* private fields */ }Expand description
One execution context with task memoization, cancellation, and dependency coalescing.
Implementations§
Source§impl<E> ExecCtx<E>
impl<E> ExecCtx<E>
Sourcepub fn cancel_token(&self) -> &CancelToken
pub fn cancel_token(&self) -> &CancelToken
Cancellation token associated with this execution context.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether this execution context has been cancelled.
Sourcepub fn child(&self) -> ExecCtx<E>
pub fn child(&self) -> ExecCtx<E>
Create a child execution context with shared memoization and child cancellation.
Sourcepub async fn run_parallel(
&self,
tasks: impl IntoIterator<Item = PreparedTask<E>>,
) -> Result<(), Error<E>>
pub async fn run_parallel( &self, tasks: impl IntoIterator<Item = PreparedTask<E>>, ) -> Result<(), Error<E>>
Run prepared tasks concurrently in a shared child execution context.
All prepared tasks share one execution context for memoization, and the first failing sibling cancels the remaining siblings.
Trait Implementations§
Auto Trait Implementations§
impl<E = Box<dyn Error + Sync + Send>> !RefUnwindSafe for ExecCtx<E>
impl<E = Box<dyn Error + Sync + Send>> !UnwindSafe for ExecCtx<E>
impl<E> Freeze for ExecCtx<E>
impl<E> Send for ExecCtx<E>
impl<E> Sync for ExecCtx<E>
impl<E> Unpin for ExecCtx<E>
impl<E> UnsafeUnpin for ExecCtx<E>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more