Commit e72472d953

Jay Petacat <jay@jayschwa.net>
2021-01-08 21:57:39
io: `FindByteOutStream` to `FindByteWriter`
See #4917
1 parent 1595ce2
lib/std/io/find_byte_out_stream.zig → 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,
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);
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;
 
CMakeLists.txt
@@ -377,7 +377,7 @@ set(ZIG_STAGE2_SOURCES
     "${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig"
     "${CMAKE_SOURCE_DIR}/lib/std/io/counting_writer.zig"
     "${CMAKE_SOURCE_DIR}/lib/std/io/counting_reader.zig"
-    "${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_out_stream.zig"
+    "${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_writer.zig"
     "${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig"
     "${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig"
     "${CMAKE_SOURCE_DIR}/lib/std/io/seekable_stream.zig"