pub struct Sprite {
pub image: Handle<Image>,
pub texture_atlas: Option<TextureAtlas>,
pub color: Color,
pub flip_x: bool,
pub flip_y: bool,
pub custom_size: Option<Vec2>,
pub rect: Option<Rect>,
pub anchor: Anchor,
pub image_mode: SpriteImageMode,
}
Expand description
Describes a sprite to be rendered to a 2D camera
Fields§
§image: Handle<Image>
The image used to render the sprite
texture_atlas: Option<TextureAtlas>
The (optional) texture atlas used to render the sprite
color: Color
The sprite’s color tint
flip_x: bool
Flip the sprite along the X
axis
flip_y: bool
Flip the sprite along the Y
axis
custom_size: Option<Vec2>
An optional custom size for the sprite that will be used when rendering, instead of the size of the sprite’s image
rect: Option<Rect>
An optional rectangle representing the region of the sprite’s image to render, instead of rendering
the full image. This is an easy one-off alternative to using a TextureAtlas
.
When used with a TextureAtlas
, the rect
is offset by the atlas’s minimal (top-left) corner position.
anchor: Anchor
Anchor
point of the sprite in the world
image_mode: SpriteImageMode
How the sprite’s image will be scaled.
Implementations§
Source§impl Sprite
impl Sprite
Sourcepub fn sized(custom_size: Vec2) -> Sprite
pub fn sized(custom_size: Vec2) -> Sprite
Create a Sprite with a custom size
Examples found in repository?
71fn spawn_curve_sprite<T: CurveColor>(commands: &mut Commands, y: f32, points: [T; 4]) {
72 commands.spawn((
73 Sprite::sized(Vec2::new(75., 75.)),
74 Transform::from_xyz(0., y, 0.),
75 Curve(CubicBezier::new([points]).to_curve().unwrap()),
76 ));
77}
78
79fn spawn_mixed_sprite<T: MixedColor>(commands: &mut Commands, y: f32, colors: [T; 4]) {
80 commands.spawn((
81 Transform::from_xyz(0., y, 0.),
82 Sprite::sized(Vec2::new(75., 75.)),
83 Mixed(colors),
84 ));
85}
Sourcepub fn from_image(image: Handle<Image>) -> Sprite
pub fn from_image(image: Handle<Image>) -> Sprite
Create a sprite from an image
Examples found in repository?
More examples
- examples/state/computed_states.rs
- examples/ecs/removal_detection.rs
- examples/2d/move_sprite.rs
- examples/testbed/2d.rs
- examples/movement/physics_in_fixed_timestep.rs
- examples/2d/pixel_grid_snap.rs
- examples/asset/extra_source.rs
- examples/ecs/parallel_query.rs
- examples/2d/transparency_2d.rs
- examples/asset/embedded_asset.rs
- examples/ecs/hierarchy.rs
- examples/asset/alter_sprite.rs
- examples/2d/rotation.rs
- examples/2d/cpu_draw.rs
- examples/time/virtual_time.rs
- examples/games/desk_toy.rs
- examples/2d/texture_atlas.rs
Sourcepub fn from_atlas_image(image: Handle<Image>, atlas: TextureAtlas) -> Sprite
pub fn from_atlas_image(image: Handle<Image>, atlas: TextureAtlas) -> Sprite
Create a sprite from an image, with an associated texture atlas
Examples found in repository?
251fn create_sprite_from_atlas(
252 commands: &mut Commands,
253 translation: (f32, f32, f32),
254 atlas_texture: Handle<Image>,
255 atlas_sources: TextureAtlasSources,
256 atlas_handle: Handle<TextureAtlasLayout>,
257 vendor_handle: &Handle<Image>,
258) {
259 commands.spawn((
260 Transform {
261 translation: Vec3::new(translation.0, translation.1, translation.2),
262 scale: Vec3::splat(3.0),
263 ..default()
264 },
265 Sprite::from_atlas_image(
266 atlas_texture,
267 atlas_sources.handle(atlas_handle, vendor_handle).unwrap(),
268 ),
269 ));
270}
More examples
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}
123fn setup_atlas(
124 mut commands: Commands,
125 asset_server: Res<AssetServer>,
126 mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
127) {
128 let texture_handle = asset_server.load("textures/rpg/chars/gabe/gabe-idle-run.png");
129 let layout = TextureAtlasLayout::from_grid(UVec2::new(24, 24), 7, 1, None, None);
130 let texture_atlas_layout_handle = texture_atlas_layouts.add(layout);
131 // Use only the subset of sprites in the sheet that make up the run animation
132 let animation_indices = AnimationIndices { first: 1, last: 6 };
133 commands
134 .spawn((
135 Sprite::from_atlas_image(
136 texture_handle,
137 TextureAtlas {
138 layout: texture_atlas_layout_handle,
139 index: animation_indices.first,
140 },
141 ),
142 Transform::from_xyz(300.0, 0.0, 0.0).with_scale(Vec3::splat(6.0)),
143 animation_indices,
144 AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
145 Pickable::default(),
146 ))
147 .observe(recolor_on::<Pointer<Over>>(Color::srgb(0.0, 1.0, 1.0)))
148 .observe(recolor_on::<Pointer<Out>>(Color::srgb(1.0, 1.0, 1.0)))
149 .observe(recolor_on::<Pointer<Pressed>>(Color::srgb(1.0, 1.0, 0.0)))
150 .observe(recolor_on::<Pointer<Released>>(Color::srgb(0.0, 1.0, 1.0)));
151}
141fn setup_texture_atlas(
142 mut commands: Commands,
143 asset_server: Res<AssetServer>,
144 mut texture_atlas_layouts: ResMut<Assets<TextureAtlasLayout>>,
145) {
146 commands.spawn(Camera2d);
147 let gabe = asset_server.load("textures/rpg/chars/gabe/gabe-idle-run.png");
148 let animation_indices_gabe = AnimationIndices { first: 0, last: 6 };
149 let gabe_atlas = TextureAtlas {
150 layout: texture_atlas_layouts.add(TextureAtlasLayout::from_grid(
151 UVec2::splat(24),
152 7,
153 1,
154 None,
155 None,
156 )),
157 index: animation_indices_gabe.first,
158 };
159
160 let sprite_sheets = [
161 SpriteSheet {
162 size: Vec2::new(120., 50.),
163 text: "Stretched".to_string(),
164 transform: Transform::from_translation(Vec3::new(-570., -200., 0.)),
165 texture: gabe.clone(),
166 image_mode: SpriteImageMode::Auto,
167 atlas: gabe_atlas.clone(),
168 indices: animation_indices_gabe.clone(),
169 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
170 },
171 SpriteSheet {
172 size: Vec2::new(120., 50.),
173 text: "Fill Center".to_string(),
174 transform: Transform::from_translation(Vec3::new(-570., -300., 0.)),
175 texture: gabe.clone(),
176 image_mode: SpriteImageMode::Scale(ScalingMode::FillCenter),
177 atlas: gabe_atlas.clone(),
178 indices: animation_indices_gabe.clone(),
179 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
180 },
181 SpriteSheet {
182 size: Vec2::new(120., 50.),
183 text: "Fill Start".to_string(),
184 transform: Transform::from_translation(Vec3::new(-430., -200., 0.)),
185 texture: gabe.clone(),
186 image_mode: SpriteImageMode::Scale(ScalingMode::FillStart),
187 atlas: gabe_atlas.clone(),
188 indices: animation_indices_gabe.clone(),
189 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
190 },
191 SpriteSheet {
192 size: Vec2::new(120., 50.),
193 text: "Fill End".to_string(),
194 transform: Transform::from_translation(Vec3::new(-430., -300., 0.)),
195 texture: gabe.clone(),
196 image_mode: SpriteImageMode::Scale(ScalingMode::FillEnd),
197 atlas: gabe_atlas.clone(),
198 indices: animation_indices_gabe.clone(),
199 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
200 },
201 SpriteSheet {
202 size: Vec2::new(50., 120.),
203 text: "Fill Center".to_string(),
204 transform: Transform::from_translation(Vec3::new(-300., -250., 0.)),
205 texture: gabe.clone(),
206 image_mode: SpriteImageMode::Scale(ScalingMode::FillCenter),
207 atlas: gabe_atlas.clone(),
208 indices: animation_indices_gabe.clone(),
209 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
210 },
211 SpriteSheet {
212 size: Vec2::new(50., 120.),
213 text: "Fill Start".to_string(),
214 transform: Transform::from_translation(Vec3::new(-190., -250., 0.)),
215 texture: gabe.clone(),
216 image_mode: SpriteImageMode::Scale(ScalingMode::FillStart),
217 atlas: gabe_atlas.clone(),
218 indices: animation_indices_gabe.clone(),
219 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
220 },
221 SpriteSheet {
222 size: Vec2::new(50., 120.),
223 text: "Fill End".to_string(),
224 transform: Transform::from_translation(Vec3::new(-90., -250., 0.)),
225 texture: gabe.clone(),
226 image_mode: SpriteImageMode::Scale(ScalingMode::FillEnd),
227 atlas: gabe_atlas.clone(),
228 indices: animation_indices_gabe.clone(),
229 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
230 },
231 SpriteSheet {
232 size: Vec2::new(120., 50.),
233 text: "Fit Center".to_string(),
234 transform: Transform::from_translation(Vec3::new(20., -200., 0.)),
235 texture: gabe.clone(),
236 image_mode: SpriteImageMode::Scale(ScalingMode::FitCenter),
237 atlas: gabe_atlas.clone(),
238 indices: animation_indices_gabe.clone(),
239 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
240 },
241 SpriteSheet {
242 size: Vec2::new(120., 50.),
243 text: "Fit Start".to_string(),
244 transform: Transform::from_translation(Vec3::new(20., -300., 0.)),
245 texture: gabe.clone(),
246 image_mode: SpriteImageMode::Scale(ScalingMode::FitStart),
247 atlas: gabe_atlas.clone(),
248 indices: animation_indices_gabe.clone(),
249 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
250 },
251 SpriteSheet {
252 size: Vec2::new(120., 50.),
253 text: "Fit End".to_string(),
254 transform: Transform::from_translation(Vec3::new(160., -200., 0.)),
255 texture: gabe.clone(),
256 image_mode: SpriteImageMode::Scale(ScalingMode::FitEnd),
257 atlas: gabe_atlas.clone(),
258 indices: animation_indices_gabe.clone(),
259 timer: AnimationTimer(Timer::from_seconds(0.1, TimerMode::Repeating)),
260 },
261 ];
262
263 for sprite_sheet in sprite_sheets {
264 let mut cmd = commands.spawn((
265 Sprite {
266 image_mode: sprite_sheet.image_mode,
267 custom_size: Some(sprite_sheet.size),
268 ..Sprite::from_atlas_image(sprite_sheet.texture.clone(), sprite_sheet.atlas.clone())
269 },
270 sprite_sheet.indices,
271 sprite_sheet.timer,
272 sprite_sheet.transform,
273 ));
274
275 cmd.with_children(|builder| {
276 builder.spawn((
277 Text2d::new(sprite_sheet.text),
278 TextLayout::new_with_justify(JustifyText::Center),
279 TextFont::from_font_size(15.),
280 Transform::from_xyz(0., -0.5 * sprite_sheet.size.y - 10., 0.),
281 bevy::sprite::Anchor::TopCenter,
282 ));
283 });
284 }
285}
Sourcepub fn from_color(color: impl Into<Color>, size: Vec2) -> Sprite
pub fn from_color(color: impl Into<Color>, size: Vec2) -> Sprite
Create a sprite from a solid color
Examples found in repository?
62fn setup_2d(mut commands: Commands) {
63 commands.spawn((
64 Camera2d,
65 Camera {
66 // render the 2d camera after the 3d camera
67 order: 1,
68 // do not use a clear color
69 clear_color: ClearColorConfig::None,
70 ..default()
71 },
72 ));
73 commands.spawn(Sprite::from_color(
74 Color::srgb(0.25, 0.25, 0.75),
75 Vec2::new(50.0, 50.0),
76 ));
77}
More examples
138fn setup_2d(mut commands: Commands) {
139 commands.spawn((
140 Camera2d,
141 Camera {
142 // render the 2d camera after the 3d camera
143 order: 1,
144 // do not use a clear color
145 clear_color: ClearColorConfig::None,
146 ..default()
147 },
148 ));
149 commands.spawn(Sprite::from_color(
150 Color::srgb(0.25, 0.25, 0.75),
151 Vec2::new(50.0, 50.0),
152 ));
153}
152 fn new(location: WallLocation) -> (Wall, Sprite, Transform) {
153 (
154 Wall,
155 Sprite::from_color(WALL_COLOR, Vec2::ONE),
156 Transform {
157 // We need to convert our Vec2 into a Vec3, by giving it a z-coordinate
158 // This is used to determine the order of our sprites
159 translation: location.position().extend(0.0),
160 // The z-scale of 2D objects must always be 1.0,
161 // or their ordering will be affected in surprising ways.
162 // See https://github.com/bevyengine/bevy/issues/4149
163 scale: location.size().extend(1.0),
164 ..default()
165 },
166 )
167 }
168}
169
170// This resource tracks the game's score
171#[derive(Resource, Deref, DerefMut)]
172struct Score(usize);
173
174#[derive(Component)]
175struct ScoreboardUi;
176
177// Add the game's entities to our world
178fn setup(
179 mut commands: Commands,
180 mut meshes: ResMut<Assets<Mesh>>,
181 mut materials: ResMut<Assets<ColorMaterial>>,
182 asset_server: Res<AssetServer>,
183) {
184 // Camera
185 commands.spawn(Camera2d);
186
187 // Sound
188 let ball_collision_sound = asset_server.load("sounds/breakout_collision.ogg");
189 commands.insert_resource(CollisionSound(ball_collision_sound));
190
191 // Paddle
192 let paddle_y = BOTTOM_WALL + GAP_BETWEEN_PADDLE_AND_FLOOR;
193
194 commands.spawn((
195 Sprite::from_color(PADDLE_COLOR, Vec2::ONE),
196 Transform {
197 translation: Vec3::new(0.0, paddle_y, 0.0),
198 scale: PADDLE_SIZE.extend(1.0),
199 ..default()
200 },
201 Paddle,
202 Collider,
203 ));
204
205 // Ball
206 commands.spawn((
207 Mesh2d(meshes.add(Circle::default())),
208 MeshMaterial2d(materials.add(BALL_COLOR)),
209 Transform::from_translation(BALL_STARTING_POSITION)
210 .with_scale(Vec2::splat(BALL_DIAMETER).extend(1.)),
211 Ball,
212 Velocity(INITIAL_BALL_DIRECTION.normalize() * BALL_SPEED),
213 ));
214
215 // Scoreboard
216 commands.spawn((
217 Text::new("Score: "),
218 TextFont {
219 font_size: SCOREBOARD_FONT_SIZE,
220 ..default()
221 },
222 TextColor(TEXT_COLOR),
223 ScoreboardUi,
224 Node {
225 position_type: PositionType::Absolute,
226 top: SCOREBOARD_TEXT_PADDING,
227 left: SCOREBOARD_TEXT_PADDING,
228 ..default()
229 },
230 children![(
231 TextSpan::default(),
232 TextFont {
233 font_size: SCOREBOARD_FONT_SIZE,
234 ..default()
235 },
236 TextColor(SCORE_COLOR),
237 )],
238 ));
239
240 // Walls
241 commands.spawn(Wall::new(WallLocation::Left));
242 commands.spawn(Wall::new(WallLocation::Right));
243 commands.spawn(Wall::new(WallLocation::Bottom));
244 commands.spawn(Wall::new(WallLocation::Top));
245
246 // Bricks
247 let total_width_of_bricks = (RIGHT_WALL - LEFT_WALL) - 2. * GAP_BETWEEN_BRICKS_AND_SIDES;
248 let bottom_edge_of_bricks = paddle_y + GAP_BETWEEN_PADDLE_AND_BRICKS;
249 let total_height_of_bricks = TOP_WALL - bottom_edge_of_bricks - GAP_BETWEEN_BRICKS_AND_CEILING;
250
251 assert!(total_width_of_bricks > 0.0);
252 assert!(total_height_of_bricks > 0.0);
253
254 // Given the space available, compute how many rows and columns of bricks we can fit
255 let n_columns = (total_width_of_bricks / (BRICK_SIZE.x + GAP_BETWEEN_BRICKS)).floor() as usize;
256 let n_rows = (total_height_of_bricks / (BRICK_SIZE.y + GAP_BETWEEN_BRICKS)).floor() as usize;
257 let n_vertical_gaps = n_columns - 1;
258
259 // Because we need to round the number of columns,
260 // the space on the top and sides of the bricks only captures a lower bound, not an exact value
261 let center_of_bricks = (LEFT_WALL + RIGHT_WALL) / 2.0;
262 let left_edge_of_bricks = center_of_bricks
263 // Space taken up by the bricks
264 - (n_columns as f32 / 2.0 * BRICK_SIZE.x)
265 // Space taken up by the gaps
266 - n_vertical_gaps as f32 / 2.0 * GAP_BETWEEN_BRICKS;
267
268 // In Bevy, the `translation` of an entity describes the center point,
269 // not its bottom-left corner
270 let offset_x = left_edge_of_bricks + BRICK_SIZE.x / 2.;
271 let offset_y = bottom_edge_of_bricks + BRICK_SIZE.y / 2.;
272
273 for row in 0..n_rows {
274 for column in 0..n_columns {
275 let brick_position = Vec2::new(
276 offset_x + column as f32 * (BRICK_SIZE.x + GAP_BETWEEN_BRICKS),
277 offset_y + row as f32 * (BRICK_SIZE.y + GAP_BETWEEN_BRICKS),
278 );
279
280 // brick
281 commands.spawn((
282 Sprite {
283 color: BRICK_COLOR,
284 ..default()
285 },
286 Transform {
287 translation: brick_position.extend(0.0),
288 scale: Vec3::new(BRICK_SIZE.x, BRICK_SIZE.y, 1.0),
289 ..default()
290 },
291 Brick,
292 Collider,
293 ));
294 }
295 }
296}
26fn setup(
27 mut commands: Commands,
28 mut meshes: ResMut<Assets<Mesh>>,
29 mut materials: ResMut<Assets<ColorMaterial>>,
30 asset_server: Res<AssetServer>,
31) {
32 // Space between the two ears
33 let gap = 400.0;
34
35 // sound emitter
36 commands.spawn((
37 Mesh2d(meshes.add(Circle::new(15.0))),
38 MeshMaterial2d(materials.add(Color::from(BLUE))),
39 Transform::from_translation(Vec3::new(0.0, 50.0, 0.0)),
40 Emitter::default(),
41 AudioPlayer::new(asset_server.load("sounds/Windless Slopes.ogg")),
42 PlaybackSettings::LOOP.with_spatial(true),
43 ));
44
45 let listener = SpatialListener::new(gap);
46 commands.spawn((
47 Transform::default(),
48 Visibility::default(),
49 listener.clone(),
50 children![
51 // left ear
52 (
53 Sprite::from_color(RED, Vec2::splat(20.0)),
54 Transform::from_xyz(-gap / 2.0, 0.0, 0.0),
55 ),
56 // right ear
57 (
58 Sprite::from_color(LIME, Vec2::splat(20.0)),
59 Transform::from_xyz(gap / 2.0, 0.0, 0.0),
60 )
61 ],
62 ));
63
64 // example instructions
65 commands.spawn((
66 Text::new("Up/Down/Left/Right: Move Listener\nSpace: Toggle Emitter Movement"),
67 Node {
68 position_type: PositionType::Absolute,
69 bottom: Val::Px(12.0),
70 left: Val::Px(12.0),
71 ..default()
72 },
73 ));
74
75 // camera
76 commands.spawn(Camera2d);
77}
31fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
32 commands.spawn(Camera2d);
33
34 let len = 128.0;
35 let sprite_size = Vec2::splat(len / 2.0);
36
37 commands
38 .spawn((Transform::default(), Visibility::default()))
39 .with_children(|commands| {
40 for (anchor_index, anchor) in [
41 Anchor::TopLeft,
42 Anchor::TopCenter,
43 Anchor::TopRight,
44 Anchor::CenterLeft,
45 Anchor::Center,
46 Anchor::CenterRight,
47 Anchor::BottomLeft,
48 Anchor::BottomCenter,
49 Anchor::BottomRight,
50 Anchor::Custom(Vec2::new(0.5, 0.5)),
51 ]
52 .iter()
53 .enumerate()
54 {
55 let i = (anchor_index % 3) as f32;
56 let j = (anchor_index / 3) as f32;
57
58 // Spawn black square behind sprite to show anchor point
59 commands
60 .spawn((
61 Sprite::from_color(Color::BLACK, sprite_size),
62 Transform::from_xyz(i * len - len, j * len - len, -1.0),
63 Pickable::default(),
64 ))
65 .observe(recolor_on::<Pointer<Over>>(Color::srgb(0.0, 1.0, 1.0)))
66 .observe(recolor_on::<Pointer<Out>>(Color::BLACK))
67 .observe(recolor_on::<Pointer<Pressed>>(Color::srgb(1.0, 1.0, 0.0)))
68 .observe(recolor_on::<Pointer<Released>>(Color::srgb(0.0, 1.0, 1.0)));
69
70 commands
71 .spawn((
72 Sprite {
73 image: asset_server.load("branding/bevy_bird_dark.png"),
74 custom_size: Some(sprite_size),
75 color: Color::srgb(1.0, 0.0, 0.0),
76 anchor: anchor.to_owned(),
77 ..default()
78 },
79 // 3x3 grid of anchor examples by changing transform
80 Transform::from_xyz(i * len - len, j * len - len, 0.0)
81 .with_scale(Vec3::splat(1.0 + (i - 1.0) * 0.2))
82 .with_rotation(Quat::from_rotation_z((j - 1.0) * 0.2)),
83 Pickable::default(),
84 ))
85 .observe(recolor_on::<Pointer<Over>>(Color::srgb(0.0, 1.0, 0.0)))
86 .observe(recolor_on::<Pointer<Out>>(Color::srgb(1.0, 0.0, 0.0)))
87 .observe(recolor_on::<Pointer<Pressed>>(Color::srgb(0.0, 0.0, 1.0)))
88 .observe(recolor_on::<Pointer<Released>>(Color::srgb(0.0, 1.0, 0.0)));
89 }
90 });
91}
21fn setup(mut commands: Commands) {
22 commands.spawn(Camera2d);
23
24 let text_font = TextFont {
25 font_size: 10.0,
26 ..default()
27 };
28
29 let chunks = [
30 // "In" row
31 EaseFunction::SineIn,
32 EaseFunction::QuadraticIn,
33 EaseFunction::CubicIn,
34 EaseFunction::QuarticIn,
35 EaseFunction::QuinticIn,
36 EaseFunction::SmoothStepIn,
37 EaseFunction::SmootherStepIn,
38 EaseFunction::CircularIn,
39 EaseFunction::ExponentialIn,
40 EaseFunction::ElasticIn,
41 EaseFunction::BackIn,
42 EaseFunction::BounceIn,
43 // "Out" row
44 EaseFunction::SineOut,
45 EaseFunction::QuadraticOut,
46 EaseFunction::CubicOut,
47 EaseFunction::QuarticOut,
48 EaseFunction::QuinticOut,
49 EaseFunction::SmoothStepOut,
50 EaseFunction::SmootherStepOut,
51 EaseFunction::CircularOut,
52 EaseFunction::ExponentialOut,
53 EaseFunction::ElasticOut,
54 EaseFunction::BackOut,
55 EaseFunction::BounceOut,
56 // "InOut" row
57 EaseFunction::SineInOut,
58 EaseFunction::QuadraticInOut,
59 EaseFunction::CubicInOut,
60 EaseFunction::QuarticInOut,
61 EaseFunction::QuinticInOut,
62 EaseFunction::SmoothStep,
63 EaseFunction::SmootherStep,
64 EaseFunction::CircularInOut,
65 EaseFunction::ExponentialInOut,
66 EaseFunction::ElasticInOut,
67 EaseFunction::BackInOut,
68 EaseFunction::BounceInOut,
69 // "Other" row
70 EaseFunction::Linear,
71 EaseFunction::Steps(4, JumpAt::End),
72 EaseFunction::Steps(4, JumpAt::Start),
73 EaseFunction::Steps(4, JumpAt::Both),
74 EaseFunction::Steps(4, JumpAt::None),
75 EaseFunction::Elastic(50.0),
76 ]
77 .chunks(COLS);
78
79 let max_rows = chunks.clone().count();
80
81 let half_extent = EXTENT / 2.;
82 let half_size = PLOT_SIZE / 2.;
83
84 for (row, functions) in chunks.enumerate() {
85 for (col, function) in functions.iter().enumerate() {
86 let color = Hsla::hsl(col as f32 / COLS as f32 * 360.0, 0.8, 0.75).into();
87 commands
88 .spawn((
89 EaseFunctionPlot(*function, color),
90 Transform::from_xyz(
91 -half_extent.x + EXTENT.x / (COLS - 1) as f32 * col as f32,
92 half_extent.y - EXTENT.y / (max_rows - 1) as f32 * row as f32,
93 0.0,
94 ),
95 ))
96 .with_children(|p| {
97 // Marks the y value on the right side of the plot
98 p.spawn((
99 Sprite::from_color(color, Vec2::splat(5.0)),
100 Transform::from_xyz(half_size.x + 5.0, -half_size.y, 0.0),
101 ));
102 // Marks the x and y value inside the plot
103 p.spawn((
104 Sprite::from_color(color, Vec2::splat(4.0)),
105 Transform::from_xyz(-half_size.x, -half_size.y, 0.0),
106 ));
107
108 // Label
109 p.spawn((
110 Text2d(format!("{:?}", function)),
111 text_font.clone(),
112 TextColor(color),
113 Transform::from_xyz(0.0, -half_size.y - 15.0, 0.0),
114 ));
115 });
116 }
117 }
118 commands.spawn((
119 Text::default(),
120 Node {
121 position_type: PositionType::Absolute,
122 top: Val::Px(12.0),
123 left: Val::Px(12.0),
124 ..default()
125 },
126 ));
127}
Sourcepub fn compute_pixel_space_point(
&self,
point_relative_to_sprite: Vec2,
images: &Assets<Image>,
texture_atlases: &Assets<TextureAtlasLayout>,
) -> Result<Vec2, Vec2>
pub fn compute_pixel_space_point( &self, point_relative_to_sprite: Vec2, images: &Assets<Image>, texture_atlases: &Assets<TextureAtlasLayout>, ) -> Result<Vec2, Vec2>
Computes the pixel point where point_relative_to_sprite
is sampled
from in this sprite. point_relative_to_sprite
must be in the sprite’s
local frame. Returns an Ok if the point is inside the bounds of the
sprite (not just the image), and returns an Err otherwise.
Trait Implementations§
Source§impl Component for Sprite
Required Components: Transform
, Visibility
, SyncToRenderWorld
, VisibilityClass
.
impl Component for Sprite
Required Components: Transform
, Visibility
, SyncToRenderWorld
, VisibilityClass
.
A component’s Required Components are inserted whenever it is inserted. Note that this will also insert the required components of the required components, recursively, in depth-first order.
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::Table
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>
],
while immutable components will instead have [Component<Mutability = Immutable>
]. Read moreSource§fn register_required_components(
requiree: ComponentId,
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
inheritance_depth: u16,
recursion_check_stack: &mut Vec<ComponentId>,
)
fn register_required_components( requiree: ComponentId, components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, inheritance_depth: u16, recursion_check_stack: &mut Vec<ComponentId>, )
Source§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn register_component_hooks(hooks: &mut ComponentHooks)
fn register_component_hooks(hooks: &mut ComponentHooks)
Component::on_add
, etc.)ComponentHooks
.Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper
. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component
, this is populated by annotating fields containing entities with #[entities]
Read moreSource§impl FromArg for &'static Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromArg for &'static Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl FromArg for &'static mut Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromArg for &'static mut Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl FromArg for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromArg for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl FromReflect for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl FromReflect for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Sprite>
fn from_reflect(reflect: &(dyn PartialReflect + 'static)) -> Option<Sprite>
Self
from a reflected value.Source§fn take_from_reflect(
reflect: Box<dyn PartialReflect>,
) -> Result<Self, Box<dyn PartialReflect>>
fn take_from_reflect( reflect: Box<dyn PartialReflect>, ) -> Result<Self, Box<dyn PartialReflect>>
Self
using,
constructing the value using from_reflect
if that fails. Read moreSource§impl GetOwnership for &Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetOwnership for &Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl GetOwnership for &mut Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetOwnership for &mut Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl GetOwnership for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetOwnership for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl GetTypeRegistration for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl GetTypeRegistration for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn get_type_registration() -> TypeRegistration
fn get_type_registration() -> TypeRegistration
TypeRegistration
for this type.Source§fn register_type_dependencies(registry: &mut TypeRegistry)
fn register_type_dependencies(registry: &mut TypeRegistry)
Source§impl IntoReturn for &Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl IntoReturn for &Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl IntoReturn for &mut Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl IntoReturn for &mut Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl IntoReturn for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl IntoReturn for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§impl PartialReflect for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl PartialReflect for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
fn get_represented_type_info(&self) -> Option<&'static TypeInfo>
Source§fn try_apply(
&mut self,
value: &(dyn PartialReflect + 'static),
) -> Result<(), ApplyError>
fn try_apply( &mut self, value: &(dyn PartialReflect + 'static), ) -> Result<(), ApplyError>
Source§fn reflect_kind(&self) -> ReflectKind
fn reflect_kind(&self) -> ReflectKind
Source§fn reflect_ref(&self) -> ReflectRef<'_>
fn reflect_ref(&self) -> ReflectRef<'_>
Source§fn reflect_mut(&mut self) -> ReflectMut<'_>
fn reflect_mut(&mut self) -> ReflectMut<'_>
Source§fn reflect_owned(self: Box<Sprite>) -> ReflectOwned
fn reflect_owned(self: Box<Sprite>) -> ReflectOwned
Source§fn try_into_reflect(
self: Box<Sprite>,
) -> Result<Box<dyn Reflect>, Box<dyn PartialReflect>>
fn try_into_reflect( self: Box<Sprite>, ) -> 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<Sprite>) -> Box<dyn PartialReflect>
fn into_partial_reflect(self: Box<Sprite>) -> Box<dyn PartialReflect>
Source§fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
fn as_partial_reflect(&self) -> &(dyn PartialReflect + 'static)
Source§fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
fn as_partial_reflect_mut(&mut self) -> &mut (dyn PartialReflect + 'static)
Source§fn reflect_partial_eq(
&self,
value: &(dyn PartialReflect + 'static),
) -> Option<bool>
fn reflect_partial_eq( &self, value: &(dyn PartialReflect + 'static), ) -> Option<bool>
Source§fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
fn debug(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
fn reflect_clone(&self) -> Result<Box<dyn Reflect>, ReflectCloneError>
Self
using reflection. Read moreSource§fn apply(&mut self, value: &(dyn PartialReflect + 'static))
fn apply(&mut self, value: &(dyn PartialReflect + 'static))
Source§fn clone_value(&self) -> Box<dyn PartialReflect>
fn clone_value(&self) -> Box<dyn PartialReflect>
reflect_clone
. To convert reflected values to dynamic ones, use to_dynamic
.Self
into its dynamic representation. Read moreSource§fn to_dynamic(&self) -> Box<dyn PartialReflect>
fn to_dynamic(&self) -> Box<dyn PartialReflect>
Source§fn reflect_hash(&self) -> Option<u64>
fn reflect_hash(&self) -> Option<u64>
Source§fn is_dynamic(&self) -> bool
fn is_dynamic(&self) -> bool
Source§impl Reflect for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl Reflect for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
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<Sprite>) -> Box<dyn Reflect>
fn into_reflect(self: Box<Sprite>) -> 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 Struct for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl Struct for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Source§fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
fn field(&self, name: &str) -> Option<&(dyn PartialReflect + 'static)>
name
as a &dyn PartialReflect
.Source§fn field_mut(
&mut self,
name: &str,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_mut( &mut self, name: &str, ) -> Option<&mut (dyn PartialReflect + 'static)>
name
as a
&mut dyn PartialReflect
.Source§fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
fn field_at(&self, index: usize) -> Option<&(dyn PartialReflect + 'static)>
index
as a
&dyn PartialReflect
.Source§fn field_at_mut(
&mut self,
index: usize,
) -> Option<&mut (dyn PartialReflect + 'static)>
fn field_at_mut( &mut self, index: usize, ) -> Option<&mut (dyn PartialReflect + 'static)>
index
as a &mut dyn PartialReflect
.Source§fn name_at(&self, index: usize) -> Option<&str>
fn name_at(&self, index: usize) -> Option<&str>
index
.Source§fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn iter_fields(&self) -> FieldIter<'_> ⓘ
fn to_dynamic_struct(&self) -> DynamicStruct
Source§fn clone_dynamic(&self) -> DynamicStruct
fn clone_dynamic(&self) -> DynamicStruct
to_dynamic_struct
insteadDynamicStruct
.Source§fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
fn get_represented_struct_info(&self) -> Option<&'static StructInfo>
None
if TypeInfo
is not available.Source§impl TypePath for Sprite
impl TypePath for Sprite
Source§fn type_path() -> &'static str
fn type_path() -> &'static str
Source§fn short_type_path() -> &'static str
fn short_type_path() -> &'static str
Source§fn type_ident() -> Option<&'static str>
fn type_ident() -> Option<&'static str>
Source§fn crate_name() -> Option<&'static str>
fn crate_name() -> Option<&'static str>
Source§impl Typed for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
impl Typed for Spritewhere
Sprite: Any + Send + Sync,
Handle<Image>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<TextureAtlas>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Color: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
bool: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Vec2>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Option<Rect>: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Anchor: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
SpriteImageMode: FromReflect + TypePath + MaybeTyped + RegisterForReflection,
Auto Trait Implementations§
impl Freeze for Sprite
impl !RefUnwindSafe for Sprite
impl Send for Sprite
impl Sync for Sprite
impl Unpin for Sprite
impl !UnwindSafe for Sprite
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ids: &mut impl FnMut(ComponentId), )
Source§fn register_required_components(
components: &mut ComponentsRegistrator<'_>,
required_components: &mut RequiredComponents,
)
fn register_required_components( components: &mut ComponentsRegistrator<'_>, required_components: &mut RequiredComponents, )
Bundle
.Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
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<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components( self, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§impl<T> DynamicTypePath for Twhere
T: TypePath,
impl<T> DynamicTypePath for Twhere
T: TypePath,
Source§fn reflect_type_path(&self) -> &str
fn reflect_type_path(&self) -> &str
TypePath::type_path
.Source§fn reflect_short_type_path(&self) -> &str
fn reflect_short_type_path(&self) -> &str
Source§fn reflect_type_ident(&self) -> Option<&str>
fn reflect_type_ident(&self) -> Option<&str>
TypePath::type_ident
.Source§fn reflect_crate_name(&self) -> Option<&str>
fn reflect_crate_name(&self) -> Option<&str>
TypePath::crate_name
.Source§fn reflect_module_path(&self) -> Option<&str>
fn reflect_module_path(&self) -> Option<&str>
Source§impl<T> DynamicTyped for Twhere
T: Typed,
impl<T> DynamicTyped for Twhere
T: Typed,
Source§fn reflect_type_info(&self) -> &'static TypeInfo
fn reflect_type_info(&self) -> &'static TypeInfo
Typed::type_info
.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self
using default()
.
Source§impl<S> GetField for Swhere
S: Struct,
impl<S> GetField for Swhere
S: Struct,
Source§impl<T> GetPath for T
impl<T> GetPath for T
Source§fn reflect_path<'p>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path<'p>( &self, path: impl ReflectPath<'p>, ) -> Result<&(dyn PartialReflect + 'static), ReflectPathError<'p>>
path
. Read moreSource§fn reflect_path_mut<'p>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
fn reflect_path_mut<'p>( &mut self, path: impl ReflectPath<'p>, ) -> Result<&mut (dyn PartialReflect + 'static), ReflectPathError<'p>>
path
. Read moreSource§fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
fn path<'p, T>(
&self,
path: impl ReflectPath<'p>,
) -> Result<&T, ReflectPathError<'p>>where
T: Reflect,
path
. Read moreSource§fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
fn path_mut<'p, T>(
&mut self,
path: impl ReflectPath<'p>,
) -> Result<&mut T, ReflectPathError<'p>>where
T: Reflect,
path
. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.Source§impl<T> 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.