-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Proposal: Consider BufferReader and BufferWriter implementation in std.mem #20179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
are you perhaps looking for std.io.BufferedReader and std.io.BufferedWriter ? |
There is a lot of similarities but this is a bit different. |
in that case it sounds like std.BoundedArray and std.fifo.LinearFifo ? |
Please take a look on FixedBufferReader it was made public in |
Perhaps I'm missing something, but isn't |
@tgschultz in comparison to SliceReader it is missing peek operation. I wonder is such operation should by dedicated or be emulated by using |
With #22125 merged I this issue can be closed |
I'm quite new to the Zig community, so I may not have seen a lot, but recently, while submitting a PR to the MicroZig project, I had to implement BufferReader and BufferWriter types. This is quite common pattern (I think) and Zig also use it in one place where it is called
FixedBufferReader
. I think something like that is very useful and should be promoted tostd.mem
namespace, althoughFixedBufferReader
itself have some specyfic functions (like:readUleb128
) I would not expect in generic implementation.FixedBufferWriter
would be useful in cases when we have to join together a lot os small byte chunks while serializing. So togetherFixedBufferReader
andFixedBufferWriter
would be very nice addition tostd.mem
namespace in my opinion.The text was updated successfully, but these errors were encountered: