Skip to main content

System

Struct System 

Source
pub struct System { /* private fields */ }
Expand description

Authoring-time system node: stage placement, ordering, conditions, and event roles.

Implementations§

Source§

impl System

Source

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.

Source

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.

Source

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.

Source

pub fn before(self, label: impl Into<String>) -> Self

Runs before the named system within the same stage.

Source

pub fn after(self, label: impl Into<String>) -> Self

Runs after the named system within the same stage.

Source

pub fn before_set(self, set: &SystemSet) -> Self

Runs before every system in the set that shares this stage.

Source

pub fn after_set(self, set: &SystemSet) -> Self

Runs after every system in the set that shares this stage.

Source

pub fn in_set(self, set: &SystemSet) -> Self

Membership for set-level ordering edges and shared run-if gates.

Source

pub fn run_if(self, condition: Condition) -> Self

Skips the system body when the condition evaluates false.

Source

pub fn requires_resource<R: 'static>(self) -> Self

Build fails unless the resource is present; attaches a world lease lock.

Source

pub fn emits<E: Clone + 'static>(self) -> Self

Declares that this system may send events of type E.

Source

pub fn consumes<E: Clone + 'static>(self) -> Self

Declares that this system may create readers for and read events of type E.

Source

pub fn consumes_on_add<T: 'static>(self) -> Self

Declares that this system consumes the added lifecycle channel for T.

Source

pub fn consumes_on_remove<T: 'static>(self) -> Self

Declares that this system consumes the removed lifecycle channel for T.

Source

pub fn flush_mode(self, mode: FlushMode) -> Self

Overrides deferred-command flush timing for this system on Update stages.

Source

pub fn flush_after(self) -> Self

Shorthand for FlushMode::AfterSystem on Update stages.

Source

pub fn disabled(self) -> Self

Registers the system but leaves it disabled until toggled at runtime.

Source

pub fn name(&self) -> &str

Authoring label and runtime diagnostic name.

Auto Trait Implementations§

§

impl !RefUnwindSafe for System

§

impl !Send for System

§

impl !Sync for System

§

impl !UnwindSafe for System

§

impl Freeze for System

§

impl Unpin for System

§

impl UnsafeUnpin for System

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.