-
-
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
Implemented #[bundle(ignore)]
and #[bundle(nest)]
#5579
Conversation
I'm fine with this limitation as this feature is overwhelmingly going to be used for |
From a user perspective, I like this change. I tested the changes with a field with [bundle(ignore)] that doesn't implement Default and the error message is clear that you need to impl Default FWIW. |
Breaking change since |
crates/bevy_ecs/src/bundle.rs
Outdated
/// a: A, | ||
/// z: Z, | ||
/// #[bundle(ignore)] | ||
/// other: Other, |
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.
IMO we should use a PhantomData
type + a bundle generic here, as it much more clearly motivates this feature.
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.
In the new PR I added the PhantomData
but left this because I figured it demonstrates the Default
trait requirement. Let me know if you want me to remove it.
crates/bevy_ui/src/ui_node.rs
Outdated
@@ -20,6 +20,16 @@ pub struct Node { | |||
} | |||
|
|||
/// An enum that describes possible types of value in flexbox layout options | |||
/// | |||
/// There are numeric traits implemented for this enum so you can multiply, divide, add, and subtract |
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.
These changes are unrelated; please remove them :)
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.
oh sorry! that must have slipped in somehow!
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.
Due to a bug in GitHub I had to create another PR for this: #5628
Objective
Fixes #5559
Solution
Because the generated method
from_components()
creates an instance ofSelf
my implementation requires any field type that is marked to be ignored to implementDefault
.Migration Guide
In
#[derive(Bundle)]
structs:#[bundle]
=>#[bundle(nest)]