ptr

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package ptr offers generic pointer utility functions.

It is implementing the generic ptr functionality from the k8s.io/utils package, because the dependency is not versioned and every upstream commit would cause Dependabot to create a new PR for a version update.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

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

Deref attempts to dereference a pointer and return the value. If the pointer is nil, the provided default value will be returned instead.

func Equal added in v0.6.0

func Equal[T comparable](a, b *T) bool

Equal returns true if both arguments are nil or both arguments dereference to the same value.

func To

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

To returns a pointer to the given value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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