From 2909766056d5c8663f228205f902f3c77cbc6eeb Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 12 Feb 2024 20:51:07 +0100 Subject: io: remove multistream, teestream unused (hopefully forever) --- src/io/teestream.nim | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/io/teestream.nim (limited to 'src/io/teestream.nim') diff --git a/src/io/teestream.nim b/src/io/teestream.nim deleted file mode 100644 index f70d8c4f..00000000 --- a/src/io/teestream.nim +++ /dev/null @@ -1,47 +0,0 @@ -# TeeStream: write to another stream when reading from one stream. -# See MultiStream for a push version. - -import std/streams - -type TeeStream = ref object of Stream - source: Stream - dest: Stream - closedest: bool - -proc tsClose(s: Stream) = - let s = cast[TeeStream](s) - s.source.close() - if s.closedest: - s.dest.close() - -proc tsReadData(s: Stream, buffer: pointer, bufLen: int): int = - let s = cast[TeeStream](s) - result = s.source.readData(buffer, bufLen) - s.dest.writeData(buffer, result) - -proc tsReadDataStr(s: Stream, buffer: var string, slice: Slice[int]): int = - let s = cast[TeeStream](s) - result = s.source.readDataStr(buffer, slice) - if result <= 0: return - s.dest.writeData(addr buffer[0], result) - -proc tsAtEnd(s: Stream): bool = - let s = cast[TeeStream](s) - return s.source.atEnd - -proc newTeeStream*(source, dest: Stream, closedest = true): TeeStream = - return TeeStream( - source: source, - dest: dest, - closedest: closedest, - closeImpl: tsClose, - readDataImpl: - cast[proc(s: Stream, buffer: pointer, len: int): int - {.nimcall, raises: [Defect, IOError, OSError], tags: [ReadIOEffect], gcsafe.} - ](tsReadData), - readDataStrImpl: - cast[proc(s: Stream, buffer: var string, slice: Slice[int]): int - {.nimcall, raises: [Defect, IOError, OSError], tags: [ReadIOEffect], gcsafe.} - ](tsReadDataStr), - atEndImpl: tsAtEnd - ) -- cgit 1.4.1-2-gfad0