Add asynctools adapter
This commit is contained in:
parent
81c24860e2
commit
5df69fc696
7 changed files with 137 additions and 31 deletions
|
|
@ -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.}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue