zig
zig copied to clipboard
Proposal: Consider BufferReader and BufferWriter implementation in std.mem
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 to std.mem
namespace, although FixedBufferReader
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 together FixedBufferReader
and FixedBufferWriter
would be very nice addition to std.mem
namespace in my opinion.