authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-27 19:11:17 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-06-27 19:11:17 -07:00
logde76815ebec2deead72f0ded8d24b0bb9586c2d8
tree02e256337961d44b2b7650e468096b64d0ef0eb5
parent01b969afa3c984b92eeb62a40529cc803786dab5
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

AllocatingWriter: add anyWritable


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

allocating_writer.zig+13
......@@ -119,4 +119,17 @@ pub const AllocatingWriter = struct {
119119 for (iovec) |vec| self.appendAssumeCapacity(vec.base[0..vec.len]);
120120 return len;
121121 }
122
123 pub fn anyWritable(self: *AllocatingWriter) nio.AnyWritable {
124 const S = struct {
125 fn write(s: *allowzero anyopaque, buffer: []const u8) anyerror!usize {
126 const bw: *AllocatingWriter = @ptrCast(@alignCast(s));
127 return bw.write(buffer);
128 }
129 };
130 return .{
131 .vtable = &.{ .write = S.write },
132 .state = @ptrCast(self),
133 };
134 }
122135};