From 1595ce273edb32493231a43216a15cfbeb9ffc12 Mon Sep 17 00:00:00 2001 From: Jay Petacat Date: Fri, 8 Jan 2021 15:36:02 -0500 Subject: [PATCH] Remove deprecated stream aliases --- doc/langref.html.in | 6 ++--- lib/std/array_list.zig | 3 --- lib/std/fifo.zig | 12 +--------- lib/std/fs/file.zig | 16 ------------- lib/std/heap/logging_allocator.zig | 30 +++++++++++------------ lib/std/io.zig | 37 ----------------------------- lib/std/io/bit_in_stream.zig | 10 -------- lib/std/io/bit_out_stream.zig | 10 -------- lib/std/io/bit_reader.zig | 7 ------ lib/std/io/bit_writer.zig | 6 ----- lib/std/io/buffered_atomic_file.zig | 22 ++++++++--------- lib/std/io/buffered_in_stream.zig | 10 -------- lib/std/io/buffered_out_stream.zig | 10 -------- lib/std/io/buffered_reader.zig | 7 ------ lib/std/io/buffered_writer.zig | 7 ------ lib/std/io/c_out_stream.zig | 10 -------- lib/std/io/counting_out_stream.zig | 10 -------- lib/std/io/counting_writer.zig | 7 ------ lib/std/io/fixed_buffer_stream.zig | 14 ----------- lib/std/io/in_stream.zig | 7 ------ lib/std/io/multi_out_stream.zig | 10 -------- lib/std/io/multi_writer.zig | 7 ------ lib/std/io/out_stream.zig | 7 ------ lib/std/io/peek_stream.zig | 17 ++++--------- lib/std/io/stream_source.zig | 16 +------------ lib/std/json.zig | 10 ++++---- lib/std/pdb.zig | 4 ---- lib/std/zig/render.zig | 2 +- src/main.zig | 2 +- 29 files changed, 43 insertions(+), 273 deletions(-) delete mode 100644 lib/std/io/bit_in_stream.zig delete mode 100644 lib/std/io/bit_out_stream.zig delete mode 100644 lib/std/io/buffered_in_stream.zig delete mode 100644 lib/std/io/buffered_out_stream.zig delete mode 100644 lib/std/io/c_out_stream.zig delete mode 100644 lib/std/io/counting_out_stream.zig delete mode 100644 lib/std/io/in_stream.zig delete mode 100644 lib/std/io/multi_out_stream.zig delete mode 100644 lib/std/io/out_stream.zig diff --git a/doc/langref.html.in b/doc/langref.html.in index 9d89e894a..85917680d 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -6120,7 +6120,7 @@ pub fn main() void { {#code_begin|syntax#} /// Calls print and then flushes the buffer. -pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anyerror!void { +pub fn printf(self: *Writer, comptime format: []const u8, args: anytype) anyerror!void { const State = enum { start, open_brace, @@ -6192,7 +6192,7 @@ pub fn printf(self: *OutStream, comptime format: []const u8, args: anytype) anye and emits a function that actually looks like this:

{#code_begin|syntax#} -pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void { +pub fn printf(self: *Writer, arg0: i32, arg1: []const u8) !void { try self.write("here is a string: '"); try self.printValue(arg0); try self.write("' here is a number: "); @@ -6206,7 +6206,7 @@ pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void { on the type:

{#code_begin|syntax#} -pub fn printValue(self: *OutStream, value: anytype) !void { +pub fn printValue(self: *Writer, value: anytype) !void { switch (@typeInfo(@TypeOf(value))) { .Int => { return self.printInt(T, value); diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 4f1cb11bc..f30a86d8f 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -242,9 +242,6 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { return .{ .context = self }; } - /// Deprecated: use `writer` - pub const outStream = writer; - /// Same as `append` except it returns the number of bytes written, which is always the same /// as `m.len`. The purpose of this function existing is to match `std.io.Writer` API. fn appendWrite(self: *Self, m: []const u8) !usize { diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig index 788f8f193..dfd932cb3 100644 --- a/lib/std/fifo.zig +++ b/lib/std/fifo.zig @@ -232,11 +232,6 @@ pub fn LinearFifo( return .{ .context = self }; } - /// Deprecated: `use reader` - pub fn inStream(self: *Self) std.io.InStream(*Self, error{}, readFn) { - return .{ .context = self }; - } - /// Returns number of items available in fifo pub fn writableLength(self: Self) usize { return self.buf.len - self.count; @@ -317,7 +312,7 @@ pub fn LinearFifo( } /// Same as `write` except it returns the number of bytes written, which is always the same - /// as `bytes.len`. The purpose of this function existing is to match `std.io.OutStream` API. + /// as `bytes.len`. The purpose of this function existing is to match `std.io.Writer` API. fn appendWrite(self: *Self, bytes: []const u8) error{OutOfMemory}!usize { try self.write(bytes); return bytes.len; @@ -327,11 +322,6 @@ pub fn LinearFifo( return .{ .context = self }; } - /// Deprecated: `use writer` - pub fn outStream(self: *Self) std.io.OutStream(*Self, error{OutOfMemory}, appendWrite) { - return .{ .context = self }; - } - /// Make `count` items available before the current read location fn rewind(self: *Self, count: usize) void { assert(self.writableLength() >= count); diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig index 2d5b311ec..faf3687a4 100644 --- a/lib/std/fs/file.zig +++ b/lib/std/fs/file.zig @@ -813,32 +813,16 @@ pub const File = struct { pub const Reader = io.Reader(File, ReadError, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; - pub fn reader(file: File) Reader { return .{ .context = file }; } - /// Deprecated: use `reader` - pub fn inStream(file: File) Reader { - return .{ .context = file }; - } - pub const Writer = io.Writer(File, WriteError, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; - pub fn writer(file: File) Writer { return .{ .context = file }; } - /// Deprecated: use `writer` - pub fn outStream(file: File) Writer { - return .{ .context = file }; - } - pub const SeekableStream = io.SeekableStream( File, SeekError, diff --git a/lib/std/heap/logging_allocator.zig b/lib/std/heap/logging_allocator.zig index 7920138e9..7885571ab 100644 --- a/lib/std/heap/logging_allocator.zig +++ b/lib/std/heap/logging_allocator.zig @@ -9,22 +9,22 @@ const Allocator = std.mem.Allocator; /// This allocator is used in front of another allocator and logs to the provided stream /// on every call to the allocator. Stream errors are ignored. /// If https://github.com/ziglang/zig/issues/2586 is implemented, this API can be improved. -pub fn LoggingAllocator(comptime OutStreamType: type) type { +pub fn LoggingAllocator(comptime Writer: type) type { return struct { allocator: Allocator, parent_allocator: *Allocator, - out_stream: OutStreamType, + writer: Writer, const Self = @This(); - pub fn init(parent_allocator: *Allocator, out_stream: OutStreamType) Self { + pub fn init(parent_allocator: *Allocator, writer: Writer) Self { return Self{ .allocator = Allocator{ .allocFn = alloc, .resizeFn = resize, }, .parent_allocator = parent_allocator, - .out_stream = out_stream, + .writer = writer, }; } @@ -36,12 +36,12 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type { ra: usize, ) error{OutOfMemory}![]u8 { const self = @fieldParentPtr(Self, "allocator", allocator); - self.out_stream.print("alloc : {}", .{len}) catch {}; + self.writer.print("alloc : {}", .{len}) catch {}; const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ra); if (result) |buff| { - self.out_stream.print(" success!\n", .{}) catch {}; + self.writer.print(" success!\n", .{}) catch {}; } else |err| { - self.out_stream.print(" failure!\n", .{}) catch {}; + self.writer.print(" failure!\n", .{}) catch {}; } return result; } @@ -56,20 +56,20 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type { ) error{OutOfMemory}!usize { const self = @fieldParentPtr(Self, "allocator", allocator); if (new_len == 0) { - self.out_stream.print("free : {}\n", .{buf.len}) catch {}; + self.writer.print("free : {}\n", .{buf.len}) catch {}; } else if (new_len <= buf.len) { - self.out_stream.print("shrink: {} to {}\n", .{ buf.len, new_len }) catch {}; + self.writer.print("shrink: {} to {}\n", .{ buf.len, new_len }) catch {}; } else { - self.out_stream.print("expand: {} to {}", .{ buf.len, new_len }) catch {}; + self.writer.print("expand: {} to {}", .{ buf.len, new_len }) catch {}; } if (self.parent_allocator.resizeFn(self.parent_allocator, buf, buf_align, new_len, len_align, ra)) |resized_len| { if (new_len > buf.len) { - self.out_stream.print(" success!\n", .{}) catch {}; + self.writer.print(" success!\n", .{}) catch {}; } return resized_len; } else |e| { std.debug.assert(new_len > buf.len); - self.out_stream.print(" failure!\n", .{}) catch {}; + self.writer.print(" failure!\n", .{}) catch {}; return e; } } @@ -78,9 +78,9 @@ pub fn LoggingAllocator(comptime OutStreamType: type) type { pub fn loggingAllocator( parent_allocator: *Allocator, - out_stream: anytype, -) LoggingAllocator(@TypeOf(out_stream)) { - return LoggingAllocator(@TypeOf(out_stream)).init(parent_allocator, out_stream); + writer: anytype, +) LoggingAllocator(@TypeOf(writer)) { + return LoggingAllocator(@TypeOf(writer)).init(parent_allocator, writer); } test "LoggingAllocator" { diff --git a/lib/std/io.zig b/lib/std/io.zig index a02ccd93c..3d8744d74 100644 --- a/lib/std/io.zig +++ b/lib/std/io.zig @@ -107,26 +107,14 @@ pub fn getStdIn() File { } pub const Reader = @import("io/reader.zig").Reader; -/// Deprecated: use `Reader` -pub const InStream = Reader; pub const Writer = @import("io/writer.zig").Writer; -/// Deprecated: use `Writer` -pub const OutStream = Writer; pub const SeekableStream = @import("io/seekable_stream.zig").SeekableStream; pub const BufferedWriter = @import("io/buffered_writer.zig").BufferedWriter; pub const bufferedWriter = @import("io/buffered_writer.zig").bufferedWriter; -/// Deprecated: use `BufferedWriter` -pub const BufferedOutStream = BufferedWriter; -/// Deprecated: use `bufferedWriter` -pub const bufferedOutStream = bufferedWriter; pub const BufferedReader = @import("io/buffered_reader.zig").BufferedReader; pub const bufferedReader = @import("io/buffered_reader.zig").bufferedReader; -/// Deprecated: use `BufferedReader` -pub const BufferedInStream = BufferedReader; -/// Deprecated: use `bufferedReader` -pub const bufferedInStream = bufferedReader; pub const PeekStream = @import("io/peek_stream.zig").PeekStream; pub const peekStream = @import("io/peek_stream.zig").peekStream; @@ -136,40 +124,20 @@ pub const fixedBufferStream = @import("io/fixed_buffer_stream.zig").fixedBufferS pub const CWriter = @import("io/c_writer.zig").CWriter; pub const cWriter = @import("io/c_writer.zig").cWriter; -/// Deprecated: use `CWriter` -pub const COutStream = CWriter; -/// Deprecated: use `cWriter` -pub const cOutStream = cWriter; pub const CountingWriter = @import("io/counting_writer.zig").CountingWriter; pub const countingWriter = @import("io/counting_writer.zig").countingWriter; pub const CountingReader = @import("io/counting_reader.zig").CountingReader; pub const countingReader = @import("io/counting_reader.zig").countingReader; -/// Deprecated: use `CountingWriter` -pub const CountingOutStream = CountingWriter; -/// Deprecated: use `countingWriter` -pub const countingOutStream = countingWriter; pub const MultiWriter = @import("io/multi_writer.zig").MultiWriter; pub const multiWriter = @import("io/multi_writer.zig").multiWriter; -/// Deprecated: use `MultiWriter` -pub const MultiOutStream = MultiWriter; -/// Deprecated: use `multiWriter` -pub const multiOutStream = multiWriter; pub const BitReader = @import("io/bit_reader.zig").BitReader; pub const bitReader = @import("io/bit_reader.zig").bitReader; -/// Deprecated: use `BitReader` -pub const BitInStream = BitReader; -/// Deprecated: use `bitReader` -pub const bitInStream = bitReader; pub const BitWriter = @import("io/bit_writer.zig").BitWriter; pub const bitWriter = @import("io/bit_writer.zig").bitWriter; -/// Deprecated: use `BitWriter` -pub const BitOutStream = BitWriter; -/// Deprecated: use `bitWriter` -pub const bitOutStream = bitWriter; pub const AutoIndentingStream = @import("io/auto_indenting_stream.zig").AutoIndentingStream; pub const autoIndentingStream = @import("io/auto_indenting_stream.zig").autoIndentingStream; @@ -187,12 +155,7 @@ pub const StreamSource = @import("io/stream_source.zig").StreamSource; /// A Writer that doesn't write to anything. pub const null_writer = @as(NullWriter, .{ .context = {} }); -/// Deprecated: use `null_writer` -pub const null_out_stream = null_writer; - const NullWriter = Writer(void, error{}, dummyWrite); -/// Deprecated: use NullWriter -const NullOutStream = NullWriter; fn dummyWrite(context: void, data: []const u8) error{}!usize { return data.len; } diff --git a/lib/std/io/bit_in_stream.zig b/lib/std/io/bit_in_stream.zig deleted file mode 100644 index 8bf3d6137..000000000 --- a/lib/std/io/bit_in_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.bit_reader.BitReader` -pub const BitInStream = @import("./bit_reader.zig").BitReader; - -/// Deprecated: use `std.io.bit_reader.bitReader` -pub const bitInStream = @import("./bit_reader.zig").bitReader; diff --git a/lib/std/io/bit_out_stream.zig b/lib/std/io/bit_out_stream.zig deleted file mode 100644 index e75da9b2d..000000000 --- a/lib/std/io/bit_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.bit_writer.BitWriter` -pub const BitOutStream = @import("./bit_writer.zig").BitWriter; - -/// Deprecated: use `std.io.bit_writer.bitWriter` -pub const bitOutStream = @import("./bit_writer.zig").bitWriter; diff --git a/lib/std/io/bit_reader.zig b/lib/std/io/bit_reader.zig index b0a60e62c..213cd2b50 100644 --- a/lib/std/io/bit_reader.zig +++ b/lib/std/io/bit_reader.zig @@ -21,8 +21,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { pub const Error = ReaderType.Error; pub const Reader = io.Reader(*Self, Error, read); - /// Deprecated: use `Reader` - pub const InStream = io.InStream(*Self, Error, read); const Self = @This(); const u8_bit_count = comptime meta.bitCount(u8); @@ -165,11 +163,6 @@ pub fn BitReader(endian: builtin.Endian, comptime ReaderType: type) type { pub fn reader(self: *Self) Reader { return .{ .context = self }; } - - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/bit_writer.zig b/lib/std/io/bit_writer.zig index 651c1e149..3ad2b75ef 100644 --- a/lib/std/io/bit_writer.zig +++ b/lib/std/io/bit_writer.zig @@ -21,8 +21,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { pub const Error = WriterType.Error; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = io.OutStream(*Self, Error, write); const Self = @This(); const u8_bit_count = comptime meta.bitCount(u8); @@ -141,10 +139,6 @@ pub fn BitWriter(endian: builtin.Endian, comptime WriterType: type) type { pub fn writer(self: *Self) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/buffered_atomic_file.zig b/lib/std/io/buffered_atomic_file.zig index 66c349d31..1aed190a4 100644 --- a/lib/std/io/buffered_atomic_file.zig +++ b/lib/std/io/buffered_atomic_file.zig @@ -10,13 +10,13 @@ const File = std.fs.File; pub const BufferedAtomicFile = struct { atomic_file: fs.AtomicFile, - file_stream: File.OutStream, - buffered_stream: BufferedOutStream, + file_writer: File.Writer, + buffered_writer: BufferedWriter, allocator: *mem.Allocator, pub const buffer_size = 4096; - pub const BufferedOutStream = std.io.BufferedOutStream(buffer_size, File.OutStream); - pub const OutStream = std.io.OutStream(*BufferedOutStream, BufferedOutStream.Error, BufferedOutStream.write); + pub const BufferedWriter = std.io.BufferedWriter(buffer_size, File.Writer); + pub const Writer = std.io.Writer(*BufferedWriter, BufferedWriter.Error, BufferedWriter.write); /// TODO when https://github.com/ziglang/zig/issues/2761 is solved /// this API will not need an allocator @@ -29,8 +29,8 @@ pub const BufferedAtomicFile = struct { var self = try allocator.create(BufferedAtomicFile); self.* = BufferedAtomicFile{ .atomic_file = undefined, - .file_stream = undefined, - .buffered_stream = undefined, + .file_writer = undefined, + .buffered_writer = undefined, .allocator = allocator, }; errdefer allocator.destroy(self); @@ -38,8 +38,8 @@ pub const BufferedAtomicFile = struct { self.atomic_file = try dir.atomicFile(dest_path, atomic_file_options); errdefer self.atomic_file.deinit(); - self.file_stream = self.atomic_file.file.writer(); - self.buffered_stream = .{ .unbuffered_writer = self.file_stream }; + self.file_writer = self.atomic_file.file.writer(); + self.buffered_writer = .{ .unbuffered_writer = self.file_writer }; return self; } @@ -50,11 +50,11 @@ pub const BufferedAtomicFile = struct { } pub fn finish(self: *BufferedAtomicFile) !void { - try self.buffered_stream.flush(); + try self.buffered_writer.flush(); try self.atomic_file.finish(); } - pub fn stream(self: *BufferedAtomicFile) OutStream { - return .{ .context = &self.buffered_stream }; + pub fn writer(self: *BufferedAtomicFile) Writer { + return .{ .context = &self.buffered_writer }; } }; diff --git a/lib/std/io/buffered_in_stream.zig b/lib/std/io/buffered_in_stream.zig deleted file mode 100644 index e24bd290c..000000000 --- a/lib/std/io/buffered_in_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.buffered_reader.BufferedReader` -pub const BufferedInStream = @import("./buffered_reader.zig").BufferedReader; - -/// Deprecated: use `std.io.buffered_reader.bufferedReader` -pub const bufferedInStream = @import("./buffered_reader.zig").bufferedReader; diff --git a/lib/std/io/buffered_out_stream.zig b/lib/std/io/buffered_out_stream.zig deleted file mode 100644 index 0d4ac1987..000000000 --- a/lib/std/io/buffered_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.buffered_writer.BufferedWriter` -pub const BufferedOutStream = @import("./buffered_writer.zig").BufferedWriter; - -/// Deprecated: use `std.io.buffered_writer.bufferedWriter` -pub const bufferedOutStream = @import("./buffered_writer.zig").bufferedWriter; diff --git a/lib/std/io/buffered_reader.zig b/lib/std/io/buffered_reader.zig index ef99ba29a..5fda7f274 100644 --- a/lib/std/io/buffered_reader.zig +++ b/lib/std/io/buffered_reader.zig @@ -15,8 +15,6 @@ pub fn BufferedReader(comptime buffer_size: usize, comptime ReaderType: type) ty pub const Error = ReaderType.Error; pub const Reader = io.Reader(*Self, Error, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; const Self = @This(); 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 pub fn reader(self: *Self) Reader { return .{ .context = self }; } - - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/buffered_writer.zig b/lib/std/io/buffered_writer.zig index c0efe1acb..056ff0898 100644 --- a/lib/std/io/buffered_writer.zig +++ b/lib/std/io/buffered_writer.zig @@ -13,8 +13,6 @@ pub fn BufferedWriter(comptime buffer_size: usize, comptime WriterType: type) ty pub const Error = WriterType.Error; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; const Self = @This(); 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 return .{ .context = self }; } - /// Deprecated: use writer - pub fn outStream(self: *Self) Writer { - return .{ .context = self }; - } - pub fn write(self: *Self, bytes: []const u8) Error!usize { if (bytes.len >= self.fifo.writableLength()) { try self.flush(); diff --git a/lib/std/io/c_out_stream.zig b/lib/std/io/c_out_stream.zig deleted file mode 100644 index 72de85b10..000000000 --- a/lib/std/io/c_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.c_writer.CWriter` -pub const COutStream = @import("./c_writer.zig").CWriter; - -/// Deprecated: use `std.io.c_writer.cWriter` -pub const cOutStream = @import("./c_writer.zig").cWriter; diff --git a/lib/std/io/counting_out_stream.zig b/lib/std/io/counting_out_stream.zig deleted file mode 100644 index aa9610649..000000000 --- a/lib/std/io/counting_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.counting_writer.CountingWriter` -pub const CountingOutStream = @import("./counting_writer.zig").CountingWriter; - -/// Deprecated: use `std.io.counting_writer.countingWriter` -pub const countingOutStream = @import("./counting_writer.zig").countingWriter; diff --git a/lib/std/io/counting_writer.zig b/lib/std/io/counting_writer.zig index d0c7c3b40..f68c25748 100644 --- a/lib/std/io/counting_writer.zig +++ b/lib/std/io/counting_writer.zig @@ -15,8 +15,6 @@ pub fn CountingWriter(comptime WriterType: type) type { pub const Error = WriterType.Error; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; const Self = @This(); @@ -29,11 +27,6 @@ pub fn CountingWriter(comptime WriterType: type) type { pub fn writer(self: *Self) Writer { return .{ .context = self }; } - - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/fixed_buffer_stream.zig b/lib/std/io/fixed_buffer_stream.zig index 1711b6da1..f86fd5a8d 100644 --- a/lib/std/io/fixed_buffer_stream.zig +++ b/lib/std/io/fixed_buffer_stream.zig @@ -23,11 +23,7 @@ pub fn FixedBufferStream(comptime Buffer: type) type { pub const GetSeekPosError = error{}; pub const Reader = io.Reader(*Self, ReadError, read); - /// Deprecated: use `Reader` - pub const InStream = io.InStream(*Self, ReadError, read); pub const Writer = io.Writer(*Self, WriteError, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; pub const SeekableStream = io.SeekableStream( *Self, @@ -45,20 +41,10 @@ pub fn FixedBufferStream(comptime Buffer: type) type { return .{ .context = self }; } - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } - pub fn writer(self: *Self) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } - pub fn seekableStream(self: *Self) SeekableStream { return .{ .context = self }; } diff --git a/lib/std/io/in_stream.zig b/lib/std/io/in_stream.zig deleted file mode 100644 index 98f94ab8a..000000000 --- a/lib/std/io/in_stream.zig +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.reader.Reader` -pub const InStream = @import("./reader.zig").Reader; diff --git a/lib/std/io/multi_out_stream.zig b/lib/std/io/multi_out_stream.zig deleted file mode 100644 index ca21e5d70..000000000 --- a/lib/std/io/multi_out_stream.zig +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.multi_writer.MultiWriter` -pub const MultiOutStream = @import("./multi_writer.zig").MultiWriter; - -/// Deprecated: use `std.io.multi_writer.multiWriter` -pub const multiOutStream = @import("./multi_writer.zig").multiWriter; diff --git a/lib/std/io/multi_writer.zig b/lib/std/io/multi_writer.zig index 9d838a3da..639dd3cd1 100644 --- a/lib/std/io/multi_writer.zig +++ b/lib/std/io/multi_writer.zig @@ -22,18 +22,11 @@ pub fn MultiWriter(comptime Writers: type) type { pub const Error = ErrSet; pub const Writer = io.Writer(*Self, Error, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; pub fn writer(self: *Self) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *Self) OutStream { - return .{ .context = self }; - } - pub fn write(self: *Self, bytes: []const u8) Error!usize { var batch = std.event.Batch(Error!void, self.streams.len, .auto_async).init(); comptime var i = 0; diff --git a/lib/std/io/out_stream.zig b/lib/std/io/out_stream.zig deleted file mode 100644 index c78374af0..000000000 --- a/lib/std/io/out_stream.zig +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: MIT -// Copyright (c) 2015-2021 Zig Contributors -// This file is part of [zig](https://ziglang.org/), which is MIT licensed. -// The MIT license requires this copyright notice to be included in all copies -// and substantial portions of the software. -/// Deprecated: use `std.io.writer.Writer` -pub const OutStream = @import("./writer.zig").Writer; diff --git a/lib/std/io/peek_stream.zig b/lib/std/io/peek_stream.zig index 536200ad7..b431b0184 100644 --- a/lib/std/io/peek_stream.zig +++ b/lib/std/io/peek_stream.zig @@ -16,13 +16,11 @@ pub fn PeekStream( comptime ReaderType: type, ) type { return struct { - unbuffered_in_stream: ReaderType, + unbuffered_reader: ReaderType, fifo: FifoType, pub const Error = ReaderType.Error; pub const Reader = io.Reader(*Self, Error, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; const Self = @This(); const FifoType = std.fifo.LinearFifo(u8, buffer_type); @@ -31,7 +29,7 @@ pub fn PeekStream( .Static => struct { pub fn init(base: ReaderType) Self { return .{ - .unbuffered_in_stream = base, + .unbuffered_reader = base, .fifo = FifoType.init(), }; } @@ -39,7 +37,7 @@ pub fn PeekStream( .Slice => struct { pub fn init(base: ReaderType, buf: []u8) Self { return .{ - .unbuffered_in_stream = base, + .unbuffered_reader = base, .fifo = FifoType.init(buf), }; } @@ -47,7 +45,7 @@ pub fn PeekStream( .Dynamic => struct { pub fn init(base: ReaderType, allocator: *mem.Allocator) Self { return .{ - .unbuffered_in_stream = base, + .unbuffered_reader = base, .fifo = FifoType.init(allocator), }; } @@ -68,18 +66,13 @@ pub fn PeekStream( if (dest_index == dest.len) return dest_index; // ask the backing stream for more - dest_index += try self.unbuffered_in_stream.read(dest[dest_index..]); + dest_index += try self.unbuffered_reader.read(dest[dest_index..]); return dest_index; } pub fn reader(self: *Self) Reader { return .{ .context = self }; } - - /// Deprecated: use `reader` - pub fn inStream(self: *Self) InStream { - return .{ .context = self }; - } }; } diff --git a/lib/std/io/stream_source.zig b/lib/std/io/stream_source.zig index 2e68e528a..df0d6cd35 100644 --- a/lib/std/io/stream_source.zig +++ b/lib/std/io/stream_source.zig @@ -9,7 +9,7 @@ const testing = std.testing; /// Provides `io.Reader`, `io.Writer`, and `io.SeekableStream` for in-memory buffers as /// well as files. -/// For memory sources, if the supplied byte buffer is const, then `io.OutStream` is not available. +/// For memory sources, if the supplied byte buffer is const, then `io.Writer` is not available. /// The error set of the stream functions is the error set of the corresponding file functions. pub const StreamSource = union(enum) { buffer: io.FixedBufferStream([]u8), @@ -22,11 +22,7 @@ pub const StreamSource = union(enum) { pub const GetSeekPosError = std.fs.File.GetPosError; pub const Reader = io.Reader(*StreamSource, ReadError, read); - /// Deprecated: use `Reader` - pub const InStream = Reader; pub const Writer = io.Writer(*StreamSource, WriteError, write); - /// Deprecated: use `Writer` - pub const OutStream = Writer; pub const SeekableStream = io.SeekableStream( *StreamSource, SeekError, @@ -89,20 +85,10 @@ pub const StreamSource = union(enum) { return .{ .context = self }; } - /// Deprecated: use `reader` - pub fn inStream(self: *StreamSource) InStream { - return .{ .context = self }; - } - pub fn writer(self: *StreamSource) Writer { return .{ .context = self }; } - /// Deprecated: use `writer` - pub fn outStream(self: *StreamSource) OutStream { - return .{ .context = self }; - } - pub fn seekableStream(self: *StreamSource) SeekableStream { return .{ .context = self }; } diff --git a/lib/std/json.zig b/lib/std/json.zig index 5cbdb4319..077b910a2 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -2620,9 +2620,9 @@ pub fn stringify( } fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions) !void { - const ValidationOutStream = struct { + const ValidationWriter = struct { const Self = @This(); - pub const OutStream = std.io.OutStream(*Self, Error, write); + pub const Writer = std.io.Writer(*Self, Error, write); pub const Error = error{ TooMuchData, DifferentData, @@ -2634,7 +2634,7 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions return .{ .expected_remaining = exp }; } - pub fn outStream(self: *Self) OutStream { + pub fn writer(self: *Self) Writer { return .{ .context = self }; } @@ -2670,8 +2670,8 @@ fn teststringify(expected: []const u8, value: anytype, options: StringifyOptions } }; - var vos = ValidationOutStream.init(expected); - try stringify(value, options, vos.outStream()); + var vos = ValidationWriter.init(expected); + try stringify(value, options, vos.writer()); if (vos.expected_remaining.len > 0) return error.NotEnoughData; } diff --git a/lib/std/pdb.zig b/lib/std/pdb.zig index 896c67aae..41356e84f 100644 --- a/lib/std/pdb.zig +++ b/lib/std/pdb.zig @@ -716,8 +716,4 @@ const MsfStream = struct { pub fn reader(self: *MsfStream) std.io.Reader(*MsfStream, Error, read) { return .{ .context = self }; } - /// Deprecated: use `reader` - pub fn inStream(self: *MsfStream) std.io.InStream(*MsfStream, Error, read) { - return .{ .context = self }; - } }; diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index b882d71cf..8d2d37b76 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -791,7 +791,7 @@ fn renderExpression( // Null stream for counting the printed length of each expression var line_find_stream = std.io.findByteOutStream('\n', std.io.null_writer); - var counting_stream = std.io.countingOutStream(line_find_stream.writer()); + var counting_stream = std.io.countingWriter(line_find_stream.writer()); var auto_indenting_stream = std.io.autoIndentingStream(indent_delta, counting_stream.writer()); // Calculate size of columns in current section diff --git a/src/main.zig b/src/main.zig index 7829901ac..89150f214 100644 --- a/src/main.zig +++ b/src/main.zig @@ -2015,7 +2015,7 @@ fn updateModule(gpa: *Allocator, comp: *Compilation, zir_out_path: ?[]const u8, const baf = try io.BufferedAtomicFile.create(gpa, fs.cwd(), zop, .{}); defer baf.destroy(); - try new_zir_module.writeToStream(gpa, baf.stream()); + try new_zir_module.writeToStream(gpa, baf.writer()); try baf.finish(); }