Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletionSource ¶
type CompletionSource[T any] struct { // contains filtered or unexported fields }
CompletionSource is a source for a promise that can be resolved or rejected. It is safe to call Resolve or Reject multiple times concurrently, the first will apply and all others will return that they couldn't set the promise.
func (*CompletionSource[T]) Fulfill ¶
func (ps *CompletionSource[T]) Fulfill(value T) bool
func (*CompletionSource[T]) MustFulfill ¶
func (ps *CompletionSource[T]) MustFulfill(value T)
func (*CompletionSource[T]) MustReject ¶
func (ps *CompletionSource[T]) MustReject(err error)
func (*CompletionSource[T]) Promise ¶
func (ps *CompletionSource[T]) Promise() *Promise[T]
func (*CompletionSource[T]) Reject ¶
func (ps *CompletionSource[T]) Reject(err error) bool
type Promise ¶
type Promise[T any] struct { // contains filtered or unexported fields }
Promise is a promise that can be resolved with a value of type T or rejected with an error. It is safe to call Result on it multiple times from multiple goroutines. This is much more permissive than channels.
func Run ¶
Run runs the given function in a goroutine and returns a promise that will be resolved with the result of the function.
Click to show internal directories.
Click to hide internal directories.