Skip to content

Commit

Permalink
Implement From<&'w mut EntityMut> for EntityMut<'w> (#12896)
Browse files Browse the repository at this point in the history
# Objective

- Implement `From<&'w mut EntityMut>` for `EntityMut<'w>`;
- Make it possible to pass `&mut EntityMut` where `impl Into<EntityMut>`
is required;
- Helps with #12895.

## Solution

- Implement `From<&'w mut EntityMut>` for `EntityMut<'w>`

---

## Changelog

- `EntityMut<'w>` now implements `From<&'w mut EntityMut>`
  • Loading branch information
SkiFire13 committed Apr 7, 2024
1 parent 6c485c8 commit 4227781
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/bevy_ecs/src/world/entity_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,12 @@ impl<'w> EntityMut<'w> {
}
}

impl<'w> From<&'w mut EntityMut<'_>> for EntityMut<'w> {
fn from(value: &'w mut EntityMut<'_>) -> Self {
value.reborrow()
}
}

impl<'w> From<EntityWorldMut<'w>> for EntityMut<'w> {
fn from(value: EntityWorldMut<'w>) -> Self {
// SAFETY: `EntityWorldMut` guarantees exclusive access to the entire world.
Expand Down

0 comments on commit 4227781

Please sign in to comment.