AsyncIter.new

This commit is contained in:
Tomasz Bekas 2024-05-15 20:30:46 +02:00
parent bf84aa29ef
commit 09d49808cc
No known key found for this signature in database
GPG Key ID: 4854E04C98824959
2 changed files with 8 additions and 1 deletions

View File

@ -120,7 +120,8 @@ proc getPendingBlocks(
CatchableError, CatchableError,
"Future for block id not found, tree cid: " & $manifest.treeCid & ", index: " & $index) "Future for block id not found, tree cid: " & $manifest.treeCid & ", index: " & $index)
newAsyncIter[(?!bt.Block, int)](genNext, isFinished) # newAsyncIter[(?!bt.Block, int)](genNext, isFinished)
asynciter.AsyncIter.new[(?!bt.Block, int)](genNext, isFinished)
proc prepareEncodingData( proc prepareEncodingData(
self: Erasure, self: Erasure,

View File

@ -64,6 +64,12 @@ proc newAsyncIter*[T](genNext: GenNext[Future[T]], isFinished: IsFinished, finis
iter.next = next iter.next = next
return iter return iter
proc new*[T](_: type AsyncIter, genNext: GenNext[Future[T]], isFinished: IsFinished, finishOnErr: bool = true): AsyncIter[T] =
newAsyncIter[T](
genNext,
isFinished
)
proc emptyAsyncIter*[T](): AsyncIter[T] = proc emptyAsyncIter*[T](): AsyncIter[T] =
## Creates an empty AsyncIter ## Creates an empty AsyncIter
## ##