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

Function ExampleOption_FlatMap_none

option_example_test.go:291–299  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

289}
290
291func ExampleOption_FlatMap_none() {
292 none := None[int]()
293 result := none.FlatMap(func(i int) Option[int] {
294 return Some(21)
295 })
296
297 fmt.Println(result.IsPresent(), result.OrEmpty())
298 // Output: false 0
299}
300
301func ExampleOption_MarshalJSON_some() {
302 type test struct {

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