(value S)
| 87 | } |
| 88 | |
| 89 | func NewPromise[S any](value S) *Promise[S] { |
| 90 | ctx0, cancel0 := context.WithTimeout(context.Background(), time.Second*10) |
| 91 | ctx, cancel := context.WithCancelCause(ctx0) |
| 92 | return &Promise[S]{ |
| 93 | Value: value, |
| 94 | Context: ctx, |
| 95 | CancelCauseFunc: cancel, |
| 96 | CancelFunc: cancel0, |
| 97 | } |
| 98 | } |