Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MutUntyped::from(mut_typed) #12406

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

jkb0o
Copy link
Contributor

@jkb0o jkb0o commented Mar 10, 2024

Objective

Allow to create MutUntyped<'a> instance from Mut<'a, T>.
Fixes #12405

Solution

Added impl<'a, T> From<Mut<'a, T>> for MutUntyped<'>

@james7132 james7132 added C-Feature A new feature, making something new possible A-ECS Entities, components, systems, and events labels Mar 10, 2024
@james7132
Copy link
Member

Merging as trivial.

@james7132 james7132 added this pull request to the merge queue Mar 10, 2024
Merged via the queue into bevyengine:main with commit f0a9864 Mar 10, 2024
27 checks passed
@targrub
Copy link
Contributor

targrub commented Mar 10, 2024

Is there no risk of possible type safety loss by an automatically-applied From?

@james7132
Copy link
Member

james7132 commented Mar 10, 2024

Mut to MutUntyped is both safe and easy to do. The same reason why &mut T to PtrMut has a From implementation. MutUntyped to Mut is unsafe and requires proving the conversion is safe.

From and Into are generally explicit about their application too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

It is impossible to create MutUntyped<'a> from Mut<'a, T>
3 participants