future

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAll

func GetAll[T any](futures []*Future[T]) ([]T, error)

func GetResult

func GetResult[T any](f *Future[any]) T

func WaitAll

func WaitAll[T any](futures []*Future[T]) error

func WaitAllSilently

func WaitAllSilently[T any](futures []*Future[T])

func WaitFor

func WaitFor(futures ...*Future[any]) error

Types

type Future

type Future[T any] struct {
	Result T
	Err    error
	IsDone bool
	// contains filtered or unexported fields
}

func Run

func Run[T any](f func() (T, error)) *Future[T]

func (*Future[T]) Get

func (f *Future[T]) Get() (T, error)

func (*Future[T]) GetResult

func (f *Future[T]) GetResult() T

func (*Future[T]) Wait

func (f *Future[T]) Wait()

Jump to

Keyboard shortcuts

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