promise

package
v1.58.8 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MPL-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wait2

func Wait2[A, B any](ctx context.Context, a *Value[A], b *Value[B]) (A, B, error)

func Wait3

func Wait3[A, B, C any](ctx context.Context, a *Value[A], b *Value[B], c *Value[C]) (A, B, C, error)

Types

type Value

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

func New

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

func Rejected

func Rejected[T any](err error) *Value[T]

func Resolved

func Resolved[T any](val T) *Value[T]

func (*Value[T]) Get

func (v *Value[T]) Get(ctx context.Context) (T, error)

func (*Value[T]) OnReject

func (v *Value[T]) OnReject(fn func(error))

func (*Value[T]) OnResolve

func (v *Value[T]) OnResolve(fn func(T))

Jump to

Keyboard shortcuts

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