bevyengine / bevyengine/bevy

Provide a fallible map_entity api

Open
#17,193 0 comments 3 reactions 0 assignees View on GitHub
A-ECS A-Networking C-Feature D-Straightforward S-Ready-For-Implementation X-Contentious
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## 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`

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

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`

## What alternative(s) have you considered?

Unknown

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.