diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-24 14:12:27 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-24 14:21:01 +0100 |
commit | fb21b1e4f0ee0e55e9556bf1f399d00d5eae26e4 (patch) | |
tree | c532aa98ee6bedf19b840f4ea0c7360a42407fbf /src/io/bufwriter.nim | |
parent | b27deb7672c53e3ee59f91b7091e83ab28a8318d (diff) | |
download | chawan-fb21b1e4f0ee0e55e9556bf1f399d00d5eae26e4.tar.gz |
io: derive DynStream from RootObj (not Stream)
This way they are no longer compatible, but we no longer need them to be compatible anyway. (This also forces us to throw out the old serialize module, and use packet writers everywhere.)
Diffstat (limited to 'src/io/bufwriter.nim')
-rw-r--r-- | src/io/bufwriter.nim | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/io/bufwriter.nim b/src/io/bufwriter.nim index cbee8b5b..75da4190 100644 --- a/src/io/bufwriter.nim +++ b/src/io/bufwriter.nim @@ -1,4 +1,5 @@ -# Write data to streams. +# Write data to streams in packets. +# Each packet is prefixed with its length as a pointer-sized integer. import std/options import std/sets @@ -53,13 +54,6 @@ proc deinit*(writer: var BufferedWriter) = writer.bufSize = 0 writer.bufLen = 0 -template withWriter*(stream: DynStream; w, body: untyped) = - block: - var w = stream.initWriter() - body - w.flush() - w.deinit() - template withPacketWriter*(stream: DynStream; w, body: untyped) = block: var w = stream.initWriter(writeLen = true) |