Skip to main content

ScheduleLabel

Trait ScheduleLabel 

Source
pub trait ScheduleLabel:
    Send
    + Sync
    + Debug
    + DynEq
    + DynHash {
    // Required method
    fn dyn_clone(&self) -> Box<dyn ScheduleLabel>;

    // Provided method
    fn intern(&self) -> Interned<dyn ScheduleLabel>
       where Self: Sized { ... }
}
Expand description

A strongly-typed class of labels used to identify a Schedule.

Each schedule in a World has a unique schedule label value, and schedules can be automatically created from labels via Schedules::add_systems().

§Defining new schedule labels

By default, you should use Bevy’s premade schedule labels which implement this trait. If you are using bevy_ecs directly or if you need to run a group of systems outside the existing schedules, you may define your own schedule labels by using #[derive(ScheduleLabel)].

use bevy_ecs::prelude::*;
use bevy_ecs::schedule::ScheduleLabel;

// Declare a new schedule label.
#[derive(ScheduleLabel, Clone, Debug, PartialEq, Eq, Hash, Default)]
struct Update;

let mut world = World::new();

// Add a system to the schedule with that label (creating it automatically).
fn a_system_function() {}
world.get_resource_or_init::<Schedules>().add_systems(Update, a_system_function);

// Run the schedule, and therefore run the system.
world.run_schedule(Update);

Required Methods§

Source

fn dyn_clone(&self) -> Box<dyn ScheduleLabel>

Clones this ScheduleLabel.

Provided Methods§

Source

fn intern(&self) -> Interned<dyn ScheduleLabel>
where Self: Sized,

Returns an Interned value corresponding to self.

Trait Implementations§

Source§

impl Eq for dyn ScheduleLabel

Source§

impl Hash for dyn ScheduleLabel

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
Source§

impl Internable for dyn ScheduleLabel

Source§

fn leak(&self) -> &'static dyn ScheduleLabel

Creates a static reference to self, possibly leaking memory.
Source§

fn ref_eq(&self, other: &(dyn ScheduleLabel + 'static)) -> bool

Returns true if the two references point to the same value.
Source§

fn ref_hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds the reference to the hasher.
Source§

impl PartialEq for dyn ScheduleLabel

Source§

fn eq(&self, other: &(dyn ScheduleLabel + 'static)) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl ScheduleLabel for Core2d
where Core2d: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for Core3d
where Core3d: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for ExtractSchedule
where ExtractSchedule: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for First
where First: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for FixedFirst
where FixedFirst: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for FixedLast
where FixedLast: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for FixedMain
where FixedMain: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for FixedPostUpdate
where FixedPostUpdate: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for FixedPreUpdate
where FixedPreUpdate: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for FixedUpdate
where FixedUpdate: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for Interned<dyn ScheduleLabel>

Source§

impl ScheduleLabel for Last
where Last: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for Main
where Main: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for PostStartup
where PostStartup: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for PostUpdate
where PostUpdate: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for PreStartup
where PreStartup: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for PreUpdate
where PreUpdate: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for Render
where Render: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for RenderGraph
where RenderGraph: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for RenderStartup
where RenderStartup: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for RunFixedMainLoop
where RunFixedMainLoop: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for SpawnScene
where SpawnScene: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for Startup
where Startup: 'static + Send + Sync + Clone + Eq + Debug + Hash,

Source§

impl ScheduleLabel for Update
where Update: 'static + Send + Sync + Clone + Eq + Debug + Hash,