Struct bevy::ecs::schedule::Schedule

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

A container of Stages set to be run in a linear order.

Since Schedule implements the Stage trait, it can be inserted into another schedule. In this way, the properties of the child schedule can be set differently from the parent. For example, it can be set to run only once during app execution, while the parent schedule runs indefinitely.

Implementations

Similar to add_stage, but it also returns itself.

Similar to add_stage_after, but it also returns itself.

Similar to add_stage_before, but it also returns itself.

Similar to add_system_to_stage, but it also returns itself.

Adds the given stage at the last position of the schedule.

Example
// Define a new label for the stage.
#[derive(StageLabel)]
struct MyStage;
// Add a stage with that label to the schedule.
schedule.add_stage(MyStage, SystemStage::parallel());

Adds the given stage immediately after the target stage.

Example
// Define a new label for the stage.
#[derive(StageLabel)]
struct NewStage;
// Add a stage with that label to the schedule.
schedule.add_stage_after(TargetStage, NewStage, SystemStage::parallel());

Adds the given stage immediately before the target stage.

Example
// Define a new, private label for the stage.
#[derive(StageLabel)]
struct NewStage;
// Add a stage with that label to the schedule.
schedule.add_stage_before(TargetStage, NewStage, SystemStage::parallel());

Adds the given system to the stage identified by stage_label.

Example
schedule.add_system_to_stage(MyStage, my_system);

Adds the given system_set to the stage identified by stage_label.

Example
schedule.add_system_set_to_stage(
    MyStage,
    SystemSet::new()
        .with_system(system_a)
        .with_system(system_b)
        .with_system(system_c)
);

Fetches the Stage of type T marked with label, then executes the provided func passing the fetched stage to it as an argument.

The func argument should be a function or a closure that accepts a mutable reference to a struct implementing Stage and returns the same type. That means that it should also assume that the stage has already been fetched successfully.

Example
schedule.stage(MyStage, |stage: &mut SystemStage| {
    stage.add_system(my_system)
});
Panics

Panics if label refers to a non-existing stage, or if it’s not of type T.

Returns a shared reference to the stage identified by label, if it exists.

If the requested stage does not exist, None is returned instead.

Example
let stage = schedule.get_stage::<SystemStage>(MyStage).unwrap();

Returns a unique, mutable reference to the stage identified by label, if it exists.

If the requested stage does not exist, None is returned instead.

Example
let stage = schedule.get_stage_mut::<SystemStage>(MyStage).unwrap();

Executes each Stage contained in the schedule, one at a time.

Iterates over all of schedule’s stages and their labels, in execution order.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Runs the stage; this happens once per update. Implementors must initialize all of their state and systems before running the first time. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Creates Self using data from the given World
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more