| 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,6 +23,7 @@ pub const readUntilDelimitersArrayList = R.readUntilDelimitersArrayList; |
| 23 | pub const readAlloc = R.readAlloc; | 23 | pub const readAlloc = R.readAlloc; |
| 24 | pub const readInt = R.readInt; | 24 | pub const readInt = R.readInt; |
| 25 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; | 25 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 26 | pub const readUntilDelimiter = R.readUntilDelimiter; | ||
| 26 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; | 27 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 27 | pub const readExpected = R.readExpected; | 28 | pub const readExpected = R.readExpected; |
| 28 | pub const skipBytes = R.skipBytes; | 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,6 +35,7 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty |
| 35 | pub const readAlloc = R.readAlloc; | 35 | pub const readAlloc = R.readAlloc; |
| 36 | pub const readInt = R.readInt; | 36 | pub const readInt = R.readInt; |
| 37 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; | 37 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 38 | pub const readUntilDelimiter = R.readUntilDelimiter; | ||
| 38 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; | 39 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 39 | pub const readExpected = R.readExpected; | 40 | pub const readExpected = R.readExpected; |
| 40 | pub const skipBytes = R.skipBytes; | 41 | pub const skipBytes = R.skipBytes; |
counting_reader.zig+1| ... | @@ -38,6 +38,7 @@ pub fn CountingReader(ReaderType: type) type { | ... | @@ -38,6 +38,7 @@ pub fn CountingReader(ReaderType: type) type { |
| 38 | pub const readAlloc = R.readAlloc; | 38 | pub const readAlloc = R.readAlloc; |
| 39 | pub const readInt = R.readInt; | 39 | pub const readInt = R.readInt; |
| 40 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; | 40 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 41 | pub const readUntilDelimiter = R.readUntilDelimiter; | ||
| 41 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; | 42 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 42 | pub const readExpected = R.readExpected; | 43 | pub const readExpected = R.readExpected; |
| 43 | pub const skipBytes = R.skipBytes; | 44 | pub const skipBytes = R.skipBytes; |
fixed_buffer_stream.zig+1| ... | @@ -43,6 +43,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { | ... | @@ -43,6 +43,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { |
| 43 | pub const readAlloc = R.readAlloc; | 43 | pub const readAlloc = R.readAlloc; |
| 44 | pub const readInt = R.readInt; | 44 | pub const readInt = R.readInt; |
| 45 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; | 45 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 46 | pub const readUntilDelimiter = R.readUntilDelimiter; | ||
| 46 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; | 47 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 47 | pub const readExpected = R.readExpected; | 48 | pub const readExpected = R.readExpected; |
| 48 | pub const skipBytes = R.skipBytes; | 49 | pub const skipBytes = R.skipBytes; |
limited_reader.zig+1| ... | @@ -38,6 +38,7 @@ pub fn LimitedReader(ReaderType: type) type { | ... | @@ -38,6 +38,7 @@ pub fn LimitedReader(ReaderType: type) type { |
| 38 | pub const readAlloc = R.readAlloc; | 38 | pub const readAlloc = R.readAlloc; |
| 39 | pub const readInt = R.readInt; | 39 | pub const readInt = R.readInt; |
| 40 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; | 40 | pub const readUntilDelimitersAlloc = R.readUntilDelimitersAlloc; |
| 41 | pub const readUntilDelimiter = R.readUntilDelimiter; | ||
| 41 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; | 42 | pub const readUntilDelimiterOrEof = R.readUntilDelimiterOrEof; |
| 42 | pub const readExpected = R.readExpected; | 43 | pub const readExpected = R.readExpected; |
| 43 | pub const skipBytes = R.skipBytes; | 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,6 +182,15 @@ pub fn Readable(T: type, this_kind: enum { _var, _const, _bare }) type { |
| 182 | return list.toOwnedSlice(); | 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 | /// Returned slice is not suffixed by needle but buf will contain it. | 194 | /// Returned slice is not suffixed by needle but buf will contain it. |
| 186 | pub fn readUntilDelimiterOrEof(self: Self, buf: []u8, needle: u8) !?[]u8 { | 195 | pub fn readUntilDelimiterOrEof(self: Self, buf: []u8, needle: u8) !?[]u8 { |
| 187 | for (buf, 0..) |*c, i| { | 196 | for (buf, 0..) |*c, i| { |