uref

package
v1.28.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare[T comparable](ptr1, ptr2 *T) bool

func CompareF

func CompareF[T any](ptr1, ptr2 *T, compare func(t1, t2 *T) bool) bool

CompareF compares two types using their pointers. Values passed to compare func never take nil/zero vales.

func Def

func Def[R any, P *R](val P) R

Def behaves as Or(val, *new(R)), so it returns default type value if value is not present.

func Do

func Do[R any, P *R](ptr P, do func(v R) *R) *R

Do safely executes function 'do' in case ptr is not nil or returns 'nil' otherwise.

func Or

func Or[R any, P *R](val P, other R) R

Or returns value of val or 'other' if val is nil.

func OrRef added in v1.17.2

func OrRef[R any, P *R](val P, other P) P

OrRef acts same as Or, but returns reference.

func Ref

func Ref[T any](t T) *T

func Run added in v1.17.5

func Run[R any, P *R](ptr P, do func(v R))

Run safely executes function 'do' if ptr is not nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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