package
Version:
v0.0.12
Opens a new window with list of versions in this module.
Published: Jun 5, 2025
License: AGPL-3.0-or-later
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type V[T any] struct {
Value T
Present bool
}
V is a value that may or may not be present.
func Deref[T any](ptr *T) V[T]
Deref creates a new optional value from a pointer.
If the pointer is non-nil, it is dereferenced and set as the value.
Empty creates a new optional value that is not present.
func New[T any](value T) V[T]
New creates a new optional value with the given value.
func (v V[T]) IsPresent() bool
IsPresent checks if the optional value is present.
func (v V[T]) IsZero() bool
IsZero checks if the optional value is not present.
Ref returns a pointer to the value if it is present, or nil if it is not.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.