pub struct RenderAssets<A>(/* private fields */)
where
A: RenderAsset;Expand description
Stores all GPU representations (RenderAsset)
of RenderAsset::SourceAsset as long as they exist.
Implementations§
Source§impl<A> RenderAssets<A>where
A: RenderAsset,
impl<A> RenderAssets<A>where
A: RenderAsset,
Sourcepub fn get(
&self,
id: impl Into<AssetId<<A as RenderAsset>::SourceAsset>>,
) -> Option<&A>
pub fn get( &self, id: impl Into<AssetId<<A as RenderAsset>::SourceAsset>>, ) -> Option<&A>
Examples found in repository?
examples/shader/gpu_readback.rs (line 161)
152fn prepare_bind_group(
153 mut commands: Commands,
154 pipeline: Res<ComputePipeline>,
155 render_device: Res<RenderDevice>,
156 buffer: Res<ReadbackBuffer>,
157 image: Res<ReadbackImage>,
158 buffers: Res<RenderAssets<GpuShaderStorageBuffer>>,
159 images: Res<RenderAssets<GpuImage>>,
160) {
161 let buffer = buffers.get(&buffer.0).unwrap();
162 let image = images.get(&image.0).unwrap();
163 let bind_group = render_device.create_bind_group(
164 None,
165 &pipeline.layout,
166 &BindGroupEntries::sequential((
167 buffer.buffer.as_entire_buffer_binding(),
168 image.texture_view.into_binding(),
169 )),
170 );
171 commands.insert_resource(GpuBufferBindGroup(bind_group));
172}More examples
examples/shader/compute_shader_game_of_life.rs (line 141)
132fn prepare_bind_group(
133 mut commands: Commands,
134 pipeline: Res<GameOfLifePipeline>,
135 gpu_images: Res<RenderAssets<GpuImage>>,
136 game_of_life_images: Res<GameOfLifeImages>,
137 game_of_life_uniforms: Res<GameOfLifeUniforms>,
138 render_device: Res<RenderDevice>,
139 queue: Res<RenderQueue>,
140) {
141 let view_a = gpu_images.get(&game_of_life_images.texture_a).unwrap();
142 let view_b = gpu_images.get(&game_of_life_images.texture_b).unwrap();
143
144 // Uniform buffer is used here to demonstrate how to set up a uniform in a compute shader
145 // Alternatives such as storage buffers or push constants may be more suitable for your use case
146 let mut uniform_buffer = UniformBuffer::from(game_of_life_uniforms.into_inner());
147 uniform_buffer.write_buffer(&render_device, &queue);
148
149 let bind_group_0 = render_device.create_bind_group(
150 None,
151 &pipeline.texture_bind_group_layout,
152 &BindGroupEntries::sequential((
153 &view_a.texture_view,
154 &view_b.texture_view,
155 &uniform_buffer,
156 )),
157 );
158 let bind_group_1 = render_device.create_bind_group(
159 None,
160 &pipeline.texture_bind_group_layout,
161 &BindGroupEntries::sequential((
162 &view_b.texture_view,
163 &view_a.texture_view,
164 &uniform_buffer,
165 )),
166 );
167 commands.insert_resource(GameOfLifeImageBindGroups([bind_group_0, bind_group_1]));
168}examples/shader_advanced/texture_binding_array.rs (line 112)
103 fn as_bind_group(
104 &self,
105 layout: &BindGroupLayout,
106 render_device: &RenderDevice,
107 (image_assets, fallback_image): &mut SystemParamItem<'_, '_, Self::Param>,
108 ) -> Result<PreparedBindGroup, AsBindGroupError> {
109 // retrieve the render resources from handles
110 let mut images = vec![];
111 for handle in self.textures.iter().take(MAX_TEXTURE_COUNT) {
112 match image_assets.get(handle) {
113 Some(image) => images.push(image),
114 None => return Err(AsBindGroupError::RetryNextUpdate),
115 }
116 }
117
118 let fallback_image = &fallback_image.d2;
119
120 let textures = vec![&fallback_image.texture_view; MAX_TEXTURE_COUNT];
121
122 // convert bevy's resource types to WGPU's references
123 let mut textures: Vec<_> = textures.into_iter().map(|texture| &**texture).collect();
124
125 // fill in up to the first `MAX_TEXTURE_COUNT` textures and samplers to the arrays
126 for (id, image) in images.into_iter().enumerate() {
127 textures[id] = &*image.texture_view;
128 }
129
130 let bind_group = render_device.create_bind_group(
131 "bindless_material_bind_group",
132 layout,
133 &BindGroupEntries::sequential((&textures[..], &fallback_image.sampler)),
134 );
135
136 Ok(PreparedBindGroup {
137 bindings: BindingResources(vec![]),
138 bind_group,
139 })
140 }examples/shader_advanced/custom_shader_instancing.rs (line 152)
124fn queue_custom(
125 transparent_3d_draw_functions: Res<DrawFunctions<Transparent3d>>,
126 custom_pipeline: Res<CustomPipeline>,
127 mut pipelines: ResMut<SpecializedMeshPipelines<CustomPipeline>>,
128 pipeline_cache: Res<PipelineCache>,
129 meshes: Res<RenderAssets<RenderMesh>>,
130 render_mesh_instances: Res<RenderMeshInstances>,
131 material_meshes: Query<(Entity, &MainEntity), With<InstanceMaterialData>>,
132 mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>,
133 views: Query<(&ExtractedView, &Msaa)>,
134) {
135 let draw_custom = transparent_3d_draw_functions.read().id::<DrawCustom>();
136
137 for (view, msaa) in &views {
138 let Some(transparent_phase) = transparent_render_phases.get_mut(&view.retained_view_entity)
139 else {
140 continue;
141 };
142
143 let msaa_key = MeshPipelineKey::from_msaa_samples(msaa.samples());
144
145 let view_key = msaa_key | MeshPipelineKey::from_hdr(view.hdr);
146 let rangefinder = view.rangefinder3d();
147 for (entity, main_entity) in &material_meshes {
148 let Some(mesh_instance) = render_mesh_instances.render_mesh_queue_data(*main_entity)
149 else {
150 continue;
151 };
152 let Some(mesh) = meshes.get(mesh_instance.mesh_asset_id) else {
153 continue;
154 };
155 let key =
156 view_key | MeshPipelineKey::from_primitive_topology(mesh.primitive_topology());
157 let pipeline = pipelines
158 .specialize(&pipeline_cache, &custom_pipeline, key, &mesh.layout)
159 .unwrap();
160 transparent_phase.add(Transparent3d {
161 entity: (entity, *main_entity),
162 pipeline,
163 draw_function: draw_custom,
164 distance: rangefinder.distance_translation(&mesh_instance.translation),
165 batch_range: 0..1,
166 extra_index: PhaseItemExtraIndex::None,
167 indexed: true,
168 });
169 }
170 }
171}
172
173#[derive(Component)]
174struct InstanceBuffer {
175 buffer: Buffer,
176 length: usize,
177}
178
179fn prepare_instance_buffers(
180 mut commands: Commands,
181 query: Query<(Entity, &InstanceMaterialData)>,
182 render_device: Res<RenderDevice>,
183) {
184 for (entity, instance_data) in &query {
185 let buffer = render_device.create_buffer_with_data(&BufferInitDescriptor {
186 label: Some("instance data buffer"),
187 contents: bytemuck::cast_slice(instance_data.as_slice()),
188 usage: BufferUsages::VERTEX | BufferUsages::COPY_DST,
189 });
190 commands.entity(entity).insert(InstanceBuffer {
191 buffer,
192 length: instance_data.len(),
193 });
194 }
195}
196
197#[derive(Resource)]
198struct CustomPipeline {
199 shader: Handle<Shader>,
200 mesh_pipeline: MeshPipeline,
201}
202
203fn init_custom_pipeline(
204 mut commands: Commands,
205 asset_server: Res<AssetServer>,
206 mesh_pipeline: Res<MeshPipeline>,
207) {
208 commands.insert_resource(CustomPipeline {
209 shader: asset_server.load(SHADER_ASSET_PATH),
210 mesh_pipeline: mesh_pipeline.clone(),
211 });
212}
213
214impl SpecializedMeshPipeline for CustomPipeline {
215 type Key = MeshPipelineKey;
216
217 fn specialize(
218 &self,
219 key: Self::Key,
220 layout: &MeshVertexBufferLayoutRef,
221 ) -> Result<RenderPipelineDescriptor, SpecializedMeshPipelineError> {
222 let mut descriptor = self.mesh_pipeline.specialize(key, layout)?;
223
224 descriptor.vertex.shader = self.shader.clone();
225 descriptor.vertex.buffers.push(VertexBufferLayout {
226 array_stride: size_of::<InstanceData>() as u64,
227 step_mode: VertexStepMode::Instance,
228 attributes: vec![
229 VertexAttribute {
230 format: VertexFormat::Float32x4,
231 offset: 0,
232 shader_location: 3, // shader locations 0-2 are taken up by Position, Normal and UV attributes
233 },
234 VertexAttribute {
235 format: VertexFormat::Float32x4,
236 offset: VertexFormat::Float32x4.size(),
237 shader_location: 4,
238 },
239 ],
240 });
241 descriptor.fragment.as_mut().unwrap().shader = self.shader.clone();
242 Ok(descriptor)
243 }
244}
245
246type DrawCustom = (
247 SetItemPipeline,
248 SetMeshViewBindGroup<0>,
249 SetMeshViewBindingArrayBindGroup<1>,
250 SetMeshBindGroup<2>,
251 DrawMeshInstanced,
252);
253
254struct DrawMeshInstanced;
255
256impl<P: PhaseItem> RenderCommand<P> for DrawMeshInstanced {
257 type Param = (
258 SRes<RenderAssets<RenderMesh>>,
259 SRes<RenderMeshInstances>,
260 SRes<MeshAllocator>,
261 );
262 type ViewQuery = ();
263 type ItemQuery = Read<InstanceBuffer>;
264
265 #[inline]
266 fn render<'w>(
267 item: &P,
268 _view: (),
269 instance_buffer: Option<&'w InstanceBuffer>,
270 (meshes, render_mesh_instances, mesh_allocator): SystemParamItem<'w, '_, Self::Param>,
271 pass: &mut TrackedRenderPass<'w>,
272 ) -> RenderCommandResult {
273 // A borrow check workaround.
274 let mesh_allocator = mesh_allocator.into_inner();
275
276 let Some(mesh_instance) = render_mesh_instances.render_mesh_queue_data(item.main_entity())
277 else {
278 return RenderCommandResult::Skip;
279 };
280 let Some(gpu_mesh) = meshes.into_inner().get(mesh_instance.mesh_asset_id) else {
281 return RenderCommandResult::Skip;
282 };
283 let Some(instance_buffer) = instance_buffer else {
284 return RenderCommandResult::Skip;
285 };
286 let Some(vertex_buffer_slice) =
287 mesh_allocator.mesh_vertex_slice(&mesh_instance.mesh_asset_id)
288 else {
289 return RenderCommandResult::Skip;
290 };
291
292 pass.set_vertex_buffer(0, vertex_buffer_slice.buffer.slice(..));
293 pass.set_vertex_buffer(1, instance_buffer.buffer.slice(..));
294
295 match &gpu_mesh.buffer_info {
296 RenderMeshBufferInfo::Indexed {
297 index_format,
298 count,
299 } => {
300 let Some(index_buffer_slice) =
301 mesh_allocator.mesh_index_slice(&mesh_instance.mesh_asset_id)
302 else {
303 return RenderCommandResult::Skip;
304 };
305
306 pass.set_index_buffer(index_buffer_slice.buffer.slice(..), 0, *index_format);
307 pass.draw_indexed(
308 index_buffer_slice.range.start..(index_buffer_slice.range.start + count),
309 vertex_buffer_slice.range.start as i32,
310 0..instance_buffer.length as u32,
311 );
312 }
313 RenderMeshBufferInfo::NonIndexed => {
314 pass.draw(vertex_buffer_slice.range, 0..instance_buffer.length as u32);
315 }
316 }
317 RenderCommandResult::Success
318 }examples/app/headless_renderer.rs (line 355)
339 fn run(
340 &self,
341 _graph: &mut RenderGraphContext,
342 render_context: &mut RenderContext,
343 world: &World,
344 ) -> Result<(), NodeRunError> {
345 let image_copiers = world.get_resource::<ImageCopiers>().unwrap();
346 let gpu_images = world
347 .get_resource::<RenderAssets<bevy::render::texture::GpuImage>>()
348 .unwrap();
349
350 for image_copier in image_copiers.iter() {
351 if !image_copier.enabled() {
352 continue;
353 }
354
355 let src_image = gpu_images.get(&image_copier.src_image).unwrap();
356
357 let mut encoder = render_context
358 .render_device()
359 .create_command_encoder(&CommandEncoderDescriptor::default());
360
361 let block_dimensions = src_image.texture_format.block_dimensions();
362 let block_size = src_image.texture_format.block_copy_size(None).unwrap();
363
364 // Calculating correct size of image row because
365 // copy_texture_to_buffer can copy image only by rows aligned wgpu::COPY_BYTES_PER_ROW_ALIGNMENT
366 // That's why image in buffer can be little bit wider
367 // This should be taken into account at copy from buffer stage
368 let padded_bytes_per_row = RenderDevice::align_copy_bytes_per_row(
369 (src_image.size.width as usize / block_dimensions.0 as usize) * block_size as usize,
370 );
371
372 encoder.copy_texture_to_buffer(
373 src_image.texture.as_image_copy(),
374 TexelCopyBufferInfo {
375 buffer: &image_copier.buffer,
376 layout: TexelCopyBufferLayout {
377 offset: 0,
378 bytes_per_row: Some(
379 std::num::NonZero::<u32>::new(padded_bytes_per_row as u32)
380 .unwrap()
381 .into(),
382 ),
383 rows_per_image: None,
384 },
385 },
386 src_image.size,
387 );
388
389 let render_queue = world.get_resource::<RenderQueue>().unwrap();
390 render_queue.submit(std::iter::once(encoder.finish()));
391 }
392
393 Ok(())
394 }examples/shader_advanced/render_depth_to_texture.rs (line 306)
288 fn run<'w>(
289 &self,
290 _: &mut RenderGraphContext,
291 render_context: &mut RenderContext<'w>,
292 (camera, depth_texture): QueryItem<'w, '_, Self::ViewQuery>,
293 world: &'w World,
294 ) -> Result<(), NodeRunError> {
295 // Make sure we only run on the depth-only camera.
296 // We could make a marker component for that camera and extract it to
297 // the render world, but using `order` as a tag to tell the main camera
298 // and the depth-only camera apart works in a pinch.
299 if camera.order >= 0 {
300 return Ok(());
301 }
302
303 // Grab the texture we're going to copy to.
304 let demo_depth_texture = world.resource::<DemoDepthTexture>();
305 let image_assets = world.resource::<RenderAssets<GpuImage>>();
306 let Some(demo_depth_image) = image_assets.get(demo_depth_texture.0.id()) else {
307 return Ok(());
308 };
309
310 // Perform the copy.
311 render_context.add_command_buffer_generation_task(move |render_device| {
312 let mut command_encoder =
313 render_device.create_command_encoder(&CommandEncoderDescriptor {
314 label: Some("copy depth to demo texture command encoder"),
315 });
316 command_encoder.push_debug_group("copy depth to demo texture");
317
318 // Copy from the view's depth texture to the destination depth
319 // texture.
320 command_encoder.copy_texture_to_texture(
321 TexelCopyTextureInfo {
322 texture: &depth_texture.texture,
323 mip_level: 0,
324 origin: Origin3d::default(),
325 aspect: TextureAspect::DepthOnly,
326 },
327 TexelCopyTextureInfo {
328 texture: &demo_depth_image.texture,
329 mip_level: 0,
330 origin: Origin3d::default(),
331 aspect: TextureAspect::DepthOnly,
332 },
333 Extent3d {
334 width: DEPTH_TEXTURE_SIZE,
335 height: DEPTH_TEXTURE_SIZE,
336 depth_or_array_layers: 1,
337 },
338 );
339
340 command_encoder.pop_debug_group();
341 command_encoder.finish()
342 });
343
344 Ok(())
345 }pub fn get_mut( &mut self, id: impl Into<AssetId<<A as RenderAsset>::SourceAsset>>, ) -> Option<&mut A>
pub fn insert( &mut self, id: impl Into<AssetId<<A as RenderAsset>::SourceAsset>>, value: A, ) -> Option<A>
pub fn remove( &mut self, id: impl Into<AssetId<<A as RenderAsset>::SourceAsset>>, ) -> Option<A>
pub fn iter( &self, ) -> impl Iterator<Item = (AssetId<<A as RenderAsset>::SourceAsset>, &A)>
pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (AssetId<<A as RenderAsset>::SourceAsset>, &mut A)>
Trait Implementations§
Source§impl<A> Default for RenderAssets<A>where
A: RenderAsset,
impl<A> Default for RenderAssets<A>where
A: RenderAsset,
Source§fn default() -> RenderAssets<A>
fn default() -> RenderAssets<A>
Returns the “default value” for a type. Read more
impl<A> Resource for RenderAssets<A>
Auto Trait Implementations§
impl<A> Freeze for RenderAssets<A>
impl<A> RefUnwindSafe for RenderAssets<A>where
A: RefUnwindSafe,
impl<A> Send for RenderAssets<A>
impl<A> Sync for RenderAssets<A>
impl<A> Unpin for RenderAssets<A>where
A: Unpin,
impl<A> UnwindSafe for RenderAssets<A>where
A: UnwindSafe,
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
Return the
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
Mutably borrows from an owned value. Read more
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.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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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,
Causes
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> 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
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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> ⓘ
Converts
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> ⓘ
Converts
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<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Converts this type into the system output type.
Source§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,
Pipes by value. This is generally the method you want to use. Read more
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,
Borrows
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,
Mutably borrows
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
Borrows
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
Mutably borrows
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
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().Source§impl<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Immutable access to the
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
Mutable access to the
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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.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
Calls
.tap_deref() only in debug builds, and is erased in release
builds.