| ... | @@ -119,4 +119,17 @@ pub const AllocatingWriter = struct { | ... | @@ -119,4 +119,17 @@ pub const AllocatingWriter = struct { |
| 119 | for (iovec) |vec| self.appendAssumeCapacity(vec.base[0..vec.len]); | 119 | for (iovec) |vec| self.appendAssumeCapacity(vec.base[0..vec.len]); |
| 120 | return len; | 120 | return len; |
| 121 | } | 121 | } |
| | 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 | } |
| 122 | }; | 135 | }; |