pub fn if_in_worker_thread<F, R>(if_true: F) -> Option<R>
where
    F: FnOnce(&WorkerThread) -> R,
{
    unsafe {
        let thread = registry::WorkerThread::current().as_ref()?;
        Some(if_true(&WorkerThread { thread }))
    }
}
/// If the current thread is a Rayon worker thread, then the callback
/// is invoked with a reference to the worker-thread the result of
/// that callback is returned with `Some`. Otherwise, if we are not on
/// a Rayon worker thread, `None` is immediately returned.
If the current thread is a Rayon worker thread, then the callback
is invoked with a reference to the worker-thread the result of
that callback is returned with `Some`. Otherwise, if we are not on
a Rayon worker thread, `None` is immediately returned.
If the current thread is a Rayon worker thread then the callback is invoked with a reference to the worker - thread the result of that callback is returned with ` Some ` . Otherwise if we are not on a Rayon worker thread ` None ` is immediately returned .
pub fn if_in_worker_thread<F, R>(if_true: F) -> Option<R>
where
    F: FnOnce(&WorkerThread) -> R,
{
    unsafe {
        let thread = registry::WorkerThread::current().as_ref()?;
        Some(if_true(&WorkerThread { thread }))
    }
}
pub fn if_in_worker_thread < F , R > ( if_true : F ) -> Option < R > where F : FnOnce ( & WorkerThread ) -> R , { unsafe { let thread = registry :: WorkerThread :: current ( ) . as_ref ( ) ? ; Some ( if_true ( & WorkerThread { thread } ) ) } }
If the current thread is a Rayon worker thread, then the callback
is invoked with a reference to the worker-thread the result of
that callback is returned with `Some`.
If the current thread is a Rayon worker thread then the callback is invoked with a reference to the worker - thread the result of that callback is returned with ` Some ` .
if_true
F