pub unsafe trait ReadOnlySystem: System {
// Provided method
fn run_readonly(
&mut self,
input: <Self::In as SystemInput>::Inner<'_>,
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.
§Safety
This must only be implemented for system types which do not mutate the World
when System::run_unsafe
is called.
Provided Methods§
sourcefn run_readonly(
&mut self,
input: <Self::In as SystemInput>::Inner<'_>,
world: &World,
) -> Self::Out
fn run_readonly( &mut self, input: <Self::In as SystemInput>::Inner<'_>, 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.
Implementors§
impl<A, B> ReadOnlySystem for PipeSystem<A, B>where
A: ReadOnlySystem,
B: ReadOnlySystem,
<B as System>::In: for<'a> SystemInput<Inner<'a> = <A as System>::Out>,
SAFETY: Both systems are read-only, so any system created by piping them will only read from the world.
impl<Func, A, B> ReadOnlySystem for CombinatorSystem<Func, A, B>
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.