I'm too dumb for Zig's new IO interface

FWIW Re tracking number of bytes written, the 15.1 release notes say:

CountingWriter Deleted

  • If you were discarding the bytes, use std.Io.Writer.Discarding, which has a count.
  • If you were allocating the bytes, use std.Io.Writer.Allocating, since you can check how much was allocated.
  • If you were writing to a fixed buffer, use std.Io.Writer.fixed, and then check the end position.
  • Otherwise, try not to create an entire node in the stream graph solely for counting bytes. It’s very disruptive to optimal buffering.
3 Likes