UnwrapOrElse returns the underlying value of a [Some] variant, or the result of calling the provided function on a [None] variant.
(f func() T)
| 89 | // UnwrapOrElse returns the underlying value of a [Some] variant, or the result |
| 90 | // of calling the provided function on a [None] variant. |
| 91 | func (o Option[T]) UnwrapOrElse(f func() T) T { |
| 92 | if o.present { |
| 93 | return o.value |
| 94 | } |
| 95 | |
| 96 | return f() |
| 97 | } |
| 98 | |
| 99 | // UnwrapOrZero returns the underlying value of a [Some] variant, or the zero |
| 100 | // value on a [None] variant. |
no outgoing calls