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

Function ExampleOption_Map_none

option_example_test.go:251–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249}
250
251func ExampleOption_Map_none() {
252 none := None[int]()
253 result := none.Map(func(i int) (int, bool) {
254 return 1234, true
255 })
256
257 fmt.Println(result.IsPresent(), result.OrEmpty())
258 // Output: false 0
259}
260
261func ExampleOption_MapNone_some() {
262 some := Some(42)

Callers

nothing calls this directly

Calls 3

IsPresentMethod · 0.80
MapMethod · 0.65
OrEmptyMethod · 0.45

Tested by

no test coverage detected