diff options
| author | Jay Petacat <jay@jayschwa.net> | 2021-01-08 15:57:39 -0500 |
|---|---|---|
| committer | Jay Petacat <jay@jayschwa.net> | 2021-01-08 16:54:56 -0500 |
| commit | e72472d953f5e91d37bc5f1bf1ec7b6fb5b1afe2 (patch) | |
| tree | 330c924a9e1fcd46275ca9500bd60e9054251a98 /lib/std | |
| parent | 1595ce273edb32493231a43216a15cfbeb9ffc12 (diff) | |
| download | zig-e72472d953f5e91d37bc5f1bf1ec7b6fb5b1afe2.tar.gz zig-e72472d953f5e91d37bc5f1bf1ec7b6fb5b1afe2.zip | |
io: `FindByteOutStream` to `FindByteWriter`
See #4917
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/io.zig | 8 | ||||
| -rw-r--r-- | lib/std/io/find_byte_writer.zig (renamed from lib/std/io/find_byte_out_stream.zig) | 8 | ||||
| -rw-r--r-- | lib/std/zig/render.zig | 4 |
3 files changed, 12 insertions, 8 deletions
diff --git a/lib/std/io.zig b/lib/std/io.zig index 3d8744d74d..fb5f00805c 100644 --- a/lib/std/io.zig +++ b/lib/std/io.zig @@ -145,8 +145,12 @@ pub const autoIndentingStream = @import("io/auto_indenting_stream.zig").autoInde pub const ChangeDetectionStream = @import("io/change_detection_stream.zig").ChangeDetectionStream; pub const changeDetectionStream = @import("io/change_detection_stream.zig").changeDetectionStream; -pub const FindByteOutStream = @import("io/find_byte_out_stream.zig").FindByteOutStream; -pub const findByteOutStream = @import("io/find_byte_out_stream.zig").findByteOutStream; +pub const FindByteWriter = @import("io/find_byte_writer.zig").FindByteWriter; +pub const findByteWriter = @import("io/find_byte_writer.zig").findByteWriter; +/// Deprecated: use `FindByteWriter`. +pub const FindByteOutStream = FindByteWriter; +/// Deprecated: use `findByteWriter`. +pub const findByteOutStream = findByteWriter; pub const BufferedAtomicFile = @import("io/buffered_atomic_file.zig").BufferedAtomicFile; diff --git a/lib/std/io/find_byte_out_stream.zig b/lib/std/io/find_byte_writer.zig index e0e8fa871c..db45114d3e 100644 --- a/lib/std/io/find_byte_out_stream.zig +++ b/lib/std/io/find_byte_writer.zig @@ -8,9 +8,9 @@ const std = @import("../std.zig"); const io = std.io; const assert = std.debug.assert; -/// An OutStream that returns whether the given character has been written to it. +/// A Writer that returns whether the given character has been written to it. /// The contents are not written to anything. -pub fn FindByteOutStream(comptime UnderlyingWriter: type) type { +pub fn FindByteWriter(comptime UnderlyingWriter: type) type { return struct { const Self = @This(); pub const Error = UnderlyingWriter.Error; @@ -37,8 +37,8 @@ pub fn FindByteOutStream(comptime UnderlyingWriter: type) type { }; } -pub fn findByteOutStream(byte: u8, underlying_writer: anytype) FindByteOutStream(@TypeOf(underlying_writer)) { - return FindByteOutStream(@TypeOf(underlying_writer)){ +pub fn findByteWriter(byte: u8, underlying_writer: anytype) FindByteWriter(@TypeOf(underlying_writer)) { + return FindByteWriter(@TypeOf(underlying_writer)){ .underlying_writer = underlying_writer, .byte = byte, .byte_found = false, diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 8d2d37b76a..3cced0dd6b 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -790,7 +790,7 @@ fn renderExpression( const section_exprs = row_exprs[0..section_end]; // Null stream for counting the printed length of each expression - var line_find_stream = std.io.findByteOutStream('\n', std.io.null_writer); + var line_find_stream = std.io.findByteWriter('\n', std.io.null_writer); var counting_stream = std.io.countingWriter(line_find_stream.writer()); var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer()); @@ -954,7 +954,7 @@ fn renderExpression( const expr_outputs_one_line = blk: { // render field expressions until a LF is found for (field_inits) |field_init| { - var find_stream = std.io.findByteOutStream('\n', std.io.null_writer); + var find_stream = std.io.findByteWriter('\n', std.io.null_writer); var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, find_stream.writer()); try renderExpression(allocator, &auto_indenting_stream, tree, field_init, Space.None); |
