pub struct PipelineCache { /* private fields */ }
Expand description
Cache for render and compute pipelines.
The cache stores existing render and compute pipelines allocated on the GPU, as well as
pending creation. Pipelines inserted into the cache are identified by a unique ID, which
can be used to retrieve the actual GPU object once it’s ready. The creation of the GPU
pipeline object is deferred to the RenderSet::Render
step, just before the render
graph starts being processed, as this requires access to the GPU.
Note that the cache does not perform automatic deduplication of identical pipelines. It is up to the user not to insert the same pipeline twice to avoid wasting GPU resources.
Implementations§
Source§impl PipelineCache
impl PipelineCache
Sourcepub fn pipelines(&self) -> impl Iterator<Item = &CachedPipeline>
pub fn pipelines(&self) -> impl Iterator<Item = &CachedPipeline>
Returns an iterator over the pipelines in the pipeline cache.
Sourcepub fn waiting_pipelines(&self) -> impl Iterator<Item = usize>
pub fn waiting_pipelines(&self) -> impl Iterator<Item = usize>
Returns a iterator of the IDs of all currently waiting pipelines.
Sourcepub fn new(
device: RenderDevice,
render_adapter: RenderAdapter,
synchronous_pipeline_compilation: bool,
) -> PipelineCache
pub fn new( device: RenderDevice, render_adapter: RenderAdapter, synchronous_pipeline_compilation: bool, ) -> PipelineCache
Create a new pipeline cache associated with the given render device.
Sourcepub fn get_render_pipeline_state(
&self,
id: CachedRenderPipelineId,
) -> &CachedPipelineState
pub fn get_render_pipeline_state( &self, id: CachedRenderPipelineId, ) -> &CachedPipelineState
Get the state of a cached render pipeline.
Sourcepub fn get_compute_pipeline_state(
&self,
id: CachedComputePipelineId,
) -> &CachedPipelineState
pub fn get_compute_pipeline_state( &self, id: CachedComputePipelineId, ) -> &CachedPipelineState
Get the state of a cached compute pipeline.
Examples found in repository?
221 fn update(&mut self, world: &mut World) {
222 let pipeline = world.resource::<GameOfLifePipeline>();
223 let pipeline_cache = world.resource::<PipelineCache>();
224
225 // if the corresponding pipeline has loaded, transition to the next stage
226 match self.state {
227 GameOfLifeState::Loading => {
228 match pipeline_cache.get_compute_pipeline_state(pipeline.init_pipeline) {
229 CachedPipelineState::Ok(_) => {
230 self.state = GameOfLifeState::Init;
231 }
232 CachedPipelineState::Err(err) => {
233 panic!("Initializing assets/{SHADER_ASSET_PATH}:\n{err}")
234 }
235 _ => {}
236 }
237 }
238 GameOfLifeState::Init => {
239 if let CachedPipelineState::Ok(_) =
240 pipeline_cache.get_compute_pipeline_state(pipeline.update_pipeline)
241 {
242 self.state = GameOfLifeState::Update(1);
243 }
244 }
245 GameOfLifeState::Update(0) => {
246 self.state = GameOfLifeState::Update(1);
247 }
248 GameOfLifeState::Update(1) => {
249 self.state = GameOfLifeState::Update(0);
250 }
251 GameOfLifeState::Update(_) => unreachable!(),
252 }
253 }
Sourcepub fn get_render_pipeline_descriptor(
&self,
id: CachedRenderPipelineId,
) -> &RenderPipelineDescriptor
pub fn get_render_pipeline_descriptor( &self, id: CachedRenderPipelineId, ) -> &RenderPipelineDescriptor
Get the render pipeline descriptor a cached render pipeline was inserted from.
See PipelineCache::queue_render_pipeline()
.
Note: Be careful calling this method. It will panic if called with a pipeline that
has been queued but has not yet been processed by PipelineCache::process_queue()
.
Sourcepub fn get_compute_pipeline_descriptor(
&self,
id: CachedComputePipelineId,
) -> &ComputePipelineDescriptor
pub fn get_compute_pipeline_descriptor( &self, id: CachedComputePipelineId, ) -> &ComputePipelineDescriptor
Get the compute pipeline descriptor a cached render pipeline was inserted from.
See PipelineCache::queue_compute_pipeline()
.
Note: Be careful calling this method. It will panic if called with a pipeline that
has been queued but has not yet been processed by PipelineCache::process_queue()
.
Sourcepub fn get_render_pipeline(
&self,
id: CachedRenderPipelineId,
) -> Option<&RenderPipeline>
pub fn get_render_pipeline( &self, id: CachedRenderPipelineId, ) -> Option<&RenderPipeline>
Try to retrieve a render pipeline GPU object from a cached ID.
§Returns
This method returns a successfully created render pipeline if any, or None
if the pipeline
was not created yet or if there was an error during creation. You can check the actual creation
state with PipelineCache::get_render_pipeline_state()
.
Examples found in repository?
142 fn run(
143 &self,
144 _graph: &mut RenderGraphContext,
145 render_context: &mut RenderContext,
146 (view_target, _post_process_settings, settings_index): QueryItem<Self::ViewQuery>,
147 world: &World,
148 ) -> Result<(), NodeRunError> {
149 // Get the pipeline resource that contains the global data we need
150 // to create the render pipeline
151 let post_process_pipeline = world.resource::<PostProcessPipeline>();
152
153 // The pipeline cache is a cache of all previously created pipelines.
154 // It is required to avoid creating a new pipeline each frame,
155 // which is expensive due to shader compilation.
156 let pipeline_cache = world.resource::<PipelineCache>();
157
158 // Get the pipeline from the cache
159 let Some(pipeline) = pipeline_cache.get_render_pipeline(post_process_pipeline.pipeline_id)
160 else {
161 return Ok(());
162 };
163
164 // Get the settings uniform binding
165 let settings_uniforms = world.resource::<ComponentUniforms<PostProcessSettings>>();
166 let Some(settings_binding) = settings_uniforms.uniforms().binding() else {
167 return Ok(());
168 };
169
170 // This will start a new "post process write", obtaining two texture
171 // views from the view target - a `source` and a `destination`.
172 // `source` is the "current" main texture and you _must_ write into
173 // `destination` because calling `post_process_write()` on the
174 // [`ViewTarget`] will internally flip the [`ViewTarget`]'s main
175 // texture to the `destination` texture. Failing to do so will cause
176 // the current main texture information to be lost.
177 let post_process = view_target.post_process_write();
178
179 // The bind_group gets created each frame.
180 //
181 // Normally, you would create a bind_group in the Queue set,
182 // but this doesn't work with the post_process_write().
183 // The reason it doesn't work is because each post_process_write will alternate the source/destination.
184 // The only way to have the correct source/destination for the bind_group
185 // is to make sure you get it during the node execution.
186 let bind_group = render_context.render_device().create_bind_group(
187 "post_process_bind_group",
188 &post_process_pipeline.layout,
189 // It's important for this to match the BindGroupLayout defined in the PostProcessPipeline
190 &BindGroupEntries::sequential((
191 // Make sure to use the source view
192 post_process.source,
193 // Use the sampler created for the pipeline
194 &post_process_pipeline.sampler,
195 // Set the settings binding
196 settings_binding.clone(),
197 )),
198 );
199
200 // Begin the render pass
201 let mut render_pass = render_context.begin_tracked_render_pass(RenderPassDescriptor {
202 label: Some("post_process_pass"),
203 color_attachments: &[Some(RenderPassColorAttachment {
204 // We need to specify the post process destination view here
205 // to make sure we write to the appropriate texture.
206 view: post_process.destination,
207 resolve_target: None,
208 ops: Operations::default(),
209 })],
210 depth_stencil_attachment: None,
211 timestamp_writes: None,
212 occlusion_query_set: None,
213 });
214
215 // This is mostly just wgpu boilerplate for drawing a fullscreen triangle,
216 // using the pipeline/bind_group created above
217 render_pass.set_render_pipeline(pipeline);
218 // By passing in the index of the post process settings on this view, we ensure
219 // that in the event that multiple settings were sent to the GPU (as would be the
220 // case with multiple cameras), we use the correct one.
221 render_pass.set_bind_group(0, &bind_group, &[settings_index.index()]);
222 render_pass.draw(0..3, 0..1);
223
224 Ok(())
225 }
Sourcepub fn block_on_render_pipeline(&mut self, id: CachedRenderPipelineId)
pub fn block_on_render_pipeline(&mut self, id: CachedRenderPipelineId)
Wait for a render pipeline to finish compiling.
Sourcepub fn get_compute_pipeline(
&self,
id: CachedComputePipelineId,
) -> Option<&ComputePipeline>
pub fn get_compute_pipeline( &self, id: CachedComputePipelineId, ) -> Option<&ComputePipeline>
Try to retrieve a compute pipeline GPU object from a cached ID.
§Returns
This method returns a successfully created compute pipeline if any, or None
if the pipeline
was not created yet or if there was an error during creation. You can check the actual creation
state with PipelineCache::get_compute_pipeline_state()
.
Examples found in repository?
197 fn run(
198 &self,
199 _graph: &mut render_graph::RenderGraphContext,
200 render_context: &mut RenderContext,
201 world: &World,
202 ) -> Result<(), render_graph::NodeRunError> {
203 let pipeline_cache = world.resource::<PipelineCache>();
204 let pipeline = world.resource::<ComputePipeline>();
205 let bind_group = world.resource::<GpuBufferBindGroup>();
206
207 if let Some(init_pipeline) = pipeline_cache.get_compute_pipeline(pipeline.pipeline) {
208 let mut pass =
209 render_context
210 .command_encoder()
211 .begin_compute_pass(&ComputePassDescriptor {
212 label: Some("GPU readback compute pass"),
213 ..default()
214 });
215
216 pass.set_bind_group(0, &bind_group.0, &[]);
217 pass.set_pipeline(init_pipeline);
218 pass.dispatch_workgroups(BUFFER_LEN as u32, 1, 1);
219 }
220 Ok(())
221 }
More examples
255 fn run(
256 &self,
257 _graph: &mut render_graph::RenderGraphContext,
258 render_context: &mut RenderContext,
259 world: &World,
260 ) -> Result<(), render_graph::NodeRunError> {
261 let bind_groups = &world.resource::<GameOfLifeImageBindGroups>().0;
262 let pipeline_cache = world.resource::<PipelineCache>();
263 let pipeline = world.resource::<GameOfLifePipeline>();
264
265 let mut pass = render_context
266 .command_encoder()
267 .begin_compute_pass(&ComputePassDescriptor::default());
268
269 // select the pipeline based on the current state
270 match self.state {
271 GameOfLifeState::Loading => {}
272 GameOfLifeState::Init => {
273 let init_pipeline = pipeline_cache
274 .get_compute_pipeline(pipeline.init_pipeline)
275 .unwrap();
276 pass.set_bind_group(0, &bind_groups[0], &[]);
277 pass.set_pipeline(init_pipeline);
278 pass.dispatch_workgroups(SIZE.0 / WORKGROUP_SIZE, SIZE.1 / WORKGROUP_SIZE, 1);
279 }
280 GameOfLifeState::Update(index) => {
281 let update_pipeline = pipeline_cache
282 .get_compute_pipeline(pipeline.update_pipeline)
283 .unwrap();
284 pass.set_bind_group(0, &bind_groups[index], &[]);
285 pass.set_pipeline(update_pipeline);
286 pass.dispatch_workgroups(SIZE.0 / WORKGROUP_SIZE, SIZE.1 / WORKGROUP_SIZE, 1);
287 }
288 }
289
290 Ok(())
291 }
Sourcepub fn queue_render_pipeline(
&self,
descriptor: RenderPipelineDescriptor,
) -> CachedRenderPipelineId
pub fn queue_render_pipeline( &self, descriptor: RenderPipelineDescriptor, ) -> CachedRenderPipelineId
Insert a render pipeline into the cache, and queue its creation.
The pipeline is always inserted and queued for creation. There is no attempt to deduplicate it with an already cached pipeline.
§Returns
This method returns the unique render shader ID of the cached pipeline, which can be used to query
the caching state with get_render_pipeline_state()
and to retrieve the created GPU pipeline once
it’s ready with get_render_pipeline()
.
Examples found in repository?
237 fn from_world(world: &mut World) -> Self {
238 let render_device = world.resource::<RenderDevice>();
239
240 // We need to define the bind group layout used for our pipeline
241 let layout = render_device.create_bind_group_layout(
242 "post_process_bind_group_layout",
243 &BindGroupLayoutEntries::sequential(
244 // The layout entries will only be visible in the fragment stage
245 ShaderStages::FRAGMENT,
246 (
247 // The screen texture
248 texture_2d(TextureSampleType::Float { filterable: true }),
249 // The sampler that will be used to sample the screen texture
250 sampler(SamplerBindingType::Filtering),
251 // The settings uniform that will control the effect
252 uniform_buffer::<PostProcessSettings>(true),
253 ),
254 ),
255 );
256
257 // We can create the sampler here since it won't change at runtime and doesn't depend on the view
258 let sampler = render_device.create_sampler(&SamplerDescriptor::default());
259
260 // Get the shader handle
261 let shader = world.load_asset(SHADER_ASSET_PATH);
262
263 let pipeline_id = world
264 .resource_mut::<PipelineCache>()
265 // This will add the pipeline to the cache and queue its creation
266 .queue_render_pipeline(RenderPipelineDescriptor {
267 label: Some("post_process_pipeline".into()),
268 layout: vec![layout.clone()],
269 // This will setup a fullscreen triangle for the vertex state
270 vertex: fullscreen_shader_vertex_state(),
271 fragment: Some(FragmentState {
272 shader,
273 shader_defs: vec![],
274 // Make sure this matches the entry point of your shader.
275 // It can be anything as long as it matches here and in the shader.
276 entry_point: "fragment".into(),
277 targets: vec![Some(ColorTargetState {
278 format: TextureFormat::bevy_default(),
279 blend: None,
280 write_mask: ColorWrites::ALL,
281 })],
282 }),
283 // All of the following properties are not important for this effect so just use the default values.
284 // This struct doesn't have the Default trait implemented because not all fields can have a default value.
285 primitive: PrimitiveState::default(),
286 depth_stencil: None,
287 multisample: MultisampleState::default(),
288 push_constant_ranges: vec![],
289 zero_initialize_workgroup_memory: false,
290 });
291
292 Self {
293 layout,
294 sampler,
295 pipeline_id,
296 }
297 }
Sourcepub fn queue_compute_pipeline(
&self,
descriptor: ComputePipelineDescriptor,
) -> CachedComputePipelineId
pub fn queue_compute_pipeline( &self, descriptor: ComputePipelineDescriptor, ) -> CachedComputePipelineId
Insert a compute pipeline into the cache, and queue its creation.
The pipeline is always inserted and queued for creation. There is no attempt to deduplicate it with an already cached pipeline.
§Returns
This method returns the unique compute shader ID of the cached pipeline, which can be used to query
the caching state with get_compute_pipeline_state()
and to retrieve the created GPU pipeline once
it’s ready with get_compute_pipeline()
.
Examples found in repository?
162 fn from_world(world: &mut World) -> Self {
163 let render_device = world.resource::<RenderDevice>();
164 let layout = render_device.create_bind_group_layout(
165 None,
166 &BindGroupLayoutEntries::sequential(
167 ShaderStages::COMPUTE,
168 (
169 storage_buffer::<Vec<u32>>(false),
170 texture_storage_2d(TextureFormat::R32Uint, StorageTextureAccess::WriteOnly),
171 ),
172 ),
173 );
174 let shader = world.load_asset(SHADER_ASSET_PATH);
175 let pipeline_cache = world.resource::<PipelineCache>();
176 let pipeline = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor {
177 label: Some("GPU readback compute shader".into()),
178 layout: vec![layout.clone()],
179 push_constant_ranges: Vec::new(),
180 shader: shader.clone(),
181 shader_defs: Vec::new(),
182 entry_point: "main".into(),
183 zero_initialize_workgroup_memory: false,
184 });
185 ComputePipeline { layout, pipeline }
186 }
More examples
161 fn from_world(world: &mut World) -> Self {
162 let render_device = world.resource::<RenderDevice>();
163 let texture_bind_group_layout = render_device.create_bind_group_layout(
164 "GameOfLifeImages",
165 &BindGroupLayoutEntries::sequential(
166 ShaderStages::COMPUTE,
167 (
168 texture_storage_2d(TextureFormat::R32Float, StorageTextureAccess::ReadOnly),
169 texture_storage_2d(TextureFormat::R32Float, StorageTextureAccess::WriteOnly),
170 ),
171 ),
172 );
173 let shader = world.load_asset(SHADER_ASSET_PATH);
174 let pipeline_cache = world.resource::<PipelineCache>();
175 let init_pipeline = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor {
176 label: None,
177 layout: vec![texture_bind_group_layout.clone()],
178 push_constant_ranges: Vec::new(),
179 shader: shader.clone(),
180 shader_defs: vec![],
181 entry_point: Cow::from("init"),
182 zero_initialize_workgroup_memory: false,
183 });
184 let update_pipeline = pipeline_cache.queue_compute_pipeline(ComputePipelineDescriptor {
185 label: None,
186 layout: vec![texture_bind_group_layout.clone()],
187 push_constant_ranges: Vec::new(),
188 shader,
189 shader_defs: vec![],
190 entry_point: Cow::from("update"),
191 zero_initialize_workgroup_memory: false,
192 });
193
194 GameOfLifePipeline {
195 texture_bind_group_layout,
196 init_pipeline,
197 update_pipeline,
198 }
199 }
Sourcepub fn process_queue(&mut self)
pub fn process_queue(&mut self)
Process the pipeline queue and create all pending pipelines if possible.
This is generally called automatically during the RenderSet::Render
step, but can
be called manually to force creation at a different time.
Trait Implementations§
impl Resource for PipelineCache
Auto Trait Implementations§
impl !Freeze for PipelineCache
impl !RefUnwindSafe for PipelineCache
impl Send for PipelineCache
impl Sync for PipelineCache
impl Unpin for PipelineCache
impl !UnwindSafe for PipelineCache
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.