pub struct ResMut<'w, T>{ /* private fields */ }Expand description
Unique mutable borrow of a Resource.
See the Resource documentation for usage.
If you need a shared borrow, use Res instead.
This SystemParam fails validation if resource doesn’t exist.
This will cause a panic. To skip this system without panicking when the resource
is missing, use If<ResMut<T>>.
Use Option<ResMut<T>> instead if the resource might not always exist
and you want to handle that case yourself.
Implementations§
Source§impl<'w, T> ResMut<'w, T>
impl<'w, T> ResMut<'w, T>
Sourcepub fn into_inner(self) -> &'w mut T
pub fn into_inner(self) -> &'w mut T
Consume self and return a mutable reference to the
contained value while marking self as “changed”.
Examples found in repository?
146fn scheduled_spawner(
147 mut commands: Commands,
148 args: Res<Args>,
149 mut scheduled: ResMut<CubeScheduled>,
150 mut counter: ResMut<BevyCounter>,
151 cube_resources: ResMut<CubeResources>,
152) {
153 if scheduled.waves > 0 {
154 let cube_resources = cube_resources.into_inner();
155 spawn_cubes(
156 &mut commands,
157 args.into_inner(),
158 &mut counter,
159 scheduled.per_wave,
160 cube_resources,
161 None,
162 scheduled.waves - 1,
163 );
164
165 scheduled.waves -= 1;
166 }
167}
168
169#[derive(Resource)]
170struct CubeResources {
171 _textures: Vec<Handle<Image>>,
172 materials: Vec<Handle<StandardMaterial>>,
173 cube_mesh: Handle<Mesh>,
174 color_rng: ChaCha8Rng,
175 material_rng: ChaCha8Rng,
176 velocity_rng: ChaCha8Rng,
177 transform_rng: ChaCha8Rng,
178}
179
180#[derive(Component)]
181struct StatsText;
182
183fn setup(
184 mut commands: Commands,
185 args: Res<Args>,
186 asset_server: Res<AssetServer>,
187 mut meshes: ResMut<Assets<Mesh>>,
188 material_assets: ResMut<Assets<StandardMaterial>>,
189 images: ResMut<Assets<Image>>,
190 counter: ResMut<BevyCounter>,
191) {
192 warn!(include_str!("warning_string.txt"));
193
194 let args = args.into_inner();
195 let images = images.into_inner();
196
197 let mut textures = Vec::with_capacity(args.material_texture_count.max(1));
198 if args.material_texture_count > 0 {
199 textures.push(asset_server.load("branding/icon.png"));
200 }
201 init_textures(&mut textures, args, images);
202
203 let material_assets = material_assets.into_inner();
204 let materials = init_materials(args, &textures, material_assets);
205
206 let mut cube_resources = CubeResources {
207 _textures: textures,
208 materials,
209 cube_mesh: meshes.add(Cuboid::from_size(Vec3::splat(CUBE_SCALE))),
210 color_rng: ChaCha8Rng::seed_from_u64(42),
211 material_rng: ChaCha8Rng::seed_from_u64(12),
212 velocity_rng: ChaCha8Rng::seed_from_u64(97),
213 transform_rng: ChaCha8Rng::seed_from_u64(26),
214 };
215
216 let font = TextFont {
217 font_size: FontSize::Px(40.0),
218 ..Default::default()
219 };
220
221 commands.spawn((
222 Camera3d::default(),
223 Transform::from_translation(VOLUME_SIZE * 1.3).looking_at(Vec3::ZERO, Vec3::Y),
224 ));
225
226 commands.spawn((
227 DirectionalLight {
228 illuminance: 10000.0,
229 shadow_maps_enabled: false,
230 ..default()
231 },
232 Transform::from_xyz(1.0, 2.0, 3.0).looking_at(Vec3::ZERO, Vec3::Y),
233 ));
234
235 commands.spawn((
236 Node {
237 position_type: PositionType::Absolute,
238 padding: UiRect::all(px(5)),
239 ..default()
240 },
241 BackgroundColor(Color::BLACK.with_alpha(0.75)),
242 GlobalZIndex(i32::MAX),
243 children![(
244 Text::default(),
245 StatsText,
246 children![
247 (
248 TextSpan::new("Cube Count: "),
249 font.clone(),
250 TextColor(LIME.into()),
251 ),
252 (TextSpan::new(""), font.clone(), TextColor(AQUA.into())),
253 (
254 TextSpan::new("\nFPS (raw): "),
255 font.clone(),
256 TextColor(LIME.into()),
257 ),
258 (TextSpan::new(""), font.clone(), TextColor(AQUA.into())),
259 (
260 TextSpan::new("\nFPS (SMA): "),
261 font.clone(),
262 TextColor(LIME.into()),
263 ),
264 (TextSpan::new(""), font.clone(), TextColor(AQUA.into())),
265 (
266 TextSpan::new("\nFPS (EMA): "),
267 font.clone(),
268 TextColor(LIME.into()),
269 ),
270 (TextSpan::new(""), font.clone(), TextColor(AQUA.into()))
271 ]
272 )],
273 ));
274
275 let mut scheduled = CubeScheduled {
276 per_wave: args.per_wave,
277 waves: args.waves,
278 };
279
280 if args.benchmark {
281 let counter = counter.into_inner();
282 for wave in (0..scheduled.waves).rev() {
283 spawn_cubes(
284 &mut commands,
285 args,
286 counter,
287 scheduled.per_wave,
288 &mut cube_resources,
289 Some(wave),
290 wave,
291 );
292 }
293 scheduled.waves = 0;
294 }
295 commands.insert_resource(cube_resources);
296 commands.insert_resource(scheduled);
297}
298
299fn mouse_handler(
300 mut commands: Commands,
301 args: Res<Args>,
302 time: Res<Time>,
303 mouse_button_input: Res<ButtonInput<MouseButton>>,
304 cube_resources: ResMut<CubeResources>,
305 mut counter: ResMut<BevyCounter>,
306 mut rng: Local<Option<ChaCha8Rng>>,
307 mut wave: Local<usize>,
308) {
309 if rng.is_none() {
310 *rng = Some(ChaCha8Rng::seed_from_u64(42));
311 }
312 let rng = rng.as_mut().unwrap();
313
314 if mouse_button_input.just_released(MouseButton::Left) {
315 counter.color = Color::linear_rgb(rng.random(), rng.random(), rng.random());
316 }
317
318 if mouse_button_input.pressed(MouseButton::Left) {
319 let spawn_count = (CUBES_PER_SECOND as f64 * time.delta_secs_f64()) as usize;
320 spawn_cubes(
321 &mut commands,
322 args.into_inner(),
323 &mut counter,
324 spawn_count,
325 cube_resources.into_inner(),
326 None,
327 *wave,
328 );
329 *wave += 1;
330 }
331}More examples
176fn scheduled_spawner(
177 mut commands: Commands,
178 args: Res<Args>,
179 window: Single<&Window>,
180 mut scheduled: ResMut<BirdScheduled>,
181 mut counter: ResMut<BevyCounter>,
182 bird_resources: ResMut<BirdResources>,
183) {
184 if scheduled.waves > 0 {
185 let bird_resources = bird_resources.into_inner();
186 spawn_birds(
187 &mut commands,
188 args.into_inner(),
189 &window.resolution,
190 &mut counter,
191 scheduled.per_wave,
192 bird_resources,
193 None,
194 scheduled.waves - 1,
195 );
196
197 scheduled.waves -= 1;
198 }
199}
200
201#[derive(Resource)]
202struct BirdResources {
203 textures: Vec<Handle<Image>>,
204 materials: Vec<Handle<ColorMaterial>>,
205 quad: Handle<Mesh>,
206 color_rng: ChaCha8Rng,
207 material_rng: ChaCha8Rng,
208 velocity_rng: ChaCha8Rng,
209 transform_rng: ChaCha8Rng,
210}
211
212#[derive(Component)]
213struct StatsText;
214
215fn setup(
216 mut commands: Commands,
217 args: Res<Args>,
218 asset_server: Res<AssetServer>,
219 mut meshes: ResMut<Assets<Mesh>>,
220 material_assets: ResMut<Assets<ColorMaterial>>,
221 images: ResMut<Assets<Image>>,
222 window: Single<&Window>,
223 counter: ResMut<BevyCounter>,
224) {
225 warn!(include_str!("warning_string.txt"));
226
227 let args = args.into_inner();
228 let images = images.into_inner();
229
230 let mut textures = Vec::with_capacity(args.material_texture_count.max(1));
231 if matches!(args.mode, Mode::Sprite) || args.material_texture_count > 0 {
232 textures.push(asset_server.load("branding/icon.png"));
233 }
234 init_textures(&mut textures, args, images);
235
236 let material_assets = material_assets.into_inner();
237 let materials = init_materials(args, &textures, material_assets);
238
239 let mut bird_resources = BirdResources {
240 textures,
241 materials,
242 quad: meshes.add(Rectangle::from_size(Vec2::splat(BIRD_TEXTURE_SIZE as f32))),
243 // We're seeding the PRNG here to make this example deterministic for testing purposes.
244 // This isn't strictly required in practical use unless you need your app to be deterministic.
245 color_rng: ChaCha8Rng::seed_from_u64(100),
246 material_rng: ChaCha8Rng::seed_from_u64(200),
247 velocity_rng: ChaCha8Rng::seed_from_u64(300),
248 transform_rng: ChaCha8Rng::seed_from_u64(400),
249 };
250
251 let font = TextFont {
252 font_size: FontSize::Px(40.0),
253 ..Default::default()
254 };
255
256 commands.spawn(Camera2d);
257 commands
258 .spawn((
259 Node {
260 position_type: PositionType::Absolute,
261 padding: UiRect::all(px(5)),
262 ..default()
263 },
264 BackgroundColor(Color::BLACK.with_alpha(0.75)),
265 GlobalZIndex(i32::MAX),
266 ))
267 .with_children(|p| {
268 p.spawn((Text::default(), StatsText)).with_children(|p| {
269 p.spawn((
270 TextSpan::new("Bird Count: "),
271 font.clone(),
272 TextColor(LIME.into()),
273 ));
274 p.spawn((TextSpan::new(""), font.clone(), TextColor(AQUA.into())));
275 p.spawn((
276 TextSpan::new("\nFPS (raw): "),
277 font.clone(),
278 TextColor(LIME.into()),
279 ));
280 p.spawn((TextSpan::new(""), font.clone(), TextColor(AQUA.into())));
281 p.spawn((
282 TextSpan::new("\nFPS (SMA): "),
283 font.clone(),
284 TextColor(LIME.into()),
285 ));
286 p.spawn((TextSpan::new(""), font.clone(), TextColor(AQUA.into())));
287 p.spawn((
288 TextSpan::new("\nFPS (EMA): "),
289 font.clone(),
290 TextColor(LIME.into()),
291 ));
292 p.spawn((TextSpan::new(""), font.clone(), TextColor(AQUA.into())));
293 });
294 });
295
296 let mut scheduled = BirdScheduled {
297 per_wave: args.per_wave,
298 waves: args.waves,
299 };
300
301 if args.benchmark {
302 let counter = counter.into_inner();
303 for wave in (0..scheduled.waves).rev() {
304 spawn_birds(
305 &mut commands,
306 args,
307 &window.resolution,
308 counter,
309 scheduled.per_wave,
310 &mut bird_resources,
311 Some(wave),
312 wave,
313 );
314 }
315 scheduled.waves = 0;
316 }
317 commands.insert_resource(bird_resources);
318 commands.insert_resource(scheduled);
319}
320
321fn mouse_handler(
322 mut commands: Commands,
323 args: Res<Args>,
324 time: Res<Time>,
325 mouse_button_input: Res<ButtonInput<MouseButton>>,
326 window: Query<&Window>,
327 bird_resources: ResMut<BirdResources>,
328 mut counter: ResMut<BevyCounter>,
329 mut rng: Local<Option<ChaCha8Rng>>,
330 mut wave: Local<usize>,
331) {
332 let Ok(window) = window.single() else {
333 return;
334 };
335
336 if rng.is_none() {
337 // We're seeding the PRNG here to make this example deterministic for testing purposes.
338 // This isn't strictly required in practical use unless you need your app to be deterministic.
339 *rng = Some(ChaCha8Rng::seed_from_u64(500));
340 }
341 let rng = rng.as_mut().unwrap();
342
343 if mouse_button_input.just_released(MouseButton::Left) {
344 counter.color = Color::linear_rgb(rng.random(), rng.random(), rng.random());
345 }
346
347 if mouse_button_input.pressed(MouseButton::Left) {
348 let spawn_count = (BIRDS_PER_SECOND as f64 * time.delta_secs_f64()) as usize;
349 spawn_birds(
350 &mut commands,
351 args.into_inner(),
352 &window.resolution,
353 &mut counter,
354 spawn_count,
355 bird_resources.into_inner(),
356 None,
357 *wave,
358 );
359 *wave += 1;
360 }
361}47fn setup(
48 mut commands: Commands,
49 args: Res<Args>,
50 mesh_assets: ResMut<Assets<Mesh>>,
51 material_assets: ResMut<Assets<StandardMaterial>>,
52) {
53 warn!(include_str!("warning_string.txt"));
54
55 let args = args.into_inner();
56 let material_assets = material_assets.into_inner();
57 let mesh_assets = mesh_assets.into_inner();
58 let n = args.grid_size;
59
60 // Camera
61 let w = n as f32;
62 commands.spawn((
63 Camera3d::default(),
64 Transform::from_xyz(w * 1.25, w + 1.0, w * 1.25)
65 .looking_at(Vec3::new(0.0, (w * -1.1) + 1.0, 0.0), Vec3::Y),
66 ));
67
68 // Light
69 commands.spawn((
70 Transform::from_rotation(Quat::from_euler(EulerRot::ZYX, 0.0, 1.0, -PI / 4.)),
71 DirectionalLight {
72 illuminance: 3000.0,
73 shadow_maps_enabled: true,
74 ..default()
75 },
76 ));
77
78 // Cubes
79 let mesh_handle = mesh_assets.add(Cuboid::from_size(Vec3::ONE));
80 for x in 0..n {
81 for z in 0..n {
82 commands.spawn((
83 Mesh3d(mesh_handle.clone()),
84 MeshMaterial3d(material_assets.add(Color::WHITE)),
85 Transform::from_translation(Vec3::new(x as f32, 0.0, z as f32)),
86 ));
87 }
88 }
89}166fn setup(
167 mut commands: Commands,
168 args: Res<Args>,
169 mesh_assets: ResMut<Assets<Mesh>>,
170 material_assets: ResMut<Assets<StandardMaterial>>,
171 images: ResMut<Assets<Image>>,
172) {
173 warn!(include_str!("warning_string.txt"));
174
175 let args = args.into_inner();
176 let images = images.into_inner();
177 let material_assets = material_assets.into_inner();
178 let mesh_assets = mesh_assets.into_inner();
179
180 let meshes = init_meshes(args, mesh_assets);
181
182 let material_textures = init_textures(args, images);
183 let materials = init_materials(args, &material_textures, material_assets);
184
185 // We're seeding the PRNG here to make this example deterministic for testing purposes.
186 // This isn't strictly required in practical use unless you need your app to be deterministic.
187 let mut material_rng = ChaCha8Rng::seed_from_u64(42);
188 match args.layout {
189 Layout::Sphere => {
190 // NOTE: This pattern is good for testing performance of culling as it provides roughly
191 // the same number of visible meshes regardless of the viewing angle.
192 let n_points: usize = args.instance_count;
193 // NOTE: f64 is used to avoid precision issues that produce visual artifacts in the distribution
194 let radius = WIDTH as f64 * 2.5;
195 let golden_ratio = 0.5f64 * (1.0f64 + 5.0f64.sqrt());
196 for i in 0..n_points {
197 let spherical_polar_theta_phi =
198 fibonacci_spiral_on_sphere(golden_ratio, i, n_points);
199 let unit_sphere_p = spherical_polar_to_cartesian(spherical_polar_theta_phi);
200 let (mesh, transform) = meshes.choose(&mut material_rng).unwrap();
201 commands
202 .spawn((
203 Mesh3d(mesh.clone()),
204 MeshMaterial3d(materials.choose(&mut material_rng).unwrap().clone()),
205 Transform::from_translation((radius * unit_sphere_p).as_vec3())
206 .looking_at(Vec3::ZERO, Vec3::Y)
207 .mul_transform(*transform),
208 ))
209 .insert_if(NoFrustumCulling, || args.no_frustum_culling)
210 .insert_if(NoAutomaticBatching, || args.no_automatic_batching)
211 .insert_if(NoCpuCulling, || args.no_cpu_culling);
212 }
213
214 // camera
215 let mut camera = commands.spawn(Camera3d::default());
216 if args.no_indirect_drawing {
217 camera.insert(NoIndirectDrawing);
218 }
219 if args.no_cpu_culling {
220 camera.insert(NoCpuCulling);
221 }
222 if args.motion_blur {
223 camera.insert((
224 MotionBlur {
225 // Use an unrealistically large shutter angle so that motion blur is clearly visible.
226 shutter_angle: 3.0,
227 ..Default::default()
228 },
229 // MSAA and MotionBlur are not compatible on WebGL.
230 #[cfg(all(
231 feature = "webgl2",
232 target_arch = "wasm32",
233 not(feature = "webgpu")
234 ))]
235 Msaa::Off,
236 ));
237 }
238
239 // Inside-out box around the meshes onto which shadows are cast (though you cannot see them...)
240 commands.spawn((
241 Mesh3d(mesh_assets.add(Cuboid::from_size(Vec3::splat(radius as f32 * 2.2)))),
242 MeshMaterial3d(material_assets.add(StandardMaterial::from(Color::WHITE))),
243 Transform::from_scale(-Vec3::ONE),
244 NotShadowCaster,
245 ));
246 }
247 Layout::Cube => {
248 // NOTE: This pattern is good for demonstrating that frustum culling is working correctly
249 // as the number of visible meshes rises and falls depending on the viewing angle.
250 let scale = 2.5;
251
252 // Scale the width and height by the same factor so that we have the
253 // right number of instances.
254 // Because of the moiré pattern check and the fact that we're
255 // spawning 4 instances per trip around the inner loop below, we're
256 // solving the following equation for the factor variable:
257 //
258 // 4 * (9/10 * factor * width * 9/10 * factor * height) = count
259 //
260 // The solution is the value below.
261 let factor = (5.0 / 9.0) * sqrt(args.instance_count as f32)
262 / (sqrt(HEIGHT as f32) * sqrt(WIDTH as f32));
263 let dimensions = (vec2(WIDTH as f32, HEIGHT as f32) * factor)
264 .ceil()
265 .as_uvec2();
266
267 for x in 0..dimensions.x {
268 for y in 0..dimensions.y {
269 // introduce spaces to break any kind of moiré pattern
270 if x % 10 == 0 || y % 10 == 0 {
271 continue;
272 }
273 // cube
274 commands
275 .spawn((
276 Mesh3d(meshes.choose(&mut material_rng).unwrap().0.clone()),
277 MeshMaterial3d(materials.choose(&mut material_rng).unwrap().clone()),
278 Transform::from_xyz((x as f32) * scale, (y as f32) * scale, 0.0),
279 ))
280 .insert_if(NoCpuCulling, || args.no_cpu_culling);
281 commands
282 .spawn((
283 Mesh3d(meshes.choose(&mut material_rng).unwrap().0.clone()),
284 MeshMaterial3d(materials.choose(&mut material_rng).unwrap().clone()),
285 Transform::from_xyz(
286 (x as f32) * scale,
287 dimensions.y as f32 * scale,
288 (y as f32) * scale,
289 ),
290 ))
291 .insert_if(NoCpuCulling, || args.no_cpu_culling);
292 commands
293 .spawn((
294 Mesh3d(meshes.choose(&mut material_rng).unwrap().0.clone()),
295 MeshMaterial3d(materials.choose(&mut material_rng).unwrap().clone()),
296 Transform::from_xyz((x as f32) * scale, 0.0, (y as f32) * scale),
297 ))
298 .insert_if(NoCpuCulling, || args.no_cpu_culling);
299 commands
300 .spawn((
301 Mesh3d(meshes.choose(&mut material_rng).unwrap().0.clone()),
302 MeshMaterial3d(materials.choose(&mut material_rng).unwrap().clone()),
303 Transform::from_xyz(0.0, (x as f32) * scale, (y as f32) * scale),
304 ))
305 .insert_if(NoCpuCulling, || args.no_cpu_culling);
306 }
307 }
308 // camera
309 let center = 0.5
310 * scale
311 * Vec3::new(
312 dimensions.x as f32,
313 dimensions.y as f32,
314 dimensions.x as f32,
315 );
316 commands.spawn((Camera3d::default(), Transform::from_translation(center)));
317 // Inside-out box around the meshes onto which shadows are cast (though you cannot see them...)
318 commands.spawn((
319 Mesh3d(mesh_assets.add(Cuboid::from_size(2.0 * 1.1 * center))),
320 MeshMaterial3d(material_assets.add(StandardMaterial::from(Color::WHITE))),
321 Transform::from_scale(-Vec3::ONE).with_translation(center),
322 NotShadowCaster,
323 ));
324 }
325 Layout::Dense => {
326 // NOTE: This pattern is good for demonstrating a dense configuration of cubes
327 // overlapping each other, all within the camera frustum.
328 let count = args.instance_count;
329 let size = cbrt(count as f32).round();
330 let gap = 1.25;
331
332 for i in 0..count {
333 let x = i as f32 % size;
334 let y = (i as f32 / size) % size;
335 let z = i as f32 / (size * size);
336 let pos = Vec3::new(x * gap, y * gap, z * gap);
337 commands
338 .spawn((
339 Mesh3d(meshes.choose(&mut material_rng).unwrap().0.clone()),
340 MeshMaterial3d(materials.choose(&mut material_rng).unwrap().clone()),
341 Transform::from_translation(pos),
342 ))
343 .insert_if(NoCpuCulling, || args.no_cpu_culling);
344 }
345
346 // camera
347 commands.spawn((
348 Camera3d::default(),
349 Transform::from_xyz(100.0, 90.0, 100.0)
350 .looking_at(Vec3::new(0.0, -10.0, 0.0), Vec3::Y),
351 ));
352 }
353 }
354
355 commands.spawn((
356 DirectionalLight {
357 shadow_maps_enabled: args.shadows,
358 ..default()
359 },
360 Transform::IDENTITY.looking_at(Vec3::new(0.0, -1.0, -1.0), Vec3::Y),
361 ));
362}Sourcepub fn reborrow(&mut self) -> Mut<'_, T>
pub fn reborrow(&mut self) -> Mut<'_, T>
Returns a Mut<> with a smaller lifetime.
This is useful if you have &mut ResMut <T>, but you need a Mut<T>.
Sourcepub fn map_unchanged<U>(self, f: impl FnOnce(&mut T) -> &mut U) -> Mut<'w, U>where
U: ?Sized,
pub fn map_unchanged<U>(self, f: impl FnOnce(&mut T) -> &mut U) -> Mut<'w, U>where
U: ?Sized,
Maps to an inner value by applying a function to the contained reference, without flagging a change.
You should never modify the argument passed to the closure – if you want to modify the data
without flagging a change, consider using DetectChangesMut::bypass_change_detection to make your intent explicit.
// When run, zeroes the translation of every entity.
fn reset_positions(mut transforms: Query<&mut Transform>) {
for transform in &mut transforms {
// We pinky promise not to modify `t` within the closure.
// Breaking this promise will result in logic errors, but will never cause undefined behavior.
let mut translation = transform.map_unchanged(|t| &mut t.translation);
// Only reset the translation if it isn't already zero;
translation.set_if_neq(Vec2::ZERO);
}
}Sourcepub fn filter_map_unchanged<U>(
self,
f: impl FnOnce(&mut T) -> Option<&mut U>,
) -> Option<Mut<'w, U>>where
U: ?Sized,
pub fn filter_map_unchanged<U>(
self,
f: impl FnOnce(&mut T) -> Option<&mut U>,
) -> Option<Mut<'w, U>>where
U: ?Sized,
Optionally maps to an inner value by applying a function to the contained reference.
This is useful in a situation where you need to convert a Mut<T> to a Mut<U>, but only if T contains U.
As with map_unchanged, you should never modify the argument passed to the closure.
Sourcepub fn try_map_unchanged<U, E>(
self,
f: impl FnOnce(&mut T) -> Result<&mut U, E>,
) -> Result<Mut<'w, U>, E>where
U: ?Sized,
pub fn try_map_unchanged<U, E>(
self,
f: impl FnOnce(&mut T) -> Result<&mut U, E>,
) -> Result<Mut<'w, U>, E>where
U: ?Sized,
Optionally maps to an inner value by applying a function to the contained reference, returns an error on failure.
This is useful in a situation where you need to convert a Mut<T> to a Mut<U>, but only if T contains U.
As with map_unchanged, you should never modify the argument passed to the closure.
Trait Implementations§
Source§impl<'w, T> DetectChanges for ResMut<'w, T>
impl<'w, T> DetectChanges for ResMut<'w, T>
Source§fn is_changed(&self) -> bool
fn is_changed(&self) -> bool
true if this value was added or mutably dereferenced
either since the last time the system ran or, if the system never ran,
since the beginning of the program. Read moreSource§fn is_added_after(&self, other: Tick) -> bool
fn is_added_after(&self, other: Tick) -> bool
true if this value was added after the other tick.Source§fn is_changed_after(&self, other: Tick) -> bool
fn is_changed_after(&self, other: Tick) -> bool
Source§fn last_changed(&self) -> Tick
fn last_changed(&self) -> Tick
Source§fn changed_by(&self) -> MaybeLocation
fn changed_by(&self) -> MaybeLocation
Source§impl<'w, T> DetectChangesMut for ResMut<'w, T>
impl<'w, T> DetectChangesMut for ResMut<'w, T>
Source§fn set_changed(&mut self)
fn set_changed(&mut self)
Source§fn set_last_changed(&mut self, last_changed: Tick)
fn set_last_changed(&mut self, last_changed: Tick)
Source§fn set_last_added(&mut self, last_added: Tick)
fn set_last_added(&mut self, last_added: Tick)
Source§fn bypass_change_detection(
&mut self,
) -> &mut <ResMut<'w, T> as DetectChangesMut>::Inner
fn bypass_change_detection( &mut self, ) -> &mut <ResMut<'w, T> as DetectChangesMut>::Inner
Source§fn set_if_neq(&mut self, value: Self::Inner) -> bool
fn set_if_neq(&mut self, value: Self::Inner) -> bool
*self != value.
Returns true if the value was overwritten, and returns false if it was not. Read moreSource§fn replace_if_neq(&mut self, value: Self::Inner) -> Option<Self::Inner>
fn replace_if_neq(&mut self, value: Self::Inner) -> Option<Self::Inner>
*self != value,
returning the previous value if this occurs. Read moreSource§impl<'w, 'a, T> IntoIterator for &'a ResMut<'w, T>
impl<'w, 'a, T> IntoIterator for &'a ResMut<'w, T>
Source§impl<'w, 'a, T> IntoIterator for &'a mut ResMut<'w, T>
impl<'w, 'a, T> IntoIterator for &'a mut ResMut<'w, T>
Source§impl<'a, T> SystemParam for ResMut<'a, T>
impl<'a, T> SystemParam for ResMut<'a, T>
Source§type State = ComponentId
type State = ComponentId
Source§type Item<'w, 's> = ResMut<'w, T>
type Item<'w, 's> = ResMut<'w, T>
Self, instantiated with new lifetimes. Read moreSource§fn init_state(world: &mut World) -> <ResMut<'a, T> as SystemParam>::State
fn init_state(world: &mut World) -> <ResMut<'a, T> as SystemParam>::State
State.Source§fn init_access(
_: &<ResMut<'a, T> as SystemParam>::State,
system_meta: &mut SystemMeta,
system_access: &mut SystemAccess,
world: &mut World,
)
fn init_access( _: &<ResMut<'a, T> as SystemParam>::State, system_meta: &mut SystemMeta, system_access: &mut SystemAccess, world: &mut World, )
Source§unsafe fn get_param<'w, 's>(
_: &'s mut <ResMut<'a, T> as SystemParam>::State,
system_meta: &SystemMeta,
world: UnsafeWorldCell<'w>,
change_tick: Tick,
) -> Result<<ResMut<'a, T> as SystemParam>::Item<'w, 's>, SystemParamValidationError>
unsafe fn get_param<'w, 's>( _: &'s mut <ResMut<'a, T> as SystemParam>::State, system_meta: &SystemMeta, world: UnsafeWorldCell<'w>, change_tick: Tick, ) -> Result<<ResMut<'a, T> as SystemParam>::Item<'w, 's>, SystemParamValidationError>
SystemParamFunction. Read moreSource§fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
fn apply(state: &mut Self::State, system_meta: &SystemMeta, world: &mut World)
SystemParam’s state.
This is used to apply Commands during ApplyDeferred.Source§fn queue(
state: &mut Self::State,
system_meta: &SystemMeta,
world: DeferredWorld<'_>,
)
fn queue( state: &mut Self::State, system_meta: &SystemMeta, world: DeferredWorld<'_>, )
ApplyDeferred.Auto Trait Implementations§
impl<'w, T> !UnwindSafe for ResMut<'w, T>
impl<'w, T> Freeze for ResMut<'w, T>
impl<'w, T> RefUnwindSafe for ResMut<'w, T>
impl<'w, T> Send for ResMut<'w, T>
impl<'w, T> Sync for ResMut<'w, T>
impl<'w, T> Unpin for ResMut<'w, T>
impl<'w, T> UnsafeUnpin for ResMut<'w, T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
impl<R> CryptoRng for R
impl<T> CryptoRng for T
Source§impl<T, C, D> Curve<T> for D
impl<T, C, D> Curve<T> for D
Source§fn sample_unchecked(&self, t: f32) -> T
fn sample_unchecked(&self, t: f32) -> T
t, extracting the associated value.
This is the unchecked version of sampling, which should only be used if the sample time t
is already known to lie within the curve’s domain. Read moreSource§fn sample(&self, t: f32) -> Option<T>
fn sample(&self, t: f32) -> Option<T>
t, returning None if the point is
outside of the curve’s domain.Source§fn sample_clamped(&self, t: f32) -> T
fn sample_clamped(&self, t: f32) -> T
t, clamping t to lie inside the
domain of the curve.Source§impl<C, T> CurveExt<T> for Cwhere
C: Curve<T>,
impl<C, T> CurveExt<T> for Cwhere
C: Curve<T>,
Source§fn sample_iter(
&self,
iter: impl IntoIterator<Item = f32>,
) -> impl Iterator<Item = Option<T>>
fn sample_iter( &self, iter: impl IntoIterator<Item = f32>, ) -> impl Iterator<Item = Option<T>>
n >= 0 points on this curve at the parameter values t_n,
returning None if the point is outside of the curve’s domain. Read moreSource§fn sample_iter_unchecked(
&self,
iter: impl IntoIterator<Item = f32>,
) -> impl Iterator<Item = T>
fn sample_iter_unchecked( &self, iter: impl IntoIterator<Item = f32>, ) -> impl Iterator<Item = T>
n >= 0 points on this curve at the parameter values t_n,
extracting the associated values. This is the unchecked version of sampling, which should
only be used if the sample times t_n are already known to lie within the curve’s domain. Read moreSource§fn sample_iter_clamped(
&self,
iter: impl IntoIterator<Item = f32>,
) -> impl Iterator<Item = T>
fn sample_iter_clamped( &self, iter: impl IntoIterator<Item = f32>, ) -> impl Iterator<Item = T>
n >= 0 points on this curve at the parameter values t_n,
clamping t_n to lie inside the domain of the curve. Read moreSource§fn map<S, F>(self, f: F) -> MapCurve<T, S, Self, F>where
F: Fn(T) -> S,
fn map<S, F>(self, f: F) -> MapCurve<T, S, Self, F>where
F: Fn(T) -> S,
f; i.e., if the
sample at time t for this curve is x, the value at time t on the new curve will be
f(x).Source§fn reparametrize<F>(self, domain: Interval, f: F) -> ReparamCurve<T, Self, F>
fn reparametrize<F>(self, domain: Interval, f: F) -> ReparamCurve<T, Self, F>
Curve whose parameter space is related to the parameter space of this curve
by f. For each time t, the sample from the new curve at time t is the sample from
this curve at time f(t). The given domain will be the domain of the new curve. The
function f is expected to take domain into self.domain(). Read moreSource§fn reparametrize_linear(
self,
domain: Interval,
) -> Result<LinearReparamCurve<T, Self>, LinearReparamError>
fn reparametrize_linear( self, domain: Interval, ) -> Result<LinearReparamCurve<T, Self>, LinearReparamError>
Source§fn reparametrize_by_curve<C>(self, other: C) -> CurveReparamCurve<T, Self, C>
fn reparametrize_by_curve<C>(self, other: C) -> CurveReparamCurve<T, Self, C>
Source§fn graph(self) -> GraphCurve<T, Self>
fn graph(self) -> GraphCurve<T, Self>
Source§fn zip<S, C>(
self,
other: C,
) -> Result<ZipCurve<T, S, Self, C>, InvalidIntervalError>where
C: Curve<S>,
fn zip<S, C>(
self,
other: C,
) -> Result<ZipCurve<T, S, Self, C>, InvalidIntervalError>where
C: Curve<S>,
Source§fn chain<C>(self, other: C) -> Result<ChainCurve<T, Self, C>, ChainError>where
C: Curve<T>,
fn chain<C>(self, other: C) -> Result<ChainCurve<T, Self, C>, ChainError>where
C: Curve<T>,
Source§fn reverse(self) -> Result<ReverseCurve<T, Self>, ReverseError>
fn reverse(self) -> Result<ReverseCurve<T, Self>, ReverseError>
Source§fn repeat(self, count: usize) -> Result<RepeatCurve<T, Self>, RepeatError>
fn repeat(self, count: usize) -> Result<RepeatCurve<T, Self>, RepeatError>
Source§fn forever(self) -> Result<ForeverCurve<T, Self>, RepeatError>
fn forever(self) -> Result<ForeverCurve<T, Self>, RepeatError>
Source§fn ping_pong(self) -> Result<PingPongCurve<T, Self>, PingPongError>
fn ping_pong(self) -> Result<PingPongCurve<T, Self>, PingPongError>
Source§fn chain_continue<C>(
self,
other: C,
) -> Result<ContinuationCurve<T, Self, C>, ChainError>where
T: VectorSpace,
C: Curve<T>,
fn chain_continue<C>(
self,
other: C,
) -> Result<ContinuationCurve<T, Self, C>, ChainError>where
T: VectorSpace,
C: Curve<T>,
Source§fn samples(
&self,
samples: usize,
) -> Result<impl Iterator<Item = T>, ResamplingError>
fn samples( &self, samples: usize, ) -> Result<impl Iterator<Item = T>, ResamplingError>
Source§impl<C, T> CurveResampleExt<T> for C
impl<C, T> CurveResampleExt<T> for C
Source§fn resample<I>(
&self,
segments: usize,
interpolation: I,
) -> Result<SampleCurve<T, I>, ResamplingError>
fn resample<I>( &self, segments: usize, interpolation: I, ) -> Result<SampleCurve<T, I>, ResamplingError>
Curve to produce a new one that is defined by interpolation over equally
spaced sample values, using the provided interpolation to interpolate between adjacent samples.
The curve is interpolated on segments segments between samples. For example, if segments is 1,
only the start and end points of the curve are used as samples; if segments is 2, a sample at
the midpoint is taken as well, and so on. Read moreSource§fn resample_auto(
&self,
segments: usize,
) -> Result<SampleAutoCurve<T>, ResamplingError>where
T: StableInterpolate,
fn resample_auto(
&self,
segments: usize,
) -> Result<SampleAutoCurve<T>, ResamplingError>where
T: StableInterpolate,
Curve to produce a new one that is defined by interpolation over equally
spaced sample values, using automatic interpolation to interpolate between adjacent samples.
The curve is interpolated on segments segments between samples. For example, if segments is 1,
only the start and end points of the curve are used as samples; if segments is 2, a sample at
the midpoint is taken as well, and so on. Read moreSource§fn resample_uneven<I>(
&self,
sample_times: impl IntoIterator<Item = f32>,
interpolation: I,
) -> Result<UnevenSampleCurve<T, I>, ResamplingError>
fn resample_uneven<I>( &self, sample_times: impl IntoIterator<Item = f32>, interpolation: I, ) -> Result<UnevenSampleCurve<T, I>, ResamplingError>
Source§fn resample_uneven_auto(
&self,
sample_times: impl IntoIterator<Item = f32>,
) -> Result<UnevenSampleAutoCurve<T>, ResamplingError>where
T: StableInterpolate,
fn resample_uneven_auto(
&self,
sample_times: impl IntoIterator<Item = f32>,
) -> Result<UnevenSampleAutoCurve<T>, ResamplingError>where
T: StableInterpolate,
Curve to produce a new one that is defined by automatic interpolation over
samples taken at the given set of times. The given sample_times are expected to contain at least
two valid times within the curve’s domain interval. Read moreSource§impl<T, C> CurveWithDerivative<T> for Cwhere
T: HasTangent,
C: SampleDerivative<T>,
impl<T, C> CurveWithDerivative<T> for Cwhere
T: HasTangent,
C: SampleDerivative<T>,
Source§fn with_derivative(self) -> SampleDerivativeWrapper<C>
fn with_derivative(self) -> SampleDerivativeWrapper<C>
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T> HitDataExtra for T
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
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<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>
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,
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.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Renamed to random to avoid conflict with the new gen keyword in Rust 2024.
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Renamed to random_range
Rng::random_range.impl<R> RngCore for Rwhere
R: Rng,
Source§impl<R> RngExt for R
impl<R> RngExt for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T> ⓘ
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T> ⓘwhere
D: Distribution<T>,
Self: Sized,
Source§impl<T, C, D> SampleDerivative<T> for D
impl<T, C, D> SampleDerivative<T> for D
Source§fn sample_with_derivative_unchecked(&self, t: f32) -> WithDerivative<T>
fn sample_with_derivative_unchecked(&self, t: f32) -> WithDerivative<T>
t, extracting the associated value
in addition to its derivative. This is the unchecked version of sampling, which
should only be used if the sample time t is already known to lie within the
curve’s domain. Read moreSource§fn sample_with_derivative(&self, t: f32) -> Option<WithDerivative<T>>
fn sample_with_derivative(&self, t: f32) -> Option<WithDerivative<T>>
t, returning
None if the point is outside of the curve’s domain.Source§fn sample_with_derivative_clamped(&self, t: f32) -> WithDerivative<T>
fn sample_with_derivative_clamped(&self, t: f32) -> WithDerivative<T>
t, clamping t
to lie inside the domain of the curve.impl<T> Settings for T
Source§impl<T> Source for T
impl<T> Source for T
Source§type Slice<'a> = <<T as Deref>::Target as Source>::Slice<'a>
where
T: 'a
type Slice<'a> = <<T as Deref>::Target as Source>::Slice<'a> where T: 'a
Source can be sliced into.Source§fn read<'a, Chunk>(&'a self, offset: usize) -> Option<Chunk>where
Chunk: Chunk<'a>,
fn read<'a, Chunk>(&'a self, offset: usize) -> Option<Chunk>where
Chunk: Chunk<'a>,
None when reading
out of bounds would occur. Read moreSource§fn slice(&self, range: Range<usize>) -> Option<<T as Source>::Slice<'_>>
fn slice(&self, range: Range<usize>) -> Option<<T as Source>::Slice<'_>>
slice::get(range). Read moreSource§unsafe fn slice_unchecked(
&self,
range: Range<usize>,
) -> <T as Source>::Slice<'_>
unsafe fn slice_unchecked( &self, range: Range<usize>, ) -> <T as Source>::Slice<'_>
forbid_unsafe only.slice::get_unchecked(range). Read moreSource§fn is_boundary(&self, index: usize) -> bool
fn is_boundary(&self, index: usize) -> bool
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
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
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.Source§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
impl<R> TryCryptoRng for R
impl<R> TryCryptoRng for R
Source§impl<R> TryRng for R
impl<R> TryRng for R
Source§impl<R> TryRngCore for Rwhere
R: TryRng,
impl<R> TryRngCore for Rwhere
R: TryRng,
Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self> ⓘwhere
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self> ⓘwhere
Self: Sized,
std only.RngCore to a RngReadAdapter.