package
module
Version:
v0.0.6
Opens a new window with list of versions in this module.
Published: Dec 21, 2022
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 3
Opens a new window with list of known importers.
Documentation
¶
Package option implements optional values to represent the lack of value
without pointers.
IsNil returns true if the value is nil.
func UnwrapOrZero[T any](opt Of[T]) T
UnwrapOrZero returns the option value or its zero value if it is not set.
type Of[T any] struct {
}
Of represents an optional value that may be nil.
func Map[T, U any](opt Of[T], f func(T) U) Of[U]
Map applies function f to the underlying option value if it is set.
Nil returns nil option with type T.
func Value[T any](v T) Of[T]
Value returns an option with the given value.
func (v Of[T]) Unwrap() (T, bool)
Unwrap returns the underlying value and a boolean flag indicating whether it
is set.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.