pub unsafe trait ReadOnlySystem: System {
    // Provided method
    fn run_readonly(&mut self, input: Self::In, world: &World) -> Self::Out { ... }
Expand description

System types that do not modify the World when run. This is implemented for any systems whose parameters all implement ReadOnlySystemParam.

Note that systems which perform deferred mutations (such as with Commands) may implement this trait.


This must only be implemented for system types which do not mutate the World when System::run_unsafe is called.

Provided Methods§

fn run_readonly(&mut self, input: Self::In, world: &World) -> Self::Out

Runs this system with the given input in the world.

Unlike System::run, this can be called with a shared reference to the world, since this system is known not to modify the world.



impl<A, B, Func> ReadOnlySystem for CombinatorSystem<Func, A, B>where Func: Combine<A, B> + 'static, A: ReadOnlySystem, B: ReadOnlySystem,

SAFETY: Both systems are read-only, so any system created by combining them will only read from the world.


impl<Func, S> ReadOnlySystem for AdapterSystem<Func, S>where Func: Adapt<S>, S: ReadOnlySystem,


impl<Marker, F> ReadOnlySystem for FunctionSystem<Marker, F>where Marker: 'static, F: SystemParamFunction<Marker>, <F as SystemParamFunction<Marker>>::Param: ReadOnlySystemParam,

SAFETY: F’s param is ReadOnlySystemParam, so this system will only read from the world.