derive Debug, Clone for FixedState (StableAHash) (#2694)

This matches `ahash::RandomState`, which provides both `Debug` and `Clone`.

Notably, implementing `Clone` allows the `StableHashMap`/`Set` to also implement `Clone`.

# Objective

- Allow `bevy_utils::StableHashMap` to be cloned.

## Solution

- Derive `Clone` for `bevy_utils::FixedState`.
- Also derive `Debug`, since we're touching it anyway, and this aligns `FixedState` with `ahash::RandomState`.
This commit is contained in:
Christopher Durham 2021-08-24 01:31:39 +00:00
parent 62e4e59a86
commit 481fa3c7a0

View file

@ -16,7 +16,7 @@ pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>; pub type BoxedFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
/// A hasher builder that will create a fixed hasher. /// A hasher builder that will create a fixed hasher.
#[derive(Default)] #[derive(Debug, Clone, Default)]
pub struct FixedState; pub struct FixedState;
impl std::hash::BuildHasher for FixedState { impl std::hash::BuildHasher for FixedState {