Skip to content
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

[Merged by Bors] - Use a fixed state hasher in bevy_reflect for deterministic Reflect::reflect_hash() across processes #7583

Closed
wants to merge 6 commits into from
Closed
Prev Previous commit
Next Next commit
Add doc comment for bevy_reflect::utility::reflect_hasher
  • Loading branch information
johanhelsing committed Feb 14, 2023
commit d4475d1676d259ec445b47ce57083becf19ff149
5 changes: 5 additions & 0 deletions crates/bevy_reflect/src/utility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ impl GenericTypeInfoCell {
}
}

/// Deterministic fixed state hasher to be used by implementors of [`Reflect::reflect_hash`].
///
/// Hashes should be deterministic across processes so hashes can be used as
/// checksums for saved scenes, rollback snapshots etc. This function returns
/// such a hasher.
#[inline]
pub fn reflect_hasher() -> bevy_utils::AHasher {
FixedState.build_hasher()
Expand Down