pub struct System { /* private fields */ }Expand description
Authoring-time system node: stage placement, ordering, conditions, and event roles.
Implementations§
Source§impl System
impl System
Sourcepub fn new(
name: impl Into<String>,
stage: impl Into<String>,
body: impl FnMut(&mut World, f32) + 'static,
) -> Self
pub fn new( name: impl Into<String>, stage: impl Into<String>, body: impl FnMut(&mut World, f32) + 'static, ) -> Self
Infallible body wrapper; panics and world errors must be handled inside the closure.
Sourcepub fn try_new(
name: impl Into<String>,
stage: impl Into<String>,
body: impl FnMut(&mut World, f32) -> Result<(), String> + 'static,
) -> Self
pub fn try_new( name: impl Into<String>, stage: impl Into<String>, body: impl FnMut(&mut World, f32) -> Result<(), String> + 'static, ) -> Self
Fallible body that can abort the stage pass with a detail string.
Sourcepub fn with_local<L: 'static>(
name: impl Into<String>,
stage: impl Into<String>,
init: impl FnOnce(&mut SystemInitContext<'_>) -> Result<L, String> + 'static,
run: impl FnMut(&mut World, f32, &mut L) -> Result<(), String> + 'static,
) -> Self
pub fn with_local<L: 'static>( name: impl Into<String>, stage: impl Into<String>, init: impl FnOnce(&mut SystemInitContext<'_>) -> Result<L, String> + 'static, run: impl FnMut(&mut World, f32, &mut L) -> Result<(), String> + 'static, ) -> Self
Creates a system whose persistent local state is initialized at build time.
Sourcepub fn before(self, label: impl Into<String>) -> Self
pub fn before(self, label: impl Into<String>) -> Self
Runs before the named system within the same stage.
Sourcepub fn after(self, label: impl Into<String>) -> Self
pub fn after(self, label: impl Into<String>) -> Self
Runs after the named system within the same stage.
Sourcepub fn before_set(self, set: &SystemSet) -> Self
pub fn before_set(self, set: &SystemSet) -> Self
Runs before every system in the set that shares this stage.
Sourcepub fn after_set(self, set: &SystemSet) -> Self
pub fn after_set(self, set: &SystemSet) -> Self
Runs after every system in the set that shares this stage.
Sourcepub fn in_set(self, set: &SystemSet) -> Self
pub fn in_set(self, set: &SystemSet) -> Self
Membership for set-level ordering edges and shared run-if gates.
Sourcepub fn run_if(self, condition: Condition) -> Self
pub fn run_if(self, condition: Condition) -> Self
Skips the system body when the condition evaluates false.
Sourcepub fn requires_resource<R: 'static>(self) -> Self
pub fn requires_resource<R: 'static>(self) -> Self
Build fails unless the resource is present; attaches a world lease lock.
Sourcepub fn emits<E: Clone + 'static>(self) -> Self
pub fn emits<E: Clone + 'static>(self) -> Self
Declares that this system may send events of type E.
Sourcepub fn consumes<E: Clone + 'static>(self) -> Self
pub fn consumes<E: Clone + 'static>(self) -> Self
Declares that this system may create readers for and read events of type E.
Sourcepub fn consumes_on_add<T: 'static>(self) -> Self
pub fn consumes_on_add<T: 'static>(self) -> Self
Declares that this system consumes the added lifecycle channel for T.
Sourcepub fn consumes_on_remove<T: 'static>(self) -> Self
pub fn consumes_on_remove<T: 'static>(self) -> Self
Declares that this system consumes the removed lifecycle channel for T.
Sourcepub fn flush_mode(self, mode: FlushMode) -> Self
pub fn flush_mode(self, mode: FlushMode) -> Self
Overrides deferred-command flush timing for this system on Update stages.
Sourcepub fn flush_after(self) -> Self
pub fn flush_after(self) -> Self
Shorthand for FlushMode::AfterSystem on Update stages.