pointers

package
v0.22.4 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duplicate

func Duplicate[T any, PT *T](p PT) PT

Creates a new pointer from the given pointer, pointing to the same value as the original pointer. Returns nil if the input pointer is nil.

func EqualValue

func EqualValue[T comparable, PT *T](p1 PT, p2 PT) bool

Checks if the values pointed to by two pointers are equal. If either pointer is nil, returns true if both are nil.

func EqualValueFunc

func EqualValueFunc[T any, PT *T](p1 PT, p2 PT, equal func(PT, PT) bool) bool

Checks if the values pointed to by two pointers are equal using a custom equality function. If either pointer is nil, returns true if both are nil. The function will be called only if both pointers are non-nil.

func GetValueOrDefault

func GetValueOrDefault[T any, PT *T](p PT, defaultValue T) T

func Make

func Make[T any, PT *T](pp *PT, val T)

Sets the value of the pointer to the given value, allocating new memory if the pointer is nil.

func NotTrue

func NotTrue[T ~bool, PT *T](p PT) bool

Returns true if the boolean pointer has no value OR the value is false.

func SetValue

func SetValue[T any, PT *T](pp *PT, val T)

Sets the value pointed to by a pointer to the given value, allocating new memory if the pointer is nil.

func SetValueFrom

func SetValueFrom[T any, PT *T](pp *PT, pVal PT)

Sets the value pointed to by a pointer to the value pointed to by another pointer, allocating new memory if the pointer is nil.

func TrueValue

func TrueValue[T ~bool, PT *T](p PT) bool

Returns true if the boolean pointer has value and the value is true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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