t15804.nim 305 B

12345678910111213141516
  1. import asyncdispatch
  2. type
  3. Foo*[E] = ref object
  4. op: proc(): Future[bool] {.gcsafe.}
  5. proc newFoo*[E](): Foo[E] =
  6. result = Foo[E]()
  7. result.op = proc(): Future[bool] {.gcsafe,async.} =
  8. await sleepAsync(100)
  9. result = false
  10. when isMainModule:
  11. let f = newFoo[int]()
  12. echo waitFor f.op()