| author | |
| committer | |
| log | 29928af6005997d2b02b4c3a3576a696a02fa269 |
| tree | 9852e606adc5bc065e758482445bb6d1c5ead99c |
| parent | a0ad2dee6a0b3bb7fd04032f6113206f7b4e73eb |
| parent | e72472d953f5e91d37bc5f1bf1ec7b6fb5b1afe2 |
| signature |
Remove deprecated stream aliases32 files changed, 98 insertions(+), 324 deletions(-)
CMakeLists.txt+1-1| ... | ... | @@ -377,7 +377,7 @@ set(ZIG_STAGE2_SOURCES |
| 377 | 377 | "${CMAKE_SOURCE_DIR}/lib/std/io/change_detection_stream.zig" |
| 378 | 378 | "${CMAKE_SOURCE_DIR}/lib/std/io/counting_writer.zig" |
| 379 | 379 | "${CMAKE_SOURCE_DIR}/lib/std/io/counting_reader.zig" |
| 380 | "${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_out_stream.zig" | |
| 380 | "${CMAKE_SOURCE_DIR}/lib/std/io/find_byte_writer.zig" | |
| 381 | 381 | "${CMAKE_SOURCE_DIR}/lib/std/io/fixed_buffer_stream.zig" |
| 382 | 382 | "${CMAKE_SOURCE_DIR}/lib/std/io/reader.zig" |
| 383 | 383 | "${CMAKE_SOURCE_DIR}/lib/std/io/seekable_stream.zig" |
doc/langref.html.in+3-3| ... | ... | @@ -6120,7 +6120,7 @@ pub fn main() void { |
| 6120 | 6120 | |
| 6121 | 6121 | {#code_begin|syntax#} |
| 6122 | 6122 | /// Calls print and then flushes the buffer. |
| 6123 | pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anyerror!void { | |
| 6123 | pub fn printf(self: *Writer, comptime format: []const u8, args: anytype) anyerror!void { | |
| 6124 | 6124 | const State = enum { |
| 6125 | 6125 | start, |
| 6126 | 6126 | open_brace, |
| ... | ... | @@ -6192,7 +6192,7 @@ pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anye |
| 6192 | 6192 | and emits a function that actually looks like this: |
| 6193 | 6193 | </p> |
| 6194 | 6194 | {#code_begin|syntax#} |
| 6195 | pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void { | |
| 6195 | pub fn printf(self: *Writer, arg0: i32, arg1: []const u8) !void { | |
| 6196 | 6196 | try self.write("here is a string: '"); |
| 6197 | 6197 | try self.printValue(arg0); |
| 6198 | 6198 | try self.write("' here is a number: "); |
| ... | ... | @@ -6206,7 +6206,7 @@ pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void { |
| 6206 | 6206 | on the type: |
| 6207 | 6207 | </p> |
| 6208 | 6208 | {#code_begin|syntax#} |
| 6209 | pub fn printValue(self: *OutStream, value: anytype) !void { | |
| 6209 | pub fn printValue(self: *Writer, value: anytype) !void { | |
| 6210 | 6210 | switch (@typeInfo(@TypeOf(value))) { |
| 6211 | 6211 | .Int => { |
| 6212 | 6212 | return self.printInt(T, value); |
lib/std/array_list.zig-3| ... | ... | @@ -242,9 +242,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { |
| 242 | 242 | return .{ .context = self }; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | /// Deprecated: use `writer` | |
| 246 | pub const outStream = writer; | |
| 247 | ||
| 248 | 245 | /// Same as `append` except it returns the number of bytes written, which is always the same |
| 249 | 246 | /// as `m.len`. The purpose of this function existing is to match `std.io.Writer` API. |
| 250 | 247 | fn appendWrite(self: *Self, m: []const u8) !usize { |
lib/std/fifo.zig+1-11| ... | ... | @@ -232,11 +232,6 @@ pub fn LinearFifo( |
| 232 | 232 | return .{ .context = self }; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | /// Deprecated: `use reader` | |
| 236 | pub fn inStream(self: *Self) std.io.InStream(*Self, error{}, readFn) { | |
| 237 | return .{ .context = self }; | |
| 238 | } | |
| 239 | ||
| 240 | 235 | /// Returns number of items available in fifo |
| 241 | 236 | pub fn writableLength(self: Self) usize { |
| 242 | 237 | return self.buf.len - self.count; |
| ... | ... | @@ -317,7 +312,7 @@ pub fn LinearFifo( |
| 317 | 312 | } |
| 318 | 313 | |
| 319 | 314 | /// Same as `write` except it returns the number of bytes written, which is always the same |
| 320 | /// as `bytes.len`. The purpose of this function existing is to match `std.io.OutStream` API. | |
| 315 | /// as `bytes.len`. The purpose of this function existing is to match `std.io.Writer` API. | |
| 321 | 316 | fn appendWrite(self: *Self, bytes: []const u8) error{OutOfMemory}!usize { |
| 322 | 317 | try self.write(bytes); |
| 323 | 318 | return bytes.len; |
| ... | ... | @@ -327,11 +322,6 @@ pub fn LinearFifo( |
| 327 | 322 | return .{ .context = self }; |
| 328 | 323 | } |
| 329 | 324 | |
| 330 | /// Deprecated: `use writer` | |
| 331 | pub fn outStream(self: *Self) std.io.OutStream(*Self, error{OutOfMemory}, appendWrite) { | |
| 332 | return .{ .context = self }; | |
| 333 | } | |
| 334 | ||
| 335 | 325 | /// Make `count` items available before the current read location |
| 336 | 326 | fn rewind(self: *Self, count: usize) void { |
| 337 | 327 | assert(self.writableLength() >= count); |
lib/std/fs/file.zig-16| ... | ... | @@ -813,32 +813,16 @@ pub const File = struct { |
| 813 | 813 | |
| 814 | 814 | pub const Reader = io.Reader(File, ReadError, read); |
| 815 | 815 | |
| 816 | /// Deprecated: use `Reader` | |
| 817 | pub const InStream = Reader; | |
| 818 | ||
| 819 | 816 | pub fn reader(file: File) Reader { |
| 820 | 817 | return .{ .context = file }; |
| 821 | 818 | } |
| 822 | 819 | |
| 823 | /// Deprecated: use `reader` | |
| 824 | pub fn inStream(file: File) Reader { | |
| 825 | return .{ .context = file }; | |
| 826 | } | |
| 827 | ||
| 828 | 820 | pub const Writer = io.Writer(File, WriteError, write); |
| 829 | 821 | |
| 830 | /// Deprecated: use `Writer` | |
| 831 | pub const OutStream = Writer; | |
| 832 | ||
| 833 | 822 | pub fn writer(file: File) Writer { |
| 834 | 823 | return .{ .context = file }; |
| 835 | 824 | } |
| 836 | 825 | |
| 837 | /// Deprecated: use `writer` | |
| 838 | pub fn outStream(file: File) Writer { | |
| 839 | return .{ .context = file }; | |
| 840 | } | |
| 841 | ||
| 842 | 826 | pub const SeekableStream = io.SeekableStream( |
| 843 | 827 | File, |
| 844 | 828 | SeekError, |
lib/std/heap/logging_allocator.zig+15-15| ... | ... | @@ -9,22 +9,22 @@ const Allocator = std.mem.Allocator; |
| 9 | 9 | /// This allocator is used in front of another allocator and logs to the provided stream |
| 10 | 10 | /// on every call to the allocator. Stream errors are ignored. |
| 11 | 11 | /// If https://github.com/ziglang/zig/issues/2586 is implemented, this API can be improved. |
| 12 | pub fn LoggingAllocator(comptime OutStreamType: type) type { | |
| 12 | pub fn LoggingAllocator(comptime Writer: type) type { | |
| 13 | 13 | return struct { |
| 14 | 14 | allocator: Allocator, |
| 15 | 15 | parent_allocator: *Allocator, |
| 16 | out_stream: OutStreamType, | |
| 16 | writer: Writer, | |
| 17 | 17 | |
| 18 | 18 | const Self = @This(); |
| 19 | 19 | |
| 20 | pub fn init(parent_allocator: *Allocator, out_stream: OutStreamType) Self { | |
| 20 | pub fn init(parent_allocator: *Allocator, writer: Writer) Self { | |
| 21 | 21 | return Self{ |
| 22 | 22 | .allocator = Allocator{ |
| 23 | 23 | .allocFn = alloc, |
| 24 | 24 | .resizeFn = resize, |
| 25 | 25 | }, |
| 26 | 26 | .parent_allocator = parent_allocator, |
| 27 | .out_stream = out_stream, | |
| 27 | .writer = writer, | |
| 28 | 28 | }; |
| 29 | 29 | } |
| 30 | 30 | |
| ... | ... | @@ -36,12 +36,12 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type { |
| 36 | 36 | ra: usize, |
| 37 | 37 | ) error{OutOfMemory}![]u8 { |
| 38 | 38 | const self = @fieldParentPtr(Self, "allocator", allocator); |
| 39 | self.out_stream.print("alloc : {}", .{len}) catch {}; | |
| 39 | self.writer.print("alloc : {}", .{len}) catch {}; | |
| 40 | 40 | const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra); |
| 41 | 41 | if (result) |buff| { |
| 42 | self.out_stream.print(" success!\n", .{}) catch {}; | |
| 42 | self.writer.print(" success!\n", .{}) catch {}; | |
| 43 | 43 | } else |err| { |
| 44 | self.out_stream.print(" failure!\n", .{}) catch {}; | |
| 44 | self.writer.print(" failure!\n", .{}) catch {}; | |
| 45 | 45 | } |
| 46 | 46 | return result; |
| 47 | 47 | } |
| ... | ... | @@ -56,20 +56,20 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type { |
| 56 | 56 | ) error{OutOfMemory}!usize { |
| 57 | 57 | const self = @fieldParentPtr(Self, "allocator", allocator); |
| 58 | 58 | if (new_len == 0) { |
| 59 | self.out_stream.print("free : {}\n", .{buf.len}) catch {}; | |
| 59 | self.writer.print("free : {}\n", .{buf.len}) catch {}; | |
| 60 | 60 | } else if (new_len <= buf.len) { |
| 61 | self.out_stream.print("shrink: {} to {}\n", .{ buf.len, new_len }) catch {}; | |
| 61 | self.writer.print("shrink: {} to {}\n", .{ buf.len, new_len }) catch {}; | |
| 62 | 62 | } else { |
| 63 | self.out_stream.print("expand: {} to {}", .{ buf.len, new_len }) catch {}; | |
| 63 | self.writer.print("expand: {} to {}", .{ buf.len, new_len }) catch {}; | |
| 64 | 64 | } |
| 65 | 65 | if (self.parent_allocator.resizeFn(self.parent_allocator, buf, buf_align, new_len, len_align, ra)) |resized_len| { |
| 66 | 66 | if (new_len > buf.len) { |
| 67 | self.out_stream.print(" success!\n", .{}) catch {}; | |
| 67 | self.writer.print(" success!\n", .{}) catch {}; | |
| 68 | 68 | } |
| 69 | 69 | return resized_len; |
| 70 | 70 | } else |e| { |
| 71 | 71 | std.debug.assert(new_len > buf.len); |
| 72 | self.out_stream.print(" failure!\n", .{}) catch {}; | |
| 72 | self.writer.print(" failure!\n", .{}) catch {}; | |
| 73 | 73 | return e; |
| 74 | 74 | } |
| 75 | 75 | } |
| ... | ... | @@ -78,9 +78,9 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type { |
| 78 | 78 | |
| 79 | 79 | pub fn loggingAllocator( |
| 80 | 80 | parent_allocator: *Allocator, |
| 81 | out_stream: anytype, | |
| 82 | ) LoggingAllocator(@TypeOf(out_stream)) { | |
| 83 | return LoggingAllocator(@TypeOf(out_stream)).init(parent_allocator, out_stream); | |
| 81 | writer: anytype, | |
| 82 | ) LoggingAllocator(@TypeOf(writer)) { | |
| 83 | return LoggingAllocator(@TypeOf(writer)).init(parent_allocator, writer); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | test "LoggingAllocator" { |
lib/std/io.zig+6-39| ... | ... | @@ -107,26 +107,14 @@ pub fn getStdIn() File { |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | pub const Reader = @import("io/reader.zig").Reader; |
| 110 | /// Deprecated: use `Reader` | |
| 111 | pub const InStream = Reader; | |
| 112 | 110 | pub const Writer = @import("io/writer.zig").Writer; |
| 113 | /// Deprecated: use `Writer` | |
| 114 | pub const OutStream = Writer; | |
| 115 | 111 | pub const SeekableStream = @import("io/seekable_stream.zig").SeekableStream; |
| 116 | 112 | |
| 117 | 113 | pub const BufferedWriter = @import("io/buffered_writer.zig").BufferedWriter; |
| 118 | 114 | pub const bufferedWriter = @import("io/buffered_writer.zig").bufferedWriter; |
| 119 | /// Deprecated: use `BufferedWriter` | |
| 120 | pub const BufferedOutStream = BufferedWriter; | |
| 121 | /// Deprecated: use `bufferedWriter` | |
| 122 | pub const bufferedOutStream = bufferedWriter; | |
| 123 | 115 | |
| 124 | 116 | pub const BufferedReader = @import("io/buffered_reader.zig").BufferedReader; |
| 125 | 117 | pub const bufferedReader = @import("io/buffered_reader.zig").bufferedReader; |
| 126 | /// Deprecated: use `BufferedReader` | |
| 127 | pub const BufferedInStream = BufferedReader; | |
| 128 | /// Deprecated: use `bufferedReader` | |
| 129 | pub const bufferedInStream = bufferedReader; | |
| 130 | 118 | |
| 131 | 119 | pub const PeekStream = @import("io/peek_stream.zig").PeekStream; |
| 132 | 120 | pub const peekStream = @import("io/peek_stream.zig").peekStream; |
| ... | ... | @@ -136,40 +124,20 @@ pub const fixedBufferStream = @import("io/fixed_buffer_stream.zig").fixedBufferS |
| 136 | 124 | |
| 137 | 125 | pub const CWriter = @import("io/c_writer.zig").CWriter; |
| 138 | 126 | pub const cWriter = @import("io/c_writer.zig").cWriter; |
| 139 | /// Deprecated: use `CWriter` | |
| 140 | pub const COutStream = CWriter; | |
| 141 | /// Deprecated: use `cWriter` | |
| 142 | pub const cOutStream = cWriter; | |
| 143 | 127 | |
| 144 | 128 | pub const CountingWriter = @import("io/counting_writer.zig").CountingWriter; |
| 145 | 129 | pub const countingWriter = @import("io/counting_writer.zig").countingWriter; |
| 146 | 130 | pub const CountingReader = @import("io/counting_reader.zig").CountingReader; |
| 147 | 131 | pub const countingReader = @import("io/counting_reader.zig").countingReader; |
| 148 | /// Deprecated: use `CountingWriter` | |
| 149 | pub const CountingOutStream = CountingWriter; | |
| 150 | /// Deprecated: use `countingWriter` | |
| 151 | pub const countingOutStream = countingWriter; | |
| 152 | 132 | |
| 153 | 133 | pub const MultiWriter = @import("io/multi_writer.zig").MultiWriter; |
| 154 | 134 | pub const multiWriter = @import("io/multi_writer.zig").multiWriter; |
| 155 | /// Deprecated: use `MultiWriter` | |
| 156 | pub const MultiOutStream = MultiWriter; | |
| 157 | /// Deprecated: use `multiWriter` | |
| 158 | pub const multiOutStream = multiWriter; | |
| 159 | 135 | |
| 160 | 136 | pub const BitReader = @import("io/bit_reader.zig").BitReader; |
| 161 | 137 | pub const bitReader = @import("io/bit_reader.zig").bitReader; |
| 162 | /// Deprecated: use `BitReader` | |
| 163 | pub const BitInStream = BitReader; | |
| 164 | /// Deprecated: use `bitReader` | |
| 165 | pub const bitInStream = bitReader; | |
| 166 | 138 | |
| 167 | 139 | pub const BitWriter = @import("io/bit_writer.zig").BitWriter; |
| 168 | 140 | pub const bitWriter = @import("io/bit_writer.zig").bitWriter; |
| 169 | /// Deprecated: use `BitWriter` | |
| 170 | pub const BitOutStream = BitWriter; | |
| 171 | /// Deprecated: use `bitWriter` | |
| 172 | pub const bitOutStream = bitWriter; | |
| 173 | 141 | |
| 174 | 142 | pub const AutoIndentingStream = @import("io/auto_indenting_stream.zig").AutoIndentingStream; |
| 175 | 143 | pub const autoIndentingStream = @import("io/auto_indenting_stream.zig").autoIndentingStream; |
| ... | ... | @@ -177,8 +145,12 @@ pub const autoIndentingStream = @import("io/auto_indenting_stream.zig").autoInde |
| 177 | 145 | pub const ChangeDetectionStream = @import("io/change_detection_stream.zig").ChangeDetectionStream; |
| 178 | 146 | pub const changeDetectionStream = @import("io/change_detection_stream.zig").changeDetectionStream; |
| 179 | 147 | |
| 180 | pub const FindByteOutStream = @import("io/find_byte_out_stream.zig").FindByteOutStream; | |
| 181 | pub const findByteOutStream = @import("io/find_byte_out_stream.zig").findByteOutStream; | |
| 148 | pub const FindByteWriter = @import("io/find_byte_writer.zig").FindByteWriter; | |
| 149 | pub const findByteWriter = @import("io/find_byte_writer.zig").findByteWriter; | |
| 150 | /// Deprecated: use `FindByteWriter`. | |
| 151 | pub const FindByteOutStream = FindByteWriter; | |
| 152 | /// Deprecated: use `findByteWriter`. | |
| 153 | pub const findByteOutStream = findByteWriter; | |
| 182 | 154 | |
| 183 | 155 | pub const BufferedAtomicFile = @import("io/buffered_atomic_file.zig").BufferedAtomicFile; |
| 184 | 156 | |
| ... | ... | @@ -187,12 +159,7 @@ pub const StreamSource = @import("io/stream_source.zig").StreamSource; |
| 187 | 159 | /// A Writer that doesn't write to anything. |
| 188 | 160 | pub const null_writer = @as(NullWriter, .{ .context = {} }); |
| 189 | 161 | |
| 190 | /// Deprecated: use `null_writer` | |
| 191 | pub const null_out_stream = null_writer; | |
| 192 | ||
| 193 | 162 | const NullWriter = Writer(void, error{}, dummyWrite); |
| 194 | /// Deprecated: use NullWriter | |
| 195 | const NullOutStream = NullWriter; | |
| 196 | 163 | fn dummyWrite(context: void, data: []const u8) error{}!usize { |
| 197 | 164 | return data.len; |
| 198 | 165 | } |
lib/std/io/bit_in_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.bit_reader.BitReader` | |
| 7 | pub const BitInStream = @import("./bit_reader.zig").BitReader; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.bit_reader.bitReader` | |
| 10 | pub const bitInStream = @import("./bit_reader.zig").bitReader; |
lib/std/io/bit_out_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.bit_writer.BitWriter` | |
| 7 | pub const BitOutStream = @import("./bit_writer.zig").BitWriter; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.bit_writer.bitWriter` | |
| 10 | pub const bitOutStream = @import("./bit_writer.zig").bitWriter; |
lib/std/io/bit_reader.zig-7| ... | ... | @@ -21,8 +21,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { |
| 21 | 21 | |
| 22 | 22 | pub const Error = ReaderType.Error; |
| 23 | 23 | pub const Reader = io.Reader(*Self, Error, read); |
| 24 | /// Deprecated: use `Reader` | |
| 25 | pub const InStream = io.InStream(*Self, Error, read); | |
| 26 | 24 | |
| 27 | 25 | const Self = @This(); |
| 28 | 26 | const u8_bit_count = comptime meta.bitCount(u8); |
| ... | ... | @@ -165,11 +163,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { |
| 165 | 163 | pub fn reader(self: *Self) Reader { |
| 166 | 164 | return .{ .context = self }; |
| 167 | 165 | } |
| 168 | ||
| 169 | /// Deprecated: use `reader` | |
| 170 | pub fn inStream(self: *Self) InStream { | |
| 171 | return .{ .context = self }; | |
| 172 | } | |
| 173 | 166 | }; |
| 174 | 167 | } |
| 175 | 168 |
lib/std/io/bit_writer.zig-6| ... | ... | @@ -21,8 +21,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { |
| 21 | 21 | |
| 22 | 22 | pub const Error = WriterType.Error; |
| 23 | 23 | pub const Writer = io.Writer(*Self, Error, write); |
| 24 | /// Deprecated: use `Writer` | |
| 25 | pub const OutStream = io.OutStream(*Self, Error, write); | |
| 26 | 24 | |
| 27 | 25 | const Self = @This(); |
| 28 | 26 | const u8_bit_count = comptime meta.bitCount(u8); |
| ... | ... | @@ -141,10 +139,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { |
| 141 | 139 | pub fn writer(self: *Self) Writer { |
| 142 | 140 | return .{ .context = self }; |
| 143 | 141 | } |
| 144 | /// Deprecated: use `writer` | |
| 145 | pub fn outStream(self: *Self) OutStream { | |
| 146 | return .{ .context = self }; | |
| 147 | } | |
| 148 | 142 | }; |
| 149 | 143 | } |
| 150 | 144 |
lib/std/io/buffered_atomic_file.zig+11-11| ... | ... | @@ -10,13 +10,13 @@ const File = std.fs.File; |
| 10 | 10 | |
| 11 | 11 | pub const BufferedAtomicFile = struct { |
| 12 | 12 | atomic_file: fs.AtomicFile, |
| 13 | file_stream: File.OutStream, | |
| 14 | buffered_stream: BufferedOutStream, | |
| 13 | file_writer: File.Writer, | |
| 14 | buffered_writer: BufferedWriter, | |
| 15 | 15 | allocator: *mem.Allocator, |
| 16 | 16 | |
| 17 | 17 | pub const buffer_size = 4096; |
| 18 | pub const BufferedOutStream = std.io.BufferedOutStream(buffer_size, File.OutStream); | |
| 19 | pub const OutStream = std.io.OutStream(*BufferedOutStream, BufferedOutStream.Error, BufferedOutStream.write); | |
| 18 | pub const BufferedWriter = std.io.BufferedWriter(buffer_size, File.Writer); | |
| 19 | pub const Writer = std.io.Writer(*BufferedWriter, BufferedWriter.Error, BufferedWriter.write); | |
| 20 | 20 | |
| 21 | 21 | /// TODO when https://github.com/ziglang/zig/issues/2761 is solved |
| 22 | 22 | /// this API will not need an allocator |
| ... | ... | @@ -29,8 +29,8 @@ pub const BufferedAtomicFile = struct { |
| 29 | 29 | var self = try allocator.create(BufferedAtomicFile); |
| 30 | 30 | self.* = BufferedAtomicFile{ |
| 31 | 31 | .atomic_file = undefined, |
| 32 | .file_stream = undefined, | |
| 33 | .buffered_stream = undefined, | |
| 32 | .file_writer = undefined, | |
| 33 | .buffered_writer = undefined, | |
| 34 | 34 | .allocator = allocator, |
| 35 | 35 | }; |
| 36 | 36 | errdefer allocator.destroy(self); |
| ... | ... | @@ -38,8 +38,8 @@ pub const BufferedAtomicFile = struct { |
| 38 | 38 | self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options); |
| 39 | 39 | errdefer self.atomic_file.deinit(); |
| 40 | 40 | |
| 41 | self.file_stream = self.atomic_file.file.writer(); | |
| 42 | self.buffered_stream = .{ .unbuffered_writer = self.file_stream }; | |
| 41 | self.file_writer = self.atomic_file.file.writer(); | |
| 42 | self.buffered_writer = .{ .unbuffered_writer = self.file_writer }; | |
| 43 | 43 | return self; |
| 44 | 44 | } |
| 45 | 45 | |
| ... | ... | @@ -50,11 +50,11 @@ pub const BufferedAtomicFile = struct { |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | pub fn finish(self: *BufferedAtomicFile) !void { |
| 53 | try self.buffered_stream.flush(); | |
| 53 | try self.buffered_writer.flush(); | |
| 54 | 54 | try self.atomic_file.finish(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | pub fn stream(self: *BufferedAtomicFile) OutStream { | |
| 58 | return .{ .context = &self.buffered_stream }; | |
| 57 | pub fn writer(self: *BufferedAtomicFile) Writer { | |
| 58 | return .{ .context = &self.buffered_writer }; | |
| 59 | 59 | } |
| 60 | 60 | }; |
lib/std/io/buffered_in_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.buffered_reader.BufferedReader` | |
| 7 | pub const BufferedInStream = @import("./buffered_reader.zig").BufferedReader; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.buffered_reader.bufferedReader` | |
| 10 | pub const bufferedInStream = @import("./buffered_reader.zig").bufferedReader; |
lib/std/io/buffered_out_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.buffered_writer.BufferedWriter` | |
| 7 | pub const BufferedOutStream = @import("./buffered_writer.zig").BufferedWriter; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.buffered_writer.bufferedWriter` | |
| 10 | pub const bufferedOutStream = @import("./buffered_writer.zig").bufferedWriter; |
lib/std/io/buffered_reader.zig-7| ... | ... | @@ -15,8 +15,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty |
| 15 | 15 | |
| 16 | 16 | pub const Error = ReaderType.Error; |
| 17 | 17 | pub const Reader = io.Reader(*Self, Error, read); |
| 18 | /// Deprecated: use `Reader` | |
| 19 | pub const InStream = Reader; | |
| 20 | 18 | |
| 21 | 19 | const Self = @This(); |
| 22 | 20 | const FifoType = std.fifo.LinearFifo(u8, std.fifo.LinearFifoBufferType{ .Static = buffer_size }); |
| ... | ... | @@ -45,11 +43,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty |
| 45 | 43 | pub fn reader(self: *Self) Reader { |
| 46 | 44 | return .{ .context = self }; |
| 47 | 45 | } |
| 48 | ||
| 49 | /// Deprecated: use `reader` | |
| 50 | pub fn inStream(self: *Self) InStream { | |
| 51 | return .{ .context = self }; | |
| 52 | } | |
| 53 | 46 | }; |
| 54 | 47 | } |
| 55 | 48 |
lib/std/io/buffered_writer.zig-7| ... | ... | @@ -13,8 +13,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty |
| 13 | 13 | |
| 14 | 14 | pub const Error = WriterType.Error; |
| 15 | 15 | pub const Writer = io.Writer(*Self, Error, write); |
| 16 | /// Deprecated: use `Writer` | |
| 17 | pub const OutStream = Writer; | |
| 18 | 16 | |
| 19 | 17 | const Self = @This(); |
| 20 | 18 | const FifoType = std.fifo.LinearFifo(u8, std.fifo.LinearFifoBufferType{ .Static = buffer_size }); |
| ... | ... | @@ -32,11 +30,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty |
| 32 | 30 | return .{ .context = self }; |
| 33 | 31 | } |
| 34 | 32 | |
| 35 | /// Deprecated: use writer | |
| 36 | pub fn outStream(self: *Self) Writer { | |
| 37 | return .{ .context = self }; | |
| 38 | } | |
| 39 | ||
| 40 | 33 | pub fn write(self: *Self, bytes: []const u8) Error!usize { |
| 41 | 34 | if (bytes.len >= self.fifo.writableLength()) { |
| 42 | 35 | try self.flush(); |
lib/std/io/c_out_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.c_writer.CWriter` | |
| 7 | pub const COutStream = @import("./c_writer.zig").CWriter; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.c_writer.cWriter` | |
| 10 | pub const cOutStream = @import("./c_writer.zig").cWriter; |
lib/std/io/counting_out_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.counting_writer.CountingWriter` | |
| 7 | pub const CountingOutStream = @import("./counting_writer.zig").CountingWriter; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.counting_writer.countingWriter` | |
| 10 | pub const countingOutStream = @import("./counting_writer.zig").countingWriter; |
lib/std/io/counting_writer.zig-7| ... | ... | @@ -15,8 +15,6 @@ pub fn CountingWriter(comptime WriterType: type) type { |
| 15 | 15 | |
| 16 | 16 | pub const Error = WriterType.Error; |
| 17 | 17 | pub const Writer = io.Writer(*Self, Error, write); |
| 18 | /// Deprecated: use `Writer` | |
| 19 | pub const OutStream = Writer; | |
| 20 | 18 | |
| 21 | 19 | const Self = @This(); |
| 22 | 20 | |
| ... | ... | @@ -29,11 +27,6 @@ pub fn CountingWriter(comptime WriterType: type) type { |
| 29 | 27 | pub fn writer(self: *Self) Writer { |
| 30 | 28 | return .{ .context = self }; |
| 31 | 29 | } |
| 32 | ||
| 33 | /// Deprecated: use `writer` | |
| 34 | pub fn outStream(self: *Self) OutStream { | |
| 35 | return .{ .context = self }; | |
| 36 | } | |
| 37 | 30 | }; |
| 38 | 31 | } |
| 39 | 32 |
lib/std/io/find_byte_out_stream.zig deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | ||
| 7 | const std = @import("../std.zig"); | |
| 8 | const io = std.io; | |
| 9 | const assert = std.debug.assert; | |
| 10 | ||
| 11 | /// An OutStream that returns whether the given character has been written to it. | |
| 12 | /// The contents are not written to anything. | |
| 13 | pub fn FindByteOutStream(comptime UnderlyingWriter: type) type { | |
| 14 | return struct { | |
| 15 | const Self = @This(); | |
| 16 | pub const Error = UnderlyingWriter.Error; | |
| 17 | pub const Writer = io.Writer(*Self, Error, write); | |
| 18 | ||
| 19 | underlying_writer: UnderlyingWriter, | |
| 20 | byte_found: bool, | |
| 21 | byte: u8, | |
| 22 | ||
| 23 | pub fn writer(self: *Self) Writer { | |
| 24 | return .{ .context = self }; | |
| 25 | } | |
| 26 | ||
| 27 | fn write(self: *Self, bytes: []const u8) Error!usize { | |
| 28 | if (!self.byte_found) { | |
| 29 | self.byte_found = blk: { | |
| 30 | for (bytes) |b| | |
| 31 | if (b == self.byte) break :blk true; | |
| 32 | break :blk false; | |
| 33 | }; | |
| 34 | } | |
| 35 | return self.underlying_writer.write(bytes); | |
| 36 | } | |
| 37 | }; | |
| 38 | } | |
| 39 | ||
| 40 | pub fn findByteOutStream(byte: u8, underlying_writer: anytype) FindByteOutStream(@TypeOf(underlying_writer)) { | |
| 41 | return FindByteOutStream(@TypeOf(underlying_writer)){ | |
| 42 | .underlying_writer = underlying_writer, | |
| 43 | .byte = byte, | |
| 44 | .byte_found = false, | |
| 45 | }; | |
| 46 | } |
lib/std/io/find_byte_writer.zig created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | ||
| 7 | const std = @import("../std.zig"); | |
| 8 | const io = std.io; | |
| 9 | const assert = std.debug.assert; | |
| 10 | ||
| 11 | /// A Writer that returns whether the given character has been written to it. | |
| 12 | /// The contents are not written to anything. | |
| 13 | pub fn FindByteWriter(comptime UnderlyingWriter: type) type { | |
| 14 | return struct { | |
| 15 | const Self = @This(); | |
| 16 | pub const Error = UnderlyingWriter.Error; | |
| 17 | pub const Writer = io.Writer(*Self, Error, write); | |
| 18 | ||
| 19 | underlying_writer: UnderlyingWriter, | |
| 20 | byte_found: bool, | |
| 21 | byte: u8, | |
| 22 | ||
| 23 | pub fn writer(self: *Self) Writer { | |
| 24 | return .{ .context = self }; | |
| 25 | } | |
| 26 | ||
| 27 | fn write(self: *Self, bytes: []const u8) Error!usize { | |
| 28 | if (!self.byte_found) { | |
| 29 | self.byte_found = blk: { | |
| 30 | for (bytes) |b| | |
| 31 | if (b == self.byte) break :blk true; | |
| 32 | break :blk false; | |
| 33 | }; | |
| 34 | } | |
| 35 | return self.underlying_writer.write(bytes); | |
| 36 | } | |
| 37 | }; | |
| 38 | } | |
| 39 | ||
| 40 | pub fn findByteWriter(byte: u8, underlying_writer: anytype) FindByteWriter(@TypeOf(underlying_writer)) { | |
| 41 | return FindByteWriter(@TypeOf(underlying_writer)){ | |
| 42 | .underlying_writer = underlying_writer, | |
| 43 | .byte = byte, | |
| 44 | .byte_found = false, | |
| 45 | }; | |
| 46 | } |
lib/std/io/fixed_buffer_stream.zig-14| ... | ... | @@ -23,11 +23,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { |
| 23 | 23 | pub const GetSeekPosError = error{}; |
| 24 | 24 | |
| 25 | 25 | pub const Reader = io.Reader(*Self, ReadError, read); |
| 26 | /// Deprecated: use `Reader` | |
| 27 | pub const InStream = io.InStream(*Self, ReadError, read); | |
| 28 | 26 | pub const Writer = io.Writer(*Self, WriteError, write); |
| 29 | /// Deprecated: use `Writer` | |
| 30 | pub const OutStream = Writer; | |
| 31 | 27 | |
| 32 | 28 | pub const SeekableStream = io.SeekableStream( |
| 33 | 29 | *Self, |
| ... | ... | @@ -45,20 +41,10 @@ pub fn FixedBufferStream(comptime Buffer: type) type { |
| 45 | 41 | return .{ .context = self }; |
| 46 | 42 | } |
| 47 | 43 | |
| 48 | /// Deprecated: use `reader` | |
| 49 | pub fn inStream(self: *Self) InStream { | |
| 50 | return .{ .context = self }; | |
| 51 | } | |
| 52 | ||
| 53 | 44 | pub fn writer(self: *Self) Writer { |
| 54 | 45 | return .{ .context = self }; |
| 55 | 46 | } |
| 56 | 47 | |
| 57 | /// Deprecated: use `writer` | |
| 58 | pub fn outStream(self: *Self) OutStream { | |
| 59 | return .{ .context = self }; | |
| 60 | } | |
| 61 | ||
| 62 | 48 | pub fn seekableStream(self: *Self) SeekableStream { |
| 63 | 49 | return .{ .context = self }; |
| 64 | 50 | } |
lib/std/io/in_stream.zig deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.reader.Reader` | |
| 7 | pub const InStream = @import("./reader.zig").Reader; |
lib/std/io/multi_out_stream.zig deleted-10| ... | ... | @@ -1,10 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.multi_writer.MultiWriter` | |
| 7 | pub const MultiOutStream = @import("./multi_writer.zig").MultiWriter; | |
| 8 | ||
| 9 | /// Deprecated: use `std.io.multi_writer.multiWriter` | |
| 10 | pub const multiOutStream = @import("./multi_writer.zig").multiWriter; |
lib/std/io/multi_writer.zig-7| ... | ... | @@ -22,18 +22,11 @@ pub fn MultiWriter(comptime Writers: type) type { |
| 22 | 22 | |
| 23 | 23 | pub const Error = ErrSet; |
| 24 | 24 | pub const Writer = io.Writer(*Self, Error, write); |
| 25 | /// Deprecated: use `Writer` | |
| 26 | pub const OutStream = Writer; | |
| 27 | 25 | |
| 28 | 26 | pub fn writer(self: *Self) Writer { |
| 29 | 27 | return .{ .context = self }; |
| 30 | 28 | } |
| 31 | 29 | |
| 32 | /// Deprecated: use `writer` | |
| 33 | pub fn outStream(self: *Self) OutStream { | |
| 34 | return .{ .context = self }; | |
| 35 | } | |
| 36 | ||
| 37 | 30 | pub fn write(self: *Self, bytes: []const u8) Error!usize { |
| 38 | 31 | var batch = std.event.Batch(Error!void, self.streams.len, .auto_async).init(); |
| 39 | 32 | comptime var i = 0; |
lib/std/io/out_stream.zig deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | // SPDX-License-Identifier: MIT | |
| 2 | // Copyright (c) 2015-2021 Zig Contributors | |
| 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. | |
| 4 | // The MIT license requires this copyright notice to be included in all copies | |
| 5 | // and substantial portions of the software. | |
| 6 | /// Deprecated: use `std.io.writer.Writer` | |
| 7 | pub const OutStream = @import("./writer.zig").Writer; |
lib/std/io/peek_stream.zig+5-12| ... | ... | @@ -16,13 +16,11 @@ pub fn PeekStream( |
| 16 | 16 | comptime ReaderType: type, |
| 17 | 17 | ) type { |
| 18 | 18 | return struct { |
| 19 | unbuffered_in_stream: ReaderType, | |
| 19 | unbuffered_reader: ReaderType, | |
| 20 | 20 | fifo: FifoType, |
| 21 | 21 | |
| 22 | 22 | pub const Error = ReaderType.Error; |
| 23 | 23 | pub const Reader = io.Reader(*Self, Error, read); |
| 24 | /// Deprecated: use `Reader` | |
| 25 | pub const InStream = Reader; | |
| 26 | 24 | |
| 27 | 25 | const Self = @This(); |
| 28 | 26 | const FifoType = std.fifo.LinearFifo(u8, buffer_type); |
| ... | ... | @@ -31,7 +29,7 @@ pub fn PeekStream( |
| 31 | 29 | .Static => struct { |
| 32 | 30 | pub fn init(base: ReaderType) Self { |
| 33 | 31 | return .{ |
| 34 | .unbuffered_in_stream = base, | |
| 32 | .unbuffered_reader = base, | |
| 35 | 33 | .fifo = FifoType.init(), |
| 36 | 34 | }; |
| 37 | 35 | } |
| ... | ... | @@ -39,7 +37,7 @@ pub fn PeekStream( |
| 39 | 37 | .Slice => struct { |
| 40 | 38 | pub fn init(base: ReaderType, buf: []u8) Self { |
| 41 | 39 | return .{ |
| 42 | .unbuffered_in_stream = base, | |
| 40 | .unbuffered_reader = base, | |
| 43 | 41 | .fifo = FifoType.init(buf), |
| 44 | 42 | }; |
| 45 | 43 | } |
| ... | ... | @@ -47,7 +45,7 @@ pub fn PeekStream( |
| 47 | 45 | .Dynamic => struct { |
| 48 | 46 | pub fn init(base: ReaderType, allocator: *mem.Allocator) Self { |
| 49 | 47 | return .{ |
| 50 | .unbuffered_in_stream = base, | |
| 48 | .unbuffered_reader = base, | |
| 51 | 49 | .fifo = FifoType.init(allocator), |
| 52 | 50 | }; |
| 53 | 51 | } |
| ... | ... | @@ -68,18 +66,13 @@ pub fn PeekStream( |
| 68 | 66 | if (dest_index == dest.len) return dest_index; |
| 69 | 67 | |
| 70 | 68 | // ask the backing stream for more |
| 71 | dest_index += try self.unbuffered_in_stream.read(dest[dest_index..]); | |
| 69 | dest_index += try self.unbuffered_reader.read(dest[dest_index..]); | |
| 72 | 70 | return dest_index; |
| 73 | 71 | } |
| 74 | 72 | |
| 75 | 73 | pub fn reader(self: *Self) Reader { |
| 76 | 74 | return .{ .context = self }; |
| 77 | 75 | } |
| 78 | ||
| 79 | /// Deprecated: use `reader` | |
| 80 | pub fn inStream(self: *Self) InStream { | |
| 81 | return .{ .context = self }; | |
| 82 | } | |
| 83 | 76 | }; |
| 84 | 77 | } |
| 85 | 78 |
lib/std/io/stream_source.zig+1-15| ... | ... | @@ -9,7 +9,7 @@ const testing = std.testing; |
| 9 | 9 | |
| 10 | 10 | /// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as |
| 11 | 11 | /// well as files. |
| 12 | /// For memory sources, if the supplied byte buffer is const, then `io.OutStream` is not available. | |
| 12 | /// For memory sources, if the supplied byte buffer is const, then `io.Writer` is not available. | |
| 13 | 13 | /// The error set of the stream functions is the error set of the corresponding file functions. |
| 14 | 14 | pub const StreamSource = union(enum) { |
| 15 | 15 | buffer: io.FixedBufferStream([]u8), |
| ... | ... | @@ -22,11 +22,7 @@ pub const StreamSource = union(enum) { |
| 22 | 22 | pub const GetSeekPosError = std.fs.File.GetPosError; |
| 23 | 23 | |
| 24 | 24 | pub const Reader = io.Reader(*StreamSource, ReadError, read); |
| 25 | /// Deprecated: use `Reader` | |
| 26 | pub const InStream = Reader; | |
| 27 | 25 | pub const Writer = io.Writer(*StreamSource, WriteError, write); |
| 28 | /// Deprecated: use `Writer` | |
| 29 | pub const OutStream = Writer; | |
| 30 | 26 | pub const SeekableStream = io.SeekableStream( |
| 31 | 27 | *StreamSource, |
| 32 | 28 | SeekError, |
| ... | ... | @@ -89,20 +85,10 @@ pub const StreamSource = union(enum) { |
| 89 | 85 | return .{ .context = self }; |
| 90 | 86 | } |
| 91 | 87 | |
| 92 | /// Deprecated: use `reader` | |
| 93 | pub fn inStream(self: *StreamSource) InStream { | |
| 94 | return .{ .context = self }; | |
| 95 | } | |
| 96 | ||
| 97 | 88 | pub fn writer(self: *StreamSource) Writer { |
| 98 | 89 | return .{ .context = self }; |
| 99 | 90 | } |
| 100 | 91 | |
| 101 | /// Deprecated: use `writer` | |
| 102 | pub fn outStream(self: *StreamSource) OutStream { | |
| 103 | return .{ .context = self }; | |
| 104 | } | |
| 105 | ||
| 106 | 92 | pub fn seekableStream(self: *StreamSource) SeekableStream { |
| 107 | 93 | return .{ .context = self }; |
| 108 | 94 | } |
lib/std/json.zig+5-5| ... | ... | @@ -2620,9 +2620,9 @@ pub fn stringify( |
| 2620 | 2620 | } |
| 2621 | 2621 | |
| 2622 | 2622 | fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions) !void { |
| 2623 | const ValidationOutStream = struct { | |
| 2623 | const ValidationWriter = struct { | |
| 2624 | 2624 | const Self = @This(); |
| 2625 | pub const OutStream = std.io.OutStream(*Self, Error, write); | |
| 2625 | pub const Writer = std.io.Writer(*Self, Error, write); | |
| 2626 | 2626 | pub const Error = error{ |
| 2627 | 2627 | TooMuchData, |
| 2628 | 2628 | DifferentData, |
| ... | ... | @@ -2634,7 +2634,7 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions |
| 2634 | 2634 | return .{ .expected_remaining = exp }; |
| 2635 | 2635 | } |
| 2636 | 2636 | |
| 2637 | pub fn outStream(self: *Self) OutStream { | |
| 2637 | pub fn writer(self: *Self) Writer { | |
| 2638 | 2638 | return .{ .context = self }; |
| 2639 | 2639 | } |
| 2640 | 2640 | |
| ... | ... | @@ -2670,8 +2670,8 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions |
| 2670 | 2670 | } |
| 2671 | 2671 | }; |
| 2672 | 2672 | |
| 2673 | var vos = ValidationOutStream.init(expected); | |
| 2674 | try stringify(value, options, vos.outStream()); | |
| 2673 | var vos = ValidationWriter.init(expected); | |
| 2674 | try stringify(value, options, vos.writer()); | |
| 2675 | 2675 | if (vos.expected_remaining.len > 0) return error.NotEnoughData; |
| 2676 | 2676 | } |
| 2677 | 2677 |
lib/std/pdb.zig-4| ... | ... | @@ -716,8 +716,4 @@ const MsfStream = struct { |
| 716 | 716 | pub fn reader(self: *MsfStream) std.io.Reader(*MsfStream, Error, read) { |
| 717 | 717 | return .{ .context = self }; |
| 718 | 718 | } |
| 719 | /// Deprecated: use `reader` | |
| 720 | pub fn inStream(self: *MsfStream) std.io.InStream(*MsfStream, Error, read) { | |
| 721 | return .{ .context = self }; | |
| 722 | } | |
| 723 | 719 | }; |
lib/std/zig/render.zig+3-3| ... | ... | @@ -790,8 +790,8 @@ fn renderExpression( |
| 790 | 790 | const section_exprs = row_exprs[0..section_end]; |
| 791 | 791 | |
| 792 | 792 | // Null stream for counting the printed length of each expression |
| 793 | var line_find_stream = std.io.findByteOutStream('\n', std.io.null_writer); | |
| 794 | var counting_stream = std.io.countingOutStream(line_find_stream.writer()); | |
| 793 | var line_find_stream = std.io.findByteWriter('\n', std.io.null_writer); | |
| 794 | var counting_stream = std.io.countingWriter(line_find_stream.writer()); | |
| 795 | 795 | var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer()); |
| 796 | 796 | |
| 797 | 797 | // Calculate size of columns in current section |
| ... | ... | @@ -954,7 +954,7 @@ fn renderExpression( |
| 954 | 954 | const expr_outputs_one_line = blk: { |
| 955 | 955 | // render field expressions until a LF is found |
| 956 | 956 | for (field_inits) |field_init| { |
| 957 | var find_stream = std.io.findByteOutStream('\n', std.io.null_writer); | |
| 957 | var find_stream = std.io.findByteWriter('\n', std.io.null_writer); | |
| 958 | 958 | var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, find_stream.writer()); |
| 959 | 959 | |
| 960 | 960 | try renderExpression(allocator, &auto_indenting_stream, tree, field_init, Space.None); |
src/main.zig+1-1| ... | ... | @@ -2024,7 +2024,7 @@ fn updateModule(gpa: *Allocator, comp: *Compilation, zir_out_path: ?[]const u8, |
| 2024 | 2024 | const baf = try io.BufferedAtomicFile.create(gpa, fs.cwd(), zop, .{}); |
| 2025 | 2025 | defer baf.destroy(); |
| 2026 | 2026 | |
| 2027 | try new_zir_module.writeToStream(gpa, baf.stream()); | |
| 2027 | try new_zir_module.writeToStream(gpa, baf.writer()); | |
| 2028 | 2028 | |
| 2029 | 2029 | try baf.finish(); |
| 2030 | 2030 | } |