Struct jxl_threadpool::JxlThreadPool
source · pub struct JxlThreadPool(/* private fields */);
Expand description
Thread pool wrapper.
This struct wraps internal thread pool implementation and provides interfaces to access it. If
rayon
feature is enabled, users can create an actual thread pool backed by Rayon; if not,
this struct won’t have any multithreading capability, and every spawn operation will just run
the given closure in place.
Implementations§
source§impl JxlThreadPool
impl JxlThreadPool
sourcepub const fn none() -> Self
pub const fn none() -> Self
Creates a “fake” thread pool without any multithreading capability.
Every spawn operation on this thread poll will just run the closure in current thread.
sourcepub fn is_multithreaded(&self) -> bool
pub fn is_multithreaded(&self) -> bool
Returns if the thread pool is capable of multithreading.
source§impl JxlThreadPool
impl JxlThreadPool
sourcepub fn spawn(&self, op: impl FnOnce() + Send + 'static)
pub fn spawn(&self, op: impl FnOnce() + Send + 'static)
Runs the given closure on the thread pool.
sourcepub fn scope<'scope, R: Send>(
&'scope self,
op: impl for<'r> FnOnce(JxlScope<'r, 'scope>) -> R + Send
) -> R
pub fn scope<'scope, R: Send>( &'scope self, op: impl for<'r> FnOnce(JxlScope<'r, 'scope>) -> R + Send ) -> R
Creates a fork-join scope of tasks.
sourcepub fn for_each_vec<T: Send>(&self, v: Vec<T>, op: impl Fn(T) + Send + Sync)
pub fn for_each_vec<T: Send>(&self, v: Vec<T>, op: impl Fn(T) + Send + Sync)
Consumes the Vec
, and runs a job for each element of the Vec
.
sourcepub fn for_each_vec_with<T: Send, U: Send + Clone>(
&self,
v: Vec<T>,
init: U,
op: impl Fn(&mut U, T) + Send + Sync
)
pub fn for_each_vec_with<T: Send, U: Send + Clone>( &self, v: Vec<T>, init: U, op: impl Fn(&mut U, T) + Send + Sync )
Consumes the Vec
, and runs a job for each element of the Vec
.
Trait Implementations§
source§impl Clone for JxlThreadPool
impl Clone for JxlThreadPool
source§fn clone(&self) -> JxlThreadPool
fn clone(&self) -> JxlThreadPool
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl RefUnwindSafe for JxlThreadPool
impl Send for JxlThreadPool
impl Sync for JxlThreadPool
impl Unpin for JxlThreadPool
impl UnwindSafe for JxlThreadPool
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
Mutably borrows from an owned value. Read more