github.com/pubgo/xprocess@v0.1.11/xprocess_abc/future.go (about)

     1  package xprocess_abc
     2  
     3  import "reflect"
     4  
     5  type IPromise interface {
     6  	Await() chan FutureValue
     7  	Map(fn interface{}) Value
     8  }
     9  
    10  type Future interface {
    11  	Yield(data interface{})                  // async
    12  	YieldFn(val FutureValue, fn interface{}) // block
    13  }
    14  
    15  type FutureValue interface {
    16  	Assert(format string, a ...interface{})
    17  	Err() error
    18  	String() string
    19  	Get() interface{}
    20  	Raw() []reflect.Value
    21  	Value(fn interface{}) error
    22  }
    23  
    24  type Value interface {
    25  	Assert(format string, a ...interface{})
    26  	Err() error
    27  	Value() interface{}
    28  }