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

Function ExampleOption_FlatMap_some

option_example_test.go:281–289  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

279}
280
281func ExampleOption_FlatMap_some() {
282 some := Some(42)
283 result := some.FlatMap(func(i int) Option[int] {
284 return Some(21)
285 })
286
287 fmt.Println(result.IsPresent(), result.OrEmpty())
288 // Output: true 21
289}
290
291func ExampleOption_FlatMap_none() {
292 none := None[int]()

Callers

nothing calls this directly

Calls 4

SomeFunction · 0.85
IsPresentMethod · 0.80
FlatMapMethod · 0.65
OrEmptyMethod · 0.45

Tested by

no test coverage detected