Unwrap returns the underlying value of a [Some] variant, or panics if called on a [None] variant.
()
| 69 | // Unwrap returns the underlying value of a [Some] variant, or panics if called |
| 70 | // on a [None] variant. |
| 71 | func (o Option[T]) Unwrap() T { |
| 72 | if o.present { |
| 73 | return o.value |
| 74 | } |
| 75 | |
| 76 | panic("called `Option.Unwrap()` on a `None` value") |
| 77 | } |
| 78 | |
| 79 | // UnwrapOr returns the underlying value of a [Some] variant, or the provided |
| 80 | // value on a [None] variant. |
no outgoing calls