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.
§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, world: &World) -> Self::Out
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.
Implementors§
impl<A, B, Func> 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>
SAFETY: F
’s param is ReadOnlySystemParam
, so this system will only read from the world.