pub struct JobPool { /* private fields */ }Expand description
A dedicated thread pool for per-frame data-parallel work.
Implementations§
Source§impl JobPool
impl JobPool
Sourcepub fn thread_count(&self) -> usize
pub fn thread_count(&self) -> usize
Number of worker threads in this pool.
Sourcepub fn parallel_for<T, F>(&self, items: &mut [T], f: F)
pub fn parallel_for<T, F>(&self, items: &mut [T], f: F)
Apply f to every item in parallel, blocking until all are done.
Each item must be independent: f runs concurrently across items in
no defined order. Inputs shorter than two items skip the pool and run
inline to avoid dispatch overhead.
Sourcepub fn install<R, F>(&self, f: F) -> R
pub fn install<R, F>(&self, f: F) -> R
Run a closure inside this pool’s scope so any nested rayon
par_iter / par_iter_mut calls dispatch to JobPool’s bounded thread
count (available_parallelism() - 1) instead of rayon’s global pool
(which defaults to every core and would starve the render thread when
invoked from a worker that is itself competing for CPU).
Used by the DirectX / Metal parallel command-buffer recording; the Vulkan
backend records single-threaded, so it is unused under backend_vk.
Auto Trait Implementations§
impl !RefUnwindSafe for JobPool
impl !UnwindSafe for JobPool
impl Freeze for JobPool
impl Send for JobPool
impl Sync for JobPool
impl Unpin for JobPool
impl UnsafeUnpin for JobPool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more