This commit is contained in:
Dmitriy Ryajov 2019-08-28 13:02:25 -06:00
parent 002328f7e5
commit e77ebc2e5a
1 changed files with 7 additions and 2 deletions

View File

@ -28,7 +28,9 @@ proc newChronosStream*(server: StreamServer,
method read*(s: ChronosStream, n = -1): Future[seq[byte]] {.async.} =
result = await s.reader.read(n)
method readExactly*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[void] {.async.} =
method readExactly*(s: ChronosStream,
pbytes: pointer,
nbytes: int): Future[void] {.async.} =
await s.reader.readExactly(pbytes, nbytes)
method readLine*(s: ChronosStream, limit = 0, sep = "\r\n"): Future[string] {.async.} =
@ -37,7 +39,10 @@ method readLine*(s: ChronosStream, limit = 0, sep = "\r\n"): Future[string] {.as
method readOnce*(s: ChronosStream, pbytes: pointer, nbytes: int): Future[int] {.async.} =
result = await s.reader.readOnce(pbytes, nbytes)
method readUntil*(s: ChronosStream, pbytes: pointer, nbytes: int, sep: seq[byte]): Future[int] {.async.} =
method readUntil*(s: ChronosStream,
pbytes: pointer,
nbytes: int,
sep: seq[byte]): Future[int] {.async.} =
result = await s.reader.readUntil(pbytes, nbytes, sep)
method write*(s: ChronosStream, pbytes: pointer, nbytes: int) {.async.} =