lazy

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OnceFunc added in v0.4.0

func OnceFunc(f func()) func()

OnceFunc port from unreleased std module, sync.OnceFunc

func OnceValue added in v0.4.0

func OnceValue[T any](f func() T) func() T

OnceValue port from unreleased std module, sync.OnceValue

func OnceValues added in v0.6.0

func OnceValues[E, T any](f func() (E, T)) func() (E, T)

OnceValues port from unreleased std module, sync.OnceValues

func Ternary added in v0.4.0

func Ternary[E any](cond bool, x func() E, y func() E) E

Types

type Cell added in v0.6.0

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

Cell is a lazy value cell.

Which is initialized on the first access.

func NewCell added in v0.6.0

func NewCell[T any](compute func() T) *Cell[T]

func (*Cell[T]) Get added in v0.6.0

func (c *Cell[T]) Get() T

Get forces the evaluation of this lazy value and returns the computed result.

Jump to

Keyboard shortcuts

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