#[repr(C)]pub struct UVec2 {
pub x: u32,
pub y: u32,
}Expand description
A 2-dimensional vector.
Fields§
§x: u32§y: u32Implementations§
Source§impl UVec2
impl UVec2
Sourcepub const fn new(x: u32, y: u32) -> UVec2
pub const fn new(x: u32, y: u32) -> UVec2
Creates a new vector.
Examples found in repository?
More examples
115fn store_window_settings(mut window_settings: ResMut<WindowSettings>, window: &Window) -> bool {
116 window_settings.set_if_neq(WindowSettings {
117 position: match window.position {
118 WindowPosition::At(pos) => Some(pos),
119 _ => None,
120 },
121 size: Some(UVec2::new(
122 window.resolution.width() as u32,
123 window.resolution.height() as u32,
124 )),
125 fullscreen: window.mode != WindowMode::Windowed,
126 })
127}195 const SECTIONS: [Option<URect>; 5] = [
196 Some(URect {
197 min: UVec2::ZERO,
198 max: UVec2::splat(RECT_SIZE),
199 }),
200 Some(URect {
201 min: UVec2::new(RECT_SIZE, 0),
202 max: UVec2::new(2 * RECT_SIZE, RECT_SIZE),
203 }),
204 Some(URect {
205 min: UVec2::new(0, RECT_SIZE),
206 max: UVec2::new(RECT_SIZE, 2 * RECT_SIZE),
207 }),
208 Some(URect {
209 min: UVec2::new(RECT_SIZE, RECT_SIZE),
210 max: UVec2::splat(2 * RECT_SIZE),
211 }),
212 None, // reset to None
213 ];70fn spawn_fake_player(
71 mut commands: Commands,
72 mut meshes: ResMut<Assets<Mesh>>,
73 mut materials: ResMut<Assets<ColorMaterial>>,
74 chunk: Single<&TilemapChunk>,
75) {
76 let mut transform = chunk.calculate_tile_transform(UVec2::new(0, 0));
77 transform.translation.z = 1.;
78
79 commands.spawn((
80 Mesh2d(meshes.add(Rectangle::new(8., 8.))),
81 MeshMaterial2d(materials.add(Color::from(RED_400))),
82 transform,
83 MovePlayer,
84 ));
85
86 let mut transform = chunk.calculate_tile_transform(UVec2::new(5, 6));
87 transform.translation.z = 1.;
88
89 // second "player" to visually test a non-zero position
90 commands.spawn((
91 Mesh2d(meshes.add(Rectangle::new(8., 8.))),
92 MeshMaterial2d(materials.add(Color::from(RED_400))),
93 transform,
94 ));
95}
96
97fn move_player(
98 mut player: Single<&mut Transform, With<MovePlayer>>,
99 time: Res<Time>,
100 chunk: Single<&TilemapChunk>,
101) {
102 let t = (ops::sin(time.elapsed_secs()) + 1.) / 2.;
103
104 let origin = chunk
105 .calculate_tile_transform(UVec2::new(0, 0))
106 .translation
107 .x;
108 let destination = chunk
109 .calculate_tile_transform(UVec2::new(63, 0))
110 .translation
111 .x;
112
113 player.translation.x = origin.lerp(destination, t);
114}
115
116fn update_tilemap(
117 time: Res<Time>,
118 mut query: Query<(&mut TilemapChunkTileData, &mut UpdateTimer)>,
119 mut rng: ResMut<SeededRng>,
120) {
121 for (mut tile_data, mut timer) in query.iter_mut() {
122 timer.tick(time.delta());
123
124 if timer.just_finished() {
125 for _ in 0..50 {
126 let index = rng.random_range(0..tile_data.len());
127 tile_data[index] = Some(TileData::from_tileset_index(rng.random_range(0..5)));
128 }
129 }
130 }
131}
132
133// find the data for an arbitrary tile in the chunk and log its data
134fn log_tile(tilemap: Single<(&TilemapChunk, &TilemapChunkTileData)>, mut local: Local<u16>) {
135 let (chunk, data) = tilemap.into_inner();
136 let Some(tile_data) = data.tile_data_from_tile_pos(chunk.chunk_size, UVec2::new(3, 4)) else {
137 return;
138 };
139 // log when the tile changes
140 if tile_data.tileset_index != *local {
141 info!(?tile_data, "tile_data changed");
142 *local = tile_data.tileset_index;
143 }
144}403 pub fn draw_gizmos(mut gizmos: Gizmos) {
404 gizmos.rect_2d(
405 Isometry2d::from_translation(Vec2::new(-200.0, 0.0)),
406 Vec2::new(200.0, 200.0),
407 RED,
408 );
409 gizmos
410 .circle_2d(
411 Isometry2d::from_translation(Vec2::new(-200.0, 0.0)),
412 200.0,
413 GREEN,
414 )
415 .resolution(64);
416
417 gizmos.text_2d(
418 Isometry2d::from_translation(Vec2::new(-200.0, 0.0)),
419 "text_2d gizmo",
420 15.,
421 Vec2 { x: 0., y: 0. },
422 Color::WHITE,
423 );
424
425 // 2d grids with all variations of outer edges on or off
426 for i in 0..4 {
427 let x = 200.0 * (1.0 + (i % 2) as f32);
428 let y = 150.0 * (0.5 - (i / 2) as f32);
429 let mut grid = gizmos.grid(
430 Vec3::new(x, y, 0.0),
431 UVec2::new(5, 4),
432 Vec2::splat(30.),
433 Color::WHITE,
434 );
435 if i & 1 > 0 {
436 grid = grid.outer_edges_x();
437 }
438 if i & 2 > 0 {
439 grid.outer_edges_y();
440 }
441 }
442 }122fn setup_atlas(
123 mut commands: Commands,
124 asset_server: Res<AssetServer>,
125 mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
126) {
127 let texture_handle = asset_server.load("textures/rpg/chars/gabe/gabe-idle-run.png");
128 let layout = TextureAtlasLayout::from_grid(UVec2::new(24, 24), 7, 1, None, None);
129 let texture_atlas_layout_handle = texture_atlas_layouts.add(layout);
130 // Use only the subset of sprites in the sheet that make up the run animation
131 let animation_indices = AnimationIndices { first: 1, last: 6 };
132 commands
133 .spawn((
134 Sprite::from_atlas_image(
135 texture_handle,
136 TextureAtlas {
137 layout: texture_atlas_layout_handle,
138 index: animation_indices.first,
139 },
140 ),
141 Transform::from_xyz(300.0, 0.0, 0.0).with_scale(Vec3::splat(6.0)),
142 animation_indices,
143 AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
144 Pickable::default(),
145 ))
146 .observe(recolor_on::<PointerOver>(Color::srgb(0.0, 1.0, 1.0)))
147 .observe(recolor_on::<PointerOut>(Color::srgb(1.0, 1.0, 1.0)))
148 .observe(recolor_on::<PointerPress>(Color::srgb(1.0, 1.0, 0.0)))
149 .observe(recolor_on::<PointerRelease>(Color::srgb(0.0, 1.0, 1.0)));
150}- examples/shader/automatic_instancing.rs
- examples/stress_tests/many_cameras_lights.rs
- examples/ui/images/ui_texture_atlas_slice.rs
- examples/gizmos/2d_gizmos.rs
- examples/2d/2d_viewport_to_world.rs
- examples/testbed/3d.rs
- examples/3d/split_screen.rs
- examples/gizmos/3d_gizmos.rs
- examples/2d/texture_atlas.rs
- examples/3d/camera_sub_view.rs
Sourcepub const fn splat(v: u32) -> UVec2
pub const fn splat(v: u32) -> UVec2
Creates a vector with all elements set to v.
Examples found in repository?
More examples
395 fn next(&mut self) -> Option<Self::Item> {
396 // The size of mipmap level N + 1 is equal to half the size of mipmap
397 // level N, rounding down, except that the size can never go below 1
398 // pixel on either axis.
399 let result = self.size;
400 if let Some(size) = self.size {
401 self.size = if size == UVec2::splat(1) {
402 None
403 } else {
404 Some((size / 2).max(UVec2::splat(1)))
405 };
406 }
407 result
408 }25fn setup(mut commands: Commands, mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>) {
26 let layout = TextureAtlasLayout::from_grid(UVec2::splat(64), 7, 7, None, None);
27 let texture_atlas_layout = texture_atlas_layouts.add(layout);
28
29 commands.spawn(Camera2d);
30
31 // The food items
32 commands.spawn_scene(bsn! {
33 Node {
34 width: percent(100),
35 height: percent(100),
36 align_items: AlignItems::Center,
37 justify_content: JustifyContent::Center,
38 column_gap: px(15),
39 }
40 Children [
41 { food_items_scene_list(texture_atlas_layout) }
42 ]
43 });
44
45 // Status text
46 commands.spawn_scene(bsn! {
47 Node {
48 position_type: PositionType::Absolute,
49 top: px(12),
50 left: px(12),
51 }
52 Children [
53 Text("*Click some food to eat it*")
54 ]
55 });
56}42fn setup(
43 mut commands: Commands,
44 asset_server: Res<AssetServer>,
45 mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
46) {
47 let texture = asset_server.load("textures/rpg/chars/gabe/gabe-idle-run.png");
48 let layout = TextureAtlasLayout::from_grid(UVec2::splat(24), 7, 1, None, None);
49 let texture_atlas_layout = texture_atlas_layouts.add(layout);
50 // Use only the subset of sprites in the sheet that make up the run animation
51 let animation_indices = AnimationIndices { first: 1, last: 6 };
52
53 commands.spawn(Camera2d);
54
55 commands.spawn((
56 Sprite::from_atlas_image(
57 texture,
58 TextureAtlas {
59 layout: texture_atlas_layout,
60 index: animation_indices.first,
61 },
62 ),
63 Transform::from_scale(Vec3::splat(6.0)),
64 animation_indices,
65 AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
66 ));
67}242fn spawn_depth_only_camera(commands: &mut Commands) {
243 commands.spawn((
244 Camera3d::default(),
245 Transform::from_xyz(-4.0, -5.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
246 Camera {
247 // Make sure that we render from this depth-only camera *before*
248 // rendering from the main camera.
249 order: -1,
250 ..Camera::default()
251 },
252 // We specify no color render target, for maximum efficiency.
253 RenderTarget::None {
254 // When specifying no render target, we must manually specify
255 // the viewport size. Otherwise, Bevy won't know how big to make
256 // the depth buffer.
257 size: UVec2::splat(DEPTH_TEXTURE_SIZE),
258 },
259 // We need to disable multisampling or the depth texture will be
260 // multisampled, which adds complexity we don't care about for this
261 // demo.
262 Msaa::Off,
263 // Cameras with no render target render *nothing* by default. To get
264 // them to render something, we must add a prepass that specifies what
265 // we want to render: in this case, depth.
266 DepthPrepass,
267 ));
268}31fn setup_cursor_icon(
32 mut commands: Commands,
33 asset_server: Res<AssetServer>,
34 mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
35 window: Single<Entity, With<Window>>,
36) {
37 let layout =
38 TextureAtlasLayout::from_grid(UVec2::splat(64), 20, 10, Some(UVec2::splat(5)), None);
39 let texture_atlas_layout = texture_atlas_layouts.add(layout);
40
41 let animation_config = AnimationConfig::new(0, 199, 1, 4);
42
43 commands.entity(*window).insert((
44 CursorIcon::Custom(CustomCursor::Image(CustomCursorImage {
45 // Image to use as the cursor.
46 handle: asset_server
47 .load("cursors/kenney_crosshairPack/Tilesheet/crosshairs_tilesheet_white.png"),
48 // Optional texture atlas allows you to pick a section of the image
49 // and animate it.
50 texture_atlas: Some(TextureAtlas {
51 layout: texture_atlas_layout.clone(),
52 index: animation_config.first_sprite_index,
53 }),
54 flip_x: false,
55 flip_y: false,
56 // Optional section of the image to use as the cursor.
57 rect: None,
58 // The hotspot is the point in the cursor image that will be
59 // positioned at the mouse cursor's position.
60 hotspot: (0, 0),
61 })),
62 animation_config,
63 ));
64}
65
66fn setup_camera(mut commands: Commands) {
67 commands.spawn(Camera3d::default());
68}
69
70fn setup_instructions(mut commands: Commands) {
71 commands.spawn((
72 Text::new(
73 "Press T to toggle the cursor's `texture_atlas`.\n
74Press X to toggle the cursor's `flip_x` setting.\n
75Press Y to toggle the cursor's `flip_y` setting.\n
76Press C to cycle through the sections of the cursor's image using `rect`.",
77 ),
78 Node {
79 position_type: PositionType::Absolute,
80 bottom: px(12),
81 left: px(12),
82 ..default()
83 },
84 ));
85}
86
87#[derive(Component)]
88struct AnimationConfig {
89 first_sprite_index: usize,
90 last_sprite_index: usize,
91 increment: usize,
92 fps: u8,
93 frame_timer: Timer,
94}
95
96impl AnimationConfig {
97 fn new(first: usize, last: usize, increment: usize, fps: u8) -> Self {
98 Self {
99 first_sprite_index: first,
100 last_sprite_index: last,
101 increment,
102 fps,
103 frame_timer: Self::timer_from_fps(fps),
104 }
105 }
106
107 fn timer_from_fps(fps: u8) -> Timer {
108 Timer::new(Duration::from_secs_f32(1.0 / (fps as f32)), TimerMode::Once)
109 }
110}
111
112/// This system loops through all the sprites in the [`CursorIcon`]'s
113/// [`TextureAtlas`], from [`AnimationConfig`]'s `first_sprite_index` to
114/// `last_sprite_index`.
115fn execute_animation(time: Res<Time>, mut query: Query<(&mut AnimationConfig, &mut CursorIcon)>) {
116 for (mut config, mut cursor_icon) in &mut query {
117 if let CursorIcon::Custom(CustomCursor::Image(ref mut image)) = *cursor_icon {
118 config.frame_timer.tick(time.delta());
119
120 if config.frame_timer.is_finished()
121 && let Some(atlas) = image.texture_atlas.as_mut()
122 {
123 atlas.index += config.increment;
124
125 if atlas.index > config.last_sprite_index {
126 atlas.index = config.first_sprite_index;
127 }
128
129 config.frame_timer = AnimationConfig::timer_from_fps(config.fps);
130 }
131 }
132 }
133}
134
135fn toggle_texture_atlas(
136 input: Res<ButtonInput<KeyCode>>,
137 mut query: Query<&mut CursorIcon, With<Window>>,
138 mut cached_atlas: Local<Option<TextureAtlas>>, // this lets us restore the previous value
139) {
140 if input.just_pressed(KeyCode::KeyT) {
141 for mut cursor_icon in &mut query {
142 if let CursorIcon::Custom(CustomCursor::Image(ref mut image)) = *cursor_icon {
143 match image.texture_atlas.take() {
144 Some(a) => {
145 // Save the current texture atlas.
146 *cached_atlas = Some(a.clone());
147 }
148 None => {
149 // Restore the cached texture atlas.
150 if let Some(cached_a) = cached_atlas.take() {
151 image.texture_atlas = Some(cached_a);
152 }
153 }
154 }
155 }
156 }
157 }
158}
159
160fn toggle_flip_x(
161 input: Res<ButtonInput<KeyCode>>,
162 mut query: Query<&mut CursorIcon, With<Window>>,
163) {
164 if input.just_pressed(KeyCode::KeyX) {
165 for mut cursor_icon in &mut query {
166 if let CursorIcon::Custom(CustomCursor::Image(ref mut image)) = *cursor_icon {
167 image.flip_x = !image.flip_x;
168 }
169 }
170 }
171}
172
173fn toggle_flip_y(
174 input: Res<ButtonInput<KeyCode>>,
175 mut query: Query<&mut CursorIcon, With<Window>>,
176) {
177 if input.just_pressed(KeyCode::KeyY) {
178 for mut cursor_icon in &mut query {
179 if let CursorIcon::Custom(CustomCursor::Image(ref mut image)) = *cursor_icon {
180 image.flip_y = !image.flip_y;
181 }
182 }
183 }
184}
185
186/// This system alternates the [`CursorIcon`]'s `rect` field between `None` and
187/// 4 sections/rectangles of the cursor's image.
188fn cycle_rect(input: Res<ButtonInput<KeyCode>>, mut query: Query<&mut CursorIcon, With<Window>>) {
189 if !input.just_pressed(KeyCode::KeyC) {
190 return;
191 }
192
193 const RECT_SIZE: u32 = 32; // half the size of a tile in the texture atlas
194
195 const SECTIONS: [Option<URect>; 5] = [
196 Some(URect {
197 min: UVec2::ZERO,
198 max: UVec2::splat(RECT_SIZE),
199 }),
200 Some(URect {
201 min: UVec2::new(RECT_SIZE, 0),
202 max: UVec2::new(2 * RECT_SIZE, RECT_SIZE),
203 }),
204 Some(URect {
205 min: UVec2::new(0, RECT_SIZE),
206 max: UVec2::new(RECT_SIZE, 2 * RECT_SIZE),
207 }),
208 Some(URect {
209 min: UVec2::new(RECT_SIZE, RECT_SIZE),
210 max: UVec2::splat(2 * RECT_SIZE),
211 }),
212 None, // reset to None
213 ];Sourcepub fn map<F>(self, f: F) -> UVec2
pub fn map<F>(self, f: F) -> UVec2
Returns a vector containing each element of self modified by a mapping function f.
Sourcepub fn select(mask: BVec2, if_true: UVec2, if_false: UVec2) -> UVec2
pub fn select(mask: BVec2, if_true: UVec2, if_false: UVec2) -> UVec2
Creates a vector from the elements in if_true and if_false, selecting which to use
for each element of self.
A true element in the mask uses the corresponding element from if_true, and false
uses the element from if_false.
Sourcepub const fn from_array(a: [u32; 2]) -> UVec2
pub const fn from_array(a: [u32; 2]) -> UVec2
Creates a new vector from an array.
Sourcepub const fn from_slice(slice: &[u32]) -> UVec2
pub const fn from_slice(slice: &[u32]) -> UVec2
Creates a vector from the first 2 values in slice.
§Panics
Panics if slice is less than 2 elements long.
Sourcepub fn write_to_slice(self, slice: &mut [u32])
pub fn write_to_slice(self, slice: &mut [u32])
Writes the elements of self to the first 2 elements in slice.
§Panics
Panics if slice is less than 2 elements long.
Sourcepub const fn extend(self, z: u32) -> UVec3
pub const fn extend(self, z: u32) -> UVec3
Creates a 3D vector from self and the given z value.
Sourcepub fn dot_into_vec(self, rhs: UVec2) -> UVec2
pub fn dot_into_vec(self, rhs: UVec2) -> UVec2
Returns a vector where every component is the dot product of self and rhs.
Sourcepub fn min(self, rhs: UVec2) -> UVec2
pub fn min(self, rhs: UVec2) -> UVec2
Returns a vector containing the minimum values for each element of self and rhs.
In other words this computes [min(x, rhs.x), min(self.y, rhs.y), ..].
Examples found in repository?
42fn controls(
43 camera_query: Single<(&mut Camera, &mut Transform, &mut Projection)>,
44 window: Single<&Window>,
45 input: Res<ButtonInput<KeyCode>>,
46 time: Res<Time<Fixed>>,
47) {
48 let (mut camera, mut transform, mut projection) = camera_query.into_inner();
49
50 let fspeed = 600.0 * time.delta_secs();
51 let uspeed = fspeed as u32;
52 let window_size = window.resolution.physical_size();
53
54 // Camera movement controls
55 if input.pressed(KeyCode::ArrowUp) {
56 transform.translation.y += fspeed;
57 }
58 if input.pressed(KeyCode::ArrowDown) {
59 transform.translation.y -= fspeed;
60 }
61 if input.pressed(KeyCode::ArrowLeft) {
62 transform.translation.x -= fspeed;
63 }
64 if input.pressed(KeyCode::ArrowRight) {
65 transform.translation.x += fspeed;
66 }
67
68 // Camera zoom controls
69 if let Projection::Orthographic(projection2d) = &mut *projection {
70 if input.pressed(KeyCode::Comma) {
71 projection2d.scale *= powf(4.0f32, time.delta_secs());
72 }
73
74 if input.pressed(KeyCode::Period) {
75 projection2d.scale *= powf(0.25f32, time.delta_secs());
76 }
77 }
78
79 if let Some(viewport) = camera.viewport.as_mut() {
80 // Reset viewport size on window resize
81 if viewport.physical_size.x > window_size.x || viewport.physical_size.y > window_size.y {
82 viewport.physical_size = (window_size.as_vec2() * 0.75).as_uvec2();
83 }
84
85 // Viewport movement controls
86 if input.pressed(KeyCode::KeyW) {
87 viewport.physical_position.y = viewport.physical_position.y.saturating_sub(uspeed);
88 }
89 if input.pressed(KeyCode::KeyS) {
90 viewport.physical_position.y += uspeed;
91 }
92 if input.pressed(KeyCode::KeyA) {
93 viewport.physical_position.x = viewport.physical_position.x.saturating_sub(uspeed);
94 }
95 if input.pressed(KeyCode::KeyD) {
96 viewport.physical_position.x += uspeed;
97 }
98
99 // Bound viewport position so it doesn't go off-screen
100 viewport.physical_position = viewport
101 .physical_position
102 .min(window_size - viewport.physical_size);
103
104 // Viewport size controls
105 if input.pressed(KeyCode::KeyI) {
106 viewport.physical_size.y = viewport.physical_size.y.saturating_sub(uspeed);
107 }
108 if input.pressed(KeyCode::KeyK) {
109 viewport.physical_size.y += uspeed;
110 }
111 if input.pressed(KeyCode::KeyJ) {
112 viewport.physical_size.x = viewport.physical_size.x.saturating_sub(uspeed);
113 }
114 if input.pressed(KeyCode::KeyL) {
115 viewport.physical_size.x += uspeed;
116 }
117
118 // Bound viewport size so it doesn't go off-screen
119 viewport.physical_size = viewport
120 .physical_size
121 .min(window_size - viewport.physical_position)
122 .max(UVec2::new(20, 20));
123 }
124}Sourcepub fn max(self, rhs: UVec2) -> UVec2
pub fn max(self, rhs: UVec2) -> UVec2
Returns a vector containing the maximum values for each element of self and rhs.
In other words this computes [max(self.x, rhs.x), max(self.y, rhs.y), ..].
Examples found in repository?
395 fn next(&mut self) -> Option<Self::Item> {
396 // The size of mipmap level N + 1 is equal to half the size of mipmap
397 // level N, rounding down, except that the size can never go below 1
398 // pixel on either axis.
399 let result = self.size;
400 if let Some(size) = self.size {
401 self.size = if size == UVec2::splat(1) {
402 None
403 } else {
404 Some((size / 2).max(UVec2::splat(1)))
405 };
406 }
407 result
408 }More examples
42fn controls(
43 camera_query: Single<(&mut Camera, &mut Transform, &mut Projection)>,
44 window: Single<&Window>,
45 input: Res<ButtonInput<KeyCode>>,
46 time: Res<Time<Fixed>>,
47) {
48 let (mut camera, mut transform, mut projection) = camera_query.into_inner();
49
50 let fspeed = 600.0 * time.delta_secs();
51 let uspeed = fspeed as u32;
52 let window_size = window.resolution.physical_size();
53
54 // Camera movement controls
55 if input.pressed(KeyCode::ArrowUp) {
56 transform.translation.y += fspeed;
57 }
58 if input.pressed(KeyCode::ArrowDown) {
59 transform.translation.y -= fspeed;
60 }
61 if input.pressed(KeyCode::ArrowLeft) {
62 transform.translation.x -= fspeed;
63 }
64 if input.pressed(KeyCode::ArrowRight) {
65 transform.translation.x += fspeed;
66 }
67
68 // Camera zoom controls
69 if let Projection::Orthographic(projection2d) = &mut *projection {
70 if input.pressed(KeyCode::Comma) {
71 projection2d.scale *= powf(4.0f32, time.delta_secs());
72 }
73
74 if input.pressed(KeyCode::Period) {
75 projection2d.scale *= powf(0.25f32, time.delta_secs());
76 }
77 }
78
79 if let Some(viewport) = camera.viewport.as_mut() {
80 // Reset viewport size on window resize
81 if viewport.physical_size.x > window_size.x || viewport.physical_size.y > window_size.y {
82 viewport.physical_size = (window_size.as_vec2() * 0.75).as_uvec2();
83 }
84
85 // Viewport movement controls
86 if input.pressed(KeyCode::KeyW) {
87 viewport.physical_position.y = viewport.physical_position.y.saturating_sub(uspeed);
88 }
89 if input.pressed(KeyCode::KeyS) {
90 viewport.physical_position.y += uspeed;
91 }
92 if input.pressed(KeyCode::KeyA) {
93 viewport.physical_position.x = viewport.physical_position.x.saturating_sub(uspeed);
94 }
95 if input.pressed(KeyCode::KeyD) {
96 viewport.physical_position.x += uspeed;
97 }
98
99 // Bound viewport position so it doesn't go off-screen
100 viewport.physical_position = viewport
101 .physical_position
102 .min(window_size - viewport.physical_size);
103
104 // Viewport size controls
105 if input.pressed(KeyCode::KeyI) {
106 viewport.physical_size.y = viewport.physical_size.y.saturating_sub(uspeed);
107 }
108 if input.pressed(KeyCode::KeyK) {
109 viewport.physical_size.y += uspeed;
110 }
111 if input.pressed(KeyCode::KeyJ) {
112 viewport.physical_size.x = viewport.physical_size.x.saturating_sub(uspeed);
113 }
114 if input.pressed(KeyCode::KeyL) {
115 viewport.physical_size.x += uspeed;
116 }
117
118 // Bound viewport size so it doesn't go off-screen
119 viewport.physical_size = viewport
120 .physical_size
121 .min(window_size - viewport.physical_position)
122 .max(UVec2::new(20, 20));
123 }
124}Sourcepub fn clamp(self, min: UVec2, max: UVec2) -> UVec2
pub fn clamp(self, min: UVec2, max: UVec2) -> UVec2
Component-wise clamping of values, similar to u32::clamp.
Each element in min must be less-or-equal to the corresponding element in max.
§Panics
Will panic if min is greater than max when glam_assert is enabled.
Sourcepub fn min_element(self) -> u32
pub fn min_element(self) -> u32
Returns the horizontal minimum of self.
In other words this computes min(x, y, ..).
Sourcepub fn max_element(self) -> u32
pub fn max_element(self) -> u32
Returns the horizontal maximum of self.
In other words this computes max(x, y, ..).
Sourcepub fn min_position(self) -> usize
pub fn min_position(self) -> usize
Returns the index of the first minimum element of self.
Sourcepub fn max_position(self) -> usize
pub fn max_position(self) -> usize
Returns the index of the first maximum element of self.
Sourcepub fn element_sum(self) -> u32
pub fn element_sum(self) -> u32
Returns the sum of all elements of self.
In other words, this computes self.x + self.y + ...
Sourcepub fn element_product(self) -> u32
pub fn element_product(self) -> u32
Returns the product of all elements of self.
In other words, this computes self.x * self.y * ...
Examples found in repository?
26fn setup(mut commands: Commands, assets: Res<AssetServer>) {
27 // We're seeding the PRNG here to make this example deterministic for testing purposes.
28 // This isn't strictly required in practical use unless you need your app to be deterministic.
29 let mut rng = ChaCha8Rng::seed_from_u64(42);
30
31 let chunk_size = UVec2::splat(64);
32 let tile_display_size = UVec2::splat(8);
33 let tile_data: Vec<Option<TileData>> = (0..chunk_size.element_product())
34 .map(|_| rng.random_range(0..5))
35 .map(|i| {
36 if i == 0 {
37 None
38 } else {
39 Some(TileData::from_tileset_index(i - 1))
40 }
41 })
42 .collect();
43
44 commands.spawn((
45 TilemapChunk {
46 chunk_size,
47 tile_display_size,
48 tileset: assets
49 .load_builder()
50 .with_settings(|settings: &mut ImageLoaderSettings| {
51 // The tileset texture is expected to be an array of tile textures, so we tell the
52 // `ImageLoader` that our texture is composed of 4 stacked tile images.
53 settings.array_layout = Some(ImageArrayLayout::RowCount { rows: 4 });
54 })
55 .load("textures/array_texture.png"),
56 ..default()
57 },
58 TilemapChunkTileData(tile_data),
59 UpdateTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
60 ));
61
62 commands.spawn(Camera2d);
63
64 commands.insert_resource(SeededRng(rng));
65}More examples
17fn setup(mut commands: Commands, assets: Res<AssetServer>) {
18 let chunk_size = UVec2::splat(8);
19 let tile_display_size = UVec2::splat(64);
20
21 // We'll use each possible orientation, one per column
22 let orientation = [
23 TileOrientation::Default,
24 TileOrientation::Rotate90,
25 TileOrientation::Rotate180,
26 TileOrientation::Rotate270,
27 TileOrientation::MirrorH,
28 TileOrientation::MirrorHRotate90,
29 TileOrientation::MirrorHRotate180,
30 TileOrientation::MirrorHRotate270,
31 ];
32
33 // Show different color/alpha on each row
34 let colors = [
35 Color::WHITE,
36 Color::linear_rgb(1.0, 0.0, 0.0),
37 Color::linear_rgb(0.0, 1.0, 0.0),
38 Color::linear_rgb(0.0, 0.0, 1.0),
39 Color::linear_rgba(1.0, 0.0, 0.0, 0.25),
40 Color::linear_rgba(0.0, 1.0, 0.0, 0.25),
41 Color::linear_rgba(0.0, 0.0, 1.0, 0.25),
42 Color::linear_rgba(1.0, 1.0, 1.0, 0.5),
43 ];
44
45 let tile_data = (0..chunk_size.element_product())
46 .map(|i| {
47 let row = i / 8;
48 let col = i % 8;
49 Some(TileData {
50 // Alternate tiles per row
51 tileset_index: (row % 2) as u16,
52 color: colors[row as usize],
53 // Last (top) row is invisible
54 visible: row != 7,
55 orientation: orientation[col as usize],
56 })
57 })
58 .collect();
59
60 commands.spawn((
61 TilemapChunk {
62 chunk_size,
63 tile_display_size,
64 tileset: assets
65 .load_builder()
66 .with_settings(|settings: &mut ImageLoaderSettings| {
67 // The tileset texture is expected to be an array of tile textures, so we tell the
68 // `ImageLoader` that our texture is composed of 2 stacked tile images.
69 settings.array_layout = Some(ImageArrayLayout::RowCount { rows: 2 });
70 })
71 .load("textures/arrow.png"),
72 alpha_mode: AlphaMode2d::Blend,
73 },
74 TilemapChunkTileData(tile_data),
75 ));
76
77 commands.spawn(Camera2d);
78}Sourcepub fn cmpeq(self, rhs: UVec2) -> BVec2
pub fn cmpeq(self, rhs: UVec2) -> BVec2
Returns a vector mask containing the result of a == comparison for each element of
self and rhs.
In other words, this computes [self.x == rhs.x, self.y == rhs.y, ..] for all
elements.
Sourcepub fn cmpne(self, rhs: UVec2) -> BVec2
pub fn cmpne(self, rhs: UVec2) -> BVec2
Returns a vector mask containing the result of a != comparison for each element of
self and rhs.
In other words this computes [self.x != rhs.x, self.y != rhs.y, ..] for all
elements.
Sourcepub fn cmpge(self, rhs: UVec2) -> BVec2
pub fn cmpge(self, rhs: UVec2) -> BVec2
Returns a vector mask containing the result of a >= comparison for each element of
self and rhs.
In other words this computes [self.x >= rhs.x, self.y >= rhs.y, ..] for all
elements.
Sourcepub fn cmpgt(self, rhs: UVec2) -> BVec2
pub fn cmpgt(self, rhs: UVec2) -> BVec2
Returns a vector mask containing the result of a > comparison for each element of
self and rhs.
In other words this computes [self.x > rhs.x, self.y > rhs.y, ..] for all
elements.
Sourcepub fn cmple(self, rhs: UVec2) -> BVec2
pub fn cmple(self, rhs: UVec2) -> BVec2
Returns a vector mask containing the result of a <= comparison for each element of
self and rhs.
In other words this computes [self.x <= rhs.x, self.y <= rhs.y, ..] for all
elements.
Sourcepub fn cmplt(self, rhs: UVec2) -> BVec2
pub fn cmplt(self, rhs: UVec2) -> BVec2
Returns a vector mask containing the result of a < comparison for each element of
self and rhs.
In other words this computes [self.x < rhs.x, self.y < rhs.y, ..] for all
elements.
Sourcepub fn length_squared(self) -> u32
pub fn length_squared(self) -> u32
Computes the squared length of self.
Sourcepub fn manhattan_distance(self, rhs: UVec2) -> u32
pub fn manhattan_distance(self, rhs: UVec2) -> u32
Computes the manhattan distance between two points.
§Overflow
This method may overflow if the result is greater than u32::MAX.
See also checked_manhattan_distance.
Sourcepub fn checked_manhattan_distance(self, rhs: UVec2) -> Option<u32>
pub fn checked_manhattan_distance(self, rhs: UVec2) -> Option<u32>
Computes the manhattan distance between two points.
This will returns None if the result is greater than u32::MAX.
Sourcepub fn chebyshev_distance(self, rhs: UVec2) -> u32
pub fn chebyshev_distance(self, rhs: UVec2) -> u32
Computes the chebyshev distance between two points.
Sourcepub fn as_vec2(self) -> Vec2
pub fn as_vec2(self) -> Vec2
Casts all elements of self to f32.
Examples found in repository?
54fn setup(mut commands: Commands, mut images: ResMut<Assets<Image>>) {
55 let mut image = Image::new_target_texture(SIZE.x, SIZE.y, TextureFormat::Rgba32Float, None);
56 image.asset_usage = RenderAssetUsages::RENDER_WORLD;
57 image.texture_descriptor.usage =
58 TextureUsages::COPY_DST | TextureUsages::STORAGE_BINDING | TextureUsages::TEXTURE_BINDING;
59 let image0 = images.add(image.clone());
60 let image1 = images.add(image);
61
62 commands.spawn((
63 Sprite {
64 image: image0.clone(),
65 custom_size: Some(SIZE.as_vec2()),
66 ..default()
67 },
68 Transform::from_scale(Vec3::splat(DISPLAY_FACTOR as f32)),
69 ));
70 commands.spawn(Camera2d);
71
72 commands.insert_resource(GameOfLifeImages {
73 texture_a: image0,
74 texture_b: image1,
75 });
76
77 commands.insert_resource(GameOfLifeUniforms {
78 alive_color: LinearRgba::RED,
79 });
80}More examples
603fn spawn_mip_level_views(
604 commands: &mut Commands,
605 app_status: &AppStatus,
606 app_assets: &AppAssets,
607 windows_query: &Query<&Window, With<PrimaryWindow>>,
608 single_mip_level_materials: &mut Assets<SingleMipLevelMaterial>,
609 image_handle: &Handle<Image>,
610) {
611 let window_size = windows_query.iter().next().unwrap().size();
612
613 // Calculate the placement of the column of mipmap levels.
614 let max_slice_size = app_status.max_mip_slice_size(window_size);
615 let y_origin = app_status.vertical_mip_slice_origin(window_size);
616 let y_spacing = app_status.vertical_mip_slice_spacing(window_size);
617 let x_origin = app_status.horizontal_mip_slice_origin(window_size);
618
619 for (mip_level, mip_size) in MipmapSizeIterator::new(app_status).enumerate() {
620 let y_center = y_origin - y_spacing * mip_level as f32;
621
622 // Size each image to fit its container, preserving aspect ratio.
623 let mut slice_size = mip_size.as_vec2();
624 let ratios = max_slice_size / slice_size;
625 let slice_scale = ratios.x.min(ratios.y).min(1.0);
626 slice_size *= slice_scale;
627
628 // Spawn the image. Use the `SingleMipLevelMaterial` with its custom
629 // shader so that only the mip level in question is displayed.
630 commands.spawn((
631 Mesh2d(app_assets.rectangle.clone()),
632 MeshMaterial2d(single_mip_level_materials.add(SingleMipLevelMaterial {
633 mip_level: mip_level as u32,
634 texture: image_handle.clone(),
635 })),
636 Transform::from_xyz(x_origin, y_center, 0.0).with_scale(slice_size.extend(1.0)),
637 ImageView,
638 ));
639
640 // Display a label to the side.
641 commands.spawn((
642 Text2d::new(format!(
643 "Level {}\n{}×{}",
644 mip_level, mip_size.x, mip_size.y
645 )),
646 app_assets.text_font.clone(),
647 TextLayout::justify(Justify::Center),
648 Text2dShadow::default(),
649 Transform::from_xyz(x_origin - max_slice_size.x * 0.5 - 64.0, y_center, 0.0),
650 ImageView,
651 ));
652 }
653}158fn drive_diegetic_pointer(
159 mut cursor_last: Local<Vec2>,
160 mut raycast: MeshRayCast,
161 rays: Res<RayMap>,
162 cubes: Query<&Mesh3d, With<Cube>>,
163 ui_camera: Query<&RenderTarget, With<Camera2d>>,
164 primary_window: Query<Entity, With<PrimaryWindow>>,
165 windows: Query<(Entity, &Window)>,
166 images: Res<Assets<Image>>,
167 manual_texture_views: Res<ManualTextureViews>,
168 mut window_events: MessageReader<WindowEvent>,
169 mut pointer_inputs: MessageWriter<PointerInput>,
170) -> Result {
171 // Get the size of the texture, so we can convert from dimensionless UV coordinates that span
172 // from 0 to 1, to pixel coordinates.
173 let target = ui_camera
174 .single()?
175 .normalize(primary_window.single().ok())
176 .unwrap();
177 let target_info = target
178 .get_render_target_info(windows, &images, &manual_texture_views)
179 .unwrap();
180 let size = target_info.physical_size.as_vec2();
181
182 // Find raycast hits and update the virtual pointer.
183 let raycast_settings = MeshRayCastSettings {
184 visibility: RayCastVisibility::VisibleInView,
185 filter: &|entity| cubes.contains(entity),
186 early_exit_test: &|_| false,
187 };
188 for (_id, ray) in rays.iter() {
189 for (_cube, hit) in raycast.cast_ray(*ray, &raycast_settings) {
190 let position = size * hit.uv.unwrap();
191 if position != *cursor_last {
192 pointer_inputs.write(PointerInput::new(
193 CUBE_POINTER_ID,
194 Location {
195 target: target.clone(),
196 position,
197 },
198 PointerAction::Move {
199 delta: position - *cursor_last,
200 },
201 ));
202 *cursor_last = position;
203 }
204 }
205 }
206
207 // Pipe pointer button presses to the virtual pointer on the UI texture.
208 for window_event in window_events.read() {
209 if let WindowEvent::MouseButtonInput(input) = window_event {
210 let button = match input.button {
211 MouseButton::Left => PointerButton::Primary,
212 MouseButton::Right => PointerButton::Secondary,
213 MouseButton::Middle => PointerButton::Middle,
214 _ => continue,
215 };
216 let action = match input.state {
217 ButtonState::Pressed => PointerAction::Press(button),
218 ButtonState::Released => PointerAction::Release(button),
219 };
220 pointer_inputs.write(PointerInput::new(
221 CUBE_POINTER_ID,
222 Location {
223 target: target.clone(),
224 position: *cursor_last,
225 },
226 action,
227 ));
228 }
229 }
230
231 Ok(())
232}42fn controls(
43 camera_query: Single<(&mut Camera, &mut Transform, &mut Projection)>,
44 window: Single<&Window>,
45 input: Res<ButtonInput<KeyCode>>,
46 time: Res<Time<Fixed>>,
47) {
48 let (mut camera, mut transform, mut projection) = camera_query.into_inner();
49
50 let fspeed = 600.0 * time.delta_secs();
51 let uspeed = fspeed as u32;
52 let window_size = window.resolution.physical_size();
53
54 // Camera movement controls
55 if input.pressed(KeyCode::ArrowUp) {
56 transform.translation.y += fspeed;
57 }
58 if input.pressed(KeyCode::ArrowDown) {
59 transform.translation.y -= fspeed;
60 }
61 if input.pressed(KeyCode::ArrowLeft) {
62 transform.translation.x -= fspeed;
63 }
64 if input.pressed(KeyCode::ArrowRight) {
65 transform.translation.x += fspeed;
66 }
67
68 // Camera zoom controls
69 if let Projection::Orthographic(projection2d) = &mut *projection {
70 if input.pressed(KeyCode::Comma) {
71 projection2d.scale *= powf(4.0f32, time.delta_secs());
72 }
73
74 if input.pressed(KeyCode::Period) {
75 projection2d.scale *= powf(0.25f32, time.delta_secs());
76 }
77 }
78
79 if let Some(viewport) = camera.viewport.as_mut() {
80 // Reset viewport size on window resize
81 if viewport.physical_size.x > window_size.x || viewport.physical_size.y > window_size.y {
82 viewport.physical_size = (window_size.as_vec2() * 0.75).as_uvec2();
83 }
84
85 // Viewport movement controls
86 if input.pressed(KeyCode::KeyW) {
87 viewport.physical_position.y = viewport.physical_position.y.saturating_sub(uspeed);
88 }
89 if input.pressed(KeyCode::KeyS) {
90 viewport.physical_position.y += uspeed;
91 }
92 if input.pressed(KeyCode::KeyA) {
93 viewport.physical_position.x = viewport.physical_position.x.saturating_sub(uspeed);
94 }
95 if input.pressed(KeyCode::KeyD) {
96 viewport.physical_position.x += uspeed;
97 }
98
99 // Bound viewport position so it doesn't go off-screen
100 viewport.physical_position = viewport
101 .physical_position
102 .min(window_size - viewport.physical_size);
103
104 // Viewport size controls
105 if input.pressed(KeyCode::KeyI) {
106 viewport.physical_size.y = viewport.physical_size.y.saturating_sub(uspeed);
107 }
108 if input.pressed(KeyCode::KeyK) {
109 viewport.physical_size.y += uspeed;
110 }
111 if input.pressed(KeyCode::KeyJ) {
112 viewport.physical_size.x = viewport.physical_size.x.saturating_sub(uspeed);
113 }
114 if input.pressed(KeyCode::KeyL) {
115 viewport.physical_size.x += uspeed;
116 }
117
118 // Bound viewport size so it doesn't go off-screen
119 viewport.physical_size = viewport
120 .physical_size
121 .min(window_size - viewport.physical_position)
122 .max(UVec2::new(20, 20));
123 }
124}
125
126fn setup(
127 mut commands: Commands,
128 mut meshes: ResMut<Assets<Mesh>>,
129 mut materials: ResMut<Assets<ColorMaterial>>,
130 window: Single<&Window>,
131) {
132 let window_size = window.resolution.physical_size().as_vec2();
133
134 // Initialize centered, non-window-filling viewport
135 commands.spawn((
136 Camera2d,
137 Camera {
138 viewport: Some(Viewport {
139 physical_position: (window_size * 0.125).as_uvec2(),
140 physical_size: (window_size * 0.75).as_uvec2(),
141 ..default()
142 }),
143 ..default()
144 },
145 ));
146
147 // Create a minimal UI explaining how to interact with the example
148 commands.spawn((
149 Text::new(
150 "Move the mouse to see the circle follow your cursor.\n\
151 Use the arrow keys to move the camera.\n\
152 Use the comma and period keys to zoom in and out.\n\
153 Use the WASD keys to move the viewport.\n\
154 Use the IJKL keys to resize the viewport.",
155 ),
156 Node {
157 position_type: PositionType::Absolute,
158 top: px(12),
159 left: px(12),
160 ..default()
161 },
162 ));
163
164 // Add mesh to make camera movement visible
165 commands.spawn((
166 Mesh2d(meshes.add(Rectangle::new(40.0, 20.0))),
167 MeshMaterial2d(materials.add(Color::from(GREEN))),
168 ));
169
170 // Add background to visualize viewport bounds
171 commands.spawn((
172 Mesh2d(meshes.add(Rectangle::new(50000.0, 50000.0))),
173 MeshMaterial2d(materials.add(Color::linear_rgb(0.01, 0.01, 0.01))),
174 Transform::from_translation(Vec3::new(0.0, 0.0, -200.0)),
175 ));
176}460 pub fn setup(
461 mut commands: Commands,
462 mut textures: ResMut<Assets<Image>>,
463 mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
464 ) {
465 commands.spawn((Camera2d, DespawnOnExit(super::Scene::TextureAtlasBuilder)));
466
467 for (i, padding) in [UVec2::ZERO, PADDING_SIZE].into_iter().enumerate() {
468 // generate solid red green and blue and yellow images
469 let images = [
470 [255, 0, 0, 255],
471 [0, 255, 0, 255],
472 [0, 0, 255, 255],
473 [255, 255, 0, 255],
474 ]
475 .map(|pixel| {
476 Image::new_fill(
477 Extent3d {
478 width: 28,
479 height: 28,
480 depth_or_array_layers: 1,
481 },
482 TextureDimension::D2,
483 &pixel,
484 TextureFormat::Rgba8UnormSrgb,
485 RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD,
486 )
487 });
488
489 let mut texture_atlas_builder = TextureAtlasBuilder::default();
490 texture_atlas_builder
491 .initial_size(ATLAS_SIZE)
492 .max_size(ATLAS_SIZE)
493 .padding(padding);
494 for image in &images {
495 texture_atlas_builder.add_texture(None, image);
496 }
497
498 let (atlas_layout, _, atlas_texture) = texture_atlas_builder.build().expect(
499 "The images are 28 pixels square, so they should fit with 4 pixels left over",
500 );
501 let atlas_layout = texture_atlases.add(atlas_layout);
502
503 let mut nearest_atlas_image = atlas_texture.clone();
504 nearest_atlas_image.sampler = ImageSampler::nearest();
505
506 let atlas_handle = textures.add(atlas_texture);
507 let nearest_atlas_handle = textures.add(nearest_atlas_image);
508
509 let position = ((2. * i as f32 - 1.) * (0.625 * ATLAS_SIZE.x as f32 * ATLAS_SCALE))
510 .round()
511 * Vec3::X;
512
513 commands.spawn((
514 Sprite {
515 image: nearest_atlas_handle,
516 custom_size: Some(ATLAS_SIZE.as_vec2() * ATLAS_SCALE),
517 ..default()
518 },
519 Anchor::BOTTOM_CENTER,
520 ShowAabbGizmo {
521 color: Some(Color::WHITE),
522 },
523 DespawnOnExit(super::Scene::TextureAtlasBuilder),
524 Transform::from_translation(position),
525 ));
526
527 for (index, anchor) in [
528 Anchor::BOTTOM_RIGHT,
529 Anchor::BOTTOM_LEFT,
530 Anchor::TOP_LEFT,
531 Anchor::TOP_RIGHT,
532 ]
533 .into_iter()
534 .enumerate()
535 {
536 commands.spawn((
537 Sprite {
538 image: atlas_handle.clone(),
539 texture_atlas: Some(TextureAtlas {
540 layout: atlas_layout.clone(),
541 index,
542 }),
543 custom_size: Some(IMAGE_SIZE.as_vec2() * IMAGE_SCALE),
544 ..default()
545 },
546 Transform::from_translation(
547 position
548 + -2.
549 * IMAGE_SCALE
550 * (Vec3::Y * IMAGE_SIZE.y as f32 + anchor.as_vec().extend(0.)),
551 ),
552 anchor,
553 DespawnOnExit(super::Scene::TextureAtlasBuilder),
554 ));
555 }
556 }
557 }Sourcepub fn as_dvec2(self) -> DVec2
Available on crate feature f64 only.
pub fn as_dvec2(self) -> DVec2
f64 only.Casts all elements of self to f64.
Sourcepub fn as_i8vec2(self) -> I8Vec2
Available on crate feature i8 only.
pub fn as_i8vec2(self) -> I8Vec2
i8 only.Casts all elements of self to i8.
Sourcepub fn as_u8vec2(self) -> U8Vec2
Available on crate feature u8 only.
pub fn as_u8vec2(self) -> U8Vec2
u8 only.Casts all elements of self to u8.
Sourcepub fn as_i16vec2(self) -> I16Vec2
Available on crate feature i16 only.
pub fn as_i16vec2(self) -> I16Vec2
i16 only.Casts all elements of self to i16.
Sourcepub fn as_u16vec2(self) -> U16Vec2
Available on crate feature u16 only.
pub fn as_u16vec2(self) -> U16Vec2
u16 only.Casts all elements of self to u16.
Sourcepub fn as_ivec2(self) -> IVec2
Available on crate feature i32 only.
pub fn as_ivec2(self) -> IVec2
i32 only.Casts all elements of self to i32.
Sourcepub fn as_i64vec2(self) -> I64Vec2
Available on crate feature i64 only.
pub fn as_i64vec2(self) -> I64Vec2
i64 only.Casts all elements of self to i64.
Sourcepub fn as_u64vec2(self) -> U64Vec2
Available on crate feature u64 only.
pub fn as_u64vec2(self) -> U64Vec2
u64 only.Casts all elements of self to u64.
Sourcepub const fn checked_add(self, rhs: UVec2) -> Option<UVec2>
pub const fn checked_add(self, rhs: UVec2) -> Option<UVec2>
Returns a vector containing the wrapping addition of self and rhs.
In other words this computes Some([self.x + rhs.x, self.y + rhs.y, ..]) but returns None on any overflow.
Sourcepub const fn checked_sub(self, rhs: UVec2) -> Option<UVec2>
pub const fn checked_sub(self, rhs: UVec2) -> Option<UVec2>
Returns a vector containing the wrapping subtraction of self and rhs.
In other words this computes Some([self.x - rhs.x, self.y - rhs.y, ..]) but returns None on any overflow.
Sourcepub const fn checked_mul(self, rhs: UVec2) -> Option<UVec2>
pub const fn checked_mul(self, rhs: UVec2) -> Option<UVec2>
Returns a vector containing the wrapping multiplication of self and rhs.
In other words this computes Some([self.x * rhs.x, self.y * rhs.y, ..]) but returns None on any overflow.
Sourcepub const fn checked_div(self, rhs: UVec2) -> Option<UVec2>
pub const fn checked_div(self, rhs: UVec2) -> Option<UVec2>
Returns a vector containing the wrapping division of self and rhs.
In other words this computes Some([self.x / rhs.x, self.y / rhs.y, ..]) but returns None on any division by zero.
Sourcepub const fn wrapping_add(self, rhs: UVec2) -> UVec2
pub const fn wrapping_add(self, rhs: UVec2) -> UVec2
Returns a vector containing the wrapping addition of self and rhs.
In other words this computes [self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Sourcepub const fn wrapping_sub(self, rhs: UVec2) -> UVec2
pub const fn wrapping_sub(self, rhs: UVec2) -> UVec2
Returns a vector containing the wrapping subtraction of self and rhs.
In other words this computes [self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Sourcepub const fn wrapping_mul(self, rhs: UVec2) -> UVec2
pub const fn wrapping_mul(self, rhs: UVec2) -> UVec2
Returns a vector containing the wrapping multiplication of self and rhs.
In other words this computes [self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Sourcepub const fn wrapping_div(self, rhs: UVec2) -> UVec2
pub const fn wrapping_div(self, rhs: UVec2) -> UVec2
Returns a vector containing the wrapping division of self and rhs.
In other words this computes [self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Sourcepub const fn saturating_add(self, rhs: UVec2) -> UVec2
pub const fn saturating_add(self, rhs: UVec2) -> UVec2
Returns a vector containing the saturating addition of self and rhs.
In other words this computes [self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Sourcepub const fn saturating_sub(self, rhs: UVec2) -> UVec2
pub const fn saturating_sub(self, rhs: UVec2) -> UVec2
Returns a vector containing the saturating subtraction of self and rhs.
In other words this computes [self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Sourcepub const fn saturating_mul(self, rhs: UVec2) -> UVec2
pub const fn saturating_mul(self, rhs: UVec2) -> UVec2
Returns a vector containing the saturating multiplication of self and rhs.
In other words this computes [self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Sourcepub const fn saturating_div(self, rhs: UVec2) -> UVec2
pub const fn saturating_div(self, rhs: UVec2) -> UVec2
Returns a vector containing the saturating division of self and rhs.
In other words this computes [self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Sourcepub const fn checked_add_signed(self, rhs: IVec2) -> Option<UVec2>
Available on crate feature i32 only.
pub const fn checked_add_signed(self, rhs: IVec2) -> Option<UVec2>
i32 only.Returns a vector containing the wrapping addition of self and signed vector rhs.
In other words this computes Some([self.x + rhs.x, self.y + rhs.y, ..]) but returns None on any overflow.
Sourcepub const fn wrapping_add_signed(self, rhs: IVec2) -> UVec2
Available on crate feature i32 only.
pub const fn wrapping_add_signed(self, rhs: IVec2) -> UVec2
i32 only.Returns a vector containing the wrapping addition of self and signed vector rhs.
In other words this computes [self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Sourcepub const fn saturating_add_signed(self, rhs: IVec2) -> UVec2
Available on crate feature i32 only.
pub const fn saturating_add_signed(self, rhs: IVec2) -> UVec2
i32 only.Returns a vector containing the saturating addition of self and signed vector rhs.
In other words this computes [self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Trait Implementations§
Source§impl AddAssign for UVec2
impl AddAssign for UVec2
Source§fn add_assign(&mut self, rhs: UVec2)
fn add_assign(&mut self, rhs: UVec2)
+= operation. Read moreSource§impl AddAssign<&UVec2> for UVec2
impl AddAssign<&UVec2> for UVec2
Source§fn add_assign(&mut self, rhs: &UVec2)
fn add_assign(&mut self, rhs: &UVec2)
+= operation. Read moreSource§impl AddAssign<&u32> for UVec2
impl AddAssign<&u32> for UVec2
Source§fn add_assign(&mut self, rhs: &u32)
fn add_assign(&mut self, rhs: &u32)
+= operation. Read moreSource§impl AddAssign<u32> for UVec2
impl AddAssign<u32> for UVec2
Source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
+= operation. Read moreSource§impl AsMutVectorParts<u32, 2> for UVec2
impl AsMutVectorParts<u32, 2> for UVec2
fn as_mut_parts(&mut self) -> &mut [u32; 2]
Source§impl AsRefVectorParts<u32, 2> for UVec2
impl AsRefVectorParts<u32, 2> for UVec2
fn as_ref_parts(&self) -> &[u32; 2]
Source§impl BitAndAssign for UVec2
impl BitAndAssign for UVec2
Source§fn bitand_assign(&mut self, rhs: UVec2)
fn bitand_assign(&mut self, rhs: UVec2)
&= operation. Read moreSource§impl BitAndAssign<&UVec2> for UVec2
impl BitAndAssign<&UVec2> for UVec2
Source§fn bitand_assign(&mut self, rhs: &UVec2)
fn bitand_assign(&mut self, rhs: &UVec2)
&= operation. Read moreSource§impl BitAndAssign<&u32> for UVec2
impl BitAndAssign<&u32> for UVec2
Source§fn bitand_assign(&mut self, rhs: &u32)
fn bitand_assign(&mut self, rhs: &u32)
&= operation. Read moreSource§impl BitAndAssign<u32> for UVec2
impl BitAndAssign<u32> for UVec2
Source§fn bitand_assign(&mut self, rhs: u32)
fn bitand_assign(&mut self, rhs: u32)
&= operation. Read moreSource§impl BitOrAssign for UVec2
impl BitOrAssign for UVec2
Source§fn bitor_assign(&mut self, rhs: UVec2)
fn bitor_assign(&mut self, rhs: UVec2)
|= operation. Read moreSource§impl BitOrAssign<&UVec2> for UVec2
impl BitOrAssign<&UVec2> for UVec2
Source§fn bitor_assign(&mut self, rhs: &UVec2)
fn bitor_assign(&mut self, rhs: &UVec2)
|= operation. Read moreSource§impl BitOrAssign<&u32> for UVec2
impl BitOrAssign<&u32> for UVec2
Source§fn bitor_assign(&mut self, rhs: &u32)
fn bitor_assign(&mut self, rhs: &u32)
|= operation. Read moreSource§impl BitOrAssign<u32> for UVec2
impl BitOrAssign<u32> for UVec2
Source§fn bitor_assign(&mut self, rhs: u32)
fn bitor_assign(&mut self, rhs: u32)
|= operation. Read moreSource§impl BitXorAssign for UVec2
impl BitXorAssign for UVec2
Source§fn bitxor_assign(&mut self, rhs: UVec2)
fn bitxor_assign(&mut self, rhs: UVec2)
^= operation. Read moreSource§impl BitXorAssign<&UVec2> for UVec2
impl BitXorAssign<&UVec2> for UVec2
Source§fn bitxor_assign(&mut self, rhs: &UVec2)
fn bitxor_assign(&mut self, rhs: &UVec2)
^= operation. Read moreSource§impl BitXorAssign<&u32> for UVec2
impl BitXorAssign<&u32> for UVec2
Source§fn bitxor_assign(&mut self, rhs: &u32)
fn bitxor_assign(&mut self, rhs: &u32)
^= operation. Read moreSource§impl BitXorAssign<u32> for UVec2
impl BitXorAssign<u32> for UVec2
Source§fn bitxor_assign(&mut self, rhs: u32)
fn bitxor_assign(&mut self, rhs: u32)
^= operation. Read moreimpl Copy for UVec2
Source§impl CreateFrom for UVec2
impl CreateFrom for UVec2
Source§impl<'de> Deserialize<'de> for UVec2
Deserialize expects a sequence of 2 values.
impl<'de> Deserialize<'de> for UVec2
Deserialize expects a sequence of 2 values.
Source§fn deserialize<D>(
deserializer: D,
) -> Result<UVec2, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<UVec2, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl DivAssign for UVec2
impl DivAssign for UVec2
Source§fn div_assign(&mut self, rhs: UVec2)
fn div_assign(&mut self, rhs: UVec2)
/= operation. Read moreSource§impl DivAssign<&UVec2> for UVec2
impl DivAssign<&UVec2> for UVec2
Source§fn div_assign(&mut self, rhs: &UVec2)
fn div_assign(&mut self, rhs: &UVec2)
/= operation. Read moreSource§impl DivAssign<&u32> for UVec2
impl DivAssign<&u32> for UVec2
Source§fn div_assign(&mut self, rhs: &u32)
fn div_assign(&mut self, rhs: &u32)
/= operation. Read moreSource§impl DivAssign<u32> for UVec2
impl DivAssign<u32> for UVec2
Source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/= operation. Read moreimpl Eq for UVec2
Source§impl From<UVec2> for RenderTarget
impl From<UVec2> for RenderTarget
Source§fn from(value: UVec2) -> RenderTarget
fn from(value: UVec2) -> RenderTarget
Source§impl From<UVec2> for WindowResolution
impl From<UVec2> for WindowResolution
Source§fn from(res: UVec2) -> WindowResolution
fn from(res: UVec2) -> WindowResolution
Source§impl FromReflect for UVec2
impl FromReflect for UVec2
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<UVec2>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<UVec2>
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 FromVectorParts<u32, 2> for UVec2
impl FromVectorParts<u32, 2> for UVec2
Source§impl GetTypeRegistration for UVec2
impl GetTypeRegistration for UVec2
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 UVec2
impl IntoReturn for UVec2
Source§impl MulAssign for UVec2
impl MulAssign for UVec2
Source§fn mul_assign(&mut self, rhs: UVec2)
fn mul_assign(&mut self, rhs: UVec2)
*= operation. Read moreSource§impl MulAssign<&UVec2> for UVec2
impl MulAssign<&UVec2> for UVec2
Source§fn mul_assign(&mut self, rhs: &UVec2)
fn mul_assign(&mut self, rhs: &UVec2)
*= operation. Read moreSource§impl MulAssign<&u32> for UVec2
impl MulAssign<&u32> for UVec2
Source§fn mul_assign(&mut self, rhs: &u32)
fn mul_assign(&mut self, rhs: &u32)
*= operation. Read moreSource§impl MulAssign<u32> for UVec2
impl MulAssign<u32> for UVec2
Source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*= operation. Read moreSource§impl PartialReflect for UVec2
impl PartialReflect for UVec2
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<UVec2>) -> ReflectOwned
fn reflect_owned(self: Box<UVec2>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<UVec2>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<UVec2>, ) -> 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<UVec2>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<UVec2>) -> 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_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
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 reflect_partial_cmp(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<Ordering>
fn reflect_partial_cmp( &self, value: &(dyn PartialReflect + 'static), ) -> Option<Ordering>
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 to_dynamic(&self) -> Result<Box<dyn PartialReflect>, ReflectCloneError>
fn to_dynamic(&self) -> Result<Box<dyn PartialReflect>, ReflectCloneError>
Source§fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
fn reflect_clone_and_take<T>(&self) -> Result<T, ReflectCloneError>
PartialReflect, combines reflect_clone and
take in a useful fashion, automatically constructing an appropriate
ReflectCloneError if the downcast fails.Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
impl Pod for UVec2
Source§impl Reflect for UVec2
impl Reflect for UVec2
Source§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<UVec2>) -> Box<dyn Reflect>
fn into_reflect(self: Box<UVec2>) -> 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 RemAssign for UVec2
impl RemAssign for UVec2
Source§fn rem_assign(&mut self, rhs: UVec2)
fn rem_assign(&mut self, rhs: UVec2)
%= operation. Read moreSource§impl RemAssign<&UVec2> for UVec2
impl RemAssign<&UVec2> for UVec2
Source§fn rem_assign(&mut self, rhs: &UVec2)
fn rem_assign(&mut self, rhs: &UVec2)
%= operation. Read moreSource§impl RemAssign<&u32> for UVec2
impl RemAssign<&u32> for UVec2
Source§fn rem_assign(&mut self, rhs: &u32)
fn rem_assign(&mut self, rhs: &u32)
%= operation. Read moreSource§impl RemAssign<u32> for UVec2
impl RemAssign<u32> for UVec2
Source§fn rem_assign(&mut self, rhs: u32)
fn rem_assign(&mut self, rhs: u32)
%= operation. Read moreSource§impl SampleUniform for UVec2
impl SampleUniform for UVec2
Source§type Sampler = UniformVec2<UniformInt<u32>>
type Sampler = UniformVec2<UniformInt<u32>>
UniformSampler implementation supporting type X.Source§impl Serialize for UVec2
Serialize as a sequence of 2 values.
impl Serialize for UVec2
Serialize as a sequence of 2 values.
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 ShaderSize for UVec2where
u32: ShaderSize,
impl ShaderSize for UVec2where
u32: ShaderSize,
Source§const SHADER_SIZE: NonZero<u64> = _
const SHADER_SIZE: NonZero<u64> = _
ShaderType::min_size)Source§impl ShaderType for UVec2where
u32: ShaderSize,
impl ShaderType for UVec2where
u32: ShaderSize,
Source§fn assert_uniform_compat()
fn assert_uniform_compat()
Self meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints Read moreSource§impl ShlAssign<&i8> for UVec2
impl ShlAssign<&i8> for UVec2
Source§fn shl_assign(&mut self, rhs: &i8)
fn shl_assign(&mut self, rhs: &i8)
<<= operation. Read moreSource§impl ShlAssign<&i16> for UVec2
impl ShlAssign<&i16> for UVec2
Source§fn shl_assign(&mut self, rhs: &i16)
fn shl_assign(&mut self, rhs: &i16)
<<= operation. Read moreSource§impl ShlAssign<&i32> for UVec2
impl ShlAssign<&i32> for UVec2
Source§fn shl_assign(&mut self, rhs: &i32)
fn shl_assign(&mut self, rhs: &i32)
<<= operation. Read moreSource§impl ShlAssign<&i64> for UVec2
impl ShlAssign<&i64> for UVec2
Source§fn shl_assign(&mut self, rhs: &i64)
fn shl_assign(&mut self, rhs: &i64)
<<= operation. Read moreSource§impl ShlAssign<&u8> for UVec2
impl ShlAssign<&u8> for UVec2
Source§fn shl_assign(&mut self, rhs: &u8)
fn shl_assign(&mut self, rhs: &u8)
<<= operation. Read moreSource§impl ShlAssign<&u16> for UVec2
impl ShlAssign<&u16> for UVec2
Source§fn shl_assign(&mut self, rhs: &u16)
fn shl_assign(&mut self, rhs: &u16)
<<= operation. Read moreSource§impl ShlAssign<&u32> for UVec2
impl ShlAssign<&u32> for UVec2
Source§fn shl_assign(&mut self, rhs: &u32)
fn shl_assign(&mut self, rhs: &u32)
<<= operation. Read moreSource§impl ShlAssign<&u64> for UVec2
impl ShlAssign<&u64> for UVec2
Source§fn shl_assign(&mut self, rhs: &u64)
fn shl_assign(&mut self, rhs: &u64)
<<= operation. Read moreSource§impl ShlAssign<i8> for UVec2
impl ShlAssign<i8> for UVec2
Source§fn shl_assign(&mut self, rhs: i8)
fn shl_assign(&mut self, rhs: i8)
<<= operation. Read moreSource§impl ShlAssign<i16> for UVec2
impl ShlAssign<i16> for UVec2
Source§fn shl_assign(&mut self, rhs: i16)
fn shl_assign(&mut self, rhs: i16)
<<= operation. Read moreSource§impl ShlAssign<i32> for UVec2
impl ShlAssign<i32> for UVec2
Source§fn shl_assign(&mut self, rhs: i32)
fn shl_assign(&mut self, rhs: i32)
<<= operation. Read moreSource§impl ShlAssign<i64> for UVec2
impl ShlAssign<i64> for UVec2
Source§fn shl_assign(&mut self, rhs: i64)
fn shl_assign(&mut self, rhs: i64)
<<= operation. Read moreSource§impl ShlAssign<u8> for UVec2
impl ShlAssign<u8> for UVec2
Source§fn shl_assign(&mut self, rhs: u8)
fn shl_assign(&mut self, rhs: u8)
<<= operation. Read moreSource§impl ShlAssign<u16> for UVec2
impl ShlAssign<u16> for UVec2
Source§fn shl_assign(&mut self, rhs: u16)
fn shl_assign(&mut self, rhs: u16)
<<= operation. Read moreSource§impl ShlAssign<u32> for UVec2
impl ShlAssign<u32> for UVec2
Source§fn shl_assign(&mut self, rhs: u32)
fn shl_assign(&mut self, rhs: u32)
<<= operation. Read moreSource§impl ShlAssign<u64> for UVec2
impl ShlAssign<u64> for UVec2
Source§fn shl_assign(&mut self, rhs: u64)
fn shl_assign(&mut self, rhs: u64)
<<= operation. Read moreSource§impl ShrAssign<&i8> for UVec2
impl ShrAssign<&i8> for UVec2
Source§fn shr_assign(&mut self, rhs: &i8)
fn shr_assign(&mut self, rhs: &i8)
>>= operation. Read moreSource§impl ShrAssign<&i16> for UVec2
impl ShrAssign<&i16> for UVec2
Source§fn shr_assign(&mut self, rhs: &i16)
fn shr_assign(&mut self, rhs: &i16)
>>= operation. Read moreSource§impl ShrAssign<&i32> for UVec2
impl ShrAssign<&i32> for UVec2
Source§fn shr_assign(&mut self, rhs: &i32)
fn shr_assign(&mut self, rhs: &i32)
>>= operation. Read moreSource§impl ShrAssign<&i64> for UVec2
impl ShrAssign<&i64> for UVec2
Source§fn shr_assign(&mut self, rhs: &i64)
fn shr_assign(&mut self, rhs: &i64)
>>= operation. Read moreSource§impl ShrAssign<&u8> for UVec2
impl ShrAssign<&u8> for UVec2
Source§fn shr_assign(&mut self, rhs: &u8)
fn shr_assign(&mut self, rhs: &u8)
>>= operation. Read moreSource§impl ShrAssign<&u16> for UVec2
impl ShrAssign<&u16> for UVec2
Source§fn shr_assign(&mut self, rhs: &u16)
fn shr_assign(&mut self, rhs: &u16)
>>= operation. Read moreSource§impl ShrAssign<&u32> for UVec2
impl ShrAssign<&u32> for UVec2
Source§fn shr_assign(&mut self, rhs: &u32)
fn shr_assign(&mut self, rhs: &u32)
>>= operation. Read moreSource§impl ShrAssign<&u64> for UVec2
impl ShrAssign<&u64> for UVec2
Source§fn shr_assign(&mut self, rhs: &u64)
fn shr_assign(&mut self, rhs: &u64)
>>= operation. Read moreSource§impl ShrAssign<i8> for UVec2
impl ShrAssign<i8> for UVec2
Source§fn shr_assign(&mut self, rhs: i8)
fn shr_assign(&mut self, rhs: i8)
>>= operation. Read moreSource§impl ShrAssign<i16> for UVec2
impl ShrAssign<i16> for UVec2
Source§fn shr_assign(&mut self, rhs: i16)
fn shr_assign(&mut self, rhs: i16)
>>= operation. Read moreSource§impl ShrAssign<i32> for UVec2
impl ShrAssign<i32> for UVec2
Source§fn shr_assign(&mut self, rhs: i32)
fn shr_assign(&mut self, rhs: i32)
>>= operation. Read moreSource§impl ShrAssign<i64> for UVec2
impl ShrAssign<i64> for UVec2
Source§fn shr_assign(&mut self, rhs: i64)
fn shr_assign(&mut self, rhs: i64)
>>= operation. Read moreSource§impl ShrAssign<u8> for UVec2
impl ShrAssign<u8> for UVec2
Source§fn shr_assign(&mut self, rhs: u8)
fn shr_assign(&mut self, rhs: u8)
>>= operation. Read moreSource§impl ShrAssign<u16> for UVec2
impl ShrAssign<u16> for UVec2
Source§fn shr_assign(&mut self, rhs: u16)
fn shr_assign(&mut self, rhs: u16)
>>= operation. Read moreSource§impl ShrAssign<u32> for UVec2
impl ShrAssign<u32> for UVec2
Source§fn shr_assign(&mut self, rhs: u32)
fn shr_assign(&mut self, rhs: u32)
>>= operation. Read moreSource§impl ShrAssign<u64> for UVec2
impl ShrAssign<u64> for UVec2
Source§fn shr_assign(&mut self, rhs: u64)
fn shr_assign(&mut self, rhs: u64)
>>= operation. Read moreSource§impl Struct for UVec2
impl Struct for UVec2
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 index_of_name(&self, name: &str) -> Option<usize>
fn index_of_name(&self, name: &str) -> Option<usize>
Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
Source§fn to_dynamic_struct(&self) -> Result<DynamicStruct, ReflectCloneError>
fn to_dynamic_struct(&self) -> Result<DynamicStruct, ReflectCloneError>
DynamicStruct from this struct. Read moreSource§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None if TypeInfo is not available.impl StructuralPartialEq for UVec2
Source§impl SubAssign for UVec2
impl SubAssign for UVec2
Source§fn sub_assign(&mut self, rhs: UVec2)
fn sub_assign(&mut self, rhs: UVec2)
-= operation. Read moreSource§impl SubAssign<&UVec2> for UVec2
impl SubAssign<&UVec2> for UVec2
Source§fn sub_assign(&mut self, rhs: &UVec2)
fn sub_assign(&mut self, rhs: &UVec2)
-= operation. Read moreSource§impl SubAssign<&u32> for UVec2
impl SubAssign<&u32> for UVec2
Source§fn sub_assign(&mut self, rhs: &u32)
fn sub_assign(&mut self, rhs: &u32)
-= operation. Read moreSource§impl SubAssign<u32> for UVec2
impl SubAssign<u32> for UVec2
Source§fn sub_assign(&mut self, rhs: u32)
fn sub_assign(&mut self, rhs: u32)
-= operation. Read moreSource§impl ToExtents for UVec2
impl ToExtents for UVec2
Source§fn to_extents(self) -> Extent3d
fn to_extents(self) -> Extent3d
Extent3d.Source§impl TypePath for UVec2
impl TypePath for UVec2
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 Vec2Swizzles for UVec2
impl Vec2Swizzles for UVec2
type Vec3 = UVec3
type Vec4 = UVec4
fn xx(self) -> UVec2
fn yx(self) -> UVec2
fn yy(self) -> UVec2
fn xxx(self) -> UVec3
fn xxy(self) -> UVec3
fn xyx(self) -> UVec3
fn xyy(self) -> UVec3
fn yxx(self) -> UVec3
fn yxy(self) -> UVec3
fn yyx(self) -> UVec3
fn yyy(self) -> UVec3
fn xxxx(self) -> UVec4
fn xxxy(self) -> UVec4
fn xxyx(self) -> UVec4
fn xxyy(self) -> UVec4
fn xyxx(self) -> UVec4
fn xyxy(self) -> UVec4
fn xyyx(self) -> UVec4
fn xyyy(self) -> UVec4
fn yxxx(self) -> UVec4
fn yxxy(self) -> UVec4
fn yxyx(self) -> UVec4
fn yxyy(self) -> UVec4
fn yyxx(self) -> UVec4
fn yyxy(self) -> UVec4
fn yyyx(self) -> UVec4
fn yyyy(self) -> UVec4
fn xy(self) -> Self
Auto Trait Implementations§
impl Freeze for UVec2
impl RefUnwindSafe for UVec2
impl Send for UVec2
impl Sync for UVec2
impl Unpin for UVec2
impl UnsafeUnpin for UVec2
impl UnwindSafe for UVec2
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
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<T> Brush for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> FromTemplate for T
impl<T> FromTemplate for T
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 moreimpl<T> GpuArrayBufferable for T
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> ⓘ
impl<T> Interleave for Twhere
T: Pod,
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
impl<T> NoUninit for Twhere
T: Pod,
impl<T, Rhs> NumAssignOps<Rhs> for T
impl<T, Rhs, Output> NumOps<Rhs, Output> for T
Source§impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
impl<G> PatchFromTemplate for Gwhere
G: FromTemplate,
Source§fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
fn patch<F>(func: F) -> TemplatePatch<F, <G as PatchFromTemplate>::Template>
func, and turns it into a TemplatePatch.Source§impl<T> PatchTemplate for Twhere
T: Template,
impl<T> PatchTemplate for Twhere
T: Template,
Source§fn patch_template<F>(func: F) -> TemplatePatch<F, T>
fn patch_template<F>(func: F) -> TemplatePatch<F, 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, 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().impl<T, Base> RefNum<Base> for T
impl<T> Reflectable for T
Source§impl<Borrowed> SampleBorrow<Borrowed> for Borrowedwhere
Borrowed: SampleUniform,
impl<Borrowed> SampleBorrow<Borrowed> for Borrowedwhere
Borrowed: SampleUniform,
Source§fn borrow(&self) -> &Borrowed
fn borrow(&self) -> &Borrowed
Borrow::borrowSource§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>
impl<T> Settings for T
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> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.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
Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
self.