| author | |
| committer | |
| log | af0a02a2de8fad56029cccbfeb6254a2c2169b51 |
| tree | a0d09dbe06b7720d92ff17142941391a400b21e8 |
| parent | 03a6892189891f1566b9e63780129834bea7eb1e |
dead2 files changed, 0 insertions(+), 43 deletions(-)
lib/std/Io.zig-3| ... | @@ -462,9 +462,6 @@ pub const bitReader = @import("Io/bit_reader.zig").bitReader; | ... | @@ -462,9 +462,6 @@ pub const bitReader = @import("Io/bit_reader.zig").bitReader; |
| 462 | pub const BitWriter = @import("Io/bit_writer.zig").BitWriter; | 462 | pub const BitWriter = @import("Io/bit_writer.zig").BitWriter; |
| 463 | pub const bitWriter = @import("Io/bit_writer.zig").bitWriter; | 463 | pub const bitWriter = @import("Io/bit_writer.zig").bitWriter; |
| 464 | 464 | ||
| 465 | pub const FindByteWriter = @import("Io/find_byte_writer.zig").FindByteWriter; | ||
| 466 | pub const findByteWriter = @import("Io/find_byte_writer.zig").findByteWriter; | ||
| 467 | |||
| 468 | pub const tty = @import("Io/tty.zig"); | 465 | pub const tty = @import("Io/tty.zig"); |
| 469 | 466 | ||
| 470 | /// A Writer that doesn't write to anything. | 467 | /// A Writer that doesn't write to anything. |
lib/std/Io/find_byte_writer.zig deleted-40| ... | @@ -1,40 +0,0 @@ | ||
| 1 | const std = @import("../std.zig"); | ||
| 2 | const io = std.io; | ||
| 3 | const assert = std.debug.assert; | ||
| 4 | |||
| 5 | /// A Writer that returns whether the given character has been written to it. | ||
| 6 | /// The contents are not written to anything. | ||
| 7 | pub fn FindByteWriter(comptime UnderlyingWriter: type) type { | ||
| 8 | return struct { | ||
| 9 | const Self = @This(); | ||
| 10 | pub const Error = UnderlyingWriter.Error; | ||
| 11 | pub const Writer = io.GenericWriter(*Self, Error, write); | ||
| 12 | |||
| 13 | underlying_writer: UnderlyingWriter, | ||
| 14 | byte_found: bool, | ||
| 15 | byte: u8, | ||
| 16 | |||
| 17 | pub fn writer(self: *Self) Writer { | ||
| 18 | return .{ .context = self }; | ||
| 19 | } | ||
| 20 | |||
| 21 | fn write(self: *Self, bytes: []const u8) Error!usize { | ||
| 22 | if (!self.byte_found) { | ||
| 23 | self.byte_found = blk: { | ||
| 24 | for (bytes) |b| | ||
| 25 | if (b == self.byte) break :blk true; | ||
| 26 | break :blk false; | ||
| 27 | }; | ||
| 28 | } | ||
| 29 | return self.underlying_writer.write(bytes); | ||
| 30 | } | ||
| 31 | }; | ||
| 32 | } | ||
| 33 | |||
| 34 | pub fn findByteWriter(byte: u8, underlying_writer: anytype) FindByteWriter(@TypeOf(underlying_writer)) { | ||
| 35 | return FindByteWriter(@TypeOf(underlying_writer)){ | ||
| 36 | .underlying_writer = underlying_writer, | ||
| 37 | .byte = byte, | ||
| 38 | .byte_found = false, | ||
| 39 | }; | ||
| 40 | } | ||