pub fn adjust_thread_pool() -> &'static Result<(), ThreadPoolBuildError>Expand description
Builds the global rayon pool on the current thread when RAYON_NUM_THREADS=1.
A one-thread pool with use_current_thread buys two things over rayon’s default:
- Throughput close to a build with rayon compiled out.
- Call stacks with no worker frames, which keeps profiles and debugger sessions readable.
Call this before anything touches the pool — rayon builds the global pool on first use, and refuses to build it twice. That first use is what the returned error reports, so callers that cannot guarantee they run first should treat it as advisory rather than fatal.
Calling it more than once is harmless: the result is computed once and cached.
§Returns
A reference, because ThreadPoolBuildError is not Clone.