Struct TaskPoolBuilder
pub struct TaskPoolBuilder { /* private fields */ }
Expand description
Used to create a TaskPool
Implementations§
§impl TaskPoolBuilder
impl TaskPoolBuilder
pub fn new() -> TaskPoolBuilder
pub fn new() -> TaskPoolBuilder
Creates a new TaskPoolBuilder
instance
pub fn num_threads(self, num_threads: usize) -> TaskPoolBuilder
pub fn num_threads(self, num_threads: usize) -> TaskPoolBuilder
Override the number of threads created for the pool. If unset, we default to the number of logical cores of the system
pub fn stack_size(self, stack_size: usize) -> TaskPoolBuilder
pub fn stack_size(self, stack_size: usize) -> TaskPoolBuilder
Override the stack size of the threads created for the pool
pub fn thread_name(self, thread_name: String) -> TaskPoolBuilder
pub fn thread_name(self, thread_name: String) -> TaskPoolBuilder
Override the name of the threads created for the pool. If set, threads will
be named <thread_name> (<thread_index>)
, i.e. MyThreadPool (2)
pub fn on_thread_spawn(
self,
f: impl Fn() + Send + Sync + 'static,
) -> TaskPoolBuilder
pub fn on_thread_spawn( self, f: impl Fn() + Send + Sync + 'static, ) -> TaskPoolBuilder
Sets a callback that is invoked once for every created thread as it starts.
This is called on the thread itself and has access to all thread-local storage. This will block running async tasks on the thread until the callback completes.
pub fn on_thread_destroy(
self,
f: impl Fn() + Send + Sync + 'static,
) -> TaskPoolBuilder
pub fn on_thread_destroy( self, f: impl Fn() + Send + Sync + 'static, ) -> TaskPoolBuilder
Sets a callback that is invoked once for every created thread as it terminates.
This is called on the thread itself and has access to all thread-local storage. This will block thread termination until the callback completes.
Trait Implementations§
§impl Default for TaskPoolBuilder
impl Default for TaskPoolBuilder
§fn default() -> TaskPoolBuilder
fn default() -> TaskPoolBuilder
Auto Trait Implementations§
impl Freeze for TaskPoolBuilder
impl !RefUnwindSafe for TaskPoolBuilder
impl Send for TaskPoolBuilder
impl Sync for TaskPoolBuilder
impl Unpin for TaskPoolBuilder
impl !UnwindSafe for TaskPoolBuilder
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.