| ... | ... | @@ -1,7 +1,13 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); |
| 2 | 3 | const extras = @import("extras"); |
| 3 | 4 | const nio = @import("./nio.zig"); |
| 4 | 5 | |
| 6 | const sys = switch (builtin.target.os.tag) { |
| 7 | .linux => @import("sys-linux"), |
| 8 | else => unreachable, |
| 9 | }; |
| 10 | |
| 5 | 11 | pub fn CountingWriter(WriterType: type) type { |
| 6 | 12 | return struct { |
| 7 | 13 | backing_writer: WriterType, |
| ... | ... | @@ -32,5 +38,10 @@ pub fn CountingWriter(WriterType: type) type { |
| 32 | 38 | self.bytes_written += len; |
| 33 | 39 | return len; |
| 34 | 40 | } |
| 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 | } |
| 35 | 46 | }; |
| 36 | 47 | } |