orx_parallel/pools/scope.rs
1/// A scope within which work can be spawned onto a [`ThreadPool`], bounded by the
2/// lifetimes of the borrowed environment.
3///
4/// [`ThreadPool`]: crate::ThreadPool
5pub trait Scope<'s, 'env, 'scope>: Copy {
6 /// Runs `work` within this scope on a worker thread of the pool this
7 /// scope is created from.
8 fn run<W>(self, work: W)
9 where
10 'scope: 's,
11 'env: 'scope + 's,
12 W: FnOnce() + Send + 'scope + 'env;
13}