Add asynctools adapter

This commit is contained in:
Zahary Karadjov 2020-06-08 22:37:22 +03:00
commit 5df69fc696
No known key found for this signature in database
GPG key ID: C8936F8A3073D609
7 changed files with 137 additions and 31 deletions

View file

@ -20,12 +20,12 @@ when faststreams_async_backend == "chronos":
elif faststreams_async_backend in ["std", "asyncdispatch"]:
import
std/[asyncfutures, asyncmacro]
std/asyncdispatch
export
asyncfutures, asyncmacro
asyncdispatch
template fsAwait*(awaited: Future[T]): untyped =
template fsAwait*(awaited: Future): untyped =
# TODO revisit after https://github.com/nim-lang/Nim/pull/12085/ is merged
let f = awaited
yield f
@ -33,6 +33,8 @@ elif faststreams_async_backend in ["std", "asyncdispatch"]:
raise f.error
f.read
type Duration* = int
else:
{.fatal: "Unrecognized network backend: " & faststreams_async_backend.}