synstructure

Function get_or_insert_with

source
pub(crate) fn get_or_insert_with<T, F>(opt: &mut Option<T>, f: F) -> &mut T
where F: FnOnce() -> T,
Expand description

Helper method which does the same thing as rustc 1.20’s Option::get_or_insert_with. This method is used to keep backwards compatibility with rustc 1.15.