SystemStages

Struct SystemStages 

pub struct SystemStages { /* private fields */ }
Expand description

An ordered collection of SystemStages.

Implementations§

§

impl SystemStages

pub fn with_core_stages() -> SystemStages

Create a SystemStages collection, initialized with a stage for each CoreStage.

pub fn add_system_to_stage<Args, S>( &mut self, label: impl StageLabel, system: S, ) -> &mut SystemStages
where S: IntoSystem<Args, (), (), Sys = StaticSystem<(), ()>>,

Add a System to the stage with the given label.

pub fn insert_stage_before<L, S>( &mut self, label: L, stage: S, ) -> &mut SystemStages
where L: StageLabel, S: SystemStage + 'static,

Insert a new stage, before another existing stage

pub fn insert_stage_after<L, S>( &mut self, label: L, stage: S, ) -> &mut SystemStages
where L: StageLabel, S: SystemStage + 'static,

Insert a new stage, after another existing stage

pub fn run(&mut self, world: &mut World)

Execute the systems on the given world.

pub fn add_startup_system<Args, S>(&mut self, system: S) -> &mut SystemStages
where S: IntoSystem<Args, (), (), Sys = StaticSystem<(), ()>>,

👎Deprecated: use .add_system_to_stage(CoreStage::Startup, your_system) instead

Add a system to the CoreStage::Startup stage which specially runs only once, before all other core stages. Inserting CoreStageStartupSystemsRan into the world prevents systems in the startup stage from running.

pub fn add_single_success_system<Args, S>( &mut self, system: S, ) -> &mut SystemStages
where S: IntoSystem<Args, (), Option<()>, Sys = StaticSystem<(), Option<()>>>,

👎Deprecated: use `.add_system_to_stage(First, single_success_system(your_system)

Convenience method. Adds a system that will run each frame until it succeeds (returns Some). Uses Option to allow for easy usage of ?. System is added to CoreStage::First.

See also the wrapper function used inside single_success_system.

pub fn init_startup_resource<R>(&mut self) -> &mut SystemStages
where R: HasSchema + FromWorld,

Adds a system to CoreStage::Startup that inserts the default value of a resource into the World if it doesn’t already exist.

pub fn add_startup_resource<R>(&mut self, resource: R) -> &mut SystemStages
where R: HasSchema,

Adds a system to CoreStage::StartupResource that inserts the given resource into the World if it doesn’t already exist. The resource type is required to have a HasSchema clone implementation to re-insert the resource into the world after the first startup.

§Clone Requirement Details

If the type being added implements HasSchema with the derive like so:

ⓘ
#[derive(HasSchema, Default)]
#[schema(no_clone)] // This bypasses HasSchema clone requirements.
struct ResourceBeingInserted;

Then the system being added to the StartupResource system stage will panic when inserting a second time. The startup resource stage only runs once so it is therefore safe to use a type like the example above as long as you don’t plan on removing from the World the StartupSystemStage tag which in this case is CoreStageStartupResourceSystemsRan.

Trait Implementations§

§

impl Debug for SystemStages

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for SystemStages

§

fn default() -> SystemStages

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.

§

impl<T> FromWorld for T
where T: Default,

§

fn from_world(_world: &World) -> T

Creates Self using data from the given World.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> RawDefault for T
where T: Default,

§

unsafe fn raw_default(dst: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_default_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
§

impl<T> RawDrop for T

§

unsafe fn raw_drop(ptr: *mut c_void)

Write the default value of the type to the pointer. Read more
§

fn raw_drop_cb() -> Unsafe<&'static (dyn Fn(*mut c_void) + Send + Sync)>

Get a callback suitable for [SchemaData].
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more