Or: "Do the iterators really need to copy the keys by default?"
I'm having a bit of trouble creating an implementation for bevy_reflect::Map on a wrapper type around your fixed_map::Map type. The problem stems from the requirement that bevy_reflect::Map::get_at and bevy_reflect::Map::get_at_mut return the key-value pairs as borrowed dyn Reflect trait objects. While this is easy for the values (since they are borrowed anyway), there comes a problem with the keys. Because the keys are given from your iter() and iter_mut() iterators as owned values, this makes it impossible to meet the requirement for the trait.
Due to how trivial it is to acquire an owned key if necessary for a user's use-case (since the keys must implement Copy, simply doing *key in the iterator adaptor is good enough), I propose that the iterator implementations instead return borrows of the keys and leave it to the user to copy them if necessary.
Or: "Do the iterators really need to copy the keys by default?"
I'm having a bit of trouble creating an implementation for
bevy_reflect::Mapon a wrapper type around yourfixed_map::Maptype. The problem stems from the requirement thatbevy_reflect::Map::get_atandbevy_reflect::Map::get_at_mutreturn the key-value pairs as borroweddyn Reflecttrait objects. While this is easy for the values (since they are borrowed anyway), there comes a problem with the keys. Because the keys are given from youriter()anditer_mut()iterators as owned values, this makes it impossible to meet the requirement for the trait.Due to how trivial it is to acquire an owned key if necessary for a user's use-case (since the keys must implement
Copy, simply doing*keyin the iterator adaptor is good enough), I propose that the iterator implementations instead return borrows of the keys and leave it to the user to copy them if necessary.