From 62170a7ffee9a771bc71c52179e6ae7daa5ea11b Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 22 May 2026 13:50:56 -0700 Subject: [PATCH] CountingWriter: add writev --- counting_writer.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/counting_writer.zig b/counting_writer.zig index 92691b8615844a5db553ccdbf590793620f57c64..d54a35318fc41e62b1b85e0d7ca171bba947fa19 100644 --- a/counting_writer.zig +++ b/counting_writer.zig @@ -1,7 +1,13 @@ const std = @import("std"); +const builtin = @import("builtin"); const extras = @import("extras"); const nio = @import("./nio.zig"); +const sys = switch (builtin.target.os.tag) { + .linux => @import("sys-linux"), + else => unreachable, +}; + pub fn CountingWriter(WriterType: type) type { return struct { backing_writer: WriterType, @@ -32,5 +38,10 @@ pub fn CountingWriter(WriterType: type) type { self.bytes_written += len; return len; } + pub fn writev(self: *Self, iovec: []const sys.struct_iovec) WriteError!usize { + const len = try self.backing_writer.writev(iovec); + self.bytes_written += len; + return len; + } }; } -- 2.54.0