Move a value out of a hashmap

I'm currently manipulating something like a virtual method table.
Consider a table HashMap<Key, impl FnOnce>, I want to call the function behind a specific key.
Since FnOnce's calling requires a self, I need to get the function's ownership.
I've checked the relevant APIs for HashMap, but I haven't found a proper way to get it.

HashMap::remove should work.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.