You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- package future
-
- import (
- "context"
- "fmt"
- )
-
- var ErrConsumed = fmt.Errorf("future already consumed")
-
- var ErrNotComplete = fmt.Errorf("future not complete")
-
- var ErrCanceled = context.Canceled
-
- type Future interface {
- IsComplete() bool
-
- Chan() <-chan error
-
- Wait(ctx context.Context) error
- }
-
- type ChanValue1[T any] struct {
- Value T
- Err error
- }
-
- type ChanValue2[T1 any, T2 any] struct {
- Value1 T1
- Value2 T2
- Err error
- }
-
- type Future1[T any] interface {
- IsComplete() bool
-
- Chan() <-chan ChanValue1[T]
-
- Wait(ctx context.Context) (T, error)
- }
|