MCPcopy
hub / github.com/cli/cli / Unwrap

Method Unwrap

pkg/option/option.go:71–77  ·  view source on GitHub ↗

Unwrap returns the underlying value of a [Some] variant, or panics if called on a [None] variant.

()

Source from the content-addressed store, hash-verified

69// Unwrap returns the underlying value of a [Some] variant, or panics if called
70// on a [None] variant.
71func (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.

Callers 3

ExampleOption_UnwrapFunction · 0.45
TestSomeUnwrapFunction · 0.45
TestNoneUnwrapFunction · 0.45

Calls

no outgoing calls

Tested by 3

ExampleOption_UnwrapFunction · 0.36
TestSomeUnwrapFunction · 0.36
TestNoneUnwrapFunction · 0.36