authorgravatar for jay@jayschwa.netJay Petacat <jay@jayschwa.net> 2021-01-08 15:36:02-05:00
committergravatar for jay@jayschwa.netJay Petacat <jay@jayschwa.net> 2021-01-08 16:54:56-05:00
log1595ce273edb32493231a43216a15cfbeb9ffc12
tree8bc5d3dd3e0c9e7066c61f235bfba98cb78e6589
parent2b3b355a23bea47aacbdfd56b853abc83e2f3ed6

Remove deprecated stream aliases


29 files changed, 43 insertions(+), 273 deletions(-)

doc/langref.html.in+3-3
...@@ -6120,7 +6120,7 @@ pub fn main() void {...@@ -6120,7 +6120,7 @@ pub fn main() void {
61206120
6121 {#code_begin|syntax#}6121 {#code_begin|syntax#}
6122/// Calls print and then flushes the buffer.6122/// Calls print and then flushes the buffer.
6123pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anyerror!void {6123pub fn printf(self: *Writer, comptime format: []const u8, args: anytype) anyerror!void {
6124 const State = enum {6124 const State = enum {
6125 start,6125 start,
6126 open_brace,6126 open_brace,
...@@ -6192,7 +6192,7 @@ pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anye...@@ -6192,7 +6192,7 @@ pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anye
6192 and emits a function that actually looks like this:6192 and emits a function that actually looks like this:
6193 </p>6193 </p>
6194 {#code_begin|syntax#}6194 {#code_begin|syntax#}
6195pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void {6195pub fn printf(self: *Writer, arg0: i32, arg1: []const u8) !void {
6196 try self.write("here is a string: '");6196 try self.write("here is a string: '");
6197 try self.printValue(arg0);6197 try self.printValue(arg0);
6198 try self.write("' here is a number: ");6198 try self.write("' here is a number: ");
...@@ -6206,7 +6206,7 @@ pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void {...@@ -6206,7 +6206,7 @@ pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void {
6206 on the type:6206 on the type:
6207 </p>6207 </p>
6208 {#code_begin|syntax#}6208 {#code_begin|syntax#}
6209pub fn printValue(self: *OutStream, value: anytype) !void {6209pub fn printValue(self: *Writer, value: anytype) !void {
6210 switch (@typeInfo(@TypeOf(value))) {6210 switch (@typeInfo(@TypeOf(value))) {
6211 .Int => {6211 .Int => {
6212 return self.printInt(T, value);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,9 +242,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type {
242 return .{ .context = self };242 return .{ .context = self };
243 }243 }
244244
245 /// Deprecated: use `writer`
246 pub const outStream = writer;
247
248 /// Same as `append` except it returns the number of bytes written, which is always the same245 /// Same as `append` except it returns the number of bytes written, which is always the same
249 /// as `m.len`. The purpose of this function existing is to match `std.io.Writer` API.246 /// as `m.len`. The purpose of this function existing is to match `std.io.Writer` API.
250 fn appendWrite(self: *Self, m: []const u8) !usize {247 fn appendWrite(self: *Self, m: []const u8) !usize {
lib/std/fifo.zig+1-11
...@@ -232,11 +232,6 @@ pub fn LinearFifo(...@@ -232,11 +232,6 @@ pub fn LinearFifo(
232 return .{ .context = self };232 return .{ .context = self };
233 }233 }
234234
235 /// Deprecated: `use reader`
236 pub fn inStream(self: *Self) std.io.InStream(*Self, error{}, readFn) {
237 return .{ .context = self };
238 }
239
240 /// Returns number of items available in fifo235 /// Returns number of items available in fifo
241 pub fn writableLength(self: Self) usize {236 pub fn writableLength(self: Self) usize {
242 return self.buf.len - self.count;237 return self.buf.len - self.count;
...@@ -317,7 +312,7 @@ pub fn LinearFifo(...@@ -317,7 +312,7 @@ pub fn LinearFifo(
317 }312 }
318313
319 /// Same as `write` except it returns the number of bytes written, which is always the same314 /// 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 fn appendWrite(self: *Self, bytes: []const u8) error{OutOfMemory}!usize {316 fn appendWrite(self: *Self, bytes: []const u8) error{OutOfMemory}!usize {
322 try self.write(bytes);317 try self.write(bytes);
323 return bytes.len;318 return bytes.len;
...@@ -327,11 +322,6 @@ pub fn LinearFifo(...@@ -327,11 +322,6 @@ pub fn LinearFifo(
327 return .{ .context = self };322 return .{ .context = self };
328 }323 }
329324
330 /// Deprecated: `use writer`
331 pub fn outStream(self: *Self) std.io.OutStream(*Self, error{OutOfMemory}, appendWrite) {
332 return .{ .context = self };
333 }
334
335 /// Make `count` items available before the current read location325 /// Make `count` items available before the current read location
336 fn rewind(self: *Self, count: usize) void {326 fn rewind(self: *Self, count: usize) void {
337 assert(self.writableLength() >= count);327 assert(self.writableLength() >= count);
lib/std/fs/file.zig-16
...@@ -813,32 +813,16 @@ pub const File = struct {...@@ -813,32 +813,16 @@ pub const File = struct {
813813
814 pub const Reader = io.Reader(File, ReadError, read);814 pub const Reader = io.Reader(File, ReadError, read);
815815
816 /// Deprecated: use `Reader`
817 pub const InStream = Reader;
818
819 pub fn reader(file: File) Reader {816 pub fn reader(file: File) Reader {
820 return .{ .context = file };817 return .{ .context = file };
821 }818 }
822819
823 /// Deprecated: use `reader`
824 pub fn inStream(file: File) Reader {
825 return .{ .context = file };
826 }
827
828 pub const Writer = io.Writer(File, WriteError, write);820 pub const Writer = io.Writer(File, WriteError, write);
829821
830 /// Deprecated: use `Writer`
831 pub const OutStream = Writer;
832
833 pub fn writer(file: File) Writer {822 pub fn writer(file: File) Writer {
834 return .{ .context = file };823 return .{ .context = file };
835 }824 }
836825
837 /// Deprecated: use `writer`
838 pub fn outStream(file: File) Writer {
839 return .{ .context = file };
840 }
841
842 pub const SeekableStream = io.SeekableStream(826 pub const SeekableStream = io.SeekableStream(
843 File,827 File,
844 SeekError,828 SeekError,
lib/std/heap/logging_allocator.zig+15-15
...@@ -9,22 +9,22 @@ const Allocator = std.mem.Allocator;...@@ -9,22 +9,22 @@ const Allocator = std.mem.Allocator;
9/// This allocator is used in front of another allocator and logs to the provided stream9/// This allocator is used in front of another allocator and logs to the provided stream
10/// on every call to the allocator. Stream errors are ignored.10/// on every call to the allocator. Stream errors are ignored.
11/// If https://github.com/ziglang/zig/issues/2586 is implemented, this API can be improved.11/// If https://github.com/ziglang/zig/issues/2586 is implemented, this API can be improved.
12pub fn LoggingAllocator(comptime OutStreamType: type) type {12pub fn LoggingAllocator(comptime Writer: type) type {
13 return struct {13 return struct {
14 allocator: Allocator,14 allocator: Allocator,
15 parent_allocator: *Allocator,15 parent_allocator: *Allocator,
16 out_stream: OutStreamType,16 writer: Writer,
1717
18 const Self = @This();18 const Self = @This();
1919
20 pub fn init(parent_allocator: *Allocator, out_stream: OutStreamType) Self {20 pub fn init(parent_allocator: *Allocator, writer: Writer) Self {
21 return Self{21 return Self{
22 .allocator = Allocator{22 .allocator = Allocator{
23 .allocFn = alloc,23 .allocFn = alloc,
24 .resizeFn = resize,24 .resizeFn = resize,
25 },25 },
26 .parent_allocator = parent_allocator,26 .parent_allocator = parent_allocator,
27 .out_stream = out_stream,27 .writer = writer,
28 };28 };
29 }29 }
3030
...@@ -36,12 +36,12 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type {...@@ -36,12 +36,12 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type {
36 ra: usize,36 ra: usize,
37 ) error{OutOfMemory}![]u8 {37 ) error{OutOfMemory}![]u8 {
38 const self = @fieldParentPtr(Self, "allocator", allocator);38 const self = @fieldParentPtr(Self, "allocator", allocator);
39 self.out_stream.print("alloc : {}", .{len}) catch {};39 self.writer.print("alloc : {}", .{len}) catch {};
40 const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra);40 const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra);
41 if (result) |buff| {41 if (result) |buff| {
42 self.out_stream.print(" success!\n", .{}) catch {};42 self.writer.print(" success!\n", .{}) catch {};
43 } else |err| {43 } else |err| {
44 self.out_stream.print(" failure!\n", .{}) catch {};44 self.writer.print(" failure!\n", .{}) catch {};
45 }45 }
46 return result;46 return result;
47 }47 }
...@@ -56,20 +56,20 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type {...@@ -56,20 +56,20 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type {
56 ) error{OutOfMemory}!usize {56 ) error{OutOfMemory}!usize {
57 const self = @fieldParentPtr(Self, "allocator", allocator);57 const self = @fieldParentPtr(Self, "allocator", allocator);
58 if (new_len == 0) {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 } else if (new_len <= buf.len) {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 } else {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 if (self.parent_allocator.resizeFn(self.parent_allocator, buf, buf_align, new_len, len_align, ra)) |resized_len| {65 if (self.parent_allocator.resizeFn(self.parent_allocator, buf, buf_align, new_len, len_align, ra)) |resized_len| {
66 if (new_len > buf.len) {66 if (new_len > buf.len) {
67 self.out_stream.print(" success!\n", .{}) catch {};67 self.writer.print(" success!\n", .{}) catch {};
68 }68 }
69 return resized_len;69 return resized_len;
70 } else |e| {70 } else |e| {
71 std.debug.assert(new_len > buf.len);71 std.debug.assert(new_len > buf.len);
72 self.out_stream.print(" failure!\n", .{}) catch {};72 self.writer.print(" failure!\n", .{}) catch {};
73 return e;73 return e;
74 }74 }
75 }75 }
...@@ -78,9 +78,9 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type {...@@ -78,9 +78,9 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type {
7878
79pub fn loggingAllocator(79pub fn loggingAllocator(
80 parent_allocator: *Allocator,80 parent_allocator: *Allocator,
81 out_stream: anytype,81 writer: anytype,
82) LoggingAllocator(@TypeOf(out_stream)) {82) LoggingAllocator(@TypeOf(writer)) {
83 return LoggingAllocator(@TypeOf(out_stream)).init(parent_allocator, out_stream);83 return LoggingAllocator(@TypeOf(writer)).init(parent_allocator, writer);
84}84}
8585
86test "LoggingAllocator" {86test "LoggingAllocator" {
lib/std/io.zig-37
...@@ -107,26 +107,14 @@ pub fn getStdIn() File {...@@ -107,26 +107,14 @@ pub fn getStdIn() File {
107}107}
108108
109pub const Reader = @import("io/reader.zig").Reader;109pub const Reader = @import("io/reader.zig").Reader;
110/// Deprecated: use `Reader`
111pub const InStream = Reader;
112pub const Writer = @import("io/writer.zig").Writer;110pub const Writer = @import("io/writer.zig").Writer;
113/// Deprecated: use `Writer`
114pub const OutStream = Writer;
115pub const SeekableStream = @import("io/seekable_stream.zig").SeekableStream;111pub const SeekableStream = @import("io/seekable_stream.zig").SeekableStream;
116112
117pub const BufferedWriter = @import("io/buffered_writer.zig").BufferedWriter;113pub const BufferedWriter = @import("io/buffered_writer.zig").BufferedWriter;
118pub const bufferedWriter = @import("io/buffered_writer.zig").bufferedWriter;114pub const bufferedWriter = @import("io/buffered_writer.zig").bufferedWriter;
119/// Deprecated: use `BufferedWriter`
120pub const BufferedOutStream = BufferedWriter;
121/// Deprecated: use `bufferedWriter`
122pub const bufferedOutStream = bufferedWriter;
123115
124pub const BufferedReader = @import("io/buffered_reader.zig").BufferedReader;116pub const BufferedReader = @import("io/buffered_reader.zig").BufferedReader;
125pub const bufferedReader = @import("io/buffered_reader.zig").bufferedReader;117pub const bufferedReader = @import("io/buffered_reader.zig").bufferedReader;
126/// Deprecated: use `BufferedReader`
127pub const BufferedInStream = BufferedReader;
128/// Deprecated: use `bufferedReader`
129pub const bufferedInStream = bufferedReader;
130118
131pub const PeekStream = @import("io/peek_stream.zig").PeekStream;119pub const PeekStream = @import("io/peek_stream.zig").PeekStream;
132pub const peekStream = @import("io/peek_stream.zig").peekStream;120pub const peekStream = @import("io/peek_stream.zig").peekStream;
...@@ -136,40 +124,20 @@ pub const fixedBufferStream = @import("io/fixed_buffer_stream.zig").fixedBufferS...@@ -136,40 +124,20 @@ pub const fixedBufferStream = @import("io/fixed_buffer_stream.zig").fixedBufferS
136124
137pub const CWriter = @import("io/c_writer.zig").CWriter;125pub const CWriter = @import("io/c_writer.zig").CWriter;
138pub const cWriter = @import("io/c_writer.zig").cWriter;126pub const cWriter = @import("io/c_writer.zig").cWriter;
139/// Deprecated: use `CWriter`
140pub const COutStream = CWriter;
141/// Deprecated: use `cWriter`
142pub const cOutStream = cWriter;
143127
144pub const CountingWriter = @import("io/counting_writer.zig").CountingWriter;128pub const CountingWriter = @import("io/counting_writer.zig").CountingWriter;
145pub const countingWriter = @import("io/counting_writer.zig").countingWriter;129pub const countingWriter = @import("io/counting_writer.zig").countingWriter;
146pub const CountingReader = @import("io/counting_reader.zig").CountingReader;130pub const CountingReader = @import("io/counting_reader.zig").CountingReader;
147pub const countingReader = @import("io/counting_reader.zig").countingReader;131pub const countingReader = @import("io/counting_reader.zig").countingReader;
148/// Deprecated: use `CountingWriter`
149pub const CountingOutStream = CountingWriter;
150/// Deprecated: use `countingWriter`
151pub const countingOutStream = countingWriter;
152132
153pub const MultiWriter = @import("io/multi_writer.zig").MultiWriter;133pub const MultiWriter = @import("io/multi_writer.zig").MultiWriter;
154pub const multiWriter = @import("io/multi_writer.zig").multiWriter;134pub const multiWriter = @import("io/multi_writer.zig").multiWriter;
155/// Deprecated: use `MultiWriter`
156pub const MultiOutStream = MultiWriter;
157/// Deprecated: use `multiWriter`
158pub const multiOutStream = multiWriter;
159135
160pub const BitReader = @import("io/bit_reader.zig").BitReader;136pub const BitReader = @import("io/bit_reader.zig").BitReader;
161pub const bitReader = @import("io/bit_reader.zig").bitReader;137pub const bitReader = @import("io/bit_reader.zig").bitReader;
162/// Deprecated: use `BitReader`
163pub const BitInStream = BitReader;
164/// Deprecated: use `bitReader`
165pub const bitInStream = bitReader;
166138
167pub const BitWriter = @import("io/bit_writer.zig").BitWriter;139pub const BitWriter = @import("io/bit_writer.zig").BitWriter;
168pub const bitWriter = @import("io/bit_writer.zig").bitWriter;140pub const bitWriter = @import("io/bit_writer.zig").bitWriter;
169/// Deprecated: use `BitWriter`
170pub const BitOutStream = BitWriter;
171/// Deprecated: use `bitWriter`
172pub const bitOutStream = bitWriter;
173141
174pub const AutoIndentingStream = @import("io/auto_indenting_stream.zig").AutoIndentingStream;142pub const AutoIndentingStream = @import("io/auto_indenting_stream.zig").AutoIndentingStream;
175pub const autoIndentingStream = @import("io/auto_indenting_stream.zig").autoIndentingStream;143pub const autoIndentingStream = @import("io/auto_indenting_stream.zig").autoIndentingStream;
...@@ -187,12 +155,7 @@ pub const StreamSource = @import("io/stream_source.zig").StreamSource;...@@ -187,12 +155,7 @@ pub const StreamSource = @import("io/stream_source.zig").StreamSource;
187/// A Writer that doesn't write to anything.155/// A Writer that doesn't write to anything.
188pub const null_writer = @as(NullWriter, .{ .context = {} });156pub const null_writer = @as(NullWriter, .{ .context = {} });
189157
190/// Deprecated: use `null_writer`
191pub const null_out_stream = null_writer;
192
193const NullWriter = Writer(void, error{}, dummyWrite);158const NullWriter = Writer(void, error{}, dummyWrite);
194/// Deprecated: use NullWriter
195const NullOutStream = NullWriter;
196fn dummyWrite(context: void, data: []const u8) error{}!usize {159fn dummyWrite(context: void, data: []const u8) error{}!usize {
197 return data.len;160 return data.len;
198}161}
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`
7pub const BitInStream = @import("./bit_reader.zig").BitReader;
8
9/// Deprecated: use `std.io.bit_reader.bitReader`
10pub 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`
7pub const BitOutStream = @import("./bit_writer.zig").BitWriter;
8
9/// Deprecated: use `std.io.bit_writer.bitWriter`
10pub 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,8 +21,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type {
2121
22 pub const Error = ReaderType.Error;22 pub const Error = ReaderType.Error;
23 pub const Reader = io.Reader(*Self, Error, read);23 pub const Reader = io.Reader(*Self, Error, read);
24 /// Deprecated: use `Reader`
25 pub const InStream = io.InStream(*Self, Error, read);
2624
27 const Self = @This();25 const Self = @This();
28 const u8_bit_count = comptime meta.bitCount(u8);26 const u8_bit_count = comptime meta.bitCount(u8);
...@@ -165,11 +163,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type {...@@ -165,11 +163,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type {
165 pub fn reader(self: *Self) Reader {163 pub fn reader(self: *Self) Reader {
166 return .{ .context = self };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}
175168
lib/std/io/bit_writer.zig-6
...@@ -21,8 +21,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {...@@ -21,8 +21,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {
2121
22 pub const Error = WriterType.Error;22 pub const Error = WriterType.Error;
23 pub const Writer = io.Writer(*Self, Error, write);23 pub const Writer = io.Writer(*Self, Error, write);
24 /// Deprecated: use `Writer`
25 pub const OutStream = io.OutStream(*Self, Error, write);
2624
27 const Self = @This();25 const Self = @This();
28 const u8_bit_count = comptime meta.bitCount(u8);26 const u8_bit_count = comptime meta.bitCount(u8);
...@@ -141,10 +139,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {...@@ -141,10 +139,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type {
141 pub fn writer(self: *Self) Writer {139 pub fn writer(self: *Self) Writer {
142 return .{ .context = self };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}
150144
lib/std/io/buffered_atomic_file.zig+11-11
...@@ -10,13 +10,13 @@ const File = std.fs.File;...@@ -10,13 +10,13 @@ const File = std.fs.File;
1010
11pub const BufferedAtomicFile = struct {11pub const BufferedAtomicFile = struct {
12 atomic_file: fs.AtomicFile,12 atomic_file: fs.AtomicFile,
13 file_stream: File.OutStream,13 file_writer: File.Writer,
14 buffered_stream: BufferedOutStream,14 buffered_writer: BufferedWriter,
15 allocator: *mem.Allocator,15 allocator: *mem.Allocator,
1616
17 pub const buffer_size = 4096;17 pub const buffer_size = 4096;
18 pub const BufferedOutStream = std.io.BufferedOutStream(buffer_size, File.OutStream);18 pub const BufferedWriter = std.io.BufferedWriter(buffer_size, File.Writer);
19 pub const OutStream = std.io.OutStream(*BufferedOutStream, BufferedOutStream.Error, BufferedOutStream.write);19 pub const Writer = std.io.Writer(*BufferedWriter, BufferedWriter.Error, BufferedWriter.write);
2020
21 /// TODO when https://github.com/ziglang/zig/issues/2761 is solved21 /// TODO when https://github.com/ziglang/zig/issues/2761 is solved
22 /// this API will not need an allocator22 /// this API will not need an allocator
...@@ -29,8 +29,8 @@ pub const BufferedAtomicFile = struct {...@@ -29,8 +29,8 @@ pub const BufferedAtomicFile = struct {
29 var self = try allocator.create(BufferedAtomicFile);29 var self = try allocator.create(BufferedAtomicFile);
30 self.* = BufferedAtomicFile{30 self.* = BufferedAtomicFile{
31 .atomic_file = undefined,31 .atomic_file = undefined,
32 .file_stream = undefined,32 .file_writer = undefined,
33 .buffered_stream = undefined,33 .buffered_writer = undefined,
34 .allocator = allocator,34 .allocator = allocator,
35 };35 };
36 errdefer allocator.destroy(self);36 errdefer allocator.destroy(self);
...@@ -38,8 +38,8 @@ pub const BufferedAtomicFile = struct {...@@ -38,8 +38,8 @@ pub const BufferedAtomicFile = struct {
38 self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options);38 self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options);
39 errdefer self.atomic_file.deinit();39 errdefer self.atomic_file.deinit();
4040
41 self.file_stream = self.atomic_file.file.writer();41 self.file_writer = self.atomic_file.file.writer();
42 self.buffered_stream = .{ .unbuffered_writer = self.file_stream };42 self.buffered_writer = .{ .unbuffered_writer = self.file_writer };
43 return self;43 return self;
44 }44 }
4545
...@@ -50,11 +50,11 @@ pub const BufferedAtomicFile = struct {...@@ -50,11 +50,11 @@ pub const BufferedAtomicFile = struct {
50 }50 }
5151
52 pub fn finish(self: *BufferedAtomicFile) !void {52 pub fn finish(self: *BufferedAtomicFile) !void {
53 try self.buffered_stream.flush();53 try self.buffered_writer.flush();
54 try self.atomic_file.finish();54 try self.atomic_file.finish();
55 }55 }
5656
57 pub fn stream(self: *BufferedAtomicFile) OutStream {57 pub fn writer(self: *BufferedAtomicFile) Writer {
58 return .{ .context = &self.buffered_stream };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`
7pub const BufferedInStream = @import("./buffered_reader.zig").BufferedReader;
8
9/// Deprecated: use `std.io.buffered_reader.bufferedReader`
10pub 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`
7pub const BufferedOutStream = @import("./buffered_writer.zig").BufferedWriter;
8
9/// Deprecated: use `std.io.buffered_writer.bufferedWriter`
10pub 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,8 +15,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty
1515
16 pub const Error = ReaderType.Error;16 pub const Error = ReaderType.Error;
17 pub const Reader = io.Reader(*Self, Error, read);17 pub const Reader = io.Reader(*Self, Error, read);
18 /// Deprecated: use `Reader`
19 pub const InStream = Reader;
2018
21 const Self = @This();19 const Self = @This();
22 const FifoType = std.fifo.LinearFifo(u8, std.fifo.LinearFifoBufferType{ .Static = buffer_size });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,11 +43,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty
45 pub fn reader(self: *Self) Reader {43 pub fn reader(self: *Self) Reader {
46 return .{ .context = self };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}
5548
lib/std/io/buffered_writer.zig-7
...@@ -13,8 +13,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty...@@ -13,8 +13,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty
1313
14 pub const Error = WriterType.Error;14 pub const Error = WriterType.Error;
15 pub const Writer = io.Writer(*Self, Error, write);15 pub const Writer = io.Writer(*Self, Error, write);
16 /// Deprecated: use `Writer`
17 pub const OutStream = Writer;
1816
19 const Self = @This();17 const Self = @This();
20 const FifoType = std.fifo.LinearFifo(u8, std.fifo.LinearFifoBufferType{ .Static = buffer_size });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,11 +30,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty
32 return .{ .context = self };30 return .{ .context = self };
33 }31 }
3432
35 /// Deprecated: use writer
36 pub fn outStream(self: *Self) Writer {
37 return .{ .context = self };
38 }
39
40 pub fn write(self: *Self, bytes: []const u8) Error!usize {33 pub fn write(self: *Self, bytes: []const u8) Error!usize {
41 if (bytes.len >= self.fifo.writableLength()) {34 if (bytes.len >= self.fifo.writableLength()) {
42 try self.flush();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`
7pub const COutStream = @import("./c_writer.zig").CWriter;
8
9/// Deprecated: use `std.io.c_writer.cWriter`
10pub 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`
7pub const CountingOutStream = @import("./counting_writer.zig").CountingWriter;
8
9/// Deprecated: use `std.io.counting_writer.countingWriter`
10pub 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,8 +15,6 @@ pub fn CountingWriter(comptime WriterType: type) type {
1515
16 pub const Error = WriterType.Error;16 pub const Error = WriterType.Error;
17 pub const Writer = io.Writer(*Self, Error, write);17 pub const Writer = io.Writer(*Self, Error, write);
18 /// Deprecated: use `Writer`
19 pub const OutStream = Writer;
2018
21 const Self = @This();19 const Self = @This();
2220
...@@ -29,11 +27,6 @@ pub fn CountingWriter(comptime WriterType: type) type {...@@ -29,11 +27,6 @@ pub fn CountingWriter(comptime WriterType: type) type {
29 pub fn writer(self: *Self) Writer {27 pub fn writer(self: *Self) Writer {
30 return .{ .context = self };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}
3932
lib/std/io/fixed_buffer_stream.zig-14
...@@ -23,11 +23,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type {...@@ -23,11 +23,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type {
23 pub const GetSeekPosError = error{};23 pub const GetSeekPosError = error{};
2424
25 pub const Reader = io.Reader(*Self, ReadError, read);25 pub const Reader = io.Reader(*Self, ReadError, read);
26 /// Deprecated: use `Reader`
27 pub const InStream = io.InStream(*Self, ReadError, read);
28 pub const Writer = io.Writer(*Self, WriteError, write);26 pub const Writer = io.Writer(*Self, WriteError, write);
29 /// Deprecated: use `Writer`
30 pub const OutStream = Writer;
3127
32 pub const SeekableStream = io.SeekableStream(28 pub const SeekableStream = io.SeekableStream(
33 *Self,29 *Self,
...@@ -45,20 +41,10 @@ pub fn FixedBufferStream(comptime Buffer: type) type {...@@ -45,20 +41,10 @@ pub fn FixedBufferStream(comptime Buffer: type) type {
45 return .{ .context = self };41 return .{ .context = self };
46 }42 }
4743
48 /// Deprecated: use `reader`
49 pub fn inStream(self: *Self) InStream {
50 return .{ .context = self };
51 }
52
53 pub fn writer(self: *Self) Writer {44 pub fn writer(self: *Self) Writer {
54 return .{ .context = self };45 return .{ .context = self };
55 }46 }
5647
57 /// Deprecated: use `writer`
58 pub fn outStream(self: *Self) OutStream {
59 return .{ .context = self };
60 }
61
62 pub fn seekableStream(self: *Self) SeekableStream {48 pub fn seekableStream(self: *Self) SeekableStream {
63 return .{ .context = self };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`
7pub 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`
7pub const MultiOutStream = @import("./multi_writer.zig").MultiWriter;
8
9/// Deprecated: use `std.io.multi_writer.multiWriter`
10pub 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,18 +22,11 @@ pub fn MultiWriter(comptime Writers: type) type {
2222
23 pub const Error = ErrSet;23 pub const Error = ErrSet;
24 pub const Writer = io.Writer(*Self, Error, write);24 pub const Writer = io.Writer(*Self, Error, write);
25 /// Deprecated: use `Writer`
26 pub const OutStream = Writer;
2725
28 pub fn writer(self: *Self) Writer {26 pub fn writer(self: *Self) Writer {
29 return .{ .context = self };27 return .{ .context = self };
30 }28 }
3129
32 /// Deprecated: use `writer`
33 pub fn outStream(self: *Self) OutStream {
34 return .{ .context = self };
35 }
36
37 pub fn write(self: *Self, bytes: []const u8) Error!usize {30 pub fn write(self: *Self, bytes: []const u8) Error!usize {
38 var batch = std.event.Batch(Error!void, self.streams.len, .auto_async).init();31 var batch = std.event.Batch(Error!void, self.streams.len, .auto_async).init();
39 comptime var i = 0;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`
7pub const OutStream = @import("./writer.zig").Writer;
lib/std/io/peek_stream.zig+5-12
...@@ -16,13 +16,11 @@ pub fn PeekStream(...@@ -16,13 +16,11 @@ pub fn PeekStream(
16 comptime ReaderType: type,16 comptime ReaderType: type,
17) type {17) type {
18 return struct {18 return struct {
19 unbuffered_in_stream: ReaderType,19 unbuffered_reader: ReaderType,
20 fifo: FifoType,20 fifo: FifoType,
2121
22 pub const Error = ReaderType.Error;22 pub const Error = ReaderType.Error;
23 pub const Reader = io.Reader(*Self, Error, read);23 pub const Reader = io.Reader(*Self, Error, read);
24 /// Deprecated: use `Reader`
25 pub const InStream = Reader;
2624
27 const Self = @This();25 const Self = @This();
28 const FifoType = std.fifo.LinearFifo(u8, buffer_type);26 const FifoType = std.fifo.LinearFifo(u8, buffer_type);
...@@ -31,7 +29,7 @@ pub fn PeekStream(...@@ -31,7 +29,7 @@ pub fn PeekStream(
31 .Static => struct {29 .Static => struct {
32 pub fn init(base: ReaderType) Self {30 pub fn init(base: ReaderType) Self {
33 return .{31 return .{
34 .unbuffered_in_stream = base,32 .unbuffered_reader = base,
35 .fifo = FifoType.init(),33 .fifo = FifoType.init(),
36 };34 };
37 }35 }
...@@ -39,7 +37,7 @@ pub fn PeekStream(...@@ -39,7 +37,7 @@ pub fn PeekStream(
39 .Slice => struct {37 .Slice => struct {
40 pub fn init(base: ReaderType, buf: []u8) Self {38 pub fn init(base: ReaderType, buf: []u8) Self {
41 return .{39 return .{
42 .unbuffered_in_stream = base,40 .unbuffered_reader = base,
43 .fifo = FifoType.init(buf),41 .fifo = FifoType.init(buf),
44 };42 };
45 }43 }
...@@ -47,7 +45,7 @@ pub fn PeekStream(...@@ -47,7 +45,7 @@ pub fn PeekStream(
47 .Dynamic => struct {45 .Dynamic => struct {
48 pub fn init(base: ReaderType, allocator: *mem.Allocator) Self {46 pub fn init(base: ReaderType, allocator: *mem.Allocator) Self {
49 return .{47 return .{
50 .unbuffered_in_stream = base,48 .unbuffered_reader = base,
51 .fifo = FifoType.init(allocator),49 .fifo = FifoType.init(allocator),
52 };50 };
53 }51 }
...@@ -68,18 +66,13 @@ pub fn PeekStream(...@@ -68,18 +66,13 @@ pub fn PeekStream(
68 if (dest_index == dest.len) return dest_index;66 if (dest_index == dest.len) return dest_index;
6967
70 // ask the backing stream for more68 // 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 return dest_index;70 return dest_index;
73 }71 }
7472
75 pub fn reader(self: *Self) Reader {73 pub fn reader(self: *Self) Reader {
76 return .{ .context = self };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}
8578
lib/std/io/stream_source.zig+1-15
...@@ -9,7 +9,7 @@ const testing = std.testing;...@@ -9,7 +9,7 @@ const testing = std.testing;
99
10/// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as10/// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as
11/// well as files.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/// The error set of the stream functions is the error set of the corresponding file functions.13/// The error set of the stream functions is the error set of the corresponding file functions.
14pub const StreamSource = union(enum) {14pub const StreamSource = union(enum) {
15 buffer: io.FixedBufferStream([]u8),15 buffer: io.FixedBufferStream([]u8),
...@@ -22,11 +22,7 @@ pub const StreamSource = union(enum) {...@@ -22,11 +22,7 @@ pub const StreamSource = union(enum) {
22 pub const GetSeekPosError = std.fs.File.GetPosError;22 pub const GetSeekPosError = std.fs.File.GetPosError;
2323
24 pub const Reader = io.Reader(*StreamSource, ReadError, read);24 pub const Reader = io.Reader(*StreamSource, ReadError, read);
25 /// Deprecated: use `Reader`
26 pub const InStream = Reader;
27 pub const Writer = io.Writer(*StreamSource, WriteError, write);25 pub const Writer = io.Writer(*StreamSource, WriteError, write);
28 /// Deprecated: use `Writer`
29 pub const OutStream = Writer;
30 pub const SeekableStream = io.SeekableStream(26 pub const SeekableStream = io.SeekableStream(
31 *StreamSource,27 *StreamSource,
32 SeekError,28 SeekError,
...@@ -89,20 +85,10 @@ pub const StreamSource = union(enum) {...@@ -89,20 +85,10 @@ pub const StreamSource = union(enum) {
89 return .{ .context = self };85 return .{ .context = self };
90 }86 }
9187
92 /// Deprecated: use `reader`
93 pub fn inStream(self: *StreamSource) InStream {
94 return .{ .context = self };
95 }
96
97 pub fn writer(self: *StreamSource) Writer {88 pub fn writer(self: *StreamSource) Writer {
98 return .{ .context = self };89 return .{ .context = self };
99 }90 }
10091
101 /// Deprecated: use `writer`
102 pub fn outStream(self: *StreamSource) OutStream {
103 return .{ .context = self };
104 }
105
106 pub fn seekableStream(self: *StreamSource) SeekableStream {92 pub fn seekableStream(self: *StreamSource) SeekableStream {
107 return .{ .context = self };93 return .{ .context = self };
108 }94 }
lib/std/json.zig+5-5
...@@ -2620,9 +2620,9 @@ pub fn stringify(...@@ -2620,9 +2620,9 @@ pub fn stringify(
2620}2620}
26212621
2622fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions) !void {2622fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions) !void {
2623 const ValidationOutStream = struct {2623 const ValidationWriter = struct {
2624 const Self = @This();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 pub const Error = error{2626 pub const Error = error{
2627 TooMuchData,2627 TooMuchData,
2628 DifferentData,2628 DifferentData,
...@@ -2634,7 +2634,7 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions...@@ -2634,7 +2634,7 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions
2634 return .{ .expected_remaining = exp };2634 return .{ .expected_remaining = exp };
2635 }2635 }
26362636
2637 pub fn outStream(self: *Self) OutStream {2637 pub fn writer(self: *Self) Writer {
2638 return .{ .context = self };2638 return .{ .context = self };
2639 }2639 }
26402640
...@@ -2670,8 +2670,8 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions...@@ -2670,8 +2670,8 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions
2670 }2670 }
2671 };2671 };
26722672
2673 var vos = ValidationOutStream.init(expected);2673 var vos = ValidationWriter.init(expected);
2674 try stringify(value, options, vos.outStream());2674 try stringify(value, options, vos.writer());
2675 if (vos.expected_remaining.len > 0) return error.NotEnoughData;2675 if (vos.expected_remaining.len > 0) return error.NotEnoughData;
2676}2676}
26772677
lib/std/pdb.zig-4
...@@ -716,8 +716,4 @@ const MsfStream = struct {...@@ -716,8 +716,4 @@ const MsfStream = struct {
716 pub fn reader(self: *MsfStream) std.io.Reader(*MsfStream, Error, read) {716 pub fn reader(self: *MsfStream) std.io.Reader(*MsfStream, Error, read) {
717 return .{ .context = self };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+1-1
...@@ -791,7 +791,7 @@ fn renderExpression(...@@ -791,7 +791,7 @@ fn renderExpression(
791791
792 // Null stream for counting the printed length of each expression792 // Null stream for counting the printed length of each expression
793 var line_find_stream = std.io.findByteOutStream('\n', std.io.null_writer);793 var line_find_stream = std.io.findByteOutStream('\n', std.io.null_writer);
794 var counting_stream = std.io.countingOutStream(line_find_stream.writer());794 var counting_stream = std.io.countingWriter(line_find_stream.writer());
795 var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer());795 var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer());
796796
797 // Calculate size of columns in current section797 // Calculate size of columns in current section
src/main.zig+1-1
...@@ -2015,7 +2015,7 @@ fn updateModule(gpa: *Allocator, comp: *Compilation, zir_out_path: ?[]const u8,...@@ -2015,7 +2015,7 @@ fn updateModule(gpa: *Allocator, comp: *Compilation, zir_out_path: ?[]const u8,
2015 const baf = try io.BufferedAtomicFile.create(gpa, fs.cwd(), zop, .{});2015 const baf = try io.BufferedAtomicFile.create(gpa, fs.cwd(), zop, .{});
2016 defer baf.destroy();2016 defer baf.destroy();
20172017
2018 try new_zir_module.writeToStream(gpa, baf.stream());2018 try new_zir_module.writeToStream(gpa, baf.writer());
20192019
2020 try baf.finish();2020 try baf.finish();
2021 }2021 }