sentinel

package
v0.1.53 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringUnspecified = "\x00unspecified"

Functions

func TakeOrElse

func TakeOrElse[T comparable](a, b, unspecified T) T

unspecified is the sentinel value

func TakeOrElsePointer

func TakeOrElsePointer[T any](a, b, unspecified *T) *T

golang interface or pointer receiver

func TakeOrElseString

func TakeOrElseString(a, b string) string

func TakeOrElseValue

func TakeOrElseValue[T interface{ IsSpecified() bool }](a, b T) T

Generic TakeOrElse for any type with IsSpecified() method golang interface or value receiver DO NOT PASS NIL as arguments

Types

type Sentinel

type Sentinel interface {
	IsSpecified() bool
	// contains filtered or unexported methods
}

Do not implement this interface on complex objects value classes inline to primitives, and Unspecified is just the zero bit pattern.

Jump to

Keyboard shortcuts

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