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

Provide a fallible map_entity api #17193

Open
cBournhonesque opened this issue Jan 6, 2025 · 0 comments · May be fixed by #17197
Open

Provide a fallible map_entity api #17193

cBournhonesque opened this issue Jan 6, 2025 · 0 comments · May be fixed by #17197
Labels
A-ECS Entities, components, systems, and events A-Networking Sending data between clients, servers and machines C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Contentious There are nontrivial implications that should be thought through

Comments

@cBournhonesque
Copy link
Contributor

cBournhonesque commented Jan 6, 2025

What problem does this solve or what need does it fill?

The current MapEntity trait only provides a map_entity(entity) -> Entity method.
There are cases where mapping the entity would fail, for example in networking. I think it would be helpful for the API to account for the possibility that the mapping fails.

Maybe we could provide a second method:
try_map_entity(entity) -> Result<Entity>

or just modify the main api to map_entity(Entity) -> Result<Entity>.

I think historically the api was not fallible because the only EntityMapper was SceneEntityMapper which is not fallible.
(it either maps the entity or spawns a new one)

What solution would you like?

Update map_entity to return Result<Entity>

What alternative(s) have you considered?

Unknown

@cBournhonesque cBournhonesque added A-Networking Sending data between clients, servers and machines C-Feature A new feature, making something new possible X-Contentious There are nontrivial implications that should be thought through labels Jan 6, 2025
@alice-i-cecile alice-i-cecile added S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jan 6, 2025
@cBournhonesque cBournhonesque linked a pull request Jan 6, 2025 that will close this issue
@cBournhonesque cBournhonesque added the A-ECS Entities, components, systems, and events label Jan 6, 2025
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 A-Networking Sending data between clients, servers and machines C-Feature A new feature, making something new possible D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants