Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coalesce ¶
func Coalesce[T any](ptrs ...*T) *T
Coalesce returns the first non-nil pointer, or nil if all are nil.
func Equal ¶
func Equal[T comparable](a, b *T) bool
Equal compares two pointers by value. Both nil returns true, one nil returns false.
func Value ¶
func Value[T any](p *T, fallbacks ...*T) T
Value dereferences a pointer, returning its value. If p is nil, it tries each fallback pointer in order. If all are nil, the zero value of T is returned.
func ValueOrElse ¶
func ValueOrElse[T any](p *T, fn func() T) T
ValueOrElse dereferences a pointer, calling fn to produce a fallback if nil.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.