UnwrapOr returns the underlying value of a [Some] variant, or the provided value on a [None] variant.
(value T)
| 79 | // UnwrapOr returns the underlying value of a [Some] variant, or the provided |
| 80 | // value on a [None] variant. |
| 81 | func (o Option[T]) UnwrapOr(value T) T { |
| 82 | if o.present { |
| 83 | return o.value |
| 84 | } |
| 85 | |
| 86 | return value |
| 87 | } |
| 88 | |
| 89 | // UnwrapOrElse returns the underlying value of a [Some] variant, or the result |
| 90 | // of calling the provided function on a [None] variant. |
no outgoing calls