add Future.Then

This commit is contained in:
Li Jie
2024-09-08 20:27:05 +08:00
parent cf53f3a347
commit 566d5ef96f
9 changed files with 56 additions and 32 deletions

View File

@@ -24,6 +24,10 @@ type Void = [0]byte
type Future[T any] func(func(T))
func (f Future[T]) Then(cb func(T)) {
f(cb)
}
// Just for pure LLGo/Go, transpile to callback in Go+
func Await[T1 any](future Future[T1]) T1 {
return Run(future)