Implement From<&'w mut EntityMut> for EntityMut<'w> (#12896)

# 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>`
This commit is contained in:
Giacomo Stevanato 2024-04-07 15:24:10 +02:00 committed by GitHub
parent 6c485c80e0
commit 4227781e8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.