Implement ReadOnlySystemParam for Extract<> (#7182)

# Objective

- `Extract` does not implement `ReadOnlySystemParam` even though it should.
- Noticed by @hymm on discord: https://discord.com/channels/691052431525675048/749335865876021248/1063535818267963543

## Solution

Implement the trait.
This commit is contained in:
JoJoJet 2023-01-13 22:35:43 +00:00
parent 0af8e1c211
commit d9265db344

View File

@ -52,8 +52,10 @@ pub struct ExtractState<P: SystemParam + 'static> {
main_world_state: <Res<'static, MainWorld> as SystemParam>::State,
}
// SAFETY: only accesses MainWorld resource with read only system params using Res,
// which is initialized in init()
// SAFETY: The only `World` access (`Res<MainWorld>`) is read-only.
unsafe impl<P> ReadOnlySystemParam for Extract<'_, '_, P> where P: ReadOnlySystemParam {}
// SAFETY: The only `World` access is properly registered by `Res<MainWorld>::init_state`.
unsafe impl<P> SystemParam for Extract<'_, '_, P>
where
P: ReadOnlySystemParam,