MCPcopy
hub / github.com/samber/mo / ExampleResult_ok

Function ExampleResult_ok

result_example_test.go:81–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79}
80
81func ExampleResult_ok() {
82 ok := Ok(42)
83 result := ok.OrElse(1234)
84 _err := ok.Error()
85
86 fmt.Println(result, _err)
87 // Output: 42 <nil>
88}
89
90func ExampleResult_err() {
91 ko := Err[int](err)

Callers

nothing calls this directly

Calls 3

OkFunction · 0.85
ErrorMethod · 0.80
OrElseMethod · 0.45

Tested by

no test coverage detected