im-rs icon indicating copy to clipboard operation
im-rs copied to clipboard

OrdMap and iter_mut

Open xStrom opened this issue 4 years ago • 2 comments

OrdMap doesn't seem to have iter_mut like HashMap. Is there a design reason for this or is this just something that hasn't been implemented yet?

xStrom avatar Jun 19 '20 14:06 xStrom

I wanted the same and came here, ready to do a PR, but after the borrow checker reminded me that just copy-pasting immutable code doesn't actually make for valid mutable code…

I'm pretty sure this could be implemented using something akin to the recursive_reference crate, but seeing the metadata I can find on it I'm far from sure it would be a dependency that could be accepted upstream (it seems to eg. have very few downloads for now, and it's definitely dealing with unsafe code so correctness is important). I'm willing to try making it into a PR, but would like some confirmation that it would have a chance of getting in first? :)

Ekleog avatar Feb 01 '23 21:02 Ekleog

I would also love to see iter_mut for OrdMap. In the meanwhile, what would be a reasonable workaround? I'm guessing a combination of iter + get_mut?

guozirui33 avatar Sep 13 '24 17:09 guozirui33