pub struct Scope<'scope, 'env, TaskResult>where
TaskResult: Send + 'env,{ /* private fields */ }Expand description
A handle passed to the closure in scope, allowing the spawning of
scoped tasks and interaction with the set.
This handle wraps a mutable reference to the ScopedJoinSet, ensuring
exclusive access to the set for operations like spawning and joining.
Implementations§
Source§impl<'scope, 'env, TaskResult> Scope<'scope, 'env, TaskResult>where
TaskResult: Send + 'env,
impl<'scope, 'env, TaskResult> Scope<'scope, 'env, TaskResult>where
TaskResult: Send + 'env,
Sourcepub fn spawn<F>(&mut self, future: F)
pub fn spawn<F>(&mut self, future: F)
Spawns a future into the scope.
This method is synchronous and non-blocking.
Sourcepub async fn join_next(&mut self) -> Option<Result<TaskResult, JoinError>>
pub async fn join_next(&mut self) -> Option<Result<TaskResult, JoinError>>
Waits for the next task to complete.
Sourcepub fn try_join_next(&mut self) -> Option<Result<TaskResult, JoinError>>
pub fn try_join_next(&mut self) -> Option<Result<TaskResult, JoinError>>
Tries to join the next task without blocking.
Auto Trait Implementations§
impl<'scope, 'env, TaskResult> !UnwindSafe for Scope<'scope, 'env, TaskResult>
impl<'scope, 'env, TaskResult> Freeze for Scope<'scope, 'env, TaskResult>where
&'scope mut ScopedJoinSet<'env, TaskResult>: Freeze,
impl<'scope, 'env, TaskResult> RefUnwindSafe for Scope<'scope, 'env, TaskResult>where
&'scope mut ScopedJoinSet<'env, TaskResult>: RefUnwindSafe,
impl<'scope, 'env, TaskResult> Send for Scope<'scope, 'env, TaskResult>where
&'scope mut ScopedJoinSet<'env, TaskResult>: Send,
impl<'scope, 'env, TaskResult> Sync for Scope<'scope, 'env, TaskResult>where
&'scope mut ScopedJoinSet<'env, TaskResult>: Sync,
impl<'scope, 'env, TaskResult> Unpin for Scope<'scope, 'env, TaskResult>where
&'scope mut ScopedJoinSet<'env, TaskResult>: Unpin,
impl<'scope, 'env, TaskResult> UnsafeUnpin for Scope<'scope, 'env, TaskResult>where
&'scope mut ScopedJoinSet<'env, TaskResult>: UnsafeUnpin,
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