Async or_insert_with

What I would like to do:

hash_map.entry(1).or_insert_with(|| { something().await; return 2; })

What I believe I have to do:

match hash_map.entry(1) {
    Entry::Occupied(_) => {...}, 
    Entry::Vacant(entry) => {

Am I right or am I missing something?

You aren't missing anything. There isn't an async version of that method.

1 Like

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.