Skip to content
25 changes: 24 additions & 1 deletion crates/bevy_ecs/src/system/system_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,16 @@ impl World {

/// Runs a cached system, registering it if necessary.
///
/// # Type Inference Note
/// If the system returns `()`, you may need to explicitly constrain the output
/// type for error handling:
///
/// ```rust
/// () = world.run_system_cached(my_system)?;
/// ```
///
/// Without this, Rust may fail to infer the system’s output type and produce
/// a `IntoResult<!>` inference error.
/// See [`World::register_system_cached`] for more information.
pub fn run_system_cached<O: 'static, M, S: IntoSystem<(), O, M> + 'static>(
&mut self,
Expand All @@ -508,8 +518,21 @@ impl World {
self.run_system_cached_with(system, ())
}

/// Runs a cached system with an input, registering it if necessary.
/// Runs a cached system with the provided input, registering it if necessary.
///
/// This is a more general version of [`World::run_system_cached`], allowing
/// callers to supply an explicit system input.
///
/// # Type Inference Note
/// If the system returns `()`, you may need to explicitly constrain the
/// output type for proper error inference:
///
/// ```rust
/// () = world.run_system_cached_with(my_system, input)?;
/// ```
///
/// Without this, Rust may fail to infer the system’s output type and produce
/// a `IntoResult<!>` inference error.
/// See [`World::register_system_cached`] for more information.
pub fn run_system_cached_with<I, O, M, S>(
&mut self,
Expand Down
Loading