ptr

package
v0.8.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2025 License: MPL-2.0 Imports: 0 Imported by: 34

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clone

func Clone[T any](val *T) *T

Clone creates a shallow copy of the given pointer.

func NonDefault added in v0.8.0

func NonDefault[T comparable](val, def T) *T

NonDefault returns a pointer to the first parameter, unless it is equal to the second parameter.

func NonZero added in v0.8.0

func NonZero[T comparable](val T) *T

NonZero returns a pointer to the given comparable value, unless the value is the type's zero value.

func Ptr

func Ptr[T any](val T) *T

Ptr returns a pointer to the given value.

func Val

func Val[T any](ptr *T) (val T)

Val returns the value of the given pointer, or the zero value of the type if the pointer is nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL