Function scope_with

Source
pub fn scope_with<'pool, 'scope, F, R>(pool: &'pool ThreadPool, f: F) -> R
where F: FnOnce(&Scope<'pool, 'scope>) -> R,
Expand description

Borrows a threadpool creating a Scope which can be used to execute non-'static closures which may borrow from the scope of scope_with.

This is allowable as scope_with will not return until closures executed using the Scope are complete.

Note: By default the closure provided to scope_with may return much earlier than the closures it executes. If this is not desired call join_all() to force it to wait.