rust/compiler
Yuki Okushi 1c3fea2f8c
Rollup merge of #82849 - camsteffen:option-get-or-default, r=joshtriplett
Add Option::get_or_default

Tracking issue: #82901

The original issue is #55042, which was closed, but for an invalid reason (see discussion there). Opening this to reconsider (I hope that's okay). It seems like the only gap for `Option` being "entry-like".

I ran into a need for this method where I had a `Vec<Option<MyData>>` and wanted to do `vec[n].get_or_default().my_data_method()`. Using an `Option` as an inner component of a data structure is probably where the need for this will normally arise.
2021-03-10 08:01:32 +09:00
..
2021-02-14 18:03:11 +03:00
2021-02-20 17:19:30 -05:00
2021-03-09 19:31:31 +00:00
2021-02-21 12:22:22 +01:00
2021-02-21 12:22:22 +01:00
2021-03-03 11:22:44 +01:00