bevy/crates/bevy_ecs/src/entity
Zeenobit 7d816aab04
Fix inconsistency between Debug and serialized representation of Entity (#12469)
# Objective

Fixes #12139 

## Solution

- Derive `Debug` impl for `Entity`
- Add impl `Display` for `Entity`
- Add `entity_display` test to check the output contains all required
info

I decided to go with `0v0|1234` format as opposed to the `0v0[1234]`
which was initially discussed in the issue.

My rationale for this is that `[1234]` may be confused for index values,
which may be common in logs, and so searching for entities by text would
become harder. I figured `|1234` would help the entity IDs stand out
more.

Additionally, I'm a little concerned that this change is gonna break
existing logging for projects because `Debug` is now going to be a
multi-line output. But maybe this is ok.

We could implement `Debug` to be a single-line output, but then I don't
see why it would be different from `Display` at all.

@alice-i-cecile Let me know if we'd like to make any changes based on
these points.
2024-03-14 14:57:22 +00:00
..
hash.rs Move EntityHash related types into bevy_ecs (#11498) 2024-02-12 15:02:24 +00:00
map_entities.rs Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
mod.rs Fix inconsistency between Debug and serialized representation of Entity (#12469) 2024-03-14 14:57:22 +00:00