ValOrDefaultFunc returns the value of the given pointer as long as it's non-nil, or invokes the given function to produce a default value otherwise.
(ptr *T, defaultFunc func() T)
| 17 | // ValOrDefaultFunc returns the value of the given pointer as long as it's |
| 18 | // non-nil, or invokes the given function to produce a default value otherwise. |
| 19 | func ValOrDefaultFunc[T any](ptr *T, defaultFunc func() T) T { |
| 20 | if ptr != nil { |
| 21 | return *ptr |
| 22 | } |
| 23 | return defaultFunc() |
| 24 | } |
no outgoing calls
searching dependent graphs…