Skip to content

Commit

Permalink
Make Anchor Copy (#9327)
Browse files Browse the repository at this point in the history
# Objective

In `bevy_sprite`, the `Anchor` type is not `Copy`. It makes interacting
with it more difficult than necessary.

## Solution

Derive `Copy` on it. The rust API guidelines are that you should derive
`Copy` when possible.
<https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traits>
Regardless, `Anchor` is a very small `enum` which warrants `Copy`.

---

## Changelog

- In `bevy_sprite` `Anchor` is now `Copy`.

---------

Co-authored-by: Carter Anderson <[email protected]>
  • Loading branch information
nicopap and cart authored Aug 11, 2023
1 parent ad4ec14 commit b702811
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_sprite/src/sprite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct Sprite {

/// How a sprite is positioned relative to its [`Transform`](bevy_transform::components::Transform).
/// It defaults to `Anchor::Center`.
#[derive(Component, Debug, Clone, Default, Reflect)]
#[derive(Component, Debug, Clone, Copy, Default, Reflect)]
#[doc(alias = "pivot")]
pub enum Anchor {
#[default]
Expand Down

0 comments on commit b702811

Please sign in to comment.