Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
doonv committed Feb 12, 2024
1 parent 04a83e8 commit 290efce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion crates/bevy_ecs/src/entity/hash.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use std::hash::{BuildHasher, Hasher};

#[cfg(feature = "bevy_reflect")]
use bevy_reflect::Reflect;
use bevy_utils::hashbrown;

use super::Entity;

/// A [`BuildHasher`] that results in a [`EntityHasher`].
#[derive(Default, Clone, Reflect)]
#[derive(Default, Clone)]
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
pub struct EntityHash;

impl BuildHasher for EntityHash {
Expand Down Expand Up @@ -85,11 +87,13 @@ pub type EntityHashSet = hashbrown::HashSet<Entity, EntityHash>;
#[cfg(test)]
mod tests {
use super::*;
#[cfg(feature = "bevy_reflect")]
use bevy_reflect::Reflect;
use static_assertions::assert_impl_all;

// Check that the HashMaps are Clone if the key/values are Clone
assert_impl_all!(EntityHashMap::<usize>: Clone);
// EntityHashMap should implement Reflect
#[cfg(feature = "bevy_reflect")]
assert_impl_all!(EntityHashMap::<i32>: Reflect);
}
9 changes: 7 additions & 2 deletions crates/bevy_ecs/src/entity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
//! [`EntityWorldMut::insert`]: crate::world::EntityWorldMut::insert
//! [`EntityWorldMut::remove`]: crate::world::EntityWorldMut::remove
mod map_entities;
#[cfg(feature = "bevy_reflect")]
use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize};
pub use map_entities::*;

Expand Down Expand Up @@ -126,8 +127,12 @@ type IdCursor = isize;
/// [`EntityCommands`]: crate::system::EntityCommands
/// [`Query::get`]: crate::system::Query::get
/// [`World`]: crate::world::World
#[derive(Clone, Copy, Reflect)]
#[reflect_value(Hash, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy)]
#[cfg_attr(feature = "bevy_reflect", derive(Reflect))]
#[cfg_attr(
feature = "bevy_reflect",
reflect_value(Hash, PartialEq, Serialize, Deserialize)
)]
// Alignment repr necessary to allow LLVM to better output
// optimised codegen for `to_bits`, `PartialEq` and `Ord`.
#[repr(C, align(8))]
Expand Down

0 comments on commit 290efce

Please sign in to comment.