Trait IntoCondSystem

Source
pub trait IntoCondSystem<I, O, M>: IntoSystem<I, O, M>
where I: SystemInput,
{ // Provided methods fn only_if<B, MarkerB>( self, system: B, ) -> SilentCondSystem<Self::System, B::System> where B: IntoSystem<(), bool, MarkerB> { ... } fn only_if_with_output<B, MarkerB>( self, system: B, ) -> CondSystem<Self::System, B::System> where B: IntoSystem<(), bool, MarkerB> { ... } }
Expand description

Extend IntoSystem to allow for some conditional execution. Probably only appropriate for one-shot systems. Prefer run_if() when directly adding to the scheduler.

Provided Methods§

Source

fn only_if<B, MarkerB>( self, system: B, ) -> SilentCondSystem<Self::System, B::System>
where B: IntoSystem<(), bool, MarkerB>,

Only run self’s system if the given system parameter returns true. No output is provided. (This is convenient for running systems with bevy::prelude::Commands::run_system).

Source

fn only_if_with_output<B, MarkerB>( self, system: B, ) -> CondSystem<Self::System, B::System>
where B: IntoSystem<(), bool, MarkerB>,

Only run self’s system if the given system parameter returns true. The output is an Option<Self::Out>. None is returned when the condition returns false.

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.

Implementors§

Source§

impl<I, O, M, T> IntoCondSystem<I, O, M> for T
where T: IntoSystem<I, O, M>, I: SystemInput,