Documentation ¶
Overview ¶
Package ptr provides utility functions for converting non-addressable primitive types to pointers. Its useful in contexts where a variable gives nil primitive type pointers semantics (often meaning "not set") which can make it annoying to set the value.
Example
type Foo struct { A *int } func main() { foo := Foo{ A: ptr.Int(1) } }
Index ¶
- func Bool(v bool) *bool
- func Byte(v byte) *byte
- func Complex128(v complex128) *complex128
- func Complex64(v complex64) *complex64
- func Float32(v float32) *float32
- func Float64(v float64) *float64
- func Int(v int) *int
- func Int16(v int16) *int16
- func Int32(v int32) *int32
- func Int64(v int64) *int64
- func Int8(v int8) *int8
- func Rune(v rune) *rune
- func String(v string) *string
- func Uint(v uint) *uint
- func Uint16(v uint16) *uint16
- func Uint32(v uint32) *uint32
- func Uint64(v uint64) *uint64
- func Uint8(v uint8) *uint8
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Complex128 ¶
func Complex128(v complex128) *complex128
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.