Skip to main content

extern_spec_T_Option_T_get_or_insert_with

Function extern_spec_T_Option_T_get_or_insert_with 

Source
pub fn extern_spec_T_Option_T_get_or_insert_with<T, F: FnOnce() -> T>(
    self_: &mut Option<T>,
    f: F,
) -> &mut T
Expand description

extern spec for Option<T>::get_or_insert_with

This is not a real function: its only use is for documentation.

requires

*self == None ==> f.precondition(())

ensures

match *self {
    None => f.postcondition_once((), *result) && ^self == Some(^result),
    Some(_) => *self == Some(*result) && ^self == Some(^result),
}