| ... | @@ -1,5 +1,6 @@ | ... | @@ -1,5 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const nio = @import("./nio.zig"); | 2 | const nio = @import("./nio.zig"); |
| | 3 | const extras = @import("extras"); |
| 3 | | 4 | |
| 4 | pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) type { | 5 | pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) type { |
| 5 | return struct { | 6 | return struct { |
| ... | @@ -39,7 +40,7 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty | ... | @@ -39,7 +40,7 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty |
| 39 | pub const skipBytes = R.skipBytes; | 40 | pub const skipBytes = R.skipBytes; |
| 40 | pub const skipUntilDelimiterOrEof = R.skipUntilDelimiterOrEof; | 41 | pub const skipUntilDelimiterOrEof = R.skipUntilDelimiterOrEof; |
| 41 | | 42 | |
| 42 | pub const ReadError = ReaderType.ReadError; | 43 | pub const ReadError = extras.Pointee(ReaderType).ReadError; |
| 43 | pub fn read(self: *Self, dest: []u8) ReadError!usize { | 44 | pub fn read(self: *Self, dest: []u8) ReadError!usize { |
| 44 | // First try reading from the already buffered data onto the destination. | 45 | // First try reading from the already buffered data onto the destination. |
| 45 | const current = self.buf[self.start..self.end]; | 46 | const current = self.buf[self.start..self.end]; |