pub struct ComputeTaskPool(/* private fields */);
Expand description
A newtype for a task pool for CPU-intensive work that must be completed to deliver the next frame
See TaskPool
documentation for details on Bevy tasks.
AsyncComputeTaskPool
should be preferred if the work does not have to be
completed before the next frame.
Implementations§
Source§impl ComputeTaskPool
impl ComputeTaskPool
Sourcepub fn get_or_init(f: impl FnOnce() -> TaskPool) -> &'static ComputeTaskPool
pub fn get_or_init(f: impl FnOnce() -> TaskPool) -> &'static ComputeTaskPool
Gets the global ComputeTaskPool
instance, or initializes it with f
.
Sourcepub fn try_get() -> Option<&'static ComputeTaskPool>
pub fn try_get() -> Option<&'static ComputeTaskPool>
Attempts to get the global ComputeTaskPool
instance, or returns None
if it is not initialized.
Sourcepub fn get() -> &'static ComputeTaskPool
pub fn get() -> &'static ComputeTaskPool
Gets the global ComputeTaskPool
instance.
§Panics
Panics if the global instance has not been initialized yet.
Methods from Deref<Target = TaskPool>§
Sourcepub fn thread_num(&self) -> usize
pub fn thread_num(&self) -> usize
Return the number of threads owned by the task pool
Sourcepub fn scope<'env, F, T>(&self, f: F) -> Vec<T>
pub fn scope<'env, F, T>(&self, f: F) -> Vec<T>
Allows spawning non-'static
futures on the thread pool. The function takes a callback,
passing a scope object into it. The scope object provided to the callback can be used
to spawn tasks. This function will await the completion of all tasks before returning.
This is similar to thread::scope
and rayon::scope
.
§Example
use bevy_tasks::TaskPool;
let pool = TaskPool::new();
let mut x = 0;
let results = pool.scope(|s| {
s.spawn(async {
// you can borrow the spawner inside a task and spawn tasks from within the task
s.spawn(async {
// borrow x and mutate it.
x = 2;
// return a value from the task
1
});
// return some other value from the first task
0
});
});
// The ordering of results is non-deterministic if you spawn from within tasks as above.
// If you're doing this, you'll have to write your code to not depend on the ordering.
assert!(results.contains(&0));
assert!(results.contains(&1));
// The ordering is deterministic if you only spawn directly from the closure function.
let results = pool.scope(|s| {
s.spawn(async { 0 });
s.spawn(async { 1 });
});
assert_eq!(&results[..], &[0, 1]);
// You can access x after scope runs, since it was only temporarily borrowed in the scope.
assert_eq!(x, 2);
§Lifetimes
The Scope
object takes two lifetimes: 'scope
and 'env
.
The 'scope
lifetime represents the lifetime of the scope. That is the time during
which the provided closure and tasks that are spawned into the scope are run.
The 'env
lifetime represents the lifetime of whatever is borrowed by the scope.
Thus this lifetime must outlive 'scope
.
use bevy_tasks::TaskPool;
fn scope_escapes_closure() {
let pool = TaskPool::new();
let foo = Box::new(42);
pool.scope(|scope| {
std::thread::spawn(move || {
// UB. This could spawn on the scope after `.scope` returns and the internal Scope is dropped.
scope.spawn(async move {
assert_eq!(*foo, 42);
});
});
});
}
use bevy_tasks::TaskPool;
fn cannot_borrow_from_closure() {
let pool = TaskPool::new();
pool.scope(|scope| {
let x = 1;
let y = &x;
scope.spawn(async move {
assert_eq!(*y, 1);
});
});
}
Sourcepub fn scope_with_executor<'env, F, T>(
&self,
tick_task_pool_executor: bool,
external_executor: Option<&ThreadExecutor<'_>>,
f: F,
) -> Vec<T>
pub fn scope_with_executor<'env, F, T>( &self, tick_task_pool_executor: bool, external_executor: Option<&ThreadExecutor<'_>>, f: F, ) -> Vec<T>
This allows passing an external executor to spawn tasks on. When you pass an external executor
Scope::spawn_on_scope
spawns is then run on the thread that ThreadExecutor
is being ticked on.
If None
is passed the scope will use a ThreadExecutor
that is ticked on the current thread.
When tick_task_pool_executor
is set to true
, the multithreaded task stealing executor is ticked on the scope
thread. Disabling this can be useful when finishing the scope is latency sensitive. Pulling tasks from
global executor can run tasks unrelated to the scope and delay when the scope returns.
See Self::scope
for more details in general about how scopes work.
Sourcepub fn spawn<T>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> Task<T> ⓘwhere
T: Send + 'static,
pub fn spawn<T>(
&self,
future: impl Future<Output = T> + Send + 'static,
) -> Task<T> ⓘwhere
T: Send + 'static,
Spawns a static future onto the thread pool. The returned Task
is a
future that can be polled for the result. It can also be canceled and
“detached”, allowing the task to continue running even if dropped. In
any case, the pool will execute the task even without polling by the
end-user.
If the provided future is non-Send
, TaskPool::spawn_local
should
be used instead.
Examples found in repository?
144fn setup_assets(mut commands: Commands, asset_server: Res<AssetServer>) {
145 let (barrier, guard) = AssetBarrier::new();
146 commands.insert_resource(OneHundredThings(std::array::from_fn(|i| match i % 5 {
147 0 => asset_server.load_acquire("models/GolfBall/GolfBall.glb", guard.clone()),
148 1 => asset_server.load_acquire("models/AlienCake/alien.glb", guard.clone()),
149 2 => asset_server.load_acquire("models/AlienCake/cakeBirthday.glb", guard.clone()),
150 3 => asset_server.load_acquire("models/FlightHelmet/FlightHelmet.gltf", guard.clone()),
151 4 => asset_server.load_acquire("models/torus/torus.gltf", guard.clone()),
152 _ => unreachable!(),
153 })));
154 let future = barrier.wait_async();
155 commands.insert_resource(barrier);
156
157 let loading_state = Arc::new(AtomicBool::new(false));
158 commands.insert_resource(AsyncLoadingState(loading_state.clone()));
159
160 // await the `AssetBarrierFuture`.
161 AsyncComputeTaskPool::get()
162 .spawn(async move {
163 future.await;
164 // Notify via `AsyncLoadingState`
165 loading_state.store(true, Ordering::Release);
166 })
167 .detach();
168}
More examples
151fn setup_assets_programmatically(
152 commands: &mut Commands,
153 asset_server: &mut AssetServer,
154 animation_graphs: &mut Assets<AnimationGraph>,
155 _save: bool,
156) {
157 // Create the nodes.
158 let mut animation_graph = AnimationGraph::new();
159 let blend_node = animation_graph.add_blend(0.5, animation_graph.root);
160 animation_graph.add_clip(
161 asset_server.load(GltfAssetLabel::Animation(0).from_asset("models/animated/Fox.glb")),
162 1.0,
163 animation_graph.root,
164 );
165 animation_graph.add_clip(
166 asset_server.load(GltfAssetLabel::Animation(1).from_asset("models/animated/Fox.glb")),
167 1.0,
168 blend_node,
169 );
170 animation_graph.add_clip(
171 asset_server.load(GltfAssetLabel::Animation(2).from_asset("models/animated/Fox.glb")),
172 1.0,
173 blend_node,
174 );
175
176 // If asked to save, do so.
177 #[cfg(not(target_arch = "wasm32"))]
178 if _save {
179 let animation_graph = animation_graph.clone();
180
181 IoTaskPool::get()
182 .spawn(async move {
183 let mut animation_graph_writer = File::create(Path::join(
184 &FileAssetReader::get_base_path(),
185 Path::join(Path::new("assets"), Path::new(ANIMATION_GRAPH_PATH)),
186 ))
187 .expect("Failed to open the animation graph asset");
188 ron::ser::to_writer_pretty(
189 &mut animation_graph_writer,
190 &animation_graph,
191 PrettyConfig::default(),
192 )
193 .expect("Failed to serialize the animation graph");
194 })
195 .detach();
196 }
197
198 // Add the graph.
199 let handle = animation_graphs.add(animation_graph);
200
201 // Save the assets in a resource.
202 commands.insert_resource(ExampleAnimationGraph(handle));
203}
160fn save_scene_system(world: &mut World) {
161 // Scenes can be created from any ECS World.
162 // You can either create a new one for the scene or use the current World.
163 // For demonstration purposes, we'll create a new one.
164 let mut scene_world = World::new();
165
166 // The `TypeRegistry` resource contains information about all registered types (including components).
167 // This is used to construct scenes, so we'll want to ensure that our previous type registrations
168 // exist in this new scene world as well.
169 // To do this, we can simply clone the `AppTypeRegistry` resource.
170 let type_registry = world.resource::<AppTypeRegistry>().clone();
171 scene_world.insert_resource(type_registry);
172
173 let mut component_b = ComponentB::from_world(world);
174 component_b.value = "hello".to_string();
175 scene_world.spawn((
176 component_b,
177 ComponentA { x: 1.0, y: 2.0 },
178 Transform::IDENTITY,
179 Name::new("joe"),
180 ));
181 scene_world.spawn(ComponentA { x: 3.0, y: 4.0 });
182 scene_world.insert_resource(ResourceA { score: 1 });
183
184 // With our sample world ready to go, we can now create our scene using DynamicScene or DynamicSceneBuilder.
185 // For simplicity, we will create our scene using DynamicScene:
186 let scene = DynamicScene::from_world(&scene_world);
187
188 // Scenes can be serialized like this:
189 let type_registry = world.resource::<AppTypeRegistry>();
190 let type_registry = type_registry.read();
191 let serialized_scene = scene.serialize(&type_registry).unwrap();
192
193 // Showing the scene in the console
194 info!("{}", serialized_scene);
195
196 // Writing the scene to a new file. Using a task to avoid calling the filesystem APIs in a system
197 // as they are blocking.
198 //
199 // This can't work in Wasm as there is no filesystem access.
200 #[cfg(not(target_arch = "wasm32"))]
201 IoTaskPool::get()
202 .spawn(async move {
203 // Write the scene RON data to file
204 File::create(format!("assets/{NEW_SCENE_FILE_PATH}"))
205 .and_then(|mut file| file.write(serialized_scene.as_bytes()))
206 .expect("Error while writing scene to file");
207 })
208 .detach();
209}
52fn spawn_tasks(mut commands: Commands) {
53 let thread_pool = AsyncComputeTaskPool::get();
54 for x in 0..NUM_CUBES {
55 for y in 0..NUM_CUBES {
56 for z in 0..NUM_CUBES {
57 // Spawn new task on the AsyncComputeTaskPool; the task will be
58 // executed in the background, and the Task future returned by
59 // spawn() can be used to poll for the result
60 let entity = commands.spawn_empty().id();
61 let task = thread_pool.spawn(async move {
62 let duration = Duration::from_secs_f32(rand::thread_rng().gen_range(0.05..5.0));
63
64 // Pretend this is a time-intensive function. :)
65 async_std::task::sleep(duration).await;
66
67 // Such hard work, all done!
68 let transform = Transform::from_xyz(x as f32, y as f32, z as f32);
69 let mut command_queue = CommandQueue::default();
70
71 // we use a raw command queue to pass a FnOnce(&mut World) back to be
72 // applied in a deferred manner.
73 command_queue.push(move |world: &mut World| {
74 let (box_mesh_handle, box_material_handle) = {
75 let mut system_state = SystemState::<(
76 Res<BoxMeshHandle>,
77 Res<BoxMaterialHandle>,
78 )>::new(world);
79 let (box_mesh_handle, box_material_handle) =
80 system_state.get_mut(world);
81
82 (box_mesh_handle.clone(), box_material_handle.clone())
83 };
84
85 world
86 .entity_mut(entity)
87 // Add our new `Mesh3d` and `MeshMaterial3d` to our tagged entity
88 .insert((
89 Mesh3d(box_mesh_handle),
90 MeshMaterial3d(box_material_handle),
91 transform,
92 ))
93 // Task is complete, so remove task component from entity
94 .remove::<ComputeTransform>();
95 });
96
97 command_queue
98 });
99
100 // Spawn new entity and add our new task as a component
101 commands.entity(entity).insert(ComputeTransform(task));
102 }
103 }
104 }
105}
Sourcepub fn spawn_local<T>(
&self,
future: impl Future<Output = T> + 'static,
) -> Task<T> ⓘwhere
T: 'static,
pub fn spawn_local<T>(
&self,
future: impl Future<Output = T> + 'static,
) -> Task<T> ⓘwhere
T: 'static,
Spawns a static future on the thread-local async executor for the current thread. The task will run entirely on the thread the task was spawned on.
The returned Task
is a future that can be polled for the
result. It can also be canceled and “detached”, allowing the task to
continue running even if dropped. In any case, the pool will execute the
task even without polling by the end-user.
Users should generally prefer to use TaskPool::spawn
instead,
unless the provided future is not Send
.
Sourcepub fn with_local_executor<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&LocalExecutor<'_>) -> R,
pub fn with_local_executor<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&LocalExecutor<'_>) -> R,
Runs a function with the local executor. Typically used to tick the local executor on the main thread as it needs to share time with other things.
use bevy_tasks::TaskPool;
TaskPool::new().with_local_executor(|local_executor| {
local_executor.try_tick();
});
Trait Implementations§
Source§impl Debug for ComputeTaskPool
impl Debug for ComputeTaskPool
Auto Trait Implementations§
impl Freeze for ComputeTaskPool
impl !RefUnwindSafe for ComputeTaskPool
impl Send for ComputeTaskPool
impl Sync for ComputeTaskPool
impl Unpin for ComputeTaskPool
impl !UnwindSafe for ComputeTaskPool
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>
, 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>
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)
&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> 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.