The issue I have: network protocol requires to specify payload length in header. Payload could vary in size and not easily countable from a particular request structure. So my idea is to use array list to write data to, write its length to the header and use real writer to push header and array list.
std.Io.Writer.Allocating
If your protocol has a max packet size you could use the std.Io.Writer.fixed backed by an array
It doesn’t. Currently I have own ugly writer interface (not compatible with std.io) with counting and fixed implementations and do encoding in two passes: first writes nothing but counts final length, second does an actual write to allocated buf with required capacity.