#[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
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 ];65fn spawn_fake_player(
66 mut commands: Commands,
67 mut meshes: ResMut<Assets<Mesh>>,
68 mut materials: ResMut<Assets<ColorMaterial>>,
69 chunk: Single<&TilemapChunk>,
70) {
71 let mut transform = chunk.calculate_tile_transform(UVec2::new(0, 0));
72 transform.translation.z = 1.;
73
74 commands.spawn((
75 Mesh2d(meshes.add(Rectangle::new(8., 8.))),
76 MeshMaterial2d(materials.add(Color::from(RED_400))),
77 transform,
78 MovePlayer,
79 ));
80
81 let mut transform = chunk.calculate_tile_transform(UVec2::new(5, 6));
82 transform.translation.z = 1.;
83
84 // second "player" to visually test a non-zero position
85 commands.spawn((
86 Mesh2d(meshes.add(Rectangle::new(8., 8.))),
87 MeshMaterial2d(materials.add(Color::from(RED_400))),
88 transform,
89 ));
90}
91
92fn move_player(
93 mut player: Single<&mut Transform, With<MovePlayer>>,
94 time: Res<Time>,
95 chunk: Single<&TilemapChunk>,
96) {
97 let t = (ops::sin(time.elapsed_secs()) + 1.) / 2.;
98
99 let origin = chunk
100 .calculate_tile_transform(UVec2::new(0, 0))
101 .translation
102 .x;
103 let destination = chunk
104 .calculate_tile_transform(UVec2::new(63, 0))
105 .translation
106 .x;
107
108 player.translation.x = origin.lerp(destination, t);
109}
110
111fn update_tileset_image(
112 chunk_query: Single<&TilemapChunk>,
113 mut events: MessageReader<AssetEvent<Image>>,
114 mut images: ResMut<Assets<Image>>,
115) {
116 let chunk = *chunk_query;
117 for event in events.read() {
118 if event.is_loaded_with_dependencies(chunk.tileset.id()) {
119 let image = images.get_mut(&chunk.tileset).unwrap();
120 image.reinterpret_stacked_2d_as_array(4);
121 }
122 }
123}
124
125fn update_tilemap(
126 time: Res<Time>,
127 mut query: Query<(&mut TilemapChunkTileData, &mut UpdateTimer)>,
128 mut rng: ResMut<SeededRng>,
129) {
130 for (mut tile_data, mut timer) in query.iter_mut() {
131 timer.tick(time.delta());
132
133 if timer.just_finished() {
134 for _ in 0..50 {
135 let index = rng.random_range(0..tile_data.len());
136 tile_data[index] = Some(TileData::from_tileset_index(rng.random_range(0..5)));
137 }
138 }
139 }
140}
141
142// find the data for an arbitrary tile in the chunk and log its data
143fn log_tile(tilemap: Single<(&TilemapChunk, &TilemapChunkTileData)>, mut local: Local<u16>) {
144 let (chunk, data) = tilemap.into_inner();
145 let Some(tile_data) = data.tile_data_from_tile_pos(chunk.chunk_size, UVec2::new(3, 4)) else {
146 return;
147 };
148 // log when the tile changes
149 if tile_data.tileset_index != *local {
150 info!(?tile_data, "tile_data changed");
151 *local = tile_data.tileset_index;
152 }
153}290 pub fn draw_gizmos(mut gizmos: Gizmos) {
291 gizmos.rect_2d(
292 Isometry2d::from_translation(Vec2::new(-200.0, 0.0)),
293 Vec2::new(200.0, 200.0),
294 RED,
295 );
296 gizmos
297 .circle_2d(
298 Isometry2d::from_translation(Vec2::new(-200.0, 0.0)),
299 200.0,
300 GREEN,
301 )
302 .resolution(64);
303
304 // 2d grids with all variations of outer edges on or off
305 for i in 0..4 {
306 let x = 200.0 * (1.0 + (i % 2) as f32);
307 let y = 150.0 * (0.5 - (i / 2) as f32);
308 let mut grid = gizmos.grid(
309 Vec3::new(x, y, 0.0),
310 UVec2::new(5, 4),
311 Vec2::splat(30.),
312 Color::WHITE,
313 );
314 if i & 1 > 0 {
315 grid = grid.outer_edges_x();
316 }
317 if i & 2 > 0 {
318 grid.outer_edges_y();
319 }
320 }
321 }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::<Pointer<Over>>(Color::srgb(0.0, 1.0, 1.0)))
147 .observe(recolor_on::<Pointer<Out>>(Color::srgb(1.0, 1.0, 1.0)))
148 .observe(recolor_on::<Pointer<Press>>(Color::srgb(1.0, 1.0, 0.0)))
149 .observe(recolor_on::<Pointer<Release>>(Color::srgb(0.0, 1.0, 1.0)));
150}26fn setup(
27 mut commands: Commands,
28 assets: Res<AssetServer>,
29 mut meshes: ResMut<Assets<Mesh>>,
30 mut materials: ResMut<Assets<CustomMaterial>>,
31) {
32 // We will use this image as our external data for our material to sample from in the vertex shader
33 let image = assets.load("branding/icon.png");
34
35 // Our single mesh handle that will be instanced
36 let mesh_handle = meshes.add(Cuboid::from_size(Vec3::splat(0.01)));
37
38 // Create the custom material with a reference to our texture
39 // Automatic instancing works with any Material, including the `StandardMaterial`.
40 // This custom material is used to demonstrate the optional `MeshTag` feature.
41 let material_handle = materials.add(CustomMaterial {
42 image: image.clone(),
43 });
44
45 // We're hardcoding the image dimensions for simplicity
46 let image_dims = UVec2::new(256, 256);
47 let total_pixels = image_dims.x * image_dims.y;
48
49 for index in 0..total_pixels {
50 // Get x,y from index - x goes left to right, y goes top to bottom
51 let x = index % image_dims.x;
52 let y = index / image_dims.x;
53
54 // Convert to centered world coordinates
55 let world_x = (x as f32 - image_dims.x as f32 / 2.0) / 50.0;
56 let world_y = -((y as f32 - image_dims.y as f32 / 2.0) / 50.0); // Still need negative for world space
57
58 commands.spawn((
59 // For automatic instancing to take effect you need to
60 // use the same mesh handle and material handle for each instance
61 Mesh3d(mesh_handle.clone()),
62 MeshMaterial3d(material_handle.clone()),
63 // This is an optional component that can be used to help tie external data to a mesh instance
64 MeshTag(index),
65 Transform::from_xyz(world_x, world_y, 0.0),
66 ));
67 }
68
69 // Camera
70 commands.spawn((
71 Camera3d::default(),
72 Transform::from_xyz(0.0, 0.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
73 ));
74}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?
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}More examples
28fn setup(mut commands: Commands, assets: Res<AssetServer>) {
29 // We're seeding the PRNG here to make this example deterministic for testing purposes.
30 // This isn't strictly required in practical use unless you need your app to be deterministic.
31 let mut rng = ChaCha8Rng::seed_from_u64(42);
32
33 let chunk_size = UVec2::splat(64);
34 let tile_display_size = UVec2::splat(8);
35 let tile_data: Vec<Option<TileData>> = (0..chunk_size.element_product())
36 .map(|_| rng.random_range(0..5))
37 .map(|i| {
38 if i == 0 {
39 None
40 } else {
41 Some(TileData::from_tileset_index(i - 1))
42 }
43 })
44 .collect();
45
46 commands.spawn((
47 TilemapChunk {
48 chunk_size,
49 tile_display_size,
50 tileset: assets.load("textures/array_texture.png"),
51 ..default()
52 },
53 TilemapChunkTileData(tile_data),
54 UpdateTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
55 ));
56
57 commands.spawn(Camera2d);
58
59 commands.insert_resource(SeededRng(rng));
60}219fn spawn_depth_only_camera(commands: &mut Commands) {
220 commands.spawn((
221 Camera3d::default(),
222 Transform::from_xyz(-4.0, -5.0, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
223 Camera {
224 // We specify no color render target, for maximum efficiency.
225 target: RenderTarget::None {
226 // When specifying no render target, we must manually specify
227 // the viewport size. Otherwise, Bevy won't know how big to make
228 // the depth buffer.
229 size: UVec2::splat(DEPTH_TEXTURE_SIZE),
230 },
231 // Make sure that we render from this depth-only camera *before*
232 // rendering from the main camera.
233 order: -1,
234 ..Camera::default()
235 },
236 // We need to disable multisampling or the depth texture will be
237 // multisampled, which adds complexity we don't care about for this
238 // demo.
239 Msaa::Off,
240 // Cameras with no render target render *nothing* by default. To get
241 // them to render something, we must add a prepass that specifies what
242 // we want to render: in this case, depth.
243 DepthPrepass,
244 ));
245}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 ];18fn setup(
19 mut commands: Commands,
20 asset_server: Res<AssetServer>,
21 mut texture_atlases: ResMut<Assets<TextureAtlasLayout>>,
22) {
23 // Camera
24 commands.spawn(Camera2d);
25
26 let text_font = TextFont::default();
27
28 let texture_handle = asset_server.load("textures/rpg/chars/gabe/gabe-idle-run.png");
29 let texture_atlas = TextureAtlasLayout::from_grid(UVec2::splat(24), 7, 1, None, None);
30 let texture_atlas_handle = texture_atlases.add(texture_atlas);
31
32 // root node
33 commands
34 .spawn(Node {
35 width: percent(100),
36 height: percent(100),
37 flex_direction: FlexDirection::Column,
38 justify_content: JustifyContent::Center,
39 align_items: AlignItems::Center,
40 row_gap: px(text_font.font_size * 2.),
41 ..default()
42 })
43 .with_children(|parent| {
44 parent.spawn((
45 ImageNode::from_atlas_image(
46 texture_handle,
47 TextureAtlas::from(texture_atlas_handle),
48 ),
49 Node {
50 width: px(256),
51 height: px(256),
52 ..default()
53 },
54 BackgroundColor(ANTIQUE_WHITE.into()),
55 Outline::new(px(8), Val::ZERO, CRIMSON.into()),
56 ));
57 parent
58 .spawn((Text::new("press "), text_font.clone()))
59 .with_child((
60 TextSpan::new("space"),
61 TextColor(YELLOW.into()),
62 text_font.clone(),
63 ))
64 .with_child((TextSpan::new(" to advance frames"), text_font));
65 });
66}22fn setup(
23 mut commands: Commands,
24 mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
25 asset_server: Res<AssetServer>,
26) {
27 commands.spawn(Camera2d);
28 let texture = asset_server.load("textures/food_kenney.png");
29 let layout = TextureAtlasLayout::from_grid(UVec2::splat(64), 7, 7, None, None);
30 let texture_atlas_layout = texture_atlas_layouts.add(layout);
31 commands.spawn((
32 Node {
33 width: percent(100),
34 height: percent(100),
35 align_items: AlignItems::Center,
36 justify_content: JustifyContent::Center,
37 column_gap: px(15),
38 ..default()
39 },
40 Children::spawn(SpawnIter(
41 [
42 FoodItem {
43 name: "an apple",
44 cooldown: 2.,
45 index: 2,
46 },
47 FoodItem {
48 name: "a burger",
49 cooldown: 1.,
50 index: 23,
51 },
52 FoodItem {
53 name: "chocolate",
54 cooldown: 10.,
55 index: 32,
56 },
57 FoodItem {
58 name: "cherries",
59 cooldown: 4.,
60 index: 41,
61 },
62 ]
63 .into_iter()
64 .map(move |food| build_ability(food, texture.clone(), texture_atlas_layout.clone())),
65 )),
66 ));
67 commands.spawn((
68 Text::new("*Click some food to eat it*"),
69 Node {
70 position_type: PositionType::Absolute,
71 top: px(12),
72 left: px(12),
73 ..default()
74 },
75 ));
76}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 // Viewport movement controls
81 if input.pressed(KeyCode::KeyW) {
82 viewport.physical_position.y = viewport.physical_position.y.saturating_sub(uspeed);
83 }
84 if input.pressed(KeyCode::KeyS) {
85 viewport.physical_position.y += uspeed;
86 }
87 if input.pressed(KeyCode::KeyA) {
88 viewport.physical_position.x = viewport.physical_position.x.saturating_sub(uspeed);
89 }
90 if input.pressed(KeyCode::KeyD) {
91 viewport.physical_position.x += uspeed;
92 }
93
94 // Bound viewport position so it doesn't go off-screen
95 viewport.physical_position = viewport
96 .physical_position
97 .min(window_size - viewport.physical_size);
98
99 // Viewport size controls
100 if input.pressed(KeyCode::KeyI) {
101 viewport.physical_size.y = viewport.physical_size.y.saturating_sub(uspeed);
102 }
103 if input.pressed(KeyCode::KeyK) {
104 viewport.physical_size.y += uspeed;
105 }
106 if input.pressed(KeyCode::KeyJ) {
107 viewport.physical_size.x = viewport.physical_size.x.saturating_sub(uspeed);
108 }
109 if input.pressed(KeyCode::KeyL) {
110 viewport.physical_size.x += uspeed;
111 }
112
113 // Bound viewport size so it doesn't go off-screen
114 viewport.physical_size = viewport
115 .physical_size
116 .min(window_size - viewport.physical_position)
117 .max(UVec2::new(20, 20));
118 }
119}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?
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 // Viewport movement controls
81 if input.pressed(KeyCode::KeyW) {
82 viewport.physical_position.y = viewport.physical_position.y.saturating_sub(uspeed);
83 }
84 if input.pressed(KeyCode::KeyS) {
85 viewport.physical_position.y += uspeed;
86 }
87 if input.pressed(KeyCode::KeyA) {
88 viewport.physical_position.x = viewport.physical_position.x.saturating_sub(uspeed);
89 }
90 if input.pressed(KeyCode::KeyD) {
91 viewport.physical_position.x += uspeed;
92 }
93
94 // Bound viewport position so it doesn't go off-screen
95 viewport.physical_position = viewport
96 .physical_position
97 .min(window_size - viewport.physical_size);
98
99 // Viewport size controls
100 if input.pressed(KeyCode::KeyI) {
101 viewport.physical_size.y = viewport.physical_size.y.saturating_sub(uspeed);
102 }
103 if input.pressed(KeyCode::KeyK) {
104 viewport.physical_size.y += uspeed;
105 }
106 if input.pressed(KeyCode::KeyJ) {
107 viewport.physical_size.x = viewport.physical_size.x.saturating_sub(uspeed);
108 }
109 if input.pressed(KeyCode::KeyL) {
110 viewport.physical_size.x += uspeed;
111 }
112
113 // Bound viewport size so it doesn't go off-screen
114 viewport.physical_size = viewport
115 .physical_size
116 .min(window_size - viewport.physical_position)
117 .max(UVec2::new(20, 20));
118 }
119}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?
28fn setup(mut commands: Commands, assets: Res<AssetServer>) {
29 // We're seeding the PRNG here to make this example deterministic for testing purposes.
30 // This isn't strictly required in practical use unless you need your app to be deterministic.
31 let mut rng = ChaCha8Rng::seed_from_u64(42);
32
33 let chunk_size = UVec2::splat(64);
34 let tile_display_size = UVec2::splat(8);
35 let tile_data: Vec<Option<TileData>> = (0..chunk_size.element_product())
36 .map(|_| rng.random_range(0..5))
37 .map(|i| {
38 if i == 0 {
39 None
40 } else {
41 Some(TileData::from_tileset_index(i - 1))
42 }
43 })
44 .collect();
45
46 commands.spawn((
47 TilemapChunk {
48 chunk_size,
49 tile_display_size,
50 tileset: assets.load("textures/array_texture.png"),
51 ..default()
52 },
53 TilemapChunkTileData(tile_data),
54 UpdateTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
55 ));
56
57 commands.spawn(Camera2d);
58
59 commands.insert_resource(SeededRng(rng));
60}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);
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
121fn setup(
122 mut commands: Commands,
123 mut meshes: ResMut<Assets<Mesh>>,
124 mut materials: ResMut<Assets<ColorMaterial>>,
125 window: Single<&Window>,
126) {
127 let window_size = window.resolution.physical_size().as_vec2();
128
129 // Initialize centered, non-window-filling viewport
130 commands.spawn((
131 Camera2d,
132 Camera {
133 viewport: Some(Viewport {
134 physical_position: (window_size * 0.125).as_uvec2(),
135 physical_size: (window_size * 0.75).as_uvec2(),
136 ..default()
137 }),
138 ..default()
139 },
140 ));
141
142 // Create a minimal UI explaining how to interact with the example
143 commands.spawn((
144 Text::new(
145 "Move the mouse to see the circle follow your cursor.\n\
146 Use the arrow keys to move the camera.\n\
147 Use the comma and period keys to zoom in and out.\n\
148 Use the WASD keys to move the viewport.\n\
149 Use the IJKL keys to resize the viewport.",
150 ),
151 Node {
152 position_type: PositionType::Absolute,
153 top: px(12),
154 left: px(12),
155 ..default()
156 },
157 ));
158
159 // Add mesh to make camera movement visible
160 commands.spawn((
161 Mesh2d(meshes.add(Rectangle::new(40.0, 20.0))),
162 MeshMaterial2d(materials.add(Color::from(GREEN))),
163 ));
164
165 // Add background to visualize viewport bounds
166 commands.spawn((
167 Mesh2d(meshes.add(Rectangle::new(50000.0, 50000.0))),
168 MeshMaterial2d(materials.add(Color::linear_rgb(0.01, 0.01, 0.01))),
169 Transform::from_translation(Vec3::new(0.0, 0.0, -200.0)),
170 ));
171}174fn drive_diegetic_pointer(
175 mut cursor_last: Local<Vec2>,
176 mut raycast: MeshRayCast,
177 rays: Res<RayMap>,
178 cubes: Query<&Mesh3d, With<Cube>>,
179 ui_camera: Query<&Camera, With<Camera2d>>,
180 primary_window: Query<Entity, With<PrimaryWindow>>,
181 windows: Query<(Entity, &Window)>,
182 images: Res<Assets<Image>>,
183 manual_texture_views: Res<ManualTextureViews>,
184 mut window_events: MessageReader<WindowEvent>,
185 mut pointer_inputs: MessageWriter<PointerInput>,
186) -> Result {
187 // Get the size of the texture, so we can convert from dimensionless UV coordinates that span
188 // from 0 to 1, to pixel coordinates.
189 let target = ui_camera
190 .single()?
191 .target
192 .normalize(primary_window.single().ok())
193 .unwrap();
194 let target_info = target
195 .get_render_target_info(windows, &images, &manual_texture_views)
196 .unwrap();
197 let size = target_info.physical_size.as_vec2();
198
199 // Find raycast hits and update the virtual pointer.
200 let raycast_settings = MeshRayCastSettings {
201 visibility: RayCastVisibility::VisibleInView,
202 filter: &|entity| cubes.contains(entity),
203 early_exit_test: &|_| false,
204 };
205 for (_id, ray) in rays.iter() {
206 for (_cube, hit) in raycast.cast_ray(*ray, &raycast_settings) {
207 let position = size * hit.uv.unwrap();
208 if position != *cursor_last {
209 pointer_inputs.write(PointerInput::new(
210 CUBE_POINTER_ID,
211 Location {
212 target: target.clone(),
213 position,
214 },
215 PointerAction::Move {
216 delta: position - *cursor_last,
217 },
218 ));
219 *cursor_last = position;
220 }
221 }
222 }
223
224 // Pipe pointer button presses to the virtual pointer on the UI texture.
225 for window_event in window_events.read() {
226 if let WindowEvent::MouseButtonInput(input) = window_event {
227 let button = match input.button {
228 MouseButton::Left => PointerButton::Primary,
229 MouseButton::Right => PointerButton::Secondary,
230 MouseButton::Middle => PointerButton::Middle,
231 _ => continue,
232 };
233 let action = match input.state {
234 ButtonState::Pressed => PointerAction::Press(button),
235 ButtonState::Released => PointerAction::Release(button),
236 };
237 pointer_inputs.write(PointerInput::new(
238 CUBE_POINTER_ID,
239 Location {
240 target: target.clone(),
241 position: *cursor_last,
242 },
243 action,
244 ));
245 }
246 }
247
248 Ok(())
249}Sourcepub fn as_i16vec2(&self) -> I16Vec2
pub fn as_i16vec2(&self) -> I16Vec2
Casts all elements of self to i16.
Sourcepub fn as_u16vec2(&self) -> U16Vec2
pub fn as_u16vec2(&self) -> U16Vec2
Casts all elements of self to u16.
Sourcepub fn as_i64vec2(&self) -> I64Vec2
pub fn as_i64vec2(&self) -> I64Vec2
Casts all elements of self to i64.
Sourcepub fn as_u64vec2(&self) -> U64Vec2
pub fn as_u64vec2(&self) -> U64Vec2
Casts all elements of self to u64.
Sourcepub fn as_usizevec2(&self) -> USizeVec2
pub fn as_usizevec2(&self) -> USizeVec2
Casts all elements of self to usize.
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>
pub const fn checked_add_signed(self, rhs: IVec2) -> Option<UVec2>
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
pub const fn wrapping_add_signed(self, rhs: IVec2) -> UVec2
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
pub const fn saturating_add_signed(self, rhs: IVec2) -> UVec2
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<&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 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 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<&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 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 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 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 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 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 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<&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 moreSource§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 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<&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 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 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 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) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
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. Read moreSource§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
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<&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 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 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<&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<&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<&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<&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<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<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<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<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 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<&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<&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<&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<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<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<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<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 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 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<'_> ⓘ
Source§fn to_dynamic_struct(&self) -> DynamicStruct
fn to_dynamic_struct(&self) -> DynamicStruct
DynamicStruct from this struct.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 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 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 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
Source§impl WriteInto for UVec2
impl WriteInto for UVec2
fn write_into<B>(&self, writer: &mut Writer<B>)where
B: BufferMut,
impl Copy for UVec2
impl Eq for UVec2
impl Pod for UVec2
impl StructuralPartialEq for UVec2
Auto Trait Implementations§
impl Freeze for UVec2
impl RefUnwindSafe for UVec2
impl Send for UVec2
impl Sync for UVec2
impl Unpin for UVec2
impl UnwindSafe for UVec2
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> 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,
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<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<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, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.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<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>
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.