-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Anchor Copy #9327
Make Anchor Copy #9327
Conversation
Definitely agree on Anchor, not totally sold on Sprite 🤔 |
The one objection I can see for Sprite is that it might in the future hold a Otherwise it's a 68 bytes struct where each field themselves are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely agree on Anchor, not totally sold on Sprite 🤔
I'm going to mirror this concern. Adding Copy changes the semantics of the type, and any changes to revert this is going to be a very painful breaking change. @cart has mentioned multiple times that types should be Copy within the codebase if and only if you can treat the type as values (i.e. Vec2, Transform), and I don't think Sprites logically meet this criteria.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree that Sprite should not be copy. I removed that derive.
Objective
In
bevy_sprite
, theAnchor
type is notCopy
. It makes interacting with it more difficult than necessary.Solution
Derive
Copy
on it. The rust API guidelines are that you should deriveCopy
when possible. https://rust-lang.github.io/api-guidelines/interoperability.html#types-eagerly-implement-common-traits-c-common-traitsRegardless,
Anchor
is a very smallenum
which warrantsCopy
.Changelog
bevy_sprite
Anchor
is nowCopy
.