FromPointer returns the value that p points to. When p is nil, it returns the zero value of T.
(p *T)
| 10 | // FromPointer returns the value that p points to. |
| 11 | // When p is nil, it returns the zero value of T. |
| 12 | func FromPointer[T any](p *T) T { |
| 13 | var v T |
| 14 | if p != nil { |
| 15 | v = *p |
| 16 | } |
| 17 | return v |
| 18 | } |
| 19 | |
| 20 | // Int32 returns a pointer to v. |
| 21 | func Int32(v int32) *int32 { return &v } |
no outgoing calls