future

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package future implements the Future type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After[A any](dur time.Duration, a A) warp.Future[A]

After creates a future that succeeds after a timeout.

func Alt

func Alt[A any](x warp.Future[A], y warp.Future[A]) warp.Future[A]

func Ap

func Ap[A, B any](fab warp.Future[func(A) B], fa warp.Future[A]) warp.Future[B]

func Attempt

func Attempt[A any](ra warp.Result[A], onPanic func(any) error) warp.Future[A]

Attempt converts a function which returns a (value, error) pair into a future that either succeeds with a value or fails with an error.

func AttemptForever

func AttemptForever[A any](ra warp.Result[A], onPanic func(any) error) warp.Future[A]

func Chain

func Chain[A, B any](ma warp.Future[A], f func(A) warp.Future[B]) warp.Future[B]

func ChainEvent

func ChainEvent[A, B any](ma warp.Event[A], f func(A) warp.Future[B]) warp.Future[B]

func Fail

func Fail[A any](err error) warp.Future[A]

Fail creates a future that fails with an error.

func FailAfter

func FailAfter[A any](dur time.Duration, err error) warp.Future[A]

FailAfter creates a future that fails with an error after a timeout.

func Failure

func Failure[A any](ea warp.Event[error]) warp.Future[A]

Failure creates a future which always fails with errors received from a source event.

func From

func From[A any](as []A) warp.Future[A]

func FromEvent

func FromEvent[A any](fa warp.Event[A]) warp.Future[A]

func FromResult

func FromResult[A any](fa warp.Result[A]) warp.Future[A]

func FromResults

func FromResults[A any](fas []warp.Result[A]) warp.Future[A]

func Map

func Map[A, B any](fa warp.Future[A], f func(A) B) warp.Future[B]

func Parallel

func Parallel[A any](fas warp.Future[A], parallelism int) warp.Future[A]

Parallel creates a Future which emits a stream of Results in parallel while keeping the sequence of output same as the order of input.

func Succeed

func Succeed[A any](a A) warp.Future[A]

Succeed creates a future that succeeds with a value.

func Success

func Success[A any](ea warp.Event[A]) warp.Future[A]

Success creates a future which always succeeds with values received from a source event.

Types

This section is empty.

Jump to

Keyboard shortcuts

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