Files
llgo/cl/_testdata/async/in.go
2024-08-05 21:19:19 +08:00

28 lines
340 B
Go

package async
import (
"github.com/goplus/llgo/x/async"
)
func GenInts() (co *async.Promise[int]) {
co.Yield(1)
co.Yield(2)
co.Yield(3)
return
}
func WrapGenInts() *async.Promise[int] {
return GenInts()
}
func UseGenInts() int {
co := WrapGenInts()
r := 0
for !co.Done() {
v := co.Value()
r += v
co.Next()
}
return r
}