| author | |
| committer | |
| log | 56210d17f2e3fb49e8eccf287aab1a76d09658a9 |
| tree | 10629304e698f28336b97dc7bbb80b719af1fcdb |
| parent | 2a236f46f4a5831891d92469cc571b4215b3bff5 |
| signature |
6 files changed, 14 insertions(+), 0 deletions(-)
AnyReadable.zig+1| ... | ... | @@ -23,6 +23,7 @@ pub const readUntilDelimitersArrayList = R.readUntilDelimitersArrayList; |
| 23 | 23 | pub const readAlloc = R.readAlloc; |
| 24 | 24 | pub const readInt = R.readInt; |
| 25 | 25 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 26 | pub const readUntilDelimiter = R.readUntilDelimiter; | |
| 26 | 27 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 27 | 28 | pub const readExpected = R.readExpected; |
| 28 | 29 | pub const skipBytes = R.skipBytes; |
buffered_reader.zig+1| ... | ... | @@ -35,6 +35,7 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty |
| 35 | 35 | pub const readAlloc = R.readAlloc; |
| 36 | 36 | pub const readInt = R.readInt; |
| 37 | 37 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 38 | pub const readUntilDelimiter = R.readUntilDelimiter; | |
| 38 | 39 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 39 | 40 | pub const readExpected = R.readExpected; |
| 40 | 41 | pub const skipBytes = R.skipBytes; |
counting_reader.zig+1| ... | ... | @@ -38,6 +38,7 @@ pub fn CountingReader(ReaderType: type) type { |
| 38 | 38 | pub const readAlloc = R.readAlloc; |
| 39 | 39 | pub const readInt = R.readInt; |
| 40 | 40 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 41 | pub const readUntilDelimiter = R.readUntilDelimiter; | |
| 41 | 42 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 42 | 43 | pub const readExpected = R.readExpected; |
| 43 | 44 | pub const skipBytes = R.skipBytes; |
fixed_buffer_stream.zig+1| ... | ... | @@ -43,6 +43,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { |
| 43 | 43 | pub const readAlloc = R.readAlloc; |
| 44 | 44 | pub const readInt = R.readInt; |
| 45 | 45 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 46 | pub const readUntilDelimiter = R.readUntilDelimiter; | |
| 46 | 47 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 47 | 48 | pub const readExpected = R.readExpected; |
| 48 | 49 | pub const skipBytes = R.skipBytes; |
limited_reader.zig+1| ... | ... | @@ -38,6 +38,7 @@ pub fn LimitedReader(ReaderType: type) type { |
| 38 | 38 | pub const readAlloc = R.readAlloc; |
| 39 | 39 | pub const readInt = R.readInt; |
| 40 | 40 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 41 | pub const readUntilDelimiter = R.readUntilDelimiter; | |
| 41 | 42 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 42 | 43 | pub const readExpected = R.readExpected; |
| 43 | 44 | pub const skipBytes = R.skipBytes; |
nio.zig+9| ... | ... | @@ -182,6 +182,15 @@ pub fn Readable(T: type, this_kind: enum { _var, _const, _bare }) type { |
| 182 | 182 | return list.toOwnedSlice(); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | pub fn readUntilDelimiter(self: Self, buf: []u8, needle: u8) ![]u8 { | |
| 186 | for (buf, 0..) |*c, i| { | |
| 187 | const b = try readByte(self); | |
| 188 | c.* = b; | |
| 189 | if (b == needle) return buf[0..i]; | |
| 190 | } | |
| 191 | return error.StreamTooLong; | |
| 192 | } | |
| 193 | ||
| 185 | 194 | /// Returned slice is not suffixed by needle but buf will contain it. |
| 186 | 195 | pub fn readUntilDelimiterOrEof(self: Self, buf: []u8, needle: u8) !?[]u8 { |
| 187 | 196 | for (buf, 0..) |*c, i| { |