You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Entities can safely be deleted by using AllStorages but all storages have to be iterated over and it prevents any parallelization.
One way to get around this issue is to have a function on Entities. To make this function safe a component counter could be added to Entities but it would mean borrowing Entities to add/remove components and impact performance of many operations (add/remove entities and components).
To avoid the api and performance issue, a function can be implemented without counter.
delete_unchecked would rely on the user to remove all components from the entity before calling it. In case this isn't respected the user could access components they didn't removed with a deleted entity.
The question is: should delete_unchecked be unsafe or not?
I'm not the first person struggling with the issue rust-lang/api-guidelines#179 but currently no consensus has been reached.
The text was updated successfully, but these errors were encountered:
Based on this discussion and the ones linked into it, I'm closing this issue with the conclusion that it shouldn't be unsafe but just marked *_unchecked.
If someone has good opposing arguments, I'm open to go back on this decision.
Entities can safely be deleted by using
AllStorages
but all storages have to be iterated over and it prevents any parallelization.One way to get around this issue is to have a function on
Entities
. To make this function safe a component counter could be added toEntities
but it would mean borrowingEntities
to add/remove components and impact performance of many operations (add/remove entities and components).To avoid the api and performance issue, a function can be implemented without counter.
delete_unchecked
would rely on the user to remove all components from the entity before calling it. In case this isn't respected the user could access components they didn't removed with a deleted entity.The question is: should
delete_unchecked
beunsafe
or not?I'm not the first person struggling with the issue rust-lang/api-guidelines#179 but currently no consensus has been reached.
The text was updated successfully, but these errors were encountered: