Option::or_value
If this value is Some(x), return x, otherwise return value.
Some(x)
x
value
Some(1).or_value(5) //-> 1 None.or_value(5) //-> 5
Source Codepublic method or_value<T>(this: Option<T>, value: T): T { match this { Some(v) => v, None => value } }
public method or_value<T>(this: Option<T>, value: T): T { match this { Some(v) => v, None => value } }