promise

package
v1.44.9 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: MPL-2.0 Imports: 2 Imported by: 0

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