Skip to content

Commit

Permalink
refactor: move internals from entity_ref to World, add SAFETY c…
Browse files Browse the repository at this point in the history
…omments (#6402)

# Objective

There are some utility functions for actually working with `Storages` inside `entity_ref.rs` that are used both for `EntityRef/EntityMut` and `World`, with a `// TODO: move to Storages`.
This PR moves them to private methods on `World`, because that's the safest API boundary. On `Storages` you would need to ensure that you pass `Components` from the same world.

## Solution

- move get_component[_with_type], get_ticks[_with_type], get_component_and_ticks[_with_type] to `World` (still pub(crate))
- replace `pub use entity_ref::*;` with `pub use entity_ref::{EntityRef, EntityMut}` and qualified `entity_ref::get_mut[_by_id]` in `world.rs`
- add safety comments to a bunch of methods
  • Loading branch information
jakobhellermann committed Jan 13, 2023
1 parent feac2c2 commit 008c156
Show file tree
Hide file tree
Showing 2 changed files with 323 additions and 312 deletions.
Loading

0 comments on commit 008c156

Please sign in to comment.