xlazy

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader[T any] struct {
	// contains filtered or unexported fields
}

Loader is a generic Lazy loader.

func New

func New[T any](supplier Supplier[T]) Loader[T]

New creates a new Loader.

func (*Loader[T]) Error

func (c *Loader[T]) Error() error

func (*Loader[T]) Loaded

func (c *Loader[T]) Loaded() bool

Loaded returns true if the value is loaded.

func (*Loader[T]) Value

func (c *Loader[T]) Value() T

Value loads if the value is not loaded yet, and returns the value.

type Supplier

type Supplier[T any] func() (T, error)

Jump to

Keyboard shortcuts

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