@@ -657,7 +657,7 @@ impl World {
657657 ///
658658 /// This is useful in contexts where you only have read-only access to the [`World`].
659659 #[ inline]
660- pub fn visit_entities ( & self ) -> impl Iterator < Item = EntityRef < ' _ > > + ' _ {
660+ pub fn iter_entities ( & self ) -> impl Iterator < Item = EntityRef < ' _ > > + ' _ {
661661 self . archetypes . iter ( ) . flat_map ( |archetype| {
662662 archetype
663663 . entities ( )
@@ -685,7 +685,7 @@ impl World {
685685 }
686686
687687 /// Returns a mutable iterator over all entities in the `World`.
688- pub fn visit_entities_mut ( & mut self ) -> impl Iterator < Item = EntityMut < ' _ > > + ' _ {
688+ pub fn iter_entities_mut ( & mut self ) -> impl Iterator < Item = EntityMut < ' _ > > + ' _ {
689689 let world_cell = self . as_unsafe_world_cell ( ) ;
690690 world_cell. archetypes ( ) . iter ( ) . flat_map ( move |archetype| {
691691 archetype
@@ -3396,7 +3396,7 @@ mod tests {
33963396
33973397 let iterate_and_count_entities = |world : & World , entity_counters : & mut HashMap < _ , _ > | {
33983398 entity_counters. clear ( ) ;
3399- for entity in world. visit_entities ( ) {
3399+ for entity in world. iter_entities ( ) {
34003400 let counter = entity_counters. entry ( entity. id ( ) ) . or_insert ( 0 ) ;
34013401 * counter += 1 ;
34023402 }
@@ -3473,7 +3473,7 @@ mod tests {
34733473 let b1 = world. spawn ( B ( 1 ) ) . id ( ) ;
34743474 let b2 = world. spawn ( B ( 2 ) ) . id ( ) ;
34753475
3476- for mut entity in world. visit_entities_mut ( ) {
3476+ for mut entity in world. iter_entities_mut ( ) {
34773477 if let Some ( mut a) = entity. get_mut :: < A > ( ) {
34783478 a. 0 -= 1 ;
34793479 }
@@ -3483,7 +3483,7 @@ mod tests {
34833483 assert_eq ! ( world. entity( b1) . get( ) , Some ( & B ( 1 ) ) ) ;
34843484 assert_eq ! ( world. entity( b2) . get( ) , Some ( & B ( 2 ) ) ) ;
34853485
3486- for mut entity in world. visit_entities_mut ( ) {
3486+ for mut entity in world. iter_entities_mut ( ) {
34873487 if let Some ( mut b) = entity. get_mut :: < B > ( ) {
34883488 b. 0 *= 2 ;
34893489 }
@@ -3493,7 +3493,7 @@ mod tests {
34933493 assert_eq ! ( world. entity( b1) . get( ) , Some ( & B ( 2 ) ) ) ;
34943494 assert_eq ! ( world. entity( b2) . get( ) , Some ( & B ( 4 ) ) ) ;
34953495
3496- let mut entities = world. visit_entities_mut ( ) . collect :: < Vec < _ > > ( ) ;
3496+ let mut entities = world. iter_entities_mut ( ) . collect :: < Vec < _ > > ( ) ;
34973497 entities. sort_by_key ( |e| e. get :: < A > ( ) . map ( |a| a. 0 ) . or ( e. get :: < B > ( ) . map ( |b| b. 0 ) ) ) ;
34983498 let ( a, b) = entities. split_at_mut ( 2 ) ;
34993499 core:: mem:: swap (
0 commit comments