Skip to content

Commit 1a85648

Browse files
Re-export hash_map + hash_set modules rather than renaming
1 parent 4df86f6 commit 1a85648

File tree

39 files changed

+70
-63
lines changed

39 files changed

+70
-63
lines changed

benches/benches/bevy_ecs/world/entity_hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use bevy_ecs::entity::{Entity, EntityHashSet};
1+
use bevy_ecs::entity::{hash_set::EntityHashSet, Entity};
22
use criterion::{BenchmarkId, Criterion, Throughput};
33
use rand::{Rng, SeedableRng};
44
use rand_chacha::ChaCha8Rng;

crates/bevy_core_pipeline/src/oit/resolve/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use bevy_app::Plugin;
66
use bevy_asset::{load_internal_asset, Handle};
77
use bevy_derive::Deref;
88
use bevy_ecs::{
9-
entity::{EntityHashMap, EntityHashSet},
9+
entity::{hash_set::EntityHashSet, hash_map::EntityHashMap},
1010
prelude::*,
1111
};
1212
use bevy_image::BevyDefault as _;

crates/bevy_ecs/src/entity/hash_map.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Contains the [`EntityHashMap`] type, a [`HashMap`] pre-configured to use [`EntityHash`] hashing.
2+
//!
3+
//! This module is a lightweight wrapper around [`hashbrown`](bevy_utils::hashbrown)'s [`HashMap`] that is more performant for [`Entity`] keys.
4+
15
use core::{
26
fmt::{self, Debug, Formatter},
37
iter::FusedIterator,

crates/bevy_ecs/src/entity/hash_set.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//! Contains the [`EntityHashSet`] type, a [`HashSet`] pre-configured to use [`EntityHash`] hashing.
2+
//!
3+
//! This module is a lightweight wrapper around [`hashbrown`](bevy_utils::hashbrown)'s [`HashSet`] that is more performant for [`Entity`] keys.
4+
15
use core::{
26
fmt::{self, Debug, Formatter},
37
iter::FusedIterator,

crates/bevy_ecs/src/entity/map_entities.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
world::World,
55
};
66

7-
use super::{EntityHashMap, VisitEntitiesMut};
7+
use super::{hash_map::EntityHashMap, VisitEntitiesMut};
88

99
/// Operation to map all contained [`Entity`] fields in a type to new values.
1010
///
@@ -71,7 +71,7 @@ impl<T: VisitEntitiesMut> MapEntities for T {
7171
///
7272
/// ```
7373
/// # use bevy_ecs::entity::{Entity, EntityMapper};
74-
/// # use bevy_ecs::entity::EntityHashMap;
74+
/// # use bevy_ecs::entity::hash_map::EntityHashMap;
7575
/// #
7676
/// pub struct SimpleEntityMapper {
7777
/// map: EntityHashMap<Entity>,
@@ -194,7 +194,7 @@ impl<'m> SceneEntityMapper<'m> {
194194
#[cfg(test)]
195195
mod tests {
196196
use crate::{
197-
entity::{Entity, EntityHashMap, EntityMapper, SceneEntityMapper},
197+
entity::{hash_map::EntityHashMap, Entity, EntityMapper, SceneEntityMapper},
198198
world::World,
199199
};
200200

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,8 @@ pub use visit_entities::*;
5353
mod hash;
5454
pub use hash::*;
5555

56-
mod hash_map;
57-
mod hash_set;
58-
59-
pub use hash_map::EntityHashMap;
60-
pub use hash_set::{EntityHashSet, EntityHashSetIter};
56+
pub mod hash_map;
57+
pub mod hash_set;
6158

6259
use crate::{
6360
archetype::{ArchetypeId, ArchetypeRow},

crates/bevy_ecs/src/entity/visit_entities.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl VisitEntitiesMut for Entity {
5858
mod tests {
5959
use crate::{
6060
self as bevy_ecs,
61-
entity::{EntityHashMap, MapEntities, SceneEntityMapper},
61+
entity::{hash_map::EntityHashMap, MapEntities, SceneEntityMapper},
6262
world::World,
6363
};
6464
use alloc::{string::String, vec, vec::Vec};

crates/bevy_ecs/src/observer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use runner::*;
99
use crate::{
1010
archetype::ArchetypeFlags,
1111
component::ComponentId,
12-
entity::EntityHashMap,
12+
entity::hash_map::EntityHashMap,
1313
prelude::*,
1414
system::IntoObserverSystem,
1515
world::{DeferredWorld, *},

crates/bevy_ecs/src/relationship/relationship_source_collection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::entity::{Entity, EntityHashSet};
1+
use crate::entity::{hash_set::EntityHashSet, Entity};
22
use alloc::vec::Vec;
33
use smallvec::SmallVec;
44

@@ -65,7 +65,7 @@ impl RelationshipSourceCollection for Vec<Entity> {
6565
}
6666

6767
impl RelationshipSourceCollection for EntityHashSet {
68-
type SourceIter<'a> = core::iter::Copied<crate::entity::EntityHashSetIter<'a>>;
68+
type SourceIter<'a> = core::iter::Copied<crate::entity::hash_set::EntityHashSetIter<'a>>;
6969

7070
fn with_capacity(capacity: usize) -> Self {
7171
EntityHashSet::with_capacity(capacity)

crates/bevy_ecs/src/world/deferred_world.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ impl<'w> DeferredWorld<'w> {
189189
/// For examples, see [`DeferredWorld::entity_mut`].
190190
///
191191
/// [`EntityMut`]: crate::world::EntityMut
192-
/// [`&EntityHashSet`]: crate::entity::EntityHashSet
193-
/// [`EntityHashMap<EntityMut>`]: crate::entity::EntityHashMap
192+
/// [`&EntityHashSet`]: crate::entity::hash_set::EntityHashSet
193+
/// [`EntityHashMap<EntityMut>`]: crate::entity::hash_map::EntityHashMap
194194
/// [`Vec<EntityMut>`]: alloc::vec::Vec
195195
#[inline]
196196
pub fn get_entity_mut<F: WorldEntityFetch>(
@@ -298,7 +298,7 @@ impl<'w> DeferredWorld<'w> {
298298
/// ## [`&EntityHashSet`]
299299
///
300300
/// ```
301-
/// # use bevy_ecs::{prelude::*, entity::EntityHashSet, world::DeferredWorld};
301+
/// # use bevy_ecs::{prelude::*, entity::hash_set::EntityHashSet, world::DeferredWorld};
302302
/// #[derive(Component)]
303303
/// struct Position {
304304
/// x: f32,
@@ -321,8 +321,8 @@ impl<'w> DeferredWorld<'w> {
321321
/// ```
322322
///
323323
/// [`EntityMut`]: crate::world::EntityMut
324-
/// [`&EntityHashSet`]: crate::entity::EntityHashSet
325-
/// [`EntityHashMap<EntityMut>`]: crate::entity::EntityHashMap
324+
/// [`&EntityHashSet`]: crate::entity::hash_set::EntityHashSet
325+
/// [`EntityHashMap<EntityMut>`]: crate::entity::hash_map::EntityHashMap
326326
/// [`Vec<EntityMut>`]: alloc::vec::Vec
327327
#[inline]
328328
pub fn entity_mut<F: WorldEntityFetch>(&mut self, entities: F) -> F::DeferredMut<'_> {

0 commit comments

Comments
 (0)