Documentation
¶
Overview ¶
Package lazy provides a lazy value implementation. It's useful especially in global variable initialization to avoid slowing down the program startup time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
type ValueWithError ¶ added in v2.22.0
type ValueWithError[T any] struct { // contains filtered or unexported fields }
func NewWithError ¶ added in v2.22.0
func NewWithError[T any](fn func() (T, error)) *ValueWithError[T]
NewWithError allows you to provide a lazy initializer that can fail.
func (*ValueWithError[T]) Load ¶ added in v2.22.0
func (v *ValueWithError[T]) Load() (T, error)
Click to show internal directories.
Click to hide internal directories.