{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreic3oh2lccrkc3w2u36m4ppxetloau42djaunmt3dpl22lff3gnhla",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3meqvmjkrkic2"
},
"path": "/t/get-mut-map-back-from-entry-api/24003#post_2",
"publishedAt": "2026-02-13T14:38:08.000Z",
"site": "https://internals.rust-lang.org",
"tags": [
"play.rust-lang.org",
"Rust Playground"
],
"textContent": "Doesn't a simple `if let else` cover this?\n\n\n let a_or_b = if let a @ Some(_) = map.get_mut(\"a\") {\n a\n } else {\n map.get_mut(\"b\")\n };\n\n\nplay.rust-lang.org\n\n### Rust Playground\n\nA browser interface to the Rust compiler to experiment with the language\n\nA method like `Entry::or_get(alternative_key)` for expressing this succinctly in cases where you are already using the Entry API would be nice to have, that's for sure.",
"title": "Get `&mut Map` back from entry API"
}