Skip to content

Provide a fallible map_entity api #17193

Open
@cBournhonesque

Description

@cBournhonesque

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsA-NetworkingSending data between clients, servers and machinesC-FeatureA new feature, making something new possibleD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions