Skip to main content

Schedules

Struct Schedules 

pub struct Schedules {
    pub ignored_scheduling_ambiguities: BTreeSet<ComponentId>,
    /* private fields */
}
Expand description

Resource that stores Schedules mapped to [ScheduleLabel]s excluding the current running Schedule.

Fields§

§ignored_scheduling_ambiguities: BTreeSet<ComponentId>

List of [ComponentId]s to ignore when reporting system order ambiguity conflicts

Implementations§

§

impl Schedules

pub fn new() -> Schedules

Constructs an empty Schedules with zero initial capacity.

pub fn insert(&mut self, schedule: Schedule) -> Option<Schedule>

Inserts a labeled schedule into the map.

If the map already had an entry for label, schedule is inserted, and the old schedule is returned. Otherwise, None is returned.

pub fn reinsert(&mut self, schedule: Schedule) -> Option<Schedule>

Inserts a labeled schedule into the map.

If the map already had an entry for label, schedule is inserted, and the old schedule is returned. Otherwise, None is returned.

pub fn remove(&mut self, label: impl ScheduleLabel) -> Option<Schedule>

Removes the schedule corresponding to the label from the map, returning it if it existed.

pub fn remove_temporarily( &mut self, label: impl ScheduleLabel, ) -> Option<Schedule>

Removes the schedule corresponding to the label from the map, returning it if it existed, tracks.

pub fn remove_entry( &mut self, label: impl ScheduleLabel, ) -> Option<(Interned<dyn ScheduleLabel>, Schedule)>

Removes the (schedule, label) pair corresponding to the label from the map, returning it if it existed.

pub fn get_temporarily_removed(&self) -> HashSet<Interned<dyn ScheduleLabel>>

Gets a set of temporarily removed schedules

pub fn get_empty_labels(&self) -> HashSet<Interned<dyn ScheduleLabel>>

Gets a set of empty schedule labels

pub fn contains(&self, label: impl ScheduleLabel) -> bool

Does a schedule with the provided label already exist?

pub fn get(&self, label: impl ScheduleLabel) -> Option<&Schedule>

Returns a reference to the schedule associated with label, if it exists.

pub fn get_mut(&mut self, label: impl ScheduleLabel) -> Option<&mut Schedule>

Returns a mutable reference to the schedule associated with label, if it exists.

pub fn entry(&mut self, label: impl ScheduleLabel) -> &mut Schedule

Returns a mutable reference to the schedules associated with label, creating one if it doesn’t already exist.

pub fn iter( &self, ) -> impl Iterator<Item = (&(dyn ScheduleLabel + 'static), &Schedule)>

Returns an iterator over all schedules. Iteration order is undefined.

pub fn iter_mut( &mut self, ) -> impl Iterator<Item = (&(dyn ScheduleLabel + 'static), &mut Schedule)>

Returns an iterator over mutable references to all schedules. Iteration order is undefined.

pub fn configure_schedules( &mut self, schedule_build_settings: ScheduleBuildSettings, )

Applies the provided [ScheduleBuildSettings] to all schedules.

This mutates all currently present schedules, but does not apply to schedules added in the future.

pub fn allow_ambiguous_component<T>(&mut self, world: &mut World)
where T: Component,

Ignore system order ambiguities caused by conflicts on Components of type T.

pub fn allow_ambiguous_resource<T>(&mut self, world: &mut World)
where T: Resource,

Ignore system order ambiguities caused by conflicts on Resources of type T.

pub fn iter_ignored_ambiguities(&self) -> impl Iterator<Item = &ComponentId>

Iterate through the [ComponentId]’s that will be ignored.

pub fn print_ignored_ambiguities(&self, components: &Components)

Prints the names of the components and resources with info

May panic or retrieve incorrect names if [Components] is not from the same world

pub fn add_systems<M>( &mut self, schedule: impl ScheduleLabel, systems: impl IntoScheduleConfigs<Box<dyn System<In = (), Out = ()>>, M>, ) -> &mut Schedules

Adds one or more systems to the Schedule matching the provided [ScheduleLabel].

pub fn remove_systems_in_set<M>( &mut self, schedule: impl ScheduleLabel, set: impl IntoSystemSet<M>, world: &mut World, policy: ScheduleCleanupPolicy, ) -> Result<usize, ScheduleError>

Removes all systems in a SystemSet. This will cause the schedule to be rebuilt when the schedule is run again. A [ScheduleError] is returned if the schedule needs to be Schedule::initialize’d or the set is not found.

pub fn configure_sets<M>( &mut self, schedule: impl ScheduleLabel, sets: impl IntoScheduleConfigs<Interned<dyn SystemSet>, M>, ) -> &mut Schedules

Configures a collection of system sets in the provided schedule, adding any sets that do not exist.

pub fn ignore_ambiguity<M1, M2, S1, S2>( &mut self, schedule: impl ScheduleLabel, a: S1, b: S2, ) -> &mut Schedules
where S1: IntoSystemSet<M1>, S2: IntoSystemSet<M2>,

Suppress warnings and errors that would result from systems in these sets having ambiguities (conflicting access but indeterminate order) with systems in set.

When possible, do this directly in the .add_systems(Update, a.ambiguous_with(b)) call. However, sometimes two independent plugins A and B are reported as ambiguous, which you can only suppress as the consumer of both.

Trait Implementations§

§

impl Component for Schedules
where Schedules: Send + Sync + 'static,

§

const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet

A constant indicating the storage type used for this component.
§

type Mutability = Mutable

A marker type to assist Bevy with determining if this component is mutable, or immutable. Mutable components will have Component<Mutability = Mutable>, while immutable components will instead have Component<Mutability = Immutable>. Read more
§

fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )

Registers required components. Read more
§

fn clone_behavior() -> ComponentCloneBehavior

Called when registering this component, allowing to override clone function (or disable cloning altogether) for this component. Read more
§

fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Schedules>>

Returns [ComponentRelationshipAccessor] required for working with relationships in dynamic contexts. Read more
§

fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_add [ComponentHook] for this Component if one is defined.
§

fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_insert [ComponentHook] for this Component if one is defined.
§

fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_discard [ComponentHook] for this Component if one is defined.
§

fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_remove [ComponentHook] for this Component if one is defined.
§

fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>

Gets the on_despawn [ComponentHook] for this Component if one is defined.
§

fn map_entities<E>(_this: &mut Self, _mapper: &mut E)
where E: EntityMapper,

Maps the entities on this component using the given EntityMapper. This is used to remap entities in contexts like scenes and entity cloning. When deriving Component, this is populated by annotating fields containing entities with #[entities] Read more
§

impl Default for Schedules

§

fn default() -> Schedules

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

impl Resource for Schedules
where Schedules: Send + Sync + 'static,

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
§

impl<C> Bundle for C
where C: Component,

§

fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>

§

fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>

Return a iterator over this Bundle’s component ids. This will be None if the component has not been registered.
§

impl<C> BundleFromComponents for C
where C: Component,

§

unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
where F: for<'a> FnMut(&'a mut T) -> OwningPtr<'a>,

§

impl<C> DynamicBundle for C
where C: Component,

§

type Effect = ()

An operation on the entity that happens after inserting this bundle.
§

unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect

Moves the components out of the bundle. Read more
§

unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )

Applies the after-effects of spawning this bundle. 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: &mut World) -> T

Creates Self using default().

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> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
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<T> ConditionalSend for T
where T: Send,