-
-
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
Add Display implementation to DebugName. #13760
Add Display implementation to DebugName. #13760
Conversation
…ties which have one or the entity's own Display impl for entities which don't.
…part was redundant (it was generation << 32 | index). This might be contraversial and isn't required for the DebugName change.
I don't like this change personally, but we should definitely split this off to make sure the other work doesn't get blocked. |
…he bits part was redundant (it was generation << 32 | index). This might be contraversial and isn't required for the DebugName change." This reverts commit 38d14fa.
…s the Display for entities is more verbose than this.
I've updated to no longer change the Display implementation for Entity and instead use {index}v{generation} directly in DebugName. |
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.
Good change, just some minor nitpicks :)
crates/bevy_core/src/name.rs
Outdated
@@ -100,26 +100,31 @@ impl std::fmt::Debug for Name { | |||
/// for (name, mut score) in &mut scores { | |||
/// score.0 += 1.0; | |||
/// if score.0.is_nan() { | |||
/// bevy_utils::tracing::error!("Score for {:?} is invalid", name); | |||
/// // use the Display impl to return either the Name |
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.
This kind of implementation information seems a bit too in-depth for an example. Additionally, the part about debug being more verbose is imo implicitly to be expected.
Suggestion: move this information outside of the example (maybe a section # Implementation
?) and remove references to Debug
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.
Thanks for this, have updated the code if you could check its what you meant.
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.
Perfect, thanks :)
review comment Co-authored-by: Jan Hohenheim <[email protected]>
review fix Co-authored-by: Andres O. Vela <[email protected]>
Part of the original change was to make Display on an entity simpler (get rid of the redundant bit), but that change was I think more controversial than this. I’d support doing that, so this change is just a switch between two displays. |
# Objective bevyengine#12469 changed the `Debug` impl for `Entity`, making sure it's actually accurate for debugging. To ensure that its can still be readily logged in error messages and inspectors, this PR added a more concise and human-friendly `Display` impl. However, users found this form too verbose: the `to_bits` information was unhelpful and too long. Fixes bevyengine#13980. ## Solution - Don't include `Entity::to_bits` in the `Display` implementation for `Entity`. This information can readily be accessed and logged for users who need it. - Also clean up the implementation of `Display` for `DebugName`, introduced in bevyengine#13760, to simply use the new `Display` impl (since this was the desired format there). ## Testing I've updated an existing test to verify the output of `Entity::display`. --------- Co-authored-by: Kristoffer Søholm <[email protected]>
accurate for debugging. To ensure that its can still be readily logged in error messages and inspectors, this PR added a more concise and human-friendly `Display` impl. However, users found this form too verbose: the `to_bits` information was unhelpful and too long. Fixes #13980. - Don't include `Entity::to_bits` in the `Display` implementation for `Entity`. This information can readily be accessed and logged for users who need it. - Also clean up the implementation of `Display` for `DebugName`, introduced in #13760, to simply use the new `Display` impl (since this was the desired format there). I've updated an existing test to verify the output of `Entity::display`. --------- Co-authored-by: Kristoffer Søholm <[email protected]>
@alice-i-cecile will this automatically go into 0.15 or can it go into an update to 0.14? |
Looks like this will be in 0.15 :) |
Objective
Solution
Testing
Migration Guide