Help us shape the future of Go! Take the 2026 Go Developer Survey

future

package
v1.32.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Future

type Future[T any] interface {
	Get(ctx context.Context) (T, error)
	Ready() bool
}

type FutureImpl

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

func NewFuture

func NewFuture[T any]() *FutureImpl[T]

func (*FutureImpl[T]) Get

func (f *FutureImpl[T]) Get(
	ctx context.Context,
) (T, error)

func (*FutureImpl[T]) GetIfReady added in v1.30.0

func (f *FutureImpl[T]) GetIfReady() (T, error)

func (*FutureImpl[T]) Ready

func (f *FutureImpl[T]) Ready() bool

func (*FutureImpl[T]) Set

func (f *FutureImpl[T]) Set(
	value T,
	err error,
)

func (*FutureImpl[T]) SetIfNotReady added in v1.28.0

func (f *FutureImpl[T]) SetIfNotReady(
	value T,
	err error,
) bool

Sets the value of the future, if it has not been set already. Returns true if this call set the value.

type ReadyFutureImpl

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

func NewReadyFuture

func NewReadyFuture[T any](
	value T,
	err error,
) *ReadyFutureImpl[T]

func (*ReadyFutureImpl[T]) Get

func (f *ReadyFutureImpl[T]) Get(
	_ context.Context,
) (T, error)

func (*ReadyFutureImpl[T]) Ready

func (f *ReadyFutureImpl[T]) Ready() bool

Jump to

Keyboard shortcuts

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