Skip to content

feat: Add Slotmap::map - #133

Closed
lmondada wants to merge 1 commit into
orlp:masterfrom
lmondada:lm/slotmap-map
Closed

lmondada wants to merge 1 commit into
orlp:masterfrom
lmondada:lm/slotmap-map

Conversation

@lmondada

@lmondada lmondada commented Aug 14, 2025 •

Copy link
Copy Markdown

This adds a map method to Slotmap:

pub fn map<U, F>(&self, mut f: F) -> SlotMap<K, U>
where
        F: FnMut(K, &V) -> U

as discussed in #80.

Closes #80

@lmondada

Copy link
Copy Markdown
Author

If anyone is interested in this: I've created a fork of slotmap with this feature for the time being.

https://crates.io/crates/slotmap_fork_lmondada

Happy to delete it as soon as something like this is merged in and released.

@orlp

orlp commented Dec 5, 2025 •

Copy link
Copy Markdown
Owner

I don't want to merge this because it doesn't take self by value but by reference. I want it to take ownership.

I will add a map that takes ownership.

@orlp orlp closed this Dec 5, 2025
@lmondada

lmondada commented Dec 8, 2025 •

Copy link
Copy Markdown
Author

Ok, thanks for the response! Let me know if you'd like my help in drafting the new PR.

@tsoutsman tsoutsman mentioned this pull request Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow converting values, preserving keys

2 participants