-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Add derives to mouse structs #270
Conversation
This is a stylistic choice, but I think anything that is a "value type" should impl Copy. Ex: I think by default, most structs don't meet my bar for Copy and should instead require explicit clones. I'm happy to discuss it, but I think my preference here is to just impl |
That's interesting! I thought that best practice was to implement Copy where possible because it can be much more performant than clone() in many cases. (Edit: the compiler can often determine when a clone should be a bytewise copy, but it is not a guarantee) The major downside to implementing Copy, as far as I can see, is that if a non-Copy field is added to the struct in the future, it will cause a breaking change by forcing the removal of Copy and invalidating any code that relies on it instead of clone(). However, it sounds like breaking changes are a non-issue for Bevy right now. For something that is probably being used in many places every frame, does the potential performance price of clone() matter to you? If not, I'll make the changes you requested! |
Yeah you might be right about it being a performance optimization, but i would still prefer it if we made the change. Explicit clones make you think about type ownership, which I think is worth the potential perf cost (but its probably all in the noise anyway). |
Sounds good! This is probably a case of premature optimization anyway. 😄 |
Build failures appear to be azure's mirrors of the ubuntu repos. We probably just need to wait a bit. |
add Copy to MouseScrollUnit
This is a proposed fix for issue #269
This adds Copy, as well as any other derives where possible.