SystemStages

Struct SystemStages 

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

An ordered collection of SystemStages.

Implementations§

Source§

impl SystemStages

Source

pub fn with_core_stages() -> Self

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

Source

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

Add a System to the stage with the given label.

Source

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

Insert a new stage, before another existing stage

Source

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

Insert a new stage, after another existing stage

Source

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

Execute the systems on the given world.

Source

pub fn add_startup_system<Args, S>(&mut self, system: S) -> &mut Self
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.

Source

pub fn add_single_success_system<Args, S>(&mut self, system: S) -> &mut Self
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.

Source

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

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

Source

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

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§

Source§

impl Debug for SystemStages

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for SystemStages

Source§

fn default() -> Self

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.

Source§

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

Source§

fn from_world(_world: &World) -> T

Creates Self using data from the given World.
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