bevy/crates/bevy_ecs/src/world
Dawid Piotrowski 0bf7f3153d Allow access to non-send resource through World::resource_scope (#6113)
# Objective

Relaxes the trait bound for `World::resource_scope` to allow non-send resources. Fixes #6037.

## Solution

No big changes in code had to be made. Added a check so that the non-send resources won't be accessed from a different thread.

---

## Changelog
 - `World::resource_scope` accepts non-send resources now
 - `World::resource_scope` verifies non-send access if the resource is non-send
 - Two new tests are added, one for valid use of `World::resource_scope` with a non-send resource, and one for invalid use (calling it from a different thread, resulting in panic)

Co-authored-by: Dawid Piotrowski <41804418+Pietrek14@users.noreply.github.com>
2022-09-28 17:53:58 +00:00
..
entity_ref.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
identifier.rs Unique WorldId (#2827) 2021-09-30 20:54:47 +00:00
mod.rs Allow access to non-send resource through World::resource_scope (#6113) 2022-09-28 17:53:58 +00:00
spawn_batch.rs add more SAFETY comments and lint for missing ones in bevy_ecs (#4835) 2022-07-04 14:44:24 +00:00
world_cell.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00