authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 13:50:44 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-22 13:50:44 -07:00
log6e828b498ea16af2d52b62922d18d868e1b85d2b
tree8aae2df879f150f540a7bd9889fd7cecce5f66cb
parent143e3db17dca31d456b30d53ce6184488a331f70
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

NullWriter: add writev


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

null_writer.zig+12
...@@ -1,7 +1,13 @@...@@ -1,7 +1,13 @@
1const std = @import("std");1const std = @import("std");
2const builtin = @import("builtin");
2const extras = @import("extras");3const extras = @import("extras");
3const nio = @import("./nio.zig");4const nio = @import("./nio.zig");
45
6const sys = switch (builtin.target.os.tag) {
7 .linux => @import("sys-linux"),
8 else => unreachable,
9};
10
5pub const NullWriter = struct {11pub const NullWriter = struct {
6 const W = nio.Writable(@This(), ._var);12 const W = nio.Writable(@This(), ._var);
7 pub const writeAll = W.writeAll;13 pub const writeAll = W.writeAll;
...@@ -18,4 +24,10 @@ pub const NullWriter = struct {...@@ -18,4 +24,10 @@ pub const NullWriter = struct {
18 _ = self;24 _ = self;
19 return bytes.len;25 return bytes.len;
20 }26 }
27 pub fn writev(self: NullWriter, iovec: []const sys.struct_iovec) WriteError!usize {
28 _ = self;
29 var res: u64 = 0;
30 for (iovec) |item| res += item.len;
31 return res;
32 }
21};33};