pub trait RunIfFnExt<Marker>: IntoSystem<Marker> + Sized {
// Provided method
fn run_if_fn<F>(self, cond: F) -> RunIfFnSystem<Self, Marker, F>
where F: Fn(&World, &Resources) -> bool + 'static { ... }
}Expand description
Adds .run_if_fn to anything convertible into a
System, gating it on a plain closure instead of a RunCondition
type — no struct/impl boilerplate needed for a one-off check:
ⓘ
app.add_system(
SystemStage::Startup,
setup.run_if_fn(|world, resources| {
resources.has_resource::<PBR>(world)
&& resources.get_resource::<PBR>(world).cubemap_material_inst != RawAssetHandle::default()
}),
);Provided Methods§
fn run_if_fn<F>(self, cond: F) -> RunIfFnSystem<Self, Marker, F>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".