Fixes Futures' or operation so that asyncftpclient compiles.
This commit is contained in:
parent
75e5c87f15
commit
dfe416eaad
2 changed files with 6 additions and 6 deletions
|
|
@ -383,11 +383,11 @@ proc `or`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] =
|
||||||
## Returns a future which will complete once either ``fut1`` or ``fut2``
|
## Returns a future which will complete once either ``fut1`` or ``fut2``
|
||||||
## complete.
|
## complete.
|
||||||
var retFuture = newFuture[void]("asyncdispatch.`or`")
|
var retFuture = newFuture[void]("asyncdispatch.`or`")
|
||||||
proc cb(fut: Future[T]) =
|
proc cb[X](fut: Future[X]) =
|
||||||
if fut.failed: retFuture.fail(fut.error)
|
if fut.failed: retFuture.fail(fut.error)
|
||||||
if not retFuture.finished: retFuture.complete()
|
if not retFuture.finished: retFuture.complete()
|
||||||
fut1.callback = cb
|
fut1.callback = cb[T]
|
||||||
fut2.callback = cb
|
fut2.callback = cb[Y]
|
||||||
return retFuture
|
return retFuture
|
||||||
|
|
||||||
proc all*[T](futs: varargs[Future[T]]): auto =
|
proc all*[T](futs: varargs[Future[T]]): auto =
|
||||||
|
|
|
||||||
|
|
@ -353,11 +353,11 @@ proc `or`*[T, Y](fut1: Future[T], fut2: Future[Y]): Future[void] =
|
||||||
## Returns a future which will complete once either ``fut1`` or ``fut2``
|
## Returns a future which will complete once either ``fut1`` or ``fut2``
|
||||||
## complete.
|
## complete.
|
||||||
var retFuture = newFuture[void]("asyncdispatch.`or`")
|
var retFuture = newFuture[void]("asyncdispatch.`or`")
|
||||||
proc cb(fut: Future[T]) =
|
proc cb[X](fut: Future[X]) =
|
||||||
if fut.failed: retFuture.fail(fut.error)
|
if fut.failed: retFuture.fail(fut.error)
|
||||||
if not retFuture.finished: retFuture.complete()
|
if not retFuture.finished: retFuture.complete()
|
||||||
fut1.callback = cb
|
fut1.callback = cb[T]
|
||||||
fut2.callback = cb
|
fut2.callback = cb[Y]
|
||||||
return retFuture
|
return retFuture
|
||||||
|
|
||||||
proc all*[T](futs: varargs[Future[T]]): auto =
|
proc all*[T](futs: varargs[Future[T]]): auto =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue