Skip to content

Commit

Permalink
Expose SystemMeta field accessors (bevyengine#5497)
Browse files Browse the repository at this point in the history
  • Loading branch information
WinstonHartnett committed Jan 7, 2023
1 parent 076e6f7 commit 7321f25
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,36 @@ impl SystemMeta {
&self.name
}

/// Returns the system's component access set.
#[inline]
pub fn component_access_set(&self) -> &FilteredAccessSet<ComponentId> {
&self.component_access_set
}

/// Returns a mutable reference to the system's component access set.
///
/// # Safety
/// This allows unsafe modifications to the component access set that can violate Bevy's scheduling soundness.
#[inline]
pub unsafe fn component_access_set_mut(&mut self) -> &mut FilteredAccessSet<ComponentId> {
&mut self.component_access_set
}

/// Returns the system's archetype component access set.
#[inline]
pub fn archetype_component_access(&self) -> &Access<ArchetypeComponentId> {
&self.archetype_component_access
}

/// Returns a mutable reference to this system's archetype component access set.
///
/// # Safety
/// This allows unsafe modifications to the archetype component access set that can violate Bevy's scheduling soundness.
#[inline]
pub unsafe fn archetype_component_access_mut(&mut self) -> &mut Access<ArchetypeComponentId> {
&mut self.archetype_component_access
}

/// Returns true if the system is [`Send`].
#[inline]
pub fn is_send(&self) -> bool {
Expand All @@ -56,6 +86,18 @@ impl SystemMeta {
pub fn set_non_send(&mut self) {
self.is_send = false;
}

/// Returns this system's last change tick.
#[inline]
pub fn last_change_tick(&self) -> u32 {
self.last_change_tick
}

/// Set this system's last change tick.
#[inline]
pub fn set_last_change_tick(&mut self, last_change_tick: u32) {
self.last_change_tick = last_change_tick;
}
}

// TODO: Actually use this in FunctionSystem. We should probably only do this once Systems are constructed using a World reference
Expand Down

0 comments on commit 7321f25

Please sign in to comment.