pub trait RunDeferredSystem {
// Required methods
fn run_deferred_system<S, M>(
&mut self,
schedule: S,
system: impl Static + IntoSystem<(), (), M>,
)
where S: ScheduleLabel;
fn run_deferred_system_with<S, I, M>(
&mut self,
schedule: S,
system: impl Static + IntoSystem<In<I>, (), M>,
input: I,
)
where S: ScheduleLabel,
I: Static;
}Expand description
Trait used to run deferred systems via World.
Required Methods§
Sourcefn run_deferred_system<S, M>(
&mut self,
schedule: S,
system: impl Static + IntoSystem<(), (), M>,
)where
S: ScheduleLabel,
fn run_deferred_system<S, M>(
&mut self,
schedule: S,
system: impl Static + IntoSystem<(), (), M>,
)where
S: ScheduleLabel,
Queues the given System for a single execution in the given Schedule.
§Usage
You must add DefaultDeferredSystemsPlugin for deferred system execution to work
in standard Bevy schedules. You may also add run_deferred_systems manually to any
Schedule to provide deferred system execution support for it.
§Example
use bevy::prelude::*;
use bevy::ecs::world::DeferredWorld;
use bevy::ecs::lifecycle::HookContext;
use moonshine_util::prelude::*;
#[derive(Component)]
#[component(on_insert = on_insert_foo)]
struct Foo;
fn on_insert_foo(mut world: DeferredWorld, ctx: HookContext) {
world.run_deferred_system(PostUpdate, |query: Query<&Foo>| {
// ...
});
}Sourcefn run_deferred_system_with<S, I, M>(
&mut self,
schedule: S,
system: impl Static + IntoSystem<In<I>, (), M>,
input: I,
)where
S: ScheduleLabel,
I: Static,
fn run_deferred_system_with<S, I, M>(
&mut self,
schedule: S,
system: impl Static + IntoSystem<In<I>, (), M>,
input: I,
)where
S: ScheduleLabel,
I: Static,
Same as run_deferred_system, but for systems with
input parameters.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.