From d84c7f9066d095f5837049b29e1e6688dcc63cba Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Thu, 19 Aug 2021 20:02:25 +0000 Subject: [PATCH] Reduce visibility of various types and fields (#2690) See the individual commits. --- crates/bevy_ecs/src/archetype.rs | 4 ++-- crates/bevy_ecs/src/schedule/run_criteria.rs | 22 +++++++++---------- .../bevy_ecs/src/schedule/system_container.rs | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/bevy_ecs/src/archetype.rs b/crates/bevy_ecs/src/archetype.rs index 5a718bd6ba..66423ffee2 100644 --- a/crates/bevy_ecs/src/archetype.rs +++ b/crates/bevy_ecs/src/archetype.rs @@ -110,8 +110,8 @@ struct TableInfo { } pub(crate) struct ArchetypeSwapRemoveResult { - pub swapped_entity: Option, - pub table_row: usize, + pub(crate) swapped_entity: Option, + pub(crate) table_row: usize, } pub(crate) struct ArchetypeComponentInfo { diff --git a/crates/bevy_ecs/src/schedule/run_criteria.rs b/crates/bevy_ecs/src/schedule/run_criteria.rs index 7e3da8a5f3..56c43452d3 100644 --- a/crates/bevy_ecs/src/schedule/run_criteria.rs +++ b/crates/bevy_ecs/src/schedule/run_criteria.rs @@ -61,12 +61,12 @@ impl Default for BoxedRunCriteria { } impl BoxedRunCriteria { - pub fn set(&mut self, criteria_system: BoxedSystem<(), ShouldRun>) { + pub(crate) fn set(&mut self, criteria_system: BoxedSystem<(), ShouldRun>) { self.criteria_system = Some(criteria_system); self.initialized = false; } - pub fn should_run(&mut self, world: &mut World) -> ShouldRun { + pub(crate) fn should_run(&mut self, world: &mut World) -> ShouldRun { if let Some(ref mut run_criteria) = self.criteria_system { if !self.initialized { run_criteria.initialize(world); @@ -99,16 +99,16 @@ pub(crate) enum RunCriteriaInner { } pub(crate) struct RunCriteriaContainer { - pub should_run: ShouldRun, - pub inner: RunCriteriaInner, - pub label: Option, - pub before: Vec, - pub after: Vec, + pub(crate) should_run: ShouldRun, + pub(crate) inner: RunCriteriaInner, + pub(crate) label: Option, + pub(crate) before: Vec, + pub(crate) after: Vec, archetype_generation: ArchetypeGeneration, } impl RunCriteriaContainer { - pub fn from_descriptor(descriptor: RunCriteriaDescriptor) -> Self { + pub(crate) fn from_descriptor(descriptor: RunCriteriaDescriptor) -> Self { Self { should_run: ShouldRun::Yes, inner: match descriptor.system { @@ -122,21 +122,21 @@ impl RunCriteriaContainer { } } - pub fn name(&self) -> Cow<'static, str> { + pub(crate) fn name(&self) -> Cow<'static, str> { match &self.inner { RunCriteriaInner::Single(system) => system.name(), RunCriteriaInner::Piped { system, .. } => system.name(), } } - pub fn initialize(&mut self, world: &mut World) { + pub(crate) fn initialize(&mut self, world: &mut World) { match &mut self.inner { RunCriteriaInner::Single(system) => system.initialize(world), RunCriteriaInner::Piped { system, .. } => system.initialize(world), } } - pub fn update_archetypes(&mut self, world: &World) { + pub(crate) fn update_archetypes(&mut self, world: &World) { let archetypes = world.archetypes(); let new_generation = archetypes.generation(); let old_generation = std::mem::replace(&mut self.archetype_generation, new_generation); diff --git a/crates/bevy_ecs/src/schedule/system_container.rs b/crates/bevy_ecs/src/schedule/system_container.rs index 727c007e68..68e493da71 100644 --- a/crates/bevy_ecs/src/schedule/system_container.rs +++ b/crates/bevy_ecs/src/schedule/system_container.rs @@ -36,7 +36,7 @@ pub(super) struct ExclusiveSystemContainer { } impl ExclusiveSystemContainer { - pub fn from_descriptor(descriptor: ExclusiveSystemDescriptor) -> Self { + pub(super) fn from_descriptor(descriptor: ExclusiveSystemDescriptor) -> Self { ExclusiveSystemContainer { system: descriptor.system, run_criteria_index: None, @@ -49,7 +49,7 @@ impl ExclusiveSystemContainer { } } - pub fn system_mut(&mut self) -> &mut Box { + pub(super) fn system_mut(&mut self) -> &mut Box { &mut self.system } }