authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 13:50:56 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 13:50:56 -07:00
log62170a7ffee9a771bc71c52179e6ae7daa5ea11b
tree9fce29a9bc301b62b793705fed5d27ecfe0c4a6c
parent6e828b498ea16af2d52b62922d18d868e1b85d2b
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

CountingWriter: add writev


1 files changed, 11 insertions(+), 0 deletions(-)

counting_writer.zig+11
......@@ -1,7 +1,13 @@
11const std = @import("std");
2const builtin = @import("builtin");
23const extras = @import("extras");
34const nio = @import("./nio.zig");
45
6const sys = switch (builtin.target.os.tag) {
7 .linux => @import("sys-linux"),
8 else => unreachable,
9};
10
511pub fn CountingWriter(WriterType: type) type {
612 return struct {
713 backing_writer: WriterType,
......@@ -32,5 +38,10 @@ pub fn CountingWriter(WriterType: type) type {
3238 self.bytes_written += len;
3339 return len;
3440 }
41 pub fn writev(self: *Self, iovec: []const sys.struct_iovec) WriteError!usize {
42 const len = try self.backing_writer.writev(iovec);
43 self.bytes_written += len;
44 return len;
45 }
3546 };
3647}