Struct Scope
struct Scope<'scope, 'env: 'scope> { ... }
A scope to spawn scoped threads in.
See scope for details.
Implementations
impl<'scope, 'env> Scope<'scope, 'env>
fn spawn<F, T>(self: &'scope Self, f: F) -> ScopedJoinHandle<'scope, T> where F: FnOnce() -> T + Send + 'scope, T: Send + 'scopeSpawns a new thread within a scope, returning a
ScopedJoinHandlefor it.Unlike non-scoped threads, threads spawned with this function may borrow non-
'staticdata from the outside the scope. Seescopefor details.The join handle provides a
joinmethod that can be used to join the spawned thread. If the spawned thread panics,joinwill return anErrcontaining the panic payload.If the join handle is dropped, the spawned thread will be implicitly joined at the end of the scope. In that case, if the spawned thread panics,
scopewill panic after all threads are joined.This function creates a thread with the default parameters of
Builder. To specify the new thread's stack size or the name, useBuilder::spawn_scoped.Panics
Panics if the OS fails to create a thread; use
Builder::spawn_scopedto recover from such errors.
impl Debug for Scope<'_, '_>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<'scope, 'env> Freeze for Scope<'scope, 'env>
impl<'scope, 'env> RefUnwindSafe for Scope<'scope, 'env>
impl<'scope, 'env> Send for Scope<'scope, 'env>
impl<'scope, 'env> Sync for Scope<'scope, 'env>
impl<'scope, 'env> Unpin for Scope<'scope, 'env>
impl<'scope, 'env> UnsafeUnpin for Scope<'scope, 'env>
impl<'scope, 'env> UnwindSafe for Scope<'scope, 'env>
impl<T> Any for Scope<'scope, 'env>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Scope<'scope, 'env>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Scope<'scope, 'env>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> From for Scope<'scope, 'env>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for Scope<'scope, 'env>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Scope<'scope, 'env>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Scope<'scope, 'env>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>