lazy

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

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
}

func New

func New[T any](fn func() T) *Value[T]

New creates a new lazy value with the given load function.

func (*Value[T]) Load

func (v *Value[T]) Load() T

Jump to

Keyboard shortcuts

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