Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Future ¶
type Future[T any] struct { // contains filtered or unexported fields }
Future is a struct that holds a value of type T, a slice of callbacks to be called when the value is set, a boolean to track if the callbacks have been called, and a mutex for thread safety.
func (*Future[T]) Complete ¶
Complete sets the value and calls the registered callbacks if they haven't been called yet.
func (*Future[T]) ThenAccept ¶
func (f *Future[T]) ThenAccept(callback func(T))
ThenAccept registers a callback to be called when the Future is completed.
func (*Future[T]) ThenAcceptParallel ¶
func (f *Future[T]) ThenAcceptParallel(callback func(T))
ThenAcceptParallel registers a callback to be called in a separate goroutine when the Future is completed.
Click to show internal directories.
Click to hide internal directories.