Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFutureCanceled = errors.New("future canceled")
Functions ¶
This section is empty.
Types ¶
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
type Selectable ¶
type Selectable struct {
// contains filtered or unexported fields
}
func NewSelectable ¶
func NewSelectable() *Selectable
func (*Selectable) Cancel ¶
func (f *Selectable) Cancel()
Cancel is alias for SetError(ErrFutureCanceled)
func (*Selectable) Fill ¶
func (f *Selectable) Fill(v interface{}, e error) error
Fill sets value for future, if it were not already fullfilled Returns error, if it were already set to future.
func (*Selectable) GetResult ¶
func (f *Selectable) GetResult() (interface{}, error)
GetResult waits for future to be fullfilled and returns value or error, whatever is set first
func (*Selectable) SetError ¶
func (f *Selectable) SetError(e error)
func (*Selectable) SetValue ¶
func (f *Selectable) SetValue(v interface{}) error
func (*Selectable) WaitChan ¶
func (f *Selectable) WaitChan() <-chan struct{}
WaitChan returns channel, which is closed when future is fullfilled.
Click to show internal directories.
Click to hide internal directories.