pub struct WindowResolution { /* private fields */ }
Expand description
Controls the size of a Window
§Physical, logical and requested sizes
There are three sizes associated with a window:
- the physical size, which represents the actual height and width in physical pixels the window occupies on the monitor,
- the logical size, which represents the size that should be used to scale elements inside the window, measured in logical pixels,
- the requested size, measured in logical pixels, which is the value submitted to the API when creating the window, or requesting that it be resized.
§Scale factor
The reason logical size and physical size are separated and can be different is to account for the cases where:
- several monitors have different pixel densities,
- the user has set up a pixel density preference in its operating system,
- the Bevy
App
has specified a specific scale factor between both.
The factor between physical size and logical size can be retrieved with
WindowResolution::scale_factor
.
For the first two cases, a scale factor is set automatically by the operating
system through the window backend. You can get it with
WindowResolution::base_scale_factor
.
For the third case, you can override this automatic scale factor with
WindowResolution::set_scale_factor_override
.
§Requested and obtained sizes
The logical size should be equal to the requested size after creating/resizing,
when possible.
The reason the requested size and logical size might be different
is because the corresponding physical size might exceed limits (either the
size limits of the monitor, or limits defined in WindowResizeConstraints
).
Note: The requested size is not kept in memory, for example requesting a size too big for the screen, making the logical size different from the requested size, and then setting a scale factor that makes the previous requested size within the limits of the screen will not get back that previous requested size.
Implementations§
Source§impl WindowResolution
impl WindowResolution
Sourcepub fn new(physical_width: f32, physical_height: f32) -> WindowResolution
pub fn new(physical_width: f32, physical_height: f32) -> WindowResolution
Creates a new WindowResolution
.
Examples found in repository?
9fn main() {
10 App::new()
11 .add_plugins(DefaultPlugins.set(WindowPlugin {
12 primary_window: Some(Window {
13 resolution: WindowResolution::new(500., 300.).with_scale_factor_override(1.0),
14 ..default()
15 }),
16 ..default()
17 }))
18 .add_systems(Startup, setup)
19 .add_systems(
20 Update,
21 (display_override, toggle_override, change_scale_factor),
22 )
23 .run();
24}
More examples
20fn main() {
21 App::new()
22 .add_plugins(
23 DefaultPlugins.set(WindowPlugin {
24 primary_window: Some(Window {
25 resolution: WindowResolution::new(MAX_WIDTH as f32, MAX_HEIGHT as f32)
26 .with_scale_factor_override(1.0),
27 title: "Resizing".into(),
28 ..default()
29 }),
30 ..default()
31 }),
32 )
33 .insert_resource(Dimensions {
34 width: MAX_WIDTH,
35 height: MAX_HEIGHT,
36 })
37 .insert_resource(ContractingY)
38 .add_systems(Startup, (setup_3d, setup_2d))
39 .add_systems(Update, (change_window_size, sync_dimensions))
40 .run();
41}
14fn main() {
15 App::new()
16 .add_plugins((
17 DefaultPlugins.set(WindowPlugin {
18 primary_window: Some(Window {
19 present_mode: PresentMode::AutoNoVsync,
20 resolution: WindowResolution::new(1920.0, 1080.0)
21 .with_scale_factor_override(1.0),
22 ..default()
23 }),
24 ..default()
25 }),
26 FrameTimeDiagnosticsPlugin::default(),
27 LogDiagnosticsPlugin::default(),
28 ))
29 .insert_resource(WinitSettings {
30 focused_mode: UpdateMode::Continuous,
31 unfocused_mode: UpdateMode::Continuous,
32 })
33 .add_systems(Startup, spawn)
34 .add_systems(Update, update_text_bounds)
35 .run();
36}
18fn main() {
19 App::new()
20 .add_plugins((
21 DefaultPlugins.set(WindowPlugin {
22 primary_window: Some(Window {
23 resolution: WindowResolution::new(1920.0, 1080.0)
24 .with_scale_factor_override(1.0),
25 title: "many_lights".into(),
26 present_mode: PresentMode::AutoNoVsync,
27 ..default()
28 }),
29 ..default()
30 }),
31 FrameTimeDiagnosticsPlugin::default(),
32 LogDiagnosticsPlugin::default(),
33 LogVisibleLights,
34 ))
35 .insert_resource(WinitSettings {
36 focused_mode: UpdateMode::Continuous,
37 unfocused_mode: UpdateMode::Continuous,
38 })
39 .add_systems(Startup, setup)
40 .add_systems(Update, (move_camera, print_light_count))
41 .run();
42}
63fn main() {
64 // `from_env` panics on the web
65 #[cfg(not(target_arch = "wasm32"))]
66 let args: Args = argh::from_env();
67 #[cfg(target_arch = "wasm32")]
68 let args = Args::from_args(&[], &[]).unwrap();
69
70 let mut app = App::new();
71
72 app.add_plugins((
73 FrameTimeDiagnosticsPlugin::default(),
74 LogDiagnosticsPlugin::default(),
75 DefaultPlugins.set(WindowPlugin {
76 primary_window: Some(Window {
77 present_mode: PresentMode::AutoNoVsync,
78 resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
79 ..default()
80 }),
81 ..default()
82 }),
83 ))
84 .init_resource::<FontHandle>()
85 .add_systems(Startup, setup)
86 .add_systems(Update, (move_camera, print_counts));
87
88 if args.recompute {
89 app.add_systems(Update, recompute);
90 }
91
92 app.insert_resource(args).run();
93}
18fn main() {
19 // `from_env` panics on the web
20 #[cfg(not(target_arch = "wasm32"))]
21 let args: Args = argh::from_env();
22 #[cfg(target_arch = "wasm32")]
23 let args = Args::from_args(&[], &[]).unwrap();
24
25 App::new()
26 .add_plugins((
27 DefaultPlugins.set(WindowPlugin {
28 primary_window: Some(Window {
29 resolution: WindowResolution::new(1920.0, 1080.0)
30 .with_scale_factor_override(1.0),
31 title: "many_materials".into(),
32 present_mode: PresentMode::AutoNoVsync,
33 ..default()
34 }),
35 ..default()
36 }),
37 FrameTimeDiagnosticsPlugin::default(),
38 LogDiagnosticsPlugin::default(),
39 ))
40 .insert_resource(args)
41 .add_systems(Startup, setup)
42 .add_systems(Update, animate_materials)
43 .run();
44}
Sourcepub fn with_scale_factor_override(
self,
scale_factor_override: f32,
) -> WindowResolution
pub fn with_scale_factor_override( self, scale_factor_override: f32, ) -> WindowResolution
Builder method for adding a scale factor override to the resolution.
Examples found in repository?
9fn main() {
10 App::new()
11 .add_plugins(DefaultPlugins.set(WindowPlugin {
12 primary_window: Some(Window {
13 resolution: WindowResolution::new(500., 300.).with_scale_factor_override(1.0),
14 ..default()
15 }),
16 ..default()
17 }))
18 .add_systems(Startup, setup)
19 .add_systems(
20 Update,
21 (display_override, toggle_override, change_scale_factor),
22 )
23 .run();
24}
More examples
20fn main() {
21 App::new()
22 .add_plugins(
23 DefaultPlugins.set(WindowPlugin {
24 primary_window: Some(Window {
25 resolution: WindowResolution::new(MAX_WIDTH as f32, MAX_HEIGHT as f32)
26 .with_scale_factor_override(1.0),
27 title: "Resizing".into(),
28 ..default()
29 }),
30 ..default()
31 }),
32 )
33 .insert_resource(Dimensions {
34 width: MAX_WIDTH,
35 height: MAX_HEIGHT,
36 })
37 .insert_resource(ContractingY)
38 .add_systems(Startup, (setup_3d, setup_2d))
39 .add_systems(Update, (change_window_size, sync_dimensions))
40 .run();
41}
14fn main() {
15 App::new()
16 .add_plugins((
17 DefaultPlugins.set(WindowPlugin {
18 primary_window: Some(Window {
19 present_mode: PresentMode::AutoNoVsync,
20 resolution: WindowResolution::new(1920.0, 1080.0)
21 .with_scale_factor_override(1.0),
22 ..default()
23 }),
24 ..default()
25 }),
26 FrameTimeDiagnosticsPlugin::default(),
27 LogDiagnosticsPlugin::default(),
28 ))
29 .insert_resource(WinitSettings {
30 focused_mode: UpdateMode::Continuous,
31 unfocused_mode: UpdateMode::Continuous,
32 })
33 .add_systems(Startup, spawn)
34 .add_systems(Update, update_text_bounds)
35 .run();
36}
18fn main() {
19 // `from_env` panics on the web
20 #[cfg(not(target_arch = "wasm32"))]
21 let args: Args = argh::from_env();
22 #[cfg(target_arch = "wasm32")]
23 let args = Args::from_args(&[], &[]).unwrap();
24
25 let window = if let Some(scale_factor) = args.scale_factor {
26 Window {
27 resolution: WindowResolution::default().with_scale_factor_override(scale_factor),
28 ..Default::default()
29 }
30 } else {
31 Window::default()
32 };
33
34 App::new()
35 .add_plugins(DefaultPlugins.set(WindowPlugin {
36 primary_window: Some(window),
37 ..Default::default()
38 }))
39 .insert_resource(WinitSettings::desktop_app())
40 .insert_resource(UiScale(args.ui_scale))
41 .add_systems(Startup, spawn)
42 .run();
43}
18fn main() {
19 App::new()
20 .add_plugins((
21 DefaultPlugins.set(WindowPlugin {
22 primary_window: Some(Window {
23 resolution: WindowResolution::new(1920.0, 1080.0)
24 .with_scale_factor_override(1.0),
25 title: "many_lights".into(),
26 present_mode: PresentMode::AutoNoVsync,
27 ..default()
28 }),
29 ..default()
30 }),
31 FrameTimeDiagnosticsPlugin::default(),
32 LogDiagnosticsPlugin::default(),
33 LogVisibleLights,
34 ))
35 .insert_resource(WinitSettings {
36 focused_mode: UpdateMode::Continuous,
37 unfocused_mode: UpdateMode::Continuous,
38 })
39 .add_systems(Startup, setup)
40 .add_systems(Update, (move_camera, print_light_count))
41 .run();
42}
63fn main() {
64 // `from_env` panics on the web
65 #[cfg(not(target_arch = "wasm32"))]
66 let args: Args = argh::from_env();
67 #[cfg(target_arch = "wasm32")]
68 let args = Args::from_args(&[], &[]).unwrap();
69
70 let mut app = App::new();
71
72 app.add_plugins((
73 FrameTimeDiagnosticsPlugin::default(),
74 LogDiagnosticsPlugin::default(),
75 DefaultPlugins.set(WindowPlugin {
76 primary_window: Some(Window {
77 present_mode: PresentMode::AutoNoVsync,
78 resolution: WindowResolution::new(1920.0, 1080.0).with_scale_factor_override(1.0),
79 ..default()
80 }),
81 ..default()
82 }),
83 ))
84 .init_resource::<FontHandle>()
85 .add_systems(Startup, setup)
86 .add_systems(Update, (move_camera, print_counts));
87
88 if args.recompute {
89 app.add_systems(Update, recompute);
90 }
91
92 app.insert_resource(args).run();
93}
- examples/stress_tests/many_materials.rs
- examples/stress_tests/many_gizmos.rs
- examples/stress_tests/many_glyphs.rs
- examples/stress_tests/many_animated_sprites.rs
- examples/stress_tests/many_cubes.rs
- examples/stress_tests/many_sprites.rs
- examples/stress_tests/many_foxes.rs
- examples/stress_tests/bevymark.rs
- examples/stress_tests/many_buttons.rs
Sourcepub fn width(&self) -> f32
pub fn width(&self) -> f32
The window’s client area width in logical pixels.
Examples found in repository?
24fn setup(
25 mut commands: Commands,
26 mut meshes: ResMut<Assets<Mesh>>,
27 mut materials: ResMut<Assets<StandardMaterial>>,
28 window: Query<&Window>,
29) -> Result {
30 // circular base
31 commands.spawn((
32 Mesh3d(meshes.add(Circle::new(4.0))),
33 MeshMaterial3d(materials.add(Color::WHITE)),
34 Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
35 ));
36
37 // cube
38 commands.spawn((
39 Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
40 MeshMaterial3d(materials.add(Color::WHITE)),
41 Transform::from_xyz(0.0, 0.5, 0.0),
42 ));
43
44 // lights
45 for i in 0..NUM_LIGHTS {
46 let angle = (i as f32) / (NUM_LIGHTS as f32) * PI * 2.0;
47 commands.spawn((
48 PointLight {
49 color: Color::hsv(angle.to_degrees(), 1.0, 1.0),
50 intensity: 2_000_000.0 / NUM_LIGHTS as f32,
51 shadows_enabled: true,
52 ..default()
53 },
54 Transform::from_xyz(sin(angle) * 4.0, 2.0, cos(angle) * 4.0),
55 ));
56 }
57
58 // cameras
59 let window = window.single()?;
60 let width = window.resolution.width() / CAMERA_COLS as f32 * window.resolution.scale_factor();
61 let height = window.resolution.height() / CAMERA_ROWS as f32 * window.resolution.scale_factor();
62 let mut i = 0;
63 for y in 0..CAMERA_COLS {
64 for x in 0..CAMERA_ROWS {
65 let angle = i as f32 / (CAMERA_ROWS * CAMERA_COLS) as f32 * PI * 2.0;
66 commands.spawn((
67 Camera3d::default(),
68 Camera {
69 viewport: Some(Viewport {
70 physical_position: UVec2::new(
71 (x as f32 * width) as u32,
72 (y as f32 * height) as u32,
73 ),
74 physical_size: UVec2::new(width as u32, height as u32),
75 ..default()
76 }),
77 order: i,
78 ..default()
79 },
80 Transform::from_xyz(sin(angle) * 4.0, 2.5, cos(angle) * 4.0)
81 .looking_at(Vec3::ZERO, Vec3::Y),
82 ));
83 i += 1;
84 }
85 }
86 Ok(())
87}
More examples
392fn spawn_birds(
393 commands: &mut Commands,
394 args: &Args,
395 primary_window_resolution: &WindowResolution,
396 counter: &mut BevyCounter,
397 spawn_count: usize,
398 bird_resources: &mut BirdResources,
399 waves_to_simulate: Option<usize>,
400 wave: usize,
401) {
402 let bird_x = (primary_window_resolution.width() / -2.) + HALF_BIRD_SIZE;
403 let bird_y = (primary_window_resolution.height() / 2.) - HALF_BIRD_SIZE;
404
405 let half_extents = 0.5 * primary_window_resolution.size();
406
407 let color = counter.color;
408 let current_count = counter.count;
409
410 match args.mode {
411 Mode::Sprite => {
412 let batch = (0..spawn_count)
413 .map(|count| {
414 let bird_z = if args.ordered_z {
415 (current_count + count) as f32 * 0.00001
416 } else {
417 bird_resources.transform_rng.r#gen::<f32>()
418 };
419
420 let (transform, velocity) = bird_velocity_transform(
421 half_extents,
422 Vec3::new(bird_x, bird_y, bird_z),
423 &mut bird_resources.velocity_rng,
424 waves_to_simulate,
425 FIXED_DELTA_TIME,
426 );
427
428 let color = if args.vary_per_instance {
429 Color::linear_rgb(
430 bird_resources.color_rng.r#gen(),
431 bird_resources.color_rng.r#gen(),
432 bird_resources.color_rng.r#gen(),
433 )
434 } else {
435 color
436 };
437 (
438 Sprite {
439 image: bird_resources
440 .textures
441 .choose(&mut bird_resources.material_rng)
442 .unwrap()
443 .clone(),
444 color,
445 ..default()
446 },
447 transform,
448 Bird { velocity },
449 )
450 })
451 .collect::<Vec<_>>();
452 commands.spawn_batch(batch);
453 }
454 Mode::Mesh2d => {
455 let batch = (0..spawn_count)
456 .map(|count| {
457 let bird_z = if args.ordered_z {
458 (current_count + count) as f32 * 0.00001
459 } else {
460 bird_resources.transform_rng.r#gen::<f32>()
461 };
462
463 let (transform, velocity) = bird_velocity_transform(
464 half_extents,
465 Vec3::new(bird_x, bird_y, bird_z),
466 &mut bird_resources.velocity_rng,
467 waves_to_simulate,
468 FIXED_DELTA_TIME,
469 );
470
471 let material =
472 if args.vary_per_instance || args.material_texture_count > args.waves {
473 bird_resources
474 .materials
475 .choose(&mut bird_resources.material_rng)
476 .unwrap()
477 .clone()
478 } else {
479 bird_resources.materials[wave % bird_resources.materials.len()].clone()
480 };
481 (
482 Mesh2d(bird_resources.quad.clone()),
483 MeshMaterial2d(material),
484 transform,
485 Bird { velocity },
486 )
487 })
488 .collect::<Vec<_>>();
489 commands.spawn_batch(batch);
490 }
491 }
492
493 counter.count += spawn_count;
494 counter.color = Color::linear_rgb(
495 bird_resources.color_rng.r#gen(),
496 bird_resources.color_rng.r#gen(),
497 bird_resources.color_rng.r#gen(),
498 );
499}
Sourcepub fn height(&self) -> f32
pub fn height(&self) -> f32
The window’s client area height in logical pixels.
Examples found in repository?
24fn setup(
25 mut commands: Commands,
26 mut meshes: ResMut<Assets<Mesh>>,
27 mut materials: ResMut<Assets<StandardMaterial>>,
28 window: Query<&Window>,
29) -> Result {
30 // circular base
31 commands.spawn((
32 Mesh3d(meshes.add(Circle::new(4.0))),
33 MeshMaterial3d(materials.add(Color::WHITE)),
34 Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
35 ));
36
37 // cube
38 commands.spawn((
39 Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
40 MeshMaterial3d(materials.add(Color::WHITE)),
41 Transform::from_xyz(0.0, 0.5, 0.0),
42 ));
43
44 // lights
45 for i in 0..NUM_LIGHTS {
46 let angle = (i as f32) / (NUM_LIGHTS as f32) * PI * 2.0;
47 commands.spawn((
48 PointLight {
49 color: Color::hsv(angle.to_degrees(), 1.0, 1.0),
50 intensity: 2_000_000.0 / NUM_LIGHTS as f32,
51 shadows_enabled: true,
52 ..default()
53 },
54 Transform::from_xyz(sin(angle) * 4.0, 2.0, cos(angle) * 4.0),
55 ));
56 }
57
58 // cameras
59 let window = window.single()?;
60 let width = window.resolution.width() / CAMERA_COLS as f32 * window.resolution.scale_factor();
61 let height = window.resolution.height() / CAMERA_ROWS as f32 * window.resolution.scale_factor();
62 let mut i = 0;
63 for y in 0..CAMERA_COLS {
64 for x in 0..CAMERA_ROWS {
65 let angle = i as f32 / (CAMERA_ROWS * CAMERA_COLS) as f32 * PI * 2.0;
66 commands.spawn((
67 Camera3d::default(),
68 Camera {
69 viewport: Some(Viewport {
70 physical_position: UVec2::new(
71 (x as f32 * width) as u32,
72 (y as f32 * height) as u32,
73 ),
74 physical_size: UVec2::new(width as u32, height as u32),
75 ..default()
76 }),
77 order: i,
78 ..default()
79 },
80 Transform::from_xyz(sin(angle) * 4.0, 2.5, cos(angle) * 4.0)
81 .looking_at(Vec3::ZERO, Vec3::Y),
82 ));
83 i += 1;
84 }
85 }
86 Ok(())
87}
More examples
392fn spawn_birds(
393 commands: &mut Commands,
394 args: &Args,
395 primary_window_resolution: &WindowResolution,
396 counter: &mut BevyCounter,
397 spawn_count: usize,
398 bird_resources: &mut BirdResources,
399 waves_to_simulate: Option<usize>,
400 wave: usize,
401) {
402 let bird_x = (primary_window_resolution.width() / -2.) + HALF_BIRD_SIZE;
403 let bird_y = (primary_window_resolution.height() / 2.) - HALF_BIRD_SIZE;
404
405 let half_extents = 0.5 * primary_window_resolution.size();
406
407 let color = counter.color;
408 let current_count = counter.count;
409
410 match args.mode {
411 Mode::Sprite => {
412 let batch = (0..spawn_count)
413 .map(|count| {
414 let bird_z = if args.ordered_z {
415 (current_count + count) as f32 * 0.00001
416 } else {
417 bird_resources.transform_rng.r#gen::<f32>()
418 };
419
420 let (transform, velocity) = bird_velocity_transform(
421 half_extents,
422 Vec3::new(bird_x, bird_y, bird_z),
423 &mut bird_resources.velocity_rng,
424 waves_to_simulate,
425 FIXED_DELTA_TIME,
426 );
427
428 let color = if args.vary_per_instance {
429 Color::linear_rgb(
430 bird_resources.color_rng.r#gen(),
431 bird_resources.color_rng.r#gen(),
432 bird_resources.color_rng.r#gen(),
433 )
434 } else {
435 color
436 };
437 (
438 Sprite {
439 image: bird_resources
440 .textures
441 .choose(&mut bird_resources.material_rng)
442 .unwrap()
443 .clone(),
444 color,
445 ..default()
446 },
447 transform,
448 Bird { velocity },
449 )
450 })
451 .collect::<Vec<_>>();
452 commands.spawn_batch(batch);
453 }
454 Mode::Mesh2d => {
455 let batch = (0..spawn_count)
456 .map(|count| {
457 let bird_z = if args.ordered_z {
458 (current_count + count) as f32 * 0.00001
459 } else {
460 bird_resources.transform_rng.r#gen::<f32>()
461 };
462
463 let (transform, velocity) = bird_velocity_transform(
464 half_extents,
465 Vec3::new(bird_x, bird_y, bird_z),
466 &mut bird_resources.velocity_rng,
467 waves_to_simulate,
468 FIXED_DELTA_TIME,
469 );
470
471 let material =
472 if args.vary_per_instance || args.material_texture_count > args.waves {
473 bird_resources
474 .materials
475 .choose(&mut bird_resources.material_rng)
476 .unwrap()
477 .clone()
478 } else {
479 bird_resources.materials[wave % bird_resources.materials.len()].clone()
480 };
481 (
482 Mesh2d(bird_resources.quad.clone()),
483 MeshMaterial2d(material),
484 transform,
485 Bird { velocity },
486 )
487 })
488 .collect::<Vec<_>>();
489 commands.spawn_batch(batch);
490 }
491 }
492
493 counter.count += spawn_count;
494 counter.color = Color::linear_rgb(
495 bird_resources.color_rng.r#gen(),
496 bird_resources.color_rng.r#gen(),
497 bird_resources.color_rng.r#gen(),
498 );
499}
Sourcepub fn size(&self) -> Vec2
pub fn size(&self) -> Vec2
The window’s client size in logical pixels
Examples found in repository?
392fn spawn_birds(
393 commands: &mut Commands,
394 args: &Args,
395 primary_window_resolution: &WindowResolution,
396 counter: &mut BevyCounter,
397 spawn_count: usize,
398 bird_resources: &mut BirdResources,
399 waves_to_simulate: Option<usize>,
400 wave: usize,
401) {
402 let bird_x = (primary_window_resolution.width() / -2.) + HALF_BIRD_SIZE;
403 let bird_y = (primary_window_resolution.height() / 2.) - HALF_BIRD_SIZE;
404
405 let half_extents = 0.5 * primary_window_resolution.size();
406
407 let color = counter.color;
408 let current_count = counter.count;
409
410 match args.mode {
411 Mode::Sprite => {
412 let batch = (0..spawn_count)
413 .map(|count| {
414 let bird_z = if args.ordered_z {
415 (current_count + count) as f32 * 0.00001
416 } else {
417 bird_resources.transform_rng.r#gen::<f32>()
418 };
419
420 let (transform, velocity) = bird_velocity_transform(
421 half_extents,
422 Vec3::new(bird_x, bird_y, bird_z),
423 &mut bird_resources.velocity_rng,
424 waves_to_simulate,
425 FIXED_DELTA_TIME,
426 );
427
428 let color = if args.vary_per_instance {
429 Color::linear_rgb(
430 bird_resources.color_rng.r#gen(),
431 bird_resources.color_rng.r#gen(),
432 bird_resources.color_rng.r#gen(),
433 )
434 } else {
435 color
436 };
437 (
438 Sprite {
439 image: bird_resources
440 .textures
441 .choose(&mut bird_resources.material_rng)
442 .unwrap()
443 .clone(),
444 color,
445 ..default()
446 },
447 transform,
448 Bird { velocity },
449 )
450 })
451 .collect::<Vec<_>>();
452 commands.spawn_batch(batch);
453 }
454 Mode::Mesh2d => {
455 let batch = (0..spawn_count)
456 .map(|count| {
457 let bird_z = if args.ordered_z {
458 (current_count + count) as f32 * 0.00001
459 } else {
460 bird_resources.transform_rng.r#gen::<f32>()
461 };
462
463 let (transform, velocity) = bird_velocity_transform(
464 half_extents,
465 Vec3::new(bird_x, bird_y, bird_z),
466 &mut bird_resources.velocity_rng,
467 waves_to_simulate,
468 FIXED_DELTA_TIME,
469 );
470
471 let material =
472 if args.vary_per_instance || args.material_texture_count > args.waves {
473 bird_resources
474 .materials
475 .choose(&mut bird_resources.material_rng)
476 .unwrap()
477 .clone()
478 } else {
479 bird_resources.materials[wave % bird_resources.materials.len()].clone()
480 };
481 (
482 Mesh2d(bird_resources.quad.clone()),
483 MeshMaterial2d(material),
484 transform,
485 Bird { velocity },
486 )
487 })
488 .collect::<Vec<_>>();
489 commands.spawn_batch(batch);
490 }
491 }
492
493 counter.count += spawn_count;
494 counter.color = Color::linear_rgb(
495 bird_resources.color_rng.r#gen(),
496 bird_resources.color_rng.r#gen(),
497 bird_resources.color_rng.r#gen(),
498 );
499}
Sourcepub fn physical_width(&self) -> u32
pub fn physical_width(&self) -> u32
The window’s client area width in physical pixels.
Sourcepub fn physical_height(&self) -> u32
pub fn physical_height(&self) -> u32
The window’s client area height in physical pixels.
Sourcepub fn physical_size(&self) -> UVec2
pub fn physical_size(&self) -> UVec2
The window’s client size in physical pixels
Examples found in repository?
58fn controls(
59 mut camera_query: Query<(&mut Camera, &mut Transform, &mut Projection)>,
60 window: Query<&Window>,
61 input: Res<ButtonInput<KeyCode>>,
62 time: Res<Time<Fixed>>,
63) {
64 let Ok(window) = window.single() else {
65 return;
66 };
67 let Ok((mut camera, mut transform, mut projection)) = camera_query.single_mut() else {
68 return;
69 };
70 let fspeed = 600.0 * time.delta_secs();
71 let uspeed = fspeed as u32;
72 let window_size = window.resolution.physical_size();
73
74 // Camera movement controls
75 if input.pressed(KeyCode::ArrowUp) {
76 transform.translation.y += fspeed;
77 }
78 if input.pressed(KeyCode::ArrowDown) {
79 transform.translation.y -= fspeed;
80 }
81 if input.pressed(KeyCode::ArrowLeft) {
82 transform.translation.x -= fspeed;
83 }
84 if input.pressed(KeyCode::ArrowRight) {
85 transform.translation.x += fspeed;
86 }
87
88 // Camera zoom controls
89 if let Projection::Orthographic(projection2d) = &mut *projection {
90 if input.pressed(KeyCode::Comma) {
91 projection2d.scale *= powf(4.0f32, time.delta_secs());
92 }
93
94 if input.pressed(KeyCode::Period) {
95 projection2d.scale *= powf(0.25f32, time.delta_secs());
96 }
97 }
98
99 if let Some(viewport) = camera.viewport.as_mut() {
100 // Viewport movement controls
101 if input.pressed(KeyCode::KeyW) {
102 viewport.physical_position.y = viewport.physical_position.y.saturating_sub(uspeed);
103 }
104 if input.pressed(KeyCode::KeyS) {
105 viewport.physical_position.y += uspeed;
106 }
107 if input.pressed(KeyCode::KeyA) {
108 viewport.physical_position.x = viewport.physical_position.x.saturating_sub(uspeed);
109 }
110 if input.pressed(KeyCode::KeyD) {
111 viewport.physical_position.x += uspeed;
112 }
113
114 // Bound viewport position so it doesn't go off-screen
115 viewport.physical_position = viewport
116 .physical_position
117 .min(window_size - viewport.physical_size);
118
119 // Viewport size controls
120 if input.pressed(KeyCode::KeyI) {
121 viewport.physical_size.y = viewport.physical_size.y.saturating_sub(uspeed);
122 }
123 if input.pressed(KeyCode::KeyK) {
124 viewport.physical_size.y += uspeed;
125 }
126 if input.pressed(KeyCode::KeyJ) {
127 viewport.physical_size.x = viewport.physical_size.x.saturating_sub(uspeed);
128 }
129 if input.pressed(KeyCode::KeyL) {
130 viewport.physical_size.x += uspeed;
131 }
132
133 // Bound viewport size so it doesn't go off-screen
134 viewport.physical_size = viewport
135 .physical_size
136 .min(window_size - viewport.physical_position)
137 .max(UVec2::new(20, 20));
138 }
139}
140
141fn setup(
142 mut commands: Commands,
143 mut meshes: ResMut<Assets<Mesh>>,
144 mut materials: ResMut<Assets<ColorMaterial>>,
145 window: Single<&Window>,
146) {
147 let window_size = window.resolution.physical_size().as_vec2();
148
149 // Initialize centered, non-window-filling viewport
150 commands.spawn((
151 Camera2d,
152 Camera {
153 viewport: Some(Viewport {
154 physical_position: (window_size * 0.125).as_uvec2(),
155 physical_size: (window_size * 0.75).as_uvec2(),
156 ..default()
157 }),
158 ..default()
159 },
160 ));
161
162 // Create a minimal UI explaining how to interact with the example
163 commands.spawn((
164 Text::new(
165 "Move the mouse to see the circle follow your cursor.\n\
166 Use the arrow keys to move the camera.\n\
167 Use the comma and period keys to zoom in and out.\n\
168 Use the WASD keys to move the viewport.\n\
169 Use the IJKL keys to resize the viewport.",
170 ),
171 Node {
172 position_type: PositionType::Absolute,
173 top: Val::Px(12.0),
174 left: Val::Px(12.0),
175 ..default()
176 },
177 ));
178
179 // Add mesh to make camera movement visible
180 commands.spawn((
181 Mesh2d(meshes.add(Rectangle::new(40.0, 20.0))),
182 MeshMaterial2d(materials.add(Color::from(GREEN))),
183 ));
184
185 // Add background to visualize viewport bounds
186 commands.spawn((
187 Mesh2d(meshes.add(Rectangle::new(50000.0, 50000.0))),
188 MeshMaterial2d(materials.add(Color::linear_rgb(0.01, 0.01, 0.01))),
189 Transform::from_translation(Vec3::new(0.0, 0.0, -200.0)),
190 ));
191}
Sourcepub fn scale_factor(&self) -> f32
pub fn scale_factor(&self) -> f32
The ratio of physical pixels to logical pixels.
physical_pixels = logical_pixels * scale_factor
Examples found in repository?
24fn setup(
25 mut commands: Commands,
26 mut meshes: ResMut<Assets<Mesh>>,
27 mut materials: ResMut<Assets<StandardMaterial>>,
28 window: Query<&Window>,
29) -> Result {
30 // circular base
31 commands.spawn((
32 Mesh3d(meshes.add(Circle::new(4.0))),
33 MeshMaterial3d(materials.add(Color::WHITE)),
34 Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
35 ));
36
37 // cube
38 commands.spawn((
39 Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))),
40 MeshMaterial3d(materials.add(Color::WHITE)),
41 Transform::from_xyz(0.0, 0.5, 0.0),
42 ));
43
44 // lights
45 for i in 0..NUM_LIGHTS {
46 let angle = (i as f32) / (NUM_LIGHTS as f32) * PI * 2.0;
47 commands.spawn((
48 PointLight {
49 color: Color::hsv(angle.to_degrees(), 1.0, 1.0),
50 intensity: 2_000_000.0 / NUM_LIGHTS as f32,
51 shadows_enabled: true,
52 ..default()
53 },
54 Transform::from_xyz(sin(angle) * 4.0, 2.0, cos(angle) * 4.0),
55 ));
56 }
57
58 // cameras
59 let window = window.single()?;
60 let width = window.resolution.width() / CAMERA_COLS as f32 * window.resolution.scale_factor();
61 let height = window.resolution.height() / CAMERA_ROWS as f32 * window.resolution.scale_factor();
62 let mut i = 0;
63 for y in 0..CAMERA_COLS {
64 for x in 0..CAMERA_ROWS {
65 let angle = i as f32 / (CAMERA_ROWS * CAMERA_COLS) as f32 * PI * 2.0;
66 commands.spawn((
67 Camera3d::default(),
68 Camera {
69 viewport: Some(Viewport {
70 physical_position: UVec2::new(
71 (x as f32 * width) as u32,
72 (y as f32 * height) as u32,
73 ),
74 physical_size: UVec2::new(width as u32, height as u32),
75 ..default()
76 }),
77 order: i,
78 ..default()
79 },
80 Transform::from_xyz(sin(angle) * 4.0, 2.5, cos(angle) * 4.0)
81 .looking_at(Vec3::ZERO, Vec3::Y),
82 ));
83 i += 1;
84 }
85 }
86 Ok(())
87}
Sourcepub fn base_scale_factor(&self) -> f32
pub fn base_scale_factor(&self) -> f32
The window scale factor as reported by the window backend.
This value is unaffected by WindowResolution::scale_factor_override
.
Sourcepub fn scale_factor_override(&self) -> Option<f32>
pub fn scale_factor_override(&self) -> Option<f32>
The scale factor set with WindowResolution::set_scale_factor_override
.
This value may be different from the scale factor reported by the window backend.
Examples found in repository?
65fn display_override(
66 mut window: Single<&mut Window>,
67 mut custom_text: Single<&mut Text, With<CustomText>>,
68) {
69 let text = format!(
70 "Scale factor: {:.1} {}",
71 window.scale_factor(),
72 if window.resolution.scale_factor_override().is_some() {
73 "(overridden)"
74 } else {
75 "(default)"
76 }
77 );
78
79 window.title.clone_from(&text);
80 custom_text.0 = text;
81}
82
83/// This system toggles scale factor overrides when enter is pressed
84fn toggle_override(input: Res<ButtonInput<KeyCode>>, mut window: Single<&mut Window>) {
85 if input.just_pressed(KeyCode::Enter) {
86 let scale_factor_override = window.resolution.scale_factor_override();
87 window
88 .resolution
89 .set_scale_factor_override(scale_factor_override.xor(Some(1.0)));
90 }
91}
92
93/// This system changes the scale factor override when up or down is pressed
94fn change_scale_factor(input: Res<ButtonInput<KeyCode>>, mut window: Single<&mut Window>) {
95 let scale_factor_override = window.resolution.scale_factor_override();
96 if input.just_pressed(KeyCode::ArrowUp) {
97 window
98 .resolution
99 .set_scale_factor_override(scale_factor_override.map(|n| n + 1.0));
100 } else if input.just_pressed(KeyCode::ArrowDown) {
101 window
102 .resolution
103 .set_scale_factor_override(scale_factor_override.map(|n| (n - 1.0).max(1.0)));
104 }
105}
Sourcepub fn set(&mut self, width: f32, height: f32)
pub fn set(&mut self, width: f32, height: f32)
Set the window’s logical resolution.
Examples found in repository?
More examples
54fn toggle_resolution(
55 keys: Res<ButtonInput<KeyCode>>,
56 mut window: Single<&mut Window>,
57 resolution: Res<ResolutionSettings>,
58) {
59 if keys.just_pressed(KeyCode::Digit1) {
60 let res = resolution.small;
61 window.resolution.set(res.x, res.y);
62 }
63 if keys.just_pressed(KeyCode::Digit2) {
64 let res = resolution.medium;
65 window.resolution.set(res.x, res.y);
66 }
67 if keys.just_pressed(KeyCode::Digit3) {
68 let res = resolution.large;
69 window.resolution.set(res.x, res.y);
70 }
71}
Sourcepub fn set_physical_resolution(&mut self, width: u32, height: u32)
pub fn set_physical_resolution(&mut self, width: u32, height: u32)
Set the window’s physical resolution.
This will ignore the scale factor setting, so most of the time you should
prefer to use WindowResolution::set
.
Sourcepub fn set_scale_factor(&mut self, scale_factor: f32)
pub fn set_scale_factor(&mut self, scale_factor: f32)
Set the window’s scale factor, this may get overridden by the backend.
Sourcepub fn set_scale_factor_override(&mut self, scale_factor_override: Option<f32>)
pub fn set_scale_factor_override(&mut self, scale_factor_override: Option<f32>)
Set the window’s scale factor, this will be used over what the backend decides.
This can change the logical and physical sizes if the resulting physical size is not within the limits.
Examples found in repository?
84fn toggle_override(input: Res<ButtonInput<KeyCode>>, mut window: Single<&mut Window>) {
85 if input.just_pressed(KeyCode::Enter) {
86 let scale_factor_override = window.resolution.scale_factor_override();
87 window
88 .resolution
89 .set_scale_factor_override(scale_factor_override.xor(Some(1.0)));
90 }
91}
92
93/// This system changes the scale factor override when up or down is pressed
94fn change_scale_factor(input: Res<ButtonInput<KeyCode>>, mut window: Single<&mut Window>) {
95 let scale_factor_override = window.resolution.scale_factor_override();
96 if input.just_pressed(KeyCode::ArrowUp) {
97 window
98 .resolution
99 .set_scale_factor_override(scale_factor_override.map(|n| n + 1.0));
100 } else if input.just_pressed(KeyCode::ArrowDown) {
101 window
102 .resolution
103 .set_scale_factor_override(scale_factor_override.map(|n| (n - 1.0).max(1.0)));
104 }
105}
Trait Implementations§
Source§impl Clone for WindowResolution
impl Clone for WindowResolution
Source§fn clone(&self) -> WindowResolution
fn clone(&self) -> WindowResolution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WindowResolution
impl Debug for WindowResolution
Source§impl Default for WindowResolution
impl Default for WindowResolution
Source§fn default() -> WindowResolution
fn default() -> WindowResolution
Source§impl<'de> Deserialize<'de> for WindowResolution
impl<'de> Deserialize<'de> for WindowResolution
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<WindowResolution, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<WindowResolution, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<I> From<[I; 2]> for WindowResolution
impl<I> From<[I; 2]> for WindowResolution
Source§fn from(_: [I; 2]) -> WindowResolution
fn from(_: [I; 2]) -> WindowResolution
Source§impl<I> From<(I, I)> for WindowResolution
impl<I> From<(I, I)> for WindowResolution
Source§fn from(_: (I, I)) -> WindowResolution
fn from(_: (I, I)) -> WindowResolution
Source§impl From<DVec2> for WindowResolution
impl From<DVec2> for WindowResolution
Source§fn from(res: DVec2) -> WindowResolution
fn from(res: DVec2) -> WindowResolution
Source§impl From<Vec2> for WindowResolution
impl From<Vec2> for WindowResolution
Source§fn from(res: Vec2) -> WindowResolution
fn from(res: Vec2) -> WindowResolution
Source§impl FromArg for &'static WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromArg for &'static WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl FromArg for &'static mut WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromArg for &'static mut WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl FromArg for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromArg for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl FromReflect for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromReflect for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn from_reflect(
reflect: &(dyn PartialReflect + 'static),
) -> Option<WindowResolution>
fn from_reflect( reflect: &(dyn PartialReflect + 'static), ) -> Option<WindowResolution>
Self
from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self
using,
constructing the value using from_reflect
if that fails. Read moreSource§impl GetOwnership for &WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetOwnership for &WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl GetOwnership for &mut WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetOwnership for &mut WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl GetOwnership for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetOwnership for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl GetTypeRegistration for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetTypeRegistration for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration
for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl IntoReturn for &WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl IntoReturn for &WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn into_return<'into_return>(self) -> Return<'into_return>where
&WindowResolution: 'into_return,
fn into_return<'into_return>(self) -> Return<'into_return>where
&WindowResolution: 'into_return,
Source§impl IntoReturn for &mut WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl IntoReturn for &mut WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn into_return<'into_return>(self) -> Return<'into_return>where
&mut WindowResolution: 'into_return,
fn into_return<'into_return>(self) -> Return<'into_return>where
&mut WindowResolution: 'into_return,
Source§impl IntoReturn for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl IntoReturn for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn into_return<'into_return>(self) -> Return<'into_return>where
WindowResolution: 'into_return,
fn into_return<'into_return>(self) -> Return<'into_return>where
WindowResolution: 'into_return,
Source§impl PartialEq for WindowResolution
impl PartialEq for WindowResolution
Source§impl PartialReflect for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl PartialReflect for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<WindowResolution>) -> ReflectOwned
fn reflect_owned(self: Box<WindowResolution>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<WindowResolution>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<WindowResolution>, ) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
Source§fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
fn try_as_reflect(&self) -> Option<&(dyn Reflect + 'static)>
Source§fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
fn try_as_reflect_mut(&mut self) -> Option<&mut (dyn Reflect + 'static)>
Source§fn into_partial_reflect(self: Box<WindowResolution>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<WindowResolution>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Self
using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn clone_value(&self) -> Box<dyn PartialReflect>
fn clone_value(&self) -> Box<dyn PartialReflect>
reflect_clone
. To convert reflected values to dynamic ones, use to_dynamic
.Self
into its dynamic representation. Read moreSource§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl Reflect for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl Reflect for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn into_any(self: Box<WindowResolution>) -> Box<dyn Any>
fn into_any(self: Box<WindowResolution>) -> Box<dyn Any>
Box<dyn Any>
. Read moreSource§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut dyn Any
. Read moreSource§fn into_reflect(self: Box<WindowResolution>) -> Box<dyn Reflect>
fn into_reflect(self: Box<WindowResolution>) -> Box<dyn Reflect>
Source§fn as_reflect(&self) -> &(dyn Reflect + 'static)
fn as_reflect(&self) -> &(dyn Reflect + 'static)
Source§fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
Source§impl Serialize for WindowResolution
impl Serialize for WindowResolution
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Struct for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl Struct for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
name
as a &dyn PartialReflect
.Source§fn field_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
name
as a
&mut dyn PartialReflect
.Source§fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index
as a
&dyn PartialReflect
.Source§fn field_at_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn PartialReflect
.Source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index
.Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn to_dynamic_struct(&self) -> DynamicStruct
Source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
to_dynamic_struct
insteadDynamicStruct
.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None
if TypeInfo
is not available.Source§impl TypePath for WindowResolution
impl TypePath for WindowResolution
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Source§impl Typed for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl Typed for WindowResolutionwhere
WindowResolution: Any + Send + Sync,
u32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<f32>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
f32: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl StructuralPartialEq for WindowResolution
Auto Trait Implementations§
impl Freeze for WindowResolution
impl RefUnwindSafe for WindowResolution
impl Send for WindowResolution
impl Sync for WindowResolution
impl Unpin for WindowResolution
impl UnwindSafe for WindowResolution
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path
.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident
.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name
.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info
.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> 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<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path
. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path
. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path
. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path
. Read moreSource§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<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>
ReadEndian::read_from_little_endian()
.Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
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.