ptr

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package ptr contains helpers to create pointers to various types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref added in v0.1.7

func Deref[T any](ptr *T, def T) T

Deref dereferences the given pointer, or returns a default value if the pointer is nil.

func To added in v0.1.7

func To[T any](n T) *T

To returns a pointer to the given type. Useful for initializing a reference from a primitive constant. e.g. a := ptr.To(100)

Types

This section is empty.

Jump to

Keyboard shortcuts

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