ptr

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: BSD-3-Clause-LBNL Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Of

func Of[T any](value T) *T

Of returns a pointer to the given value.

This is a convenience function to create a pointer from a value.

Example:

p := ptr.Of(5)

will return a pointer to the value 5.

func ValueOrDefault added in v0.9.1

func ValueOrDefault[T any](v *T, fallback T) T

ValueOrDefault returns the value of a pointer if it is not nil, or the provided fallback value otherwise.

Types

This section is empty.

Jump to

Keyboard shortcuts

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