I want to create a helper function that returns the value of an Option
if available else it returns the default case.
fn get_val(&self) -> &Val {
return if self.my_val.is_none() {
&self.default
} else {
&self.my_val.unwrap()
};
}
I can't do this because the unwrap
function's result is short lived.