Consider returning `Result` from get(_mut)::<Component>() on an entity
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
`Entity(Mut/World/WorldMut)::get_mut` returns `Option` which doesn't play nicely with `Result`: requires writing an error message that entity x missing component y. Also `get_mut` variant doesn't allow to capture the entity because it's already mutably borrowed.
## What solution would you like?
Return `Result` instead.
Contributor guide
Research direction
Start by locating the Entity, EntityMut, World, and WorldMut get and get_mut APIs named in the issue. Read their existing tests and callers to understand current Option handling and borrowing constraints. Done means the API change is designed and consistently applied, with tests covering missing components and mutable access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100