rust/library/core
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
..
benches Auto merge of #74024 - Folyd:master, r=m-ou-se 2021-03-05 20:12:13 +00:00
src Rollup merge of #82849 - camsteffen:option-get-or-default, r=joshtriplett 2021-03-10 08:01:32 +09:00
tests Rollup merge of #79208 - LeSeulArtichaut:stable-unsafe_op_in_unsafe_fn, r=nikomatsakis 2021-03-10 08:01:25 +09:00
Cargo.toml mv std libs to library/ 2020-07-27 19:51:13 -05:00