From bd7d84fbcb738ee06755aa9c0b0ebd94e93f3a62 Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Wed, 17 Apr 2024 17:41:36 +0300 Subject: [PATCH] Fix AsyncStreamReader constructor declaration mistypes. (#533) --- chronos/streams/asyncstream.nim | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/chronos/streams/asyncstream.nim b/chronos/streams/asyncstream.nim index 301b0868..0ff9f4b9 100644 --- a/chronos/streams/asyncstream.nim +++ b/chronos/streams/asyncstream.nim @@ -1082,6 +1082,22 @@ proc newAsyncStreamReader*(tsource: StreamTransport): AsyncStreamReader = res.init(tsource) res +proc newAsyncStreamReader*[T](rsource: AsyncStreamReader, + udata: ref T): AsyncStreamReader = + ## Create copy of AsyncStreamReader object ``rsource``. + ## + ## ``udata`` - user object which will be associated with new AsyncStreamReader + ## object. + var res = AsyncStreamReader() + res.init(rsource, udata) + res + +proc newAsyncStreamReader*(rsource: AsyncStreamReader): AsyncStreamReader = + ## Create copy of AsyncStreamReader object ``rsource``. + var res = AsyncStreamReader() + res.init(rsource) + res + proc newAsyncStreamWriter*[T](wsource: AsyncStreamWriter, loop: StreamWriterLoop, queueSize = AsyncStreamDefaultQueueSize, @@ -1147,22 +1163,6 @@ proc newAsyncStreamWriter*(wsource: AsyncStreamWriter): AsyncStreamWriter = res.init(wsource) res -proc newAsyncStreamReader*[T](rsource: AsyncStreamWriter, - udata: ref T): AsyncStreamWriter = - ## Create copy of AsyncStreamReader object ``rsource``. - ## - ## ``udata`` - user object which will be associated with new AsyncStreamReader - ## object. - var res = AsyncStreamReader() - res.init(rsource, udata) - res - -proc newAsyncStreamReader*(rsource: AsyncStreamReader): AsyncStreamReader = - ## Create copy of AsyncStreamReader object ``rsource``. - var res = AsyncStreamReader() - res.init(rsource) - res - proc getUserData*[T](rw: AsyncStreamRW): T {.inline.} = ## Obtain user data associated with AsyncStreamReader or AsyncStreamWriter ## object ``rw``.