Struct bevy::tasks::TaskPoolBuilder
source · pub struct TaskPoolBuilder { /* private fields */ }
Expand description
Used to create a TaskPool
Implementations§
source§impl TaskPoolBuilder
impl TaskPoolBuilder
sourcepub fn new() -> TaskPoolBuilder
pub fn new() -> TaskPoolBuilder
Creates a new TaskPoolBuilder
instance
sourcepub 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
sourcepub 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
sourcepub 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)
sourcepub 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.
sourcepub 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§
source§impl Default for TaskPoolBuilder
impl Default for TaskPoolBuilder
source§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, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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> 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>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<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>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.