-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
feat: derive some common traits on some UI types #12532
feat: derive some common traits on some UI types #12532
Conversation
impl Default for Text { | ||
fn default() -> Self { | ||
Self { | ||
sections: Default::default(), | ||
justify: JustifyText::Left, | ||
linebreak_behavior: BreakLineOn::WordBoundary, | ||
} | ||
} | ||
} |
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.
BreakLineOn::WordBoundary
is now the Default
value, so impl Default for Text
can be derive
d automatically
@@ -1796,7 +1796,7 @@ pub struct CalculatedClip { | |||
/// `ZIndex::Local(n)` and `ZIndex::Global(n)` for root nodes. | |||
/// | |||
/// Nodes without this component will be treated as if they had a value of `ZIndex::Local(0)`. | |||
#[derive(Component, Copy, Clone, Debug, Reflect)] |
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.
ZIndex
can impl Eq
because its variants are just newtypes around i32
s
@@ -4,6 +4,6 @@ use bevy_reflect::std_traits::ReflectDefault; | |||
use bevy_reflect::Reflect; | |||
|
|||
/// Marker struct for buttons | |||
#[derive(Component, Debug, Default, Clone, Copy, Reflect)] |
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.
Marker components can trivially impl
many traits
Objective
PartialEq
for comparing simple typesSolution
derive
s for some common UI typesNote that many types, unfortunately, can't have
PartialEq
derive
d for them, because they containf32
s and / orVec
s.