-
-
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
[Merged by Bors] - Derived Copy
trait for bevy_input
events, Serialize
/Deserialize
for events in bevy_input
and bevy_windows
, PartialEq
for events in both, and Eq
where possible in both.
#6023
Conversation
…vents in bevy_input. Added PartialEq trait to bevy_input events without it.
Copy
trait for bevy_input
events.Copy
trait for bevy_input
events, Serialize
/Deserialize
for events in bevy_input
and bevy_windows
, PartialEq
for events in both, and Eq
where possible in both.
…erde an optional dependency. Added conditional #derives for necessary types in bevy_window.
now you need to add bevy/crates/bevy_internal/Cargo.toml Line 48 in 28205fd
|
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.
All the bevy_window events need PartialEq impls :) The general strategy LGTM now though.
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.
Awesome, LGTM now!
Test serialization of Bevy's `Duration`, not `std::time::Duration`.
This PR's code should have ended with 29ebbd9 |
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.
Looks good to me! I just have one question.
@@ -4,7 +4,8 @@ use super::{WindowDescriptor, WindowId}; | |||
use bevy_math::{IVec2, Vec2}; | |||
|
|||
/// A window event that is sent whenever a window's logical size has changed. | |||
#[derive(Debug, Clone)] | |||
#[derive(Debug, Clone, PartialEq)] |
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.
Is it possible to derive Copy
for the items in this file?
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.
A number of them have String
or PathBuf
fields, so Copy
cannot be derived for those.
Is it worth deriving EDIT: nvm, just saw this: #6024 (comment) |
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.
Looks good to me! (Leaving an actual approval this time!)
bors r+ |
…e` for events in `bevy_input` and `bevy_windows`, `PartialEq` for events in both, and `Eq` where possible in both. (#6023) # Objective Add traits to events in `bevy_input` and `bevy_windows`: `Copy`, `Serialize`/`Deserialize`, `PartialEq`, and `Eq`, as requested in #6022, #6023, #6024. ## Solution Added the traits to events in `bevy_input` and `bevy_windows`. Added dependency of `serde` in `Cargo.toml` of `bevy_input`. ## Migration Guide If one has been `.clone()`'ing `bevy_input` events, Clippy will now complain about that. Just remove `.clone()` to solve. ## Other Notes Some events in `bevy_input` had `f32` fields, so `Eq` trait was not derived for them. Some events in `bevy_windows` had `String` fields, so `Copy` trait was not derived for them. Co-authored-by: targrub <62773321+targrub@users.noreply.github.com>
Build failed: |
Flaky failure, see #6036 bors retry |
…e` for events in `bevy_input` and `bevy_windows`, `PartialEq` for events in both, and `Eq` where possible in both. (#6023) # Objective Add traits to events in `bevy_input` and `bevy_windows`: `Copy`, `Serialize`/`Deserialize`, `PartialEq`, and `Eq`, as requested in #6022, #6023, #6024. ## Solution Added the traits to events in `bevy_input` and `bevy_windows`. Added dependency of `serde` in `Cargo.toml` of `bevy_input`. ## Migration Guide If one has been `.clone()`'ing `bevy_input` events, Clippy will now complain about that. Just remove `.clone()` to solve. ## Other Notes Some events in `bevy_input` had `f32` fields, so `Eq` trait was not derived for them. Some events in `bevy_windows` had `String` fields, so `Copy` trait was not derived for them. Co-authored-by: targrub <62773321+targrub@users.noreply.github.com>
Pull request successfully merged into main. Build succeeded: |
Copy
trait for bevy_input
events, Serialize
/Deserialize
for events in bevy_input
and bevy_windows
, PartialEq
for events in both, and Eq
where possible in both.Copy
trait for bevy_input
events, Serialize
/Deserialize
for events in bevy_input
and bevy_windows
, PartialEq
for events in both, and Eq
where possible in both.
…e` for events in `bevy_input` and `bevy_windows`, `PartialEq` for events in both, and `Eq` where possible in both. (bevyengine#6023) Add traits to events in `bevy_input` and `bevy_windows`: `Copy`, `Serialize`/`Deserialize`, `PartialEq`, and `Eq`, as requested in bevyengine#6022, bevyengine#6023, bevyengine#6024. Added the traits to events in `bevy_input` and `bevy_windows`. Added dependency of `serde` in `Cargo.toml` of `bevy_input`. If one has been `.clone()`'ing `bevy_input` events, Clippy will now complain about that. Just remove `.clone()` to solve. Some events in `bevy_input` had `f32` fields, so `Eq` trait was not derived for them. Some events in `bevy_windows` had `String` fields, so `Copy` trait was not derived for them. Co-authored-by: targrub <62773321+targrub@users.noreply.github.com>
…e` for events in `bevy_input` and `bevy_windows`, `PartialEq` for events in both, and `Eq` where possible in both. (bevyengine#6023) # Objective Add traits to events in `bevy_input` and `bevy_windows`: `Copy`, `Serialize`/`Deserialize`, `PartialEq`, and `Eq`, as requested in bevyengine#6022, bevyengine#6023, bevyengine#6024. ## Solution Added the traits to events in `bevy_input` and `bevy_windows`. Added dependency of `serde` in `Cargo.toml` of `bevy_input`. ## Migration Guide If one has been `.clone()`'ing `bevy_input` events, Clippy will now complain about that. Just remove `.clone()` to solve. ## Other Notes Some events in `bevy_input` had `f32` fields, so `Eq` trait was not derived for them. Some events in `bevy_windows` had `String` fields, so `Copy` trait was not derived for them. Co-authored-by: targrub <62773321+targrub@users.noreply.github.com>
…e` for events in `bevy_input` and `bevy_windows`, `PartialEq` for events in both, and `Eq` where possible in both. (bevyengine#6023) # Objective Add traits to events in `bevy_input` and `bevy_windows`: `Copy`, `Serialize`/`Deserialize`, `PartialEq`, and `Eq`, as requested in bevyengine#6022, bevyengine#6023, bevyengine#6024. ## Solution Added the traits to events in `bevy_input` and `bevy_windows`. Added dependency of `serde` in `Cargo.toml` of `bevy_input`. ## Migration Guide If one has been `.clone()`'ing `bevy_input` events, Clippy will now complain about that. Just remove `.clone()` to solve. ## Other Notes Some events in `bevy_input` had `f32` fields, so `Eq` trait was not derived for them. Some events in `bevy_windows` had `String` fields, so `Copy` trait was not derived for them. Co-authored-by: targrub <62773321+targrub@users.noreply.github.com>
…e` for events in `bevy_input` and `bevy_windows`, `PartialEq` for events in both, and `Eq` where possible in both. (bevyengine#6023) # Objective Add traits to events in `bevy_input` and `bevy_windows`: `Copy`, `Serialize`/`Deserialize`, `PartialEq`, and `Eq`, as requested in bevyengine#6022, bevyengine#6023, bevyengine#6024. ## Solution Added the traits to events in `bevy_input` and `bevy_windows`. Added dependency of `serde` in `Cargo.toml` of `bevy_input`. ## Migration Guide If one has been `.clone()`'ing `bevy_input` events, Clippy will now complain about that. Just remove `.clone()` to solve. ## Other Notes Some events in `bevy_input` had `f32` fields, so `Eq` trait was not derived for them. Some events in `bevy_windows` had `String` fields, so `Copy` trait was not derived for them. Co-authored-by: targrub <62773321+targrub@users.noreply.github.com>
Objective
Add traits to events in
bevy_input
andbevy_windows
:Copy
,Serialize
/Deserialize
,PartialEq
, andEq
, as requested in #6022, #6023, #6024.Solution
Added the traits to events in
bevy_input
andbevy_windows
. Added dependency ofserde
inCargo.toml
ofbevy_input
.Migration Guide
If one has been
.clone()
'ingbevy_input
events, Clippy will now complain about that. Just remove.clone()
to solve.Other Notes
Some events in
bevy_input
hadf32
fields, soEq
trait was not derived for them.Some events in
bevy_windows
hadString
fields, soCopy
trait was not derived for them.