ptr

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ptr provides utilities for working with pointers in Go.

This package is useful when you need to create pointers to literal values or check whether a generic type parameter is a pointer type. A common use case is creating pointers to constants or literals for use with APIs that require pointer arguments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Is

func Is[T any]() bool

Is checks if the generic parameter is a pointer type. Returns true if T is a pointer, false otherwise.

func Of

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

Of allocates a new instance of the given type, copies the value into it, and returns it. This can be used as a utility to make pointers to static values. For example: Of[uint](123) returns a uint pointer containing the value 123.

Types

This section is empty.

Jump to

Keyboard shortcuts

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