MCPcopy Create free account
hub / github.com/AlekSi/pointer / ToBoolOrNil

Function ToBoolOrNil

pointer_or_nil.go:16–21  ·  view source on GitHub ↗

* Order as in spec: bool byte complex64 complex128 error float32 float64 int int8 int16 int32 int64 rune string uint uint8 uint16 uint32 uint64 uintptr time.Duration time.Time */ ToBoolOrNil returns a pointer to the passed bool value, or nil, if passed value is a zero value.

(b bool)

Source from the content-addressed store, hash-verified

14
15// ToBoolOrNil returns a pointer to the passed bool value, or nil, if passed value is a zero value.
16func ToBoolOrNil(b bool) *bool {
17 if b == false {
18 return nil
19 }
20 return &b
21}
22
23// ToByteOrNil returns a pointer to the passed byte value, or nil, if passed value is a zero value.
24func ToByteOrNil(b byte) *byte {

Callers 1

TestBoolFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestBoolFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…