Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Promise ¶
type Promise[T any] interface { // Settled indicates if a call to Await will cause a blocking behavior, or // if the result will be immediately returned. Settled() bool // Await will cause the calling code to block and wait for the promise to // settle. Await MUST be able to be called by multiple goroutines and safely // deliver the same value/error to all waiting goroutines. Successive calls // to Await should continue to respond with the result even once the promise // is settled. Await(context.Context) (T, error) }
Promise is an abstract representation of a value that might eventually be delivered.
func NewPromise ¶
NewPromise wraps a function in a goroutine that will make the result of that function deliver its result to the holder of the promise.
Click to show internal directories.
Click to hide internal directories.