Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ptr ¶
func Ptr[T any](t T) *T
Ptr returns a pointer to a copy of a value. This lets you take the address of some non-addressable[1] values, like boolean literals. So if a struct has a *bool field, you can do:
x := MyStruct{MyBool: Ptr(true)}
instead of:
temp := true x := MyStruct{MyBool: &temp}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.