pub struct TaskPoolThreadAssignmentPolicy {
pub min_threads: usize,
pub max_threads: usize,
pub percent: f32,
pub on_thread_spawn: Option<Arc<dyn Fn() + Send + Sync + 'static>>,
pub on_thread_destroy: Option<Arc<dyn Fn() + Send + Sync + 'static>>,
}
Expand description
Defines a simple way to determine how many threads to use given the number of remaining cores and number of total cores
Fields§
§min_threads: usize
Force using at least this many threads
max_threads: usize
Under no circumstance use more than this many threads for this pool
percent: f32
Target using this percentage of total cores, clamped by min_threads
and max_threads
. It is
permitted to use 1.0 to try to use all remaining threads
on_thread_spawn: Option<Arc<dyn Fn() + Send + Sync + 'static>>
Callback that is invoked once for every created thread as it starts. This configuration will be ignored under wasm platform.
on_thread_destroy: Option<Arc<dyn Fn() + Send + Sync + 'static>>
Callback that is invoked once for every created thread as it terminates This configuration will be ignored under wasm platform.
Trait Implementations§
Source§impl Clone for TaskPoolThreadAssignmentPolicy
impl Clone for TaskPoolThreadAssignmentPolicy
Source§fn clone(&self) -> TaskPoolThreadAssignmentPolicy
fn clone(&self) -> TaskPoolThreadAssignmentPolicy
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 Freeze for TaskPoolThreadAssignmentPolicy
impl !RefUnwindSafe for TaskPoolThreadAssignmentPolicy
impl Send for TaskPoolThreadAssignmentPolicy
impl Sync for TaskPoolThreadAssignmentPolicy
impl Unpin for TaskPoolThreadAssignmentPolicy
impl !UnwindSafe for TaskPoolThreadAssignmentPolicy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.