Hello world. I found out that, inside an async proc returning a Future[T], the
type of the result is not `Future[T]`, but `T`. For example, I can't write
`result.complete(54)`, but `result = 54`.
Now here is a simple code:
import asyncdispatch
proc cb(fut: Future[int]) =
if fut.failed:
echo "ðŸ˜ðŸ˜ðŸ˜"
else:
echo "😀😀😀"
proc myProc(): Future[int] {.async.} =
# Many ops here...
return 43
var fut = myProc()
fut.callback = cb
Run
How can I say, inside `myProc` that, if a certain condition is met, then the
returned Future must fail ? I can't write `result.fail`.