bevy
bevy copied to clipboard
Replace `DiagnosticId` by `DiagnosticPath`
Objective
Implements #9216
Solution
- Replace
DiagnosticIdbyDiagnosticPath. It's pre-hashed usingconst-fnv1a-hashcrate, so it's possible to create path in const contexts.
Changelog
-
Replaced
DiagnosticIdbyDiagnosticPath -
Set default history length to 120 measurements (2 seconds on 60 fps).
I've noticed hardcoded constant 20 everywhere and decided to change it to
DEFAULT_MAX_HISTORY_LENGTH, which is set to new diagnostics by default. To override it, usewith_max_history_length.
Migration Guide
- const UNIQUE_DIAG_ID: DiagnosticId = DiagnosticId::from_u128(42);
+ const UNIQUE_DIAG_PATH: DiagnosticPath = DiagnosticPath::const_new("foo/bar");
- Diagnostic::new(UNIQUE_DIAG_ID, "example", 10)
+ Diagnostic::new(UNIQUE_DIAG_PATH).with_max_history_length(10)
- diagnostics.add_measurement(UNIQUE_DIAG_ID, || 42);
+ diagnostics.add_measurement(&UNIQUE_DIAG_ID, || 42);
Hey, can you resolve merge conflicts? I'd like to get this in and at first glance this seems well-made.
I've resolved merge conflicts. Examples seem to work.