refutils

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 1 Imported by: 1

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](val R) R

Def behaves as Or(val, *new(R)), so it returns default value if value is not present or types are different

func Do

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

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

func Or

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

Or returns value of val or 'other', but supports any other type

func Ref

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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