bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.13k stars 3.45k forks source link

Better `Dynamic*` mutable iteration #14846

Open DasLixou opened 3 weeks ago

DasLixou commented 3 weeks ago

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

Mutating all fields/key-value pairs/entries/etc. in a dynamic something isn't "easily" doable yet.

What solution would you like?

Add IterFieldsMut next to IterFields and for all the other things too.

What alternative(s) have you considered?

Writing it my own.

Additional context

It's not as easy to do as the non-mutable ones, because of lifetimes. We must enforce that an index can't reference the same object and trix with unsafe code.

MrGVSV commented 3 weeks ago

We'll need to ensure that whatever PR is made for this will be compatible with #14730 (assuming we do in fact want to support readonly fields).